Skip to content

radiens_qc.persist

Write a report to a folder and read it back.

The folder is the package's stable interchange format: it is what :mod:radiens_qc.compare consumes to build cross-session comparisons, and what lets a downstream reader re-plot a recording without a server or a KPI recompute.

Layout of <out_dir>/<base_name>/:

===================== ========================================================= meta.json Provenance, thresholds, grade, per-metric summary stats, and schema_version. channels.csv One row per channel: geometry, per-metric whole-recording values, quality tier. time_series.csv Across-channel median per metric per window -- the human-readable view of the temporal data. matrices.npz The full (n_windows, n_channels) arrays, which time_series.csv collapses away. <base>_quality.png The composite report page (optional). ===================== =========================================================

Both temporal files are kept deliberately: the CSV is the one a human opens, the .npz is the one that round-trips losslessly.

Classes

Functions:

load_report

load_report(report_dir)

Load a report previously written by :func:save_report.

Reads folders written by any schema version. Pre-v1 folders (no schema_version) predate matrices.npz and the drive_path -> source rename; they load with empty :attr:~radiens_qc.report.QualityReport.matrices, which makes the temporal panels blank rather than failing.

Parameters:

Name Type Description Default
report_dir Path

A report directory containing at least meta.json and channels.csv.

required

Returns:

Type Description
QualityReport

The reconstructed report.

save_report

save_report(
    report, out_dir, *, figure=True, panels=False, dpi=150
)

Persist report to <out_dir>/<report.base_name>/.

Parameters:

Name Type Description Default
report QualityReport

Report to persist.

required
out_dir Path

Parent directory; one subdirectory per recording is created.

required
figure bool

Also render and save the composite report page.

True
panels bool

Also render each panel as a separate PNG in a <base_name>_panels/ subdirectory.

False
dpi int

Resolution for the rendered figures.

150

Returns:

Type Description
Path

The report's own directory.