Order Trace Primitive
This module defines class OrderTrace which inherits from KPF0_Primitive and provides methods to perform the event on order trace calculation in the recipe.
- Description:
Method __init__:
OrderTrace 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): Instance of KPF0 containing image data for order trace extraction.
action.args[‘data_row_range’] (list, optional): Row coverage of the level 0 data to be processed. If the number is less than 0, it stands for the position relative to the last row of the image.
action.args[‘data_col_range’] (list, optional): Column coverage of the level 0 data to be processed. If the number is less than 0, it stands for the position relative to the last column of the image.
action.args[‘data_extension’] (string, optional): name of the extension with the image. Defaults to “data”.
action.args[‘result_path’] (string, optional): name of the file path or data model extension containing the order trace result. Defaults to None.
action.args[‘fitting_poly_degree’] (int, optional): Order of polynomial used to fit the trace. Defaults to None. This value overrides the number defined in the configuration file for the module if it is defined.
action.args[‘is_output_file’] (boolean, optional): if the result is output to a file or data model extension. Defaults to True meaning output to a file.
action.args[‘orders_ccd’] (boolean, optional): total orders of the ccd. Defaults to -1.
action.args[‘do_post’] (boolean, optional): do post process only on existing order trace file.
action.args[‘orderlet_pixel_gaps’] (number, options): orderlet gap pixels between consecutive orderlets, i.e. number of pixels to ignore between orderlets during extraction. Defaults to 2.
action.args[‘overwrite’] (bool, options): overwrite existing order trace file or not. Defaults to False.
context (keckdrpframework.models.processing_context.ProcessingContext): context.config_path contains the path of the config file defined for the module of order trace in the master config file associated with the recipe.
and the following attributes are defined to initialize the object,
input (kpfpipe.models.level0.KPF0): Instance of KPF0, assigned by actions.args[0].
flat_data (numpy.array): 2D spectral data associated with actions.args[0].
data_row_range (list): Row range of the data to be processed. The row is counted from the first row in case the number is greater than or equal to 0, or from the last row in case the number is less than 0.
data_col_range (list): Column range of the data to be processed. The column is counted from first column in case the number is greater than or equal to 0, or from the last column in case the number is less than 0.
config_path (str): Path of config file for the computation of order trace.
config (configparser.ConfigParser): Config context.
logger (logging.Logger): Instance of logging.Logger.
result_path (str): File or extension containing the output.
alg (modules.order_trace.src.alg.OrderTraceAlg): Instance of OrderTraceAlg which has operation codes for the computation of order trace.
poly_degree (int): Order of polynomial for order trace fitting.
do_post (bool): if doing post processing on existing order trace data.
orderlet_gap_pixels: number of pixels to ignore between orderlets during extraction.
overwrite (bool, options): overwrite existing order trace file or not. Defaults to False.
Method __perform:
OrderTrace returns the result in Arguments object which contains the original input level 0 data object (KPF0) plus an extension with the order trace result.
- Usage:
For the recipe, the order trace event is issued like:
: flat_data = kpf0_from_fits(input_flat_file, data_type=data_type) order_result_data = OrderTrace(flat_data, data_extension='GREEN_CCD_STACK', data_col_range=[0, -1], data_row_range=[0, -1], result_path="/data/masters/20230411/kpf_20230411_master_flat_GREEN_CCD.csv", fitting_poly_degree=3) :
where order_result_data is Panda.Dataframe object wrapped in Arguments class object.