Spectral Extraction
There are three methods of spectral extraction currently implemented.
box: Sum all pixels within a fixed aperture around the trace position.
optimal: Fit a 1D profile to the data.
cross_talk: Simultaneously fit 1D profiles for all fibers to account for cross-talk between fibers. Only applicable when multiple fibers are present.
All methods rely on the trace positions defined in the calibration file tracepos (TracePosModel).
For optimal and cross-talk extraction, the required trace profiles are provided by the calibration file traceprof (TraceProfModel).
In both methods, the vector \(M_y\) is a mask that is 1 where the data is included in the extraction, and 0 where it is not (e.g. bad pixels). The vector \(W_y\) is a weight vector that defines the fraction of a pixel that overlaps with the extraction aperture. In this scheme, the location of a pixel is defined at its center, so a given pixel at location y spans from y - 0.5 to y + 0.5. This weight is important when it is difficult to define a common normalization factor for the profile at different columns, as is the case with a non-analytic profile or no profile at all. This correction is especially important when the profile is not symmetric.
Boxcar Extraction
This method sums the flux within a defined aperture around the central trace positions.
Optimal Extraction
This method attempts to find the best fit scale factor for the expected spatial profile of the spectrum. Here, \(P_y\) is the expected profile at pixel y, normalized such that \(\sum_y W_y P_y = 1\) within the extraction aperture.
Cross Talk
This method attemps to simultaneously extract spectral values from all fibers within a given order simultaneously to account for the cross-talk between fibers. The math is effectively identical to optimal extraction.
Documentation
- class SpectralExtractionPrimitive(dataset=None, config=None, context=None, log_config=None, parent=None, **kwargs)[source]
Bases:
BasePrimitiveExtracts the 2D echelleogram into 1D spectra for each fiber and order. Pre-determined trace positions and profiles (for optimal extraction) must be provided.
TODO: Fix normalization to extend to effective infinity regardless of aperture size. Aperture size only determines fit window and we can round here.
- Parameters:
suffix (str) – Suffix to add to the output filename. Default is ‘specextract’.
method (str) –
- Extraction method to use. Options are:
box: Sum all pixels within a fixed aperture around the trace position.
optimal: Fit a 1D profile to the data.
cross_talk: Simultaneously fit 1D profiles for all fibers to account for cross-talk between fibers. Only applicable when multiple fibers are present.
extraction_aperture (float) – Size of the extraction aperture in pixels, centered on the trace position.
do_fibers (list[int] or None) – List of fiber numbers to extract. If None, all fibers will be extracted.
do_orders (list[int] or None) – List of order numbers to extract. If None, all orders will be extracted.
pix_range (tuple[int, int] or None) – Range of x pixels to extract. If None, the full range will be extracted.
- Returns:
output (datamodels.L1Model or list[datamodels.L1Model]) – Extracted spectra for each fiber and order.
- extract_box(input_model, output_model, tracepos_model, do_fibers, do_orders)[source]
- extract_cross_talk(input_model, output_model, tracepos_model, traceprof_model, do_fibers, do_orders)[source]
- extract_optimal(input_model, output_model, tracepos_model, traceprof_model, do_fibers, do_orders)[source]