Order Mask Primitive
This module defines class OrderMask which inherits from KPF0_Primitive and provides methods to perform the event to produce order mask data in the recipe.
- Description:
Method __init__:
OrderMask constructor, the following arguments are passed to __init__,
action (keckdrpframework.models.action.Action): action.args contains positional arguments and keyword arguments passed by the OrderRectification event issued in the recipe:
action.args[0] (kpfpipe.models.level0.KPF0): Instance of KPF0 containing level 0 data for making order mask based on the order trace result.
action.args[1] (kpfpipe.models.level0.KPF0): Instance of KPF0 to contain order mask result.
action.args[‘data_extension’]: (str, optional): the name of the extension containing data.
action.args[‘trace_file’]: (str, optional): the path of the file containing order trace result.
action.args[‘orderlet_names’] (str|list, optional): Name or list of names of all orderlets included in the order trace result. Defaults to ‘SCI1’.
action.args[‘orderlets_on_image’] (str|list, optional): Name or list of names of the orderlets appear on the L0 image. Defaults to None.
action.args[‘start_order’] (int, optional): Index of the first orderlet of the first order against the first trace included in the order trace data indexed as 0. Defaults to 0.
action.args[‘poly_degree’]: (str, optional): Polynomial degree for order trace curve fitting. Defaults to 3.
action.args[‘origin’]: (list, optional): Origin of the image where the order trace is related to. Defaults to [0, 0]
action.args[‘orderlet_widths’]: (dict, optional): Orderlet widths to replace the edge widths from the order trace file. Defaults to {} or None.
action.args[‘orderlet_values’]: (dict, optional): The values to be assigned to the pixels of each orderlet of the output, ex. [1, 2, 3, 4, 5] assigns 5 numbers to the pixels of 5 orderlets respectively. [3] assigns all orderlet pixels the same number, i.e. 3. Defaults to 1 for all trace pixels.
action.args[‘non_orderlet_value’]: (number, optional): Value for non orderlet pixels. Defaults to 0.
action.args[‘full_coverage’]: (number, optional): Make order mask to cover entire image width regardless of the horizontal coverage provided by order trace result. Defaults to 0.
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,
img_data (numpy.ndarray): raw flux data for order trace mask.
output_level0 (kpfpipe.models.level0.KPF0): Instance of KPF0 to contain order mask result.
orderlet_names (list): list of orderlet names per order.
data_ext (str): extension of flux data to be processed.
orderlets_on_image (list): list of names of the orderlets appearing on the L0 image.
`order_trace_data (pandas.DataFrame): order trace data including polynomial coefficients, top/bottom edges and horizontal coverage for each order trace.
config_path (str): Path of config file for spectral extraction.
config (configparser.ConfigParser): Config context per the file defined by config_path.
logger (logging.Logger): Instance of logging.Logger.
alg (modules.order_trace.src.alg.OrderMaskAlg): Instance of OrderMaskAlg which has operation codes for the computation of order mask.
Method __perform:
OrderRectification returns the result in Arguments object which contains a level 0 data object (KPF0) with the rectification results replacing the raw image.
- Usage:
For the recipe, the spectral extraction event is issued like:
: order_names=['GREEN_SKY_FLUX', 'GREEN_SCI_FLUX1', 'GREEN_SCI_FLUX2', 'GREEN_SCI_FLUX3', 'GREEN_CAL_FLUX'] lev0_data = kpf0_from_fits(input_lev0_flat, data_type=data_type) op_data = OrderMask(lev0_data, NULL, orderlet_names=order_names, start_order=-1, trace_file='/data/masters/20230411/kpf_20230411_master_flat_GREEN_CCD.csv', data_extension='GREEN_CCD') :
where op_data is level 0 data (KPF0) object Wrapped in Arguments class object.