quality_control.qc_flags.level0
QC checks for KPF Level 0 (raw CCD) data products.
- class kpfpipe.quality_control.qc_flags.level0.QCL0(kpf_obj)
Bases:
QCQC checks for KPF Level 0 raw data products.
- LEVEL = 'L0'
- data_l0_red_green()
Raw CCD data present: each of GREEN/RED is a supported amp readout.
KPF reads out either 2 or 4 amplifiers per chip, so the expected amp count is inferred from the data rather than fixed: a chip passes when the number of present, non-empty amplifier extensions is a supported readout mode (
_SUPPORTED_NAMP), mirroringImageAssembly.count_amplifiers. This accepts both 2-amp and 4-amp frames and rejects a chip with no data or a partial/invalid amp set (1 or 3). Absent amps are stored asarray(None, dtype=object)and skipped – the same present-amp scan QCL1 uses for read noise.
- exptime_sane()
EXPTIME present, finite, non-negative, and consistent with ELAPSED.
Bias frames legitimately have EXPTIME=0, so we don’t require strictly positive. When the raw ELAPSED readout time is present, it must not fall short of the requested EXPTIME (premature readout) or exceed it by more than
_TIME_TOL_S(the elapsed-vs-requested check formerly done in the masters frame loader); an absent ELAPSED skips only that comparison.
- header_keywords_present()
Required PRIMARY keywords exist.
- not_junk()
obs_id not on the observer junk list for this frame’s data tree.
“Junk” is a manual observer flag (e.g. the wrong telescope settings) that no automated QC can catch. The list lives at
{KPF_DATA_INPUT}/vNext/reference/junk_obs.csv; KPF_DATA_INPUT is recovered from the frame’s own source directory, which rvdata records asself.dirname({KPF_DATA_INPUT}/L0/{datecode}) when the L0 is read. An absent list or unknown source dir yields not-junk.
- radec_consistent()
Pointing agrees with the target and catalog positions.
Thresholds the DiagL0 offsets on QUALITY_CONTROL: TARGOFF < 1”, and the catalog cross-matches OBJOFF/GAIAOFF < 5” (a loose bound, since the loaded pointing coordinates are not Gaia/SIMBAD-derived). Each offset is checked only when present, so a frame with no pointing (e.g. a calibration frame) or a skipped catalog lookup passes.
- times_consistent()
DATE-BEG < DATE-MID < DATE-END and |(END-BEG) - ELAPSED| < 0.1 s.
Ports v2.12
L2_datetime. At L0 the raw instrument times live on the WMKO-native PRIMARY (the header later snapshotted verbatim into INSTRUMENT_HEADER at to_kpf1); the 0/1 flag then propagates downstream on QUALITY_CONTROL. Passes the duration check when ELAPSED is absent – only the present cards are checked.