quality_control.qc_flags.level2
QC checks for KPF Level 2 (extracted spectra) data products.
- class kpfpipe.quality_control.qc_flags.level2.QCL2(kpf_obj)
Bases:
QCQC checks for KPF Level 2 extracted spectra products.
- LEVEL = 'L2'
- extraction_present()
All expected {CHIP}_{FIBER}_FLUX extensions exist and are non-empty.
- flux_finite_fraction()
NaN count from headers <= 1% of total L2 flux pixels.
- nonzero_flux()
ZEROFRAC < 0.5.
- required_keywords_present()
Every registry-required PRIMARY keyword for L2 is present (presence only).
- science_snr()
Science SNR is finite and above a minimum floor.
Reads the GSNRSCI/RSNRSCI metrics written by DiagL2.snr (run DiagL2 before QCL2, mirroring the flux_finite_fraction -> nan_counts dependency). Guards against a silently failed extraction.
- variance_positive()
No strictly-negative variance where the flux is finite.
A negative extracted variance is unphysical (box/optimal variance is a sum of non-negative terms) and would corrupt downstream RV weighting. Zero variance at off-detector / fully-masked columns is tolerated.