hispecdrp.primitives.sky_subtraction.sky_primitive

Classes

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

Subtract the sky background from the input data.

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

Bases: BasePrimitive

Subtract the sky background from the input data.

This primitive applies the appropriate sky calibration to the input data product. The sky frame is subtracted from the science data, the associated uncertainties are propagated by adding errors in quadrature, and data quality (DQ) flags are combined using a bitwise OR.

Parameters:
  • input (str or L2Model) – Input file path or data model to process. Currently, this is expected to be either a level 1 (uncalibrated) or level 2 (calibrated) data product.

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

  • sky_fiber (int, optional) – Manually override the sky fiber to a specific fiber

  • sci_fiber (int, optional) – Manually override the science fiber to a specific fiber

Calibrations:

fiberflat (FiberFlatModel) –

Returns:

output – The sky-subtracted level 2 data model with updated error and data quality arrays.

_create_preview()[source]
_resolve_fibers(model, sci_fiber_override=None, sky_fiber_override=None)[source]

Resolve science and sky fiber numbers from overrides or metadata.

get_output_model(input_model, **kwargs)[source]