Ca H&K Extraction Primitive
This module defines class CaHKExtraction which inherits from KPF0_Primitive and provides methods to perform the event on CA H&K extraction in the recipe.
- Description:
Method __init__:
CaHKExtraction constructor, the following arguments are passed to __init__,
action (keckdrpframework.models.action.Action): action.args contains positional arguments and keyword arguments passed by the OrderTrace event issued in the recipe:
action.args[0] (kpfpipe.models.level0.KPF0|str): Instance of KPF0 or the path of a fits file containing image data for H&K extraction.
action.args[1] (str): Path to a file defining the fiber and order location
action.args[2] (list): List containing the fiber names.
action.args[3] (kpfpipe.models.level1.KPF1): Instance of KPF1 containing spectral extraction results. If not existing, it is None.
action.args[‘output_exts’] (str): Extension names of the extensions to contain the extraction result for each fiber, optional, Defaults to fiber list.
action.args[‘output_wave_exts’] (str): Extension names of the extensions to contain the wavelength solution for each fiber, optional, Defaults to fiber list prefixed with ‘_wave’.
action.args[‘dark’] (KPF0, optional): dark master file for dark subtraction. Defaults to None.
action.args[‘bias’] (KPF0, optional): bias master file for bias subtraction. Defaults to None.
action.args[‘wave_files’] (list, optional): Wavelength solution files per fiber list. Defaults to None.
context (keckdrpframework.models.processing_context.ProcessingContext): context.config_path contains the path of the config file defined for the module of hk_spectral_extraction in the master config file associated with the recipe.
- and the following attributes are defined to initialize the object,
input_img (kpfpipe.models.level0.KPF0): Instance of KPF0, assigned by actions.args[0].
fibers (list): The interested fibers to be processed, assigned by actions.args[1].
fiber_loc (dict): An dictionary instance contains the order location for each fiber.
output_exts (list): output extension names.
Method __perform:
CaHKExtraction returns the result in Arguments object which contains a level 1 data object (KPF1) with the extraction results.
- Usage:
For the recipe, the order trace event is issued like:
: lev0_data = kpf0_from_fits(input_lev0_file) output_data = kpf1_from_fits(output_lev1_file, data_type = data_type) : output_data = CaHKExtraction(lev0_data, hk_trace_table, # ex. /data/masters/kpfMaster_HKOrderBounds20220909.csv hk_fiber_list, # ex. ['sci', 'sky'] output_data, # lev1 containing Ca H&K extraction output_exts=hk_spec_ext, # ex. ['CA_HK_SCI', 'CA_HK_SKY'] dark=hk_dark_data, # lev0 containing dark image wave_files=hk_wavelength_tables) # ex. ['/data/masters/kpfMaster_HKwave20220909_sci.csv', # '/data/masters/kpfMaster_HKwave20220909_sky.csv'] :
where output_data is KPF1 object wrapped in Arguments class object.