quality_control.qc_flags.level4

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

Ports the v2.12 RV/CCF QC checks (data_L2 presence, L2_barycentric_rv_percent_change) to vNext L4, plus the framework required-PRIMARY-keyword presence check. Every result is a 0/1 flag written to QUALITY_CONTROL via set_keyword. (The timing-consistency check ported from v2.12 L2_datetime now lives in QCL0 as DATTIMOK – it is a raw-frame property and propagates downstream via the QUALITY_CONTROL history.)

class kpfpipe.quality_control.qc_flags.level4.QCL4(kpf_obj)

Bases: QC

QC checks for KPF Level 4 RV/CCF products.

LEVEL = 'L4'
berv_within_tolerance()

Per-order BERV deviation within +/-1% of the weighted mean.

Ports v2.12 L2_barycentric_rv_percent_change, reading BERVMAXP / BERVMINP written by DiagL4 (run DiagL4 before QCL4). Passes when the metrics are absent (e.g. a calibration frame with no science RV) – there is nothing to flag.

ccf_rv_present()

Each science orderlet has a non-empty CCF cube and computed RVs.

Both stages of the split must have run: CrossCorrelation writes the CCF cube and seeds the RV table (with NaN RV/RV_ERR), and RadialVelocity fills the RV column. A seeded-but-unfilled table (CrossCorrelation without a following RadialVelocity) fails here, since the RVs are the L4 product.

required_keywords_present()

Every registry-required PRIMARY keyword for L4 is present (presence only).