hispecdrp.primitives.coadd.coadd_frames_primitive

Functions

_coadd_frames(input_frames[, do_sigma_clip, ...])

Coadd a cube of frames using a specified method.

_coadd_frames_numba(data_cube, data_out, dq_cube)

_get_data_attrs(input_model)

_make_frame_batch(input, attrs)

_mask_outliers(x, center, stddev, mask[, ...])

Mask outliers in a dataset based on sigma thresholds, respecting a minimum number of good values to retain.

coadd_frames(input[, do_sigma_clip, ...])

sigma_clip(x, mask[, sigma_thresh_low, ...])

Perform sigma clipping on an input array.

sigma_clip_frames(data_cube, mask_cube[, ...])

Classes

CoaddFramesPrimitive([dataset, config, ...])

Coadd multiple level 0 (rate maps) frames of the same kind to increase signal-to-noise.

class CoaddFramesPrimitive(dataset=None, config=None, context=None, log_config=None, parent=None, **kwargs)[source]

Bases: BasePrimitive

Coadd multiple level 0 (rate maps) frames of the same kind to increase signal-to-noise. Works on darks and flats calibration models too.

An ancestor FITS extension is created to include the list of filenames that were combined.

This primitive combines input data products using a weighted average (if mean_calc = ‘wmean’), where the weights are given by the inverse variances (1 / model.err^2). The output error and variance arrays are computed using the corresponding weighted standard error. Data quality (DQ) flags from all inputs are propagated to the output using a bitwise OR.

Parameters:
  • input (list[str or DataModel] or dict[str, str or DataModel] or L0Model) – Input files or data models to coadd. Inputs may be provided as a list or as a dictionary; when a dictionary is given, each group of inputs is coadded separately.

  • suffix (str or None, optional) – Suffix to append to the output filename. Default is 'coadded'.

  • mean_calc (str, optional) – Method for calculating the output data values. Currently, only 'wmean' (weighted mean) is implemented.

  • err_calc (str, optional) – Method for calculating the output error and variance. Currently, only 'wse' (weighted standard error) is implemented.

Returns:

output (DataModel or dict[str, DataModel]) – Coadded data model(s) with propagated errors and data quality flags. If the input was provided as a dictionary, a dictionary of coadded models is returned.

coadd_frames(input, do_sigma_clip=False, sigma_thresh_low=None, sigma_thresh_high=None, min_keep=3, mean_calc='wmean', err_calc='wse', primitive=None)[source]