Skip to content

full_reduction_easyspec

Full CCD-to-1D reduction routed through the EasySpec shelf: build the master bias / dark / flat, apply them to the science frame, remove cosmic rays and extract a 1-D pixel-index spectrum. Wavelength calibration, atmospheric extinction and flux calibration are separate steps afterwards because each needs runtime metadata (arc-lamp identifications, airmass, standard star). Everything that depends on your night lives in the variables below: supply them with a profile (--profile night.yaml) or --set name=value.

Kind reduction
Status reference - reviewed and adopted as the reference way to make this measurement
Version 2.0.0
Source bundled
Requires spectro-kernel >=0.7

References

  • EasySpec (Duarte 2024, https://github.com/ranieremenezes/easyspec)
  • Howell 2006, Handbook of CCD Astronomy, 2nd ed., ch. 4 (calibration frames)

Variables

The instrument- or observer-dependent values. Provide them with a profile file, --set name=value, or variables={...} in Python.

Variable Type Required / default Description
bias_dir path required directory of raw bias frames
dark_dir path required directory of raw dark frames
flat_dir path required directory of raw flat frames
science_path path required raw science frame (FITS)
target_name str default 'target' object name written in the extracted spectrum
exposure_seconds float required exposure time of the science frame (s)
airmass float required airmass of the science frame
gain float default None detector gain (e-/ADU); leave unset to read the GAIN header keyword
readnoise float default None read noise (e-); leave unset to read the RDNOISE header keyword
combine_method str default 'median' combination method for the master frames (one of median, mean)

Steps

# Algorithm Parameters
1 bias_combine_easyspec Master bias (easyspec) bias_dir='${bias_dir}', method='${combine_method}'
2 dark_combine_easyspec Master dark (easyspec) dark_dir='${dark_dir}', method='${combine_method}'
3 flat_combine_easyspec Master flat (easyspec) flat_dir='${flat_dir}', method='${combine_method}'
4 subtract_bias_easyspec Subtract master bias (easyspec) target_path='${science_path}'
5 subtract_dark_easyspec Subtract master dark (easyspec) -
6 flat_normalize_easyspec Divide by normalised flat (easyspec) auto_normalise=True
7 cosmic_ray_remove_easyspec Remove cosmic rays (easyspec) gain='${gain}', readnoise='${readnoise}', sigclip=5.0
8 extract_spectrum_easyspec Trace + extract 1D (easyspec) target_name='${target_name}', exposure_seconds='${exposure_seconds}', airmass='${airmass}', mc_steps=25, extraction_weights='gaussian'

Run it

# profile.yaml holds your instrument values:
#   bias_dir: /path/to/bias_dir
#   dark_dir: /path/to/dark_dir
#   flat_dir: /path/to/flat_dir
#   science_path: /path/to/science_path
#   target_name: target
#   exposure_seconds: 0.0
#   airmass: 0.0
#   gain: 0.0
#   readnoise: 0.0
#   combine_method: median
spectro pipeline full_reduction_easyspec --input spectrum.fits --profile profile.yaml
spectro preset show full_reduction_easyspec      # variables and steps
from spectro_kernel import WorkContext
from spectro_kernel.pipeline import PipelineBuilder

variables = {"bias_dir": "/path/to/bias_dir", "dark_dir": "/path/to/dark_dir", "flat_dir": "/path/to/flat_dir", "science_path": "/path/to/science_path", "target_name": "target", "exposure_seconds": 0.0, "airmass": 0.0, "gain": 0.0, "readnoise": 0.0, "combine_method": "median"}
pipeline = PipelineBuilder().from_preset("full_reduction_easyspec", variables).build()
result = pipeline.execute(ctx)        # ctx holds the spectrum / frames
print(result.history[-1])             # pipeline:<name> vX.Y.Z + variables
{
  "tool": "run_preset",
  "arguments": {
    "session_id": "<session_id>",
    "preset_name": "full_reduction_easyspec",
    "variables": {
      "bias_dir": "/path/to/bias_dir",
      "dark_dir": "/path/to/dark_dir",
      "flat_dir": "/path/to/flat_dir",
      "science_path": "/path/to/science_path",
      "target_name": "target",
      "exposure_seconds": 0.0,
      "airmass": 0.0,
      "gain": 0.0,
      "readnoise": 0.0,
      "combine_method": "median"
    }
  }
}