nirspipe.qc.figures.subject.psd_plot

nirspipe.qc.figures.subject.psd_plot#

PSD by pipeline stage: one row per stage, or for one channel the stages overlaid; band annotations.

Module Contents#

Functions#

psd_figure

Each stage’s spectrum in its own row, HbO and HbR together, with the filter drawn on it.

Data#

API#

nirspipe.qc.figures.subject.psd_plot.logger = 'getLogger(...)'#
nirspipe.qc.figures.subject.psd_plot.psd_figure(raw_haemo: mne.io.Raw, l_freq: float | None = None, h_freq: float | None = 0.4, filter_method: str = DEFAULT_FILTER_METHOD, filter_order: int = DEFAULT_FILTER_ORDER, fmax: float = 2.0, title: str = 'Power spectral density by stage', cardiac: tuple[float, float] | None = None, resp: tuple[float, float] | None = None, stages: list[tuple[str, mne.io.Raw]] | None = None, first_label: str = _FIRST_LABEL, overlay: bool = False, heart_rate: float | None = None) → plotly.graph_objects.Figure#

Each stage’s spectrum in its own row, HbO and HbR together, with the filter drawn on it.

raw_haemo is the Beer-Lambert output, the filter’s input. stages are what the run wrote after it as [(label, raw), ...], read off disk by the caller. Passing None falls back to simulating the bandpass in memory, which is what a prep-only run gets.

Stage is the row so a step is read by looking down the column, and every row shares one power axis or the comparison would be against a rescaled yardstick. The filter’s own response is drawn dashed over the row it produced, shifted so 0 dB sits at that row’s passband level: it stays on the one power axis that way, and the data curve can be read straight against the shape the filter should have given it.

Individual channels are drawn faintly behind each stage’s channel mean, so a mean is read against a real spread. Physiological bands are shaded and the cutoffs marked.

Parameters:
  • raw_haemo -- Beer-Lambert output (HbO/HbR channels), the first stage.

  • l_freq -- High-pass cutoff. Overridden by what the stage files record.

  • h_freq -- Low-pass cutoff, same.

  • filter_method -- Filter design, same.

  • filter_order -- Butterworth order, same.

  • fmax -- Maximum frequency to display (Hz), clamped per stage to Nyquist.

  • title -- Figure title.

  • stages -- Later stages as (label, raw); None simulates the bandpass.

  • first_label -- Row title for raw_haemo.

  • overlay -- HbO and HbR side by side with one line per stage instead of a row per stage, for a single channel whose rows would be compared across a gap. No faint lines and no response curve.

  • heart_rate -- The run’s heart rate, marked on every row; None draws no line.