4. Recipes
This section documents all the reduction recipes available in the MAROONX Data Reduction pipeline. Recipes define the complete processing workflows by combining sequences of primitives to achieve specific data reduction goals.
Note
Recipes are the primary interface for data reduction. Each recipe is designed for a specific observation type or calibration purpose. The recipes are organized by processing mode and data type, following the DRAGONS framework conventions.
4.1. Science Quality Recipes
The Science Quality (SQ) recipes provide the highest quality data reduction for scientific analysis.
4.1.1. Bundle Processing Recipes
Recipes available to data with tags ['MAROONX', `BUNDLE`].
4.1.2. Calibration Recipes
4.1.2.1. Dark Frame Processing
Recipes available to data with tags [‘MAROONX’, ‘CAL’, ‘DARK’].
Default is “makeProcessedDark”.
- maroonxdr.maroonx.recipes.sq.recipes_DARK.makeDarkCoefficients(p)[source]
Produce coefficient arrays ‘z0’ and ‘z1’ from pixel-by-pixel fit.
The fit uses the relationship F = z1 + z0 * log10(Texp). The input is a list of MASTER darks created from raw dark files. The input should cover a wide range of exposure times and can have multiple master dark files with the same exposure time. Master darks with non-standard ND filter settings should be avoided (they will not fit the same relationship as the other frames).
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_DARK.makeProcessedDark(p)[source]
Perform standardization and corrections to convert raw darks to processed.
This recipe converts the raw input dark images into a single processed dark image. This output processed dark is stored on disk using storeProcessedDark and has a name equal to the name of the first input bias image with “_dark.fits” appended. The background in an un-illuminated frame is very low for exposure times of less than 900s and likely doesn’t warrant a dark subtraction, however most science frames are taken with the simultaneous calibration fiber illuminated with the FP etalon. The extended wings of the etalon reach into one of the science fibers with a few 10 counts. To remove these wings and any broad diffuse (illumination independent) background, DDDDE frames are taken in daytime to construct a DDDDE processed dark. These darks are specific for different exposure times (i.e. ND filter settings) and should be taken close in time (within a day or two) to the science frame as the etalon source brightness can be time variable.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_DARK.testRegressionDark(p)[source]
Test that the legacy pipeline dark frame can be reproduced.
This is a simplified version of the makeProcessedDark recipe that does not include overscan trimming nor image orientation correction.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_DARK.testVARDark(p)[source]
Produce a dark frame with an additional variance plane.
Can be used to add a variance plane to a singular dark frame. The default recipe adds variance planes to all the dark frames while stacking, and also outputs a dark frame with a variance plane added to it.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
4.1.2.2. Flat Field Processing
Recipes available to data with tags [‘MAROONX’, ‘CAL’, ‘FLAT’].
Default is “makeProcessedFlat”. TODO: Add a step to get the 1D Spectra for the fibers to use in Wavecal and Science.
- maroonxdr.maroonx.recipes.sq.recipes_FLAT_SPECT.makeFlatVarCheck(p)[source]
Check if variance extensions are correctly computed on stacked flats.
This recipe does not find, identify, or define any stripes. It also does not remove stray light. Mostly used to test if variance is being computed correctly for a stack of images.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- Return type:
Creates test frames with variance added.
- maroonxdr.maroonx.recipes.sq.recipes_FLAT_SPECT.makeProcessedFlat(p)[source]
Perform standardization and corrections to convert raw flats to processed.
This recipe converts the raw input flat images into a single stacked flat image. This output processed flat is stored on disk using storeProcessedFlat and has a name equal to the name of the first input bias image with “_FFFFF_flat.fits” appended. A processed flatfield is required to perform optimal flux extraction and to determine the blaze function. Due to the stability of the spectrograph, one processed flatfield is typically ‘valid’ for at least a two-week period. Cross-comparison between different processed flatfields taken months apart have not been conducted so far.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_FLAT_SPECT.makeProcessedFlatDFFFF(p)[source]
Perform standardization and corrections to convert raw flats to processed.
This recipe converts the raw input flat images into a single stacked flat image. This output processed flat is stored on disk using storeProcessedFlat and has a name equal to the name of the first input bias image with “_FFFFF_flat.fits” appended. A processed flatfield is required to perform optimal flux extraction and to determine the blaze function. Due to the stability of the spectrograph, one processed flatfield is typically ‘valid’ for at least a two-week period. Cross-comparison between different processed flatfields taken months apart have not been conducted so far.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_FLAT_SPECT.makeStrayLightCheck(p)[source]
Check the stray light subtraction in normal flat frame processing.
Run the straylight_test_prep.py file to generate these.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- Returns:
Creates test frames with straylight difference and flux at levels just
before straylight removal. Unit test will independently perform straylight
removal and compare results.
- maroonxdr.maroonx.recipes.sq.recipes_FLAT_SPECT.measureBlaze(p)[source]
Measure the blaze function for each fiber of a processed masterflat.
This primitive fits a spline to the box-extracted flat spectrum of each fiber to model the blaze curve, then normalises each order so the peak equals 1. The result is stored as
BLAZE_FIBER_{f}.- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
4.1.2.3. Wavelength Calibration Recipes
4.1.2.3.1. Static Wavelength Calibration
Recipes available to data with tags [‘MAROONX’, ‘WAVECAL’, ‘ThAr’].
Default is “reduce”.
- maroonxdr.maroonx.recipes.sq.recipes_STATICWAVECAL.makeStaticWavecal(p)[source]
Process Thorium Argon and etalon spectra for static wavelength solution.
Create a static wavelength solution reference for the science and sim cal fibers on the MAROON-X instrument. The product of this recipe is the basis for all wavelength calibrations on MAROON-X data (i.e. dynamical wavecals and echelle_spect).
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
4.1.2.3.2. Dynamic Wavelength Calibration
Recipes available to data with tags [‘MAROONX’, ‘WAVECAL’, ‘ECHELLE’].
Default is “makeDynamicWavecal”.
- maroonxdr.maroonx.recipes.sq.recipes_DYNAMIC_WAVECAL.makeDynamicWavecal(p)[source]
Process MAROON-X 2D echelle spectra and create dynamic wavelength solution.
This is done in the following steps:
Utilizing the relevant flat, the fibers and orders are traced and identified from the frame. These are extracted into sparse arrays.
Using box extraction, these are converted into 1D spectra. Box extraction is the simple summation of all spatial pixels in a given fiber/order combination. The trace of the ‘box’ is taken from the master flat field.
The extracted 1D etalon lines are fitted to determine their centroid. This process involves identifying the peaks and fitting them to a box convolved with 2 gaussians. The locations of the peak centers is stored. The width of the peaks and the Gaussian sigmas vary very slowly along an order and are modeled by low-order polynomials.
The dynamic wavelength solution is computed by fitting the 1D pixel positions and the wavelengths of the etalon lines using a 30 knot cubic spline. 1D pixel positions are identified by comparing to the “static wavelength solution” that is stored in the caldb and is accurate up to 500 m/s. This allows us to calculate the “drift” of the spectrograph with time and restores accuracy to 10-20 cm/s.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
4.1.3. Science Data Recipes
Recipes available to data with tags [‘MAROONX’, ‘SCI’].
Default is “reduce”.
- maroonxdr.maroonx.recipes.sq.recipes_ECHELLE_SPECT.applyBarycentricCorrection(p)[source]
Apply barycentric velocity correction to already-reduced MAROON-X spectra.
Use this recipe to apply target-specific barycentric correction parameters after the main extraction workflow.
- Parameters:
p (Primitives object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_ECHELLE_SPECT.exportReducedBundle(p)[source]
Export reduced MAROON-X spectra from Red and Blue channels to bundle.
- Parameters:
p (Primitives object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_ECHELLE_SPECT.makeStripeExtractionCheck(p)[source]
Check the stripe extraction in normal processing of a science frame.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- Returns:
Creates test frames with FITS-formatted stripe extractions meta-info
(normally not saved). Unit test will independently perform stripe extraction
and compare results.
- maroonxdr.maroonx.recipes.sq.recipes_ECHELLE_SPECT.makeSyntheticDark(p)[source]
Construct DDDDE master darks from coefficient file for science exposures.
Uses a linear interpolation of log(exposure time) vs. flux in empirical master darks to construct interpolated darks for other exposure times.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.
- maroonxdr.maroonx.recipes.sq.recipes_ECHELLE_SPECT.reduce(p)[source]
Process MAROON-X science echelle spectrum with tracing and extraction.
This recipe: (1) traces and identifies the fibers and orders in a 2D processed flat and (2) performs both regular (aka ‘box’) and optimum extraction to produce 1D extracted spectra for 2D input spectra.
Tracing and identifying fibers and orders is done on a (preferably background subtracted) 2D processed flat. This step needs to be done only once per flat and the results can be applied to all subsequent flux extraction steps for other data. The routine allows to specify which fibers are illuminated by flat light to minimize wrong order/fiber identification.
Box extraction is the simple summation of all spatial pixels in a given fiber/order combination. Optimal extraction is per default only applied to fibers illuminated with flat (F) and science (O) input.
TODO: Once the Static and Dynamic wavecal recipes have been created, an additional set of parameters in this recipe should be added to request the calibration frame produced by the dynamic wavecal recipe and utilize it to perform a drift corrected wavelength calibration for the science frame fibers.
- Parameters:
p (PrimitivesCORE object) – A primitive set matching the recipe_tags.