quality_control.diagnostics.base

Diagnostics framework base class.

Each Diagnostics subclass defines methods that compute metrics from a finished data product and return a dict of {keyword: (value, comment)}. The runner writes each via set_keyword (which routes the keyword to its registry-home extension — DiagL2 metrics land on QUALITY_CONTROL) and stores them on self.results.

A method opts in by setting _diag_name on the function object. If a method raises, run() raises (loud failure, no silent suppression).

Diagnostics is read-only with respect to the data extensions — it only adds header keywords via set_keyword. Pair with QC, which reads the metrics Diagnostics writes and applies pass/fail thresholds.

class kpfpipe.quality_control.diagnostics.base.Diagnostics(kpf_obj)

Bases: object

Base runner for per-level diagnostic metric methods.

Parameters:

kpf_obj (KPFDataModel) – Finished data product whose headers receive the metrics (via set_keyword, routed to each keyword’s registry-home extension).

LEVEL = None
run()

Run all diagnostic methods, writing each result via set_keyword.

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

Returns:

Maps each FITS keyword to its (value, comment) pair.

Return type:

dict