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
Run it
CLI Python MCP
# 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"
}
}
}