ap_extract¶
-
pydis.
ap_extract
(img, trace, apwidth=8, skysep=3, skywidth=7, skydeg=0, coaddN=1)[source]¶ 1. Extract the spectrum using the trace. Simply add up all the flux around the aperture within a specified +/- width.
Note: implicitly assumes wavelength axis is perfectly vertical within the trace. An major simplification at present. To be changed!
Fits a polynomial to the sky at each column
Note: implicitly assumes wavelength axis is perfectly vertical within the trace. An important simplification.
Computes the uncertainty in each pixel
- Parameters
- img2d numpy array
This is the image, stored as a normal numpy array. Can be read in using astropy.io.fits like so:
>>> hdu = fits.open('file.fits') >>> img = hdu[0].data
- trace1-d array
The spatial positions (Y axis) corresponding to the center of the trace for every wavelength (X axis), as returned from ap_trace
- apwidthint, optional
The width along the Y axis on either side of the trace to extract. Note: a fixed width is used along the whole trace. (default is 8 pixels)
- skysepint, optional
The separation in pixels from the aperture to the sky window. (Default is 3)
- skywidthint, optional
The width in pixels of the sky windows on either side of the aperture. (Default is 7)
- skydegint, optional
The polynomial order to fit between the sky windows. (Default is 0)
- Returns
- onedspec1-d array
The summed flux at each column about the trace. Note: is not sky subtracted!
- skysubflux1-d array
The integrated sky values along each column, suitable for subtracting from the output of ap_extract
- fluxerr1-d array
the uncertainties of the flux values