data_models.masters.base

KPF masters base data model.

Base class for all masters calibration data models. Inherits from KPFDataModel and initializes the data model infrastructure without creating any science-level extensions.

Level-specific masters classes use double inheritance (e.g. KPFMasterL1 subclasses both KPFMasterModel and KPF1). This gives the level-specific class access to science model methods (from_fits, to_fits, _read, info, etc.) while the extension setup is controlled entirely by KPFMasterModel and its subclasses.

Masters products differ from science products in extension naming to avoid confusion: units and normalization conventions differ by calibration type (bias, dark, flat) and are not the same as raw science counts (e.g., GREEN_CCD).

Filename convention (WMKO DRP-RUN-05): masters are written as {KOAID-of-first-input}_master_{type}_L{level}.fits (e.g. KP.20240405.49597.71_master_bias_L1.fits), built by generate_standard_filename().

class kpfpipe.data_models.masters.base.KPFMasterModel

Bases: KPFDataModel

Base class for KPF masters calibration data models.

Inherits from KPFDataModel and initializes only the base data model infrastructure. Science-level extension setup is intentionally skipped so that level-specific subclasses can install masters extensions instead. Normalization conventions differ by calibration type (bias, dark, flat).

check_filename_convention(filename)

Masters use the WMKO DRP-RUN-05 name: {KOAID}_master_{type}_L{N}.fits.

Defined on KPFMasterModel (which precedes KPF1/KPF2/KPF4 in every masters MRO) so the master convention wins over the per-level science checks.

generate_standard_filename()

Return the WMKO DRP-RUN-05 master filename for this product: {KOAID-of-first-input}_master_{type}_L{level}.fits.

The KOAID is read from the first recorded input file and the type from the PRIMARY MASTYPE header (both set by set_input_files()). Raises if either is missing, so a non-compliant master name can never be produced; kpf_filename validates the type token and level.

set_input_files(file_list, master_type)

Record the stacked input L0 files and the master calibration type.

master_type is the WMKO filename token (‘bias’, ‘dark’, ‘flat’, or ‘thar’); it is stored in the PRIMARY MASTYPE header so that generate_standard_filename() can always build a DRP-RUN-05-compliant name, including after a from_fits() round-trip.