nirspipe.qc.subject.report#
Generate per-subject HTML QC report using Jinja2 + Plotly.
Each section is an independent _section_*() builder that returns a dict of template variables. Failures are caught by _guard() and appended to the errors list, and the rest of the report still renders. A section skipped because the run does not carry what it needs is not a failure: it goes to the notes list instead.
Report sections#
Summary
Subject metadata, bad-channel badge, run command.
Raw Signal
Per-channel HbO/HbR timeseries + PSD (dropdown selector).
Signal Quality
Windowed SCI/PSP heatmap + lollipop summary (build_sci_psp_figure), all on the
uncorrected optical density. Per-channel SCI/PSP across the motion correction.
Brain-surface quality map + optode flat map (if head coordinates available).
Motion Correction
GVTD + carpet plot; bad-segment zoom; per-channel before/after OD traces.
HbO / HbR
HbO–HbR correlation panel before and after denoising, one small panel per metric
across the haemoglobin stages, and HbO–HbR r per channel over the same stages.
PSD by stage
Full-dataset PSD panel + per-channel PSD detail (dropdown selector), one line
per stage file on disk.
Epoch Preview
Event timeline (one row per condition), then the grand-mean HbO/HbR averaged across
good channels, baseline-corrected.
Postprocessing (GLM mode)
Design-matrix timeseries + heatmap; activation panel per condition.
Quantitative Metrics
SQM scalar summary (channel retention, SCI, PSP, SNR, HbO–HbR corr, etc.)
+ per-channel table; CSV sidecar saved to nirs/ output directory.
Per-condition Channel Quality
Each condition page's channel grid, one block per metric, one row per condition.
Per-trial Quality
Every trial window scored on its own, over the epoch window, on the intensity
recording.
Errors / Methods / Software Versions
Module Contents#
Functions#
Render the QC report for one run and save as HTML. Returns its run-level notes. |
|
One condition’s page of a run’s report, from the condition’s own label. |
Data#
API#
- nirspipe.qc.subject.report.logger = 'get_logger(...)'#
- nirspipe.qc.subject.report.build_subject_report(subject: str, raw_intensity: mne.io.Raw, raw_haemo: mne.io.Raw, sci_scores: dict[str, float], bad_channels: list[str], config: nirspipe.pipeline.prep_pipeline.PrepConfig, run_command: str, out_path: pathlib.Path, motion_spans: list[tuple[float, float]] | None = None, segments: dict | None = None, coords_head: numpy.ndarray | None = None, good_mask: numpy.ndarray | None = None, ch_names_brain: list[str] | None = None, design_matrix: Any | None = None, glm_est: Any | None = None, l_freq: float | None = None, h_freq: float | None = None, mode: str | None = None, by_condition: bool = False, alff_df: Any | None = None, fc: dict | None = None, fc_seed: dict | None = None, fc_roi: dict | None = None, after_haemo: mne.io.Raw | None = None, roi_map: dict | None = None, provenance_path: str | None = None, sqm_label: str | None = None, roi_map_name: str | None = None, filled_settings: list[tuple[str, Any, str]] | None = None, unread_flags: list[tuple[str, str]] | None = None, chromophores: tuple[str, ...] = DEFAULT_CHROMOPHORES, short_channel_requested: bool = False, sqm_failure: str | None = None) list[str]#
Render the QC report for one run and save as HTML. Returns its run-level notes.
sqm_label is the run this report covers, as a BIDS stem (
sub-01_task-rest). It picks the SQM record and the intermediate stage files off disk, and it goes into every figure’s name so several runs of one subject share onefigures/folder without overwriting each other. Passing None falls back tosub-<subject>.roi_map_name is the ROI mapping’s label, which the figures drawn over ROIs carry so they name the same segmentation their tables do.
provenance_path is the already-rendered flow diagram, relative to out_path (the caller renders it: the report embeds, it does not draw).
- nirspipe.qc.subject.report.condition_page_name(run_label: str, condition: str, desc: str | None = None) str#
One condition’s page of a run’s report, from the condition’s own label.
("sub-01_task-rest", "game 1") -> "sub-01_task-rest_cond-game1_report.html" ("sub-01_task-rest", "game 1", desc="raw") -> "sub-01_task-rest_cond-game1_desc-raw_report.html"
Module level and not inside the writer, because the subject index looks these up on disk: the two ends came apart once already and every per-condition link went dead. The raw viewer’s pages take
desc="raw", as its run page does, and the same slug its figures and URL fragments carry.