quality_control.qc_flags.base

QC framework base class.

Each QC subclass defines check methods. A check is a method whose function object has a _qc_key (8-char FITS keyword) attribute. The runner walks all such methods, calls each one, writes a 0/1 result via set_keyword (which routes it to its registry home, QUALITY_CONTROL, with the registry Description as the FITS comment), and aggregates ISGOOD = AND of all checks. The per-check comment lives once — in the registry Description — not on the method. If any check raises, run() raises (loud failure, no silent suppression).

QC writes only 0/1 keywords. Header validation (unregistered cards, missing required keywords) is NOT done here – it lives in the separate checkpoints layer, which reads these flags plus the product headers and emits warnings or raises. The pipeline order is: science modules -> Diagnostics -> QC -> Checkpoints.

class kpfpipe.quality_control.qc_flags.base.QC(kpf_obj)

Bases: object

Base runner for per-level pass/fail QC check methods.

Parameters:

kpf_obj (KPFDataModel) – Finished data product whose QUALITY_CONTROL header receives the 0/1 flags.

LEVEL = None
run()

Run all checks, write each 0/1 result, and aggregate ISGOOD.

Resets self.results at the start so calling run() repeatedly on the same instance is deterministic.

Returns:

Maps each FITS keyword to its (passed, comment) pair (this level’s checks only). ISGOOD is the cross-level aggregate (see below).

Return type:

dict