extract_spec#
- excalibuhr.utils.extract_spec(det, det_err, badpix, trace, slit, blaze, gain, NDIT=1, cen0=90, companion_sep=None, aper_half=20, extract_2d=False, extr_level=0.9, remove_star_bkg=False, remove_sky_bkg=False, debug=False)[source]#
Extract 1D spectra from detector images
- Parameters:
im (array) – input science image that has been calibrated
im_err (array) – readout+background noise associated with the input science image
badpix (array) – bad pixel map corresponding to the input image
trace (array) – polynomials that delineate the edge of the specific order
slit (array) – polynomials that describing the slit curvature as a function of the dispersion axis
blaze (array) – 1D blaze function of each order
gain (float) – detector gain
NDIT (int) – number of DIT exposure coadded
cen0 (float) – location of the star on slit in pixel
companion_sep (float) – angular separation of the companion on slit in pixel
aper_half (int) – half of extraction aperture in pixel
extract_2d (bool) – if extracting 2D spectra, the curvature of the trace will be explicitly corrected
interpolation (bool) – This determines the mode of the slit curvature correction. If False, the 2D spectra will be resampled to a normal grid to correct for the slit curvature. Otherwise, it uses interpolation to speed up.
remove_star_bkg (bool) – in case of sub-stellar companion extraction, whether remove the starlight contamination.
remove_sky_bkg (bool) – in case of staring observations, set it to True to remove the sky background.
- Returns:
flux, err (array) – the extracted fluxes and their uncertainties
D_stack, P_stack, V_stack (array) – 2d spectral data, modeled 2d slit function, 2d spectral uncertainty
id_order (array) – the output 2D data of different orders are stacked along the first axis, id_order contains the indices to retrieve the data of each order.
chi2 (array) – reduced chi2 of the model (for diagnositic purposes)