quality_control.checkpoints

class kpfpipe.quality_control.checkpoints.Checkpoint(kpf_obj)

Bases: object

Base runner for per-level checkpoint methods.

Parameters:

kpf_obj (KPFDataModel) – Finished data product whose flags/headers are read (never written).

DIAGNOSTICS = None
LEVEL = None
QC = None
RAISE_FLAGS = ()
qc_flags()

Read this level’s 0/1 QC flags; raise a RAISE_FLAGS failure, warn the rest.

Scoped to this level’s own checks (the registry’s qc_flag_keywords_by_level[LEVEL] – the QCL{n} flags), NOT the flags propagated from lower levels: QUALITY_CONTROL accumulates the whole L0->L1->L2->L4 history, but a lower-level flag was already surfaced at its own level’s checkpoint, so re-warning it here would just be noise. A flag absent from the header is skipped (the check did not run); a flag equal to 0 raises if it is in RAISE_FLAGS, else warns.

run()

Run the paired Diagnostics and QC, then every checkpoint method.

Folds in the two upstream read-only stages: Diagnostics writes its metrics, QC writes the 0/1 flags + ISGOOD (captured in self.qc_results for callers that report them), then each checkpoint method warns or raises. A level with no paired DIAGNOSTICS/QC skips that stage. The checkpoint methods themselves never write (no return value).

unregistered_keywords()

Raise on any non-structural card not registered for its extension.

For each registry-governed extension present on the product (PRIMARY only where it is EPRV-standard – L1 onward; the raw WMKO L0 PRIMARY is skipped), a card that is neither structural nor registered (in keyword_registry.allowed[ext]) raises ValueError and names it. This subsumes the old WMKO-native leak check: a raw instrument keyword kept in INSTRUMENT_HEADER is simply unregistered for an EPRV PRIMARY.

class kpfpipe.quality_control.checkpoints.CheckpointL0(kpf_obj)

Bases: Checkpoint

Checkpoints for KPF Level 0 raw data products.

The raw WMKO L0 PRIMARY is not registry-governed, so unregistered_keywords skips it and validates only the KPF-custom extensions (QUALITY_CONTROL, RECEIPT) present on the product.

DIAGNOSTICS

alias of DiagL0

LEVEL = 'L0'
QC

alias of QCL0

RAISE_FLAGS = ('DATAPRL0',)
class kpfpipe.quality_control.checkpoints.CheckpointL1(kpf_obj)

Bases: Checkpoint

Checkpoints for KPF Level 1 assembled FFI products.

DIAGNOSTICS

alias of DiagL1

LEVEL = 'L1'
QC

alias of QCL1

RAISE_FLAGS = ('DATAPRL1',)
class kpfpipe.quality_control.checkpoints.CheckpointL2(kpf_obj)

Bases: Checkpoint

Checkpoints for KPF Level 2 extracted spectra products.

DIAGNOSTICS

alias of DiagL2

LEVEL = 'L2'
QC

alias of QCL2

RAISE_FLAGS = ('DATAPRL2',)
class kpfpipe.quality_control.checkpoints.CheckpointL4(kpf_obj)

Bases: Checkpoint

Checkpoints for KPF Level 4 RV/CCF products.

DIAGNOSTICS

alias of DiagL4

LEVEL = 'L4'
QC

alias of QCL4

RAISE_FLAGS = ('DATAPRL4',)

Submodules

base

Checkpoint framework base class.

level0

Checkpoints for KPF Level 0 (raw CCD) data products.

level1

Checkpoints for KPF Level 1 (assembled FFI) data products.

level2

Checkpoints for KPF Level 2 (extracted spectra) data products.

level4

Checkpoints for KPF Level 4 (RVs and CCFs) data products.