Quality control#

Every run gets a quality record (its quality metrics) and an HTML report built from it. Separate commands report on raw recordings before any processing, on a whole cohort, and on dyads. A rating viewer turns any report into a form for recording your own verdicts.

Report

Command

File

Run report

nirspipe ... participant, automatically

sub-<label>/<run>_report.html

Condition pages

--by-condition on nirspipe or nirspipe-qc ... participant

<run>_cond-<condition>_report.html, ..._desc-raw_report.html

Subject index

nirspipe or nirspipe-qc ... participant

sub-<label>/sub-<label>_desc-index_report.html

Raw report

nirspipe-qc ... participant

sub-<label>/<run>_desc-raw_report.html

Cohort of runs

nirspipe-qc ... group or nirspipe ... group

desc-subjects_report.html at the tree root

Dyad raw report

nirspipe-qc ... group --pairs-csv

group-<id>/<group run>_desc-raw_report.html

Dyad analysis report

nirspipe-hyper

group-<id>/<group run>_report.html, one page per condition, and the dyad index

Cohort of dyads

nirspipe-qc ... group --pairs-csv or nirspipe ... group

desc-groups_report.html at the tree root

The metrics work on any recording, whatever its design. The one exception is CNR, which needs event annotations; a run without them has no CNR.

The quality record#

nirspipe writes one record per run, <run>_desc-sqm_qc.json, once preprocessing and postprocessing have both finished. nirspipe-qc ... participant writes the same record up to the end of preprocessing to <run>_desc-sqmraw_qc.json, and nirspipe-qc ... group --pairs-csv writes a dyad record under group-<id>/[ses-<s>/]nirs/. The cohort pages are built from these records.

The record is split into sections named after the stage they were measured on (raw, rawhaemo for the haemoglobin before motion correction, motion, preproc, errts and so on), and each is measured on all channels, the long channels and the short channels separately: raw is every channel, raw_long and raw_short the two sets. The per-window series and the flagged stretches (GVTD above its threshold, spikes, corrected samples) are named the same way: gvtd_filt_per_window is every channel, gvtd_filt_per_window_long and _short the sets. Measures taken on the raw signal include rejected channels, except GVTD: it asks how much the analysed data moved, so it reads the kept channels only, as --gvtd-censor does. Measures taken on haemoglobin leave them out. <run>_desc-channel_qc.tsv beside the record holds one row per channel, with its metrics and its verdict, and the .json beside it says what each column holds. An older record is refused rather than misread, whether it named the long set’s series plainly and every channel’s _all or took GVTD over the rejected channels too. Rerun the command that wrote it.

Metrics#

Every metric the record keeps is listed below with the label the report prints and the text it shows when you hover that label. Each entry ends with how to read the value: higher is better, lower is better, best near a given value, or descriptive. The report colours five of them, and none of them rejects anything: channels are rejected one at a time, by the screening (Quality Metrics).

        flowchart TD
    REC(["recording<br/><small>raw intensity</small>"])
    OD["optical density"]
    SCR["channel screening<br/><small>SCI and PSP in every 10 s window</small>"]
    MC["motion correction"]
    BL["Beer-Lambert"]
    POST["bandpass · resample · regression<br/><small>with --mode</small>"]
    SQM(["quality record<br/><small>one per run, every section below</small>"])
    REP["reports → nirspipe-rate"]

    REC --> OD --> SCR --> MC --> BL --> POST --> SQM --> REP

    REC -.- M1["<b>raw</b><br/>SCI · PSP · CV · SNR · saturation<br/>GVTD · spikes"]
    SCR --> BAD(["bad channels<br/><small>passing in fewer than --min-good-frac of windows</small>"])
    TAB[/"--bad-channels table · channels.tsv<br/><small>the table nirspipe-rate export writes</small>"/] --> BAD
    SPIN[/"--keep-spans · --bad-spans · --gvtd-censor<br/><small>--bad-spans also as nirspipe-rate export writes it</small>"/] --> SPANS(["BAD_ spans<br/><small>left out of every estimate, and of screening<br/>except --gvtd-censor's, marked after it</small>"])
    MC -.- M2["<b>motion · motion_post</b><br/>correction footprint<br/>SCI · PSP · GVTD · spikes again"]
    BL -.- M3["<b>preproc</b><br/>HbO-HbR corr · GCOR · CNR<br/>band power · drift"]
    POST -.- M4["<b>filtered · resampled · errts</b><br/>HbO-HbR corr · GCOR · CNR"]
    POST -.- M6["<b>whitening</b><br/>whitened residual low-band power<br/><small>task GLM only</small>"]
    SENS(["motion sensor<br/><small>where the recording has one</small>"]) -.- M5["<b>imu</b><br/>gyro speed · accel jerk"]

    classDef od fill:#fdebd0,stroke:#e67e22
    classDef haemo fill:#fadbd8,stroke:#c0392b
    classDef side fill:#eaeded,stroke:#7f8c8d
    classDef derivative fill:#d6eaf8,stroke:#2874a6
    classDef acts fill:#ffffff,stroke:#c0392b,stroke-width:2px
    class REC,OD od
    class BL,POST haemo
    class M1,M2,M3,M4,M5,M6 side
    class SQM derivative
    class BAD,SPANS acts
    

In the diagram, grey boxes are measured and drawn but change nothing; the two red ones act on the data: bad channels and excluded time.

Coupling and signal level#

How well the optodes touched the scalp, and how strong and steady the light was. For coupling, read the windowed SCI: it is what screening counts, and the whole-run SCI can disagree with it.

SNR is labelled μ/σ, the mean intensity over its standard deviation, so its line of 20 is the same as a CV of 5%. Some papers give SNR in decibels instead; 20 is about 26 dB.

Two checks read the pulse itself. The heart rate should lie inside the cardiac band that SCI and PSP look in; when it does not, the report says so, and the band (--cardiac-l-freq, --cardiac-h-freq or --population) is probably wrong for your participants. The cardiac HbO/HbR ratio checks the two wavelength labels: the pulse is arterial, so it should show up mostly in HbO. When most runs of a task read the other way round, the cohort page warns that the labels may be swapped.

Mean SCI (whole run) (sci_mean, sci_per_channel)

Scalp coupling over the whole run: how well the two wavelengths share a heartbeat. [1]

Near 1 is good; low means poor optode contact. The report colours it green at 0.75 or above and red below 0.5.

Mean SCI (10 s) (sci_win_mean, sci_win_per_channel)

Scalp coupling in 10 s windows, averaged, so brief movement sways it less than the whole-run SCI.

Near 1 is good.

Channel retention (channel_retention_rate)

Share of channels not marked bad.

Higher is better. The report colours it green at 90 % or above and red below 70 %.

Mean PSP (10 s) (psp_mean, psp_per_channel)

Strength of the heartbeat peak the two wavelengths share, in 10 s windows.

Higher is better.

Passing windows (good_frac_mean)

Share of 10 s windows passing on SCI, and on PSP when it has a line; channels are rejected on this.

Higher is better. The report colours it green at 75 % or above and red below 50 %.

Mean CP (exp.) (cp_mean, cp_per_channel)

How peaked the spectrum is inside the cardiac band, 0 to 1.

\[\text{CP} = \frac{P(f_c \pm 0.2\,\text{Hz})}{P(f_c \pm 0.5\,\text{Hz})},\]

where \(f_c\) is the peak frequency in [cardiac_l_freq, cardiac_h_freq].

Experimental, with no better end; read SCI and PSP for coupling.

Mean CV (10 s) (cv_mean, cv_per_channel)

Noise relative to brightness (SD / mean) of the raw intensity, in 10 s windows.

\[\mathrm{CV} = \frac{\sigma}{\mu}\]

Lower is better.

Mean SNR μ/σ (10 s) (snr_mean, snr_per_channel)

Mean over SD (μ/σ) of the raw intensity in 10 s windows, a linear ratio, not dB.

\[\mathrm{SNR} = \frac{1}{\overline{\mathrm{CV}}}, \qquad \overline{\mathrm{CV}} = \frac{1}{W} \sum_{w=1}^{W} \frac{\sigma_w}{\mu_w}\]

where \(\sigma_w\) and \(\mu_w\) are the std and mean of the raw intensity in window \(w\) of \(W\) non-overlapping windows.

Higher is better.

SNR pass rate (snr_pass_rate)

Share of channels whose SNR clears the per-channel line.

Higher is better.

Flat channels (n_flat_channels)

Channels with no variation at all.

Zero is best. The report colours it green below 1 and red at 2 or above.

Mean amplitude (mean_amp_mean)

Average light level reaching the detectors.

Descriptive: use it to spot unusually dim channels.

Heart rate (Hz) (heart_rate, heart_rate_per_channel)

Heart rate in Hz, the median of the channels’ spectral peaks above the respiration band.

\[f_\mathrm{HR} = \operatorname*{median}_{c} \; \operatorname*{arg\,max}_{p \in \mathcal{P}_c} r_c(p), \qquad r_c(f) = \log S_c(f) - (a_c + b_c \log f),\]

where \(S_c\) is channel \(c\)’s Welch spectrum of optical density between \(f_\mathrm{resp}\), the top of the respiration band, and \(f_N - 0.3\) Hz, \(f_N\) the Nyquist frequency; \(a_c + b_c \log f\) is the least-squares line through \(\log S_c\) against \(\log f\) over that range, the background’s fall with frequency; and \(\mathcal{P}_c\) are the local maxima of \(r_c\).

Descriptive; it should lie inside the cardiac band.

Cardiac HbO/HbR ratio
  • Cardiac HbO/HbR ratio (cardiac_ratio). HbO over HbR power of the pulse, the median over kept long channels whose pulse is clear. Descriptive; far above 1, as the pulse is arterial.

  • Cardiac HbO/HbR ratio, labels swapped (cardiac_ratio_swapped). The same with the two wavelength labels swapped. Far above the labelled value in most runs of a task means the labels may be swapped.

  • Channels with a clear pulse (cardiac_ratio_n). Kept long channels whose pulse is clear enough for the cardiac HbO/HbR ratio. Descriptive.

\[\begin{split}R = \frac{\mathbf{m}_{O} S \mathbf{m}_{O}^\top}{\mathbf{m}_{R} S \mathbf{m}_{R}^\top}, \qquad S = \begin{pmatrix} S_{11} & S_{12} \\ S_{12} & S_{22} \end{pmatrix},\end{split}\]

where \(S_{11}, S_{22}\) are the band means over the cardiac band of the Welch auto-spectra of the pair’s two optical densities and \(S_{12}\) that of their real cross-spectrum; \(\mathbf{m}_{O}\) and \(\mathbf{m}_{R}\) are the rows of the pseudo-inverse of the 2 × 2 extinction matrix the conversion uses; and \(R_\mathrm{swapped}\) takes the matrix with its rows swapped.

Saturation
  • Saturated channels (n_saturated_channels). Channels held at the detector’s ceiling for two samples or more. Zero is best.

  • Saturated share (saturated_pct, saturated_per_channel). Share of samples held at the detector’s ceiling. Zero is best.

Source-detector separation
  • Mean separation (mm) (ch_dist_mean). Average source-detector separation, in mm. Descriptive.

  • Min separation (mm) (ch_dist_min). Shortest source-detector separation, in mm. Descriptive.

  • Max separation (mm) (ch_dist_max). Longest source-detector separation, in mm. Descriptive.

Motion from the optical signal#

Motion measured from the optical signal itself. The band-passed GVTD is the trace the reports draw and the threshold applies to. The spike counts are experimental.

GVTD
  • GVTD mean 0.02-0.5 Hz (mOD/sample) (gvtd_filt_mean). Head movement: GVTD band-passed to 0.02-0.5 Hz, averaged over the run. Lower is better. [2]

  • GVTD p95 0.02-0.5 Hz (mOD/sample) (gvtd_filt_p95). The same at the worst moments, the 95th percentile. Lower is better.

  • GVTD mean (mOD/sample) (gvtd_mean). Unfiltered GVTD averaged over the run, recorded for comparison with other tools; lower is better. The GVTD threshold does not apply; read the band-passed GVTD for movement.

  • GVTD p95 (mOD/sample) (gvtd_p95). The same at the worst moments, the 95th percentile.

  • GVTD mean (var-normalised) (gvtd_vstd_mean). Unfiltered GVTD with every channel scaled to unit variance, so loud channels cannot dominate. Recorded only, with no better end.

  • GVTD p95 (var-normalised) (gvtd_vstd_p95). The same at the 95th percentile.

\[g_i = \sqrt{\frac{1}{N} \sum_{j=1}^{N} \left(y_{j,i} - y_{j,i-1}\right)^2},\]

where \(N\) is the number of channels and \(y_{j,i}\) the value of channel \(j\) at sample \(i\).

GVTD threshold
  • GVTD threshold (mOD/sample) (gvtd_thresh). Motion cutoff from this recording’s own band-passed GVTD: its mode plus 10 times the spread below it. Descriptive. [2]

  • GVTD threshold applied (mOD/sample) (gvtd_thresh_applied). The cutoff the frame counts are taken against: the uncorrected recording’s, on both sides of a before and after pair. Descriptive.

\[\sigma_L = \sqrt{\frac{1}{|L|} \sum_{g_i \in L} (g_i - m)^2}, \qquad L = \{\, g_i : g_i < m \,\},\]
\[\tau = m + n_\text{std}\,\sigma_L,\]

where \(m\) is the histogram mode (center of the tallest bin, bins ~ n/5) and \(\sigma_L\) is the left-tail std, the RMS spread of the points below the mode, which are free of motion-spike contamination.

GVTD above threshold
  • GVTD % above threshold (gvtd_pct_above_thresh). Share of the recording with clear movement, above the applied GVTD threshold. Lower is better.

  • GVTD frames above threshold (gvtd_num_above_thresh). Frames whose band-passed GVTD exceeds the applied threshold. Lower is better.

GVTD censoring
  • GVTD censored % (gvtd_censor_pct). Share of the recording marked BAD_gvtd by censoring; nothing was deleted. Lower is better.

  • GVTD retained (s) (gvtd_censor_retained_s). Seconds left after censoring, the time an analysis can actually use. Higher is better.

Spikes
  • Spike count (spike_count). Sudden jumps across all channels, on the motion-band derivative. Lower is better.

  • Spike % (exp.) (spike_pct). Spike samples as a share of all channel-samples. Experimental; lower is better.

  • Spike frames (spike_num_frames). Frames where at least 10% of channels jumped together. Experimental; lower is better.

  • Spike % frames (spike_pct_frames). Spike frames as a share of the recording. Experimental; lower is better.

Motion-correction footprint#

When a motion correction ran, which samples it actually changed. The report draws it as a strip at the top of the motion figures. Experimental.

Motion corrected fraction (exp.) (motion_corrected_frac_mean, motion_corrected_frac_per_channel)

Average share of each channel’s samples the correction changed abruptly.

Experimental and descriptive.

Corrected frames
  • Motion corrected frames (motion_corrected_num). Frames where at least 10% of channels were corrected abruptly at once. Experimental and descriptive.

  • Motion corrected % (exp.) (motion_corrected_pct). Corrected frames as a share of the recording. Experimental and descriptive.

  • Motion corrected segments (motion_corrected_n_segments). Separate stretches the corrected frames form. Experimental and descriptive.

Motion from the sensor#

Only for recordings with a motion sensor (IMU). These are descriptive and belong to no channel.

Gyroscope speed
  • Gyroscope speed mean (gyro_speed_mean). Average head turning speed from the gyroscope, in the recording’s unit. Descriptive.

  • Gyroscope speed p95 (gyro_speed_p95). The same at the worst moments, the 95th percentile. Descriptive.

Accelerometer jerk
  • Accelerometer jerk mean (accel_jerk_mean). Average jerk (change in acceleration) from the accelerometer, in the recording’s unit. Descriptive.

  • Accelerometer jerk p95 (accel_jerk_p95). The same at the worst moments, the 95th percentile. Descriptive.

Agreement with GVTD
  • gyro_speed_gvtd_rho. How closely the band-passed GVTD follows the gyroscope speed, frame by frame (Spearman). Recorded only, with no better end.

  • accel_jerk_gvtd_rho. The same against the accelerometer jerk.

Processed signal#

Measured on each haemoglobin stage the run wrote.

HbO-HbR corr (hbo_hbr_corr_mean, hbo_hbr_corr_per_channel)

Correlation of HbO and HbR: cortical signal pushes it negative, systemic or motion signal positive.

\[\rho = \operatorname{corr}(\text{HbO}, \text{HbR}), \qquad \rho \in [-1, 1].\]

Lower is better, with no fixed cutoff.

CNR
  • CNR HbO (cnr_hbo_mean). How far the evoked HbO response clears its noise, averaged over channels. Higher is better; needs stimulus annotations.

  • CNR HbR (cnr_hbr_mean). The same for HbR, which falls with a response, so more negative is better.

  • CNR epochs (cnr_n_epochs). Stimulus epochs the CNR averaged over; with only a few, the CNR is noisy. Descriptive.

\[\mathrm{CNR} = \frac{\mu_\text{resp} - \mu_\text{base}} {\sqrt{\sigma^2_\text{resp} + \sigma^2_\text{base}}},\]

taken per epoch on the channel’s own samples and then averaged over epochs.

Global correlation

Global corr HbO (gcor_hbo). How much all HbO channels move together; high means a strong global or systemic component. Descriptive. HbR the same: gcor_hbr.

\[\text{GCOR} = \mathbf{g}^\top \mathbf{g} = \lVert \mathbf{g} \rVert^2,\]

where each channel is demeaned and unit-L2-normalised, then averaged into \(\mathbf{g}\).

Low-frequency drift

Low-freq drift (HbO, µM) (lowfreq_drift_amplitude_hbo). How far the HbO baseline travelled, peak to peak of a fitted trend. Lower is better; not comparable across recording lengths. HbR the same: lowfreq_drift_amplitude_hbr.

Cardiac band power

Cardiac band power (HbO, µM²/Hz) (cardiac_band_power_hbo). Average HbO spectral density in the cardiac band. Descriptive; it scales with signal amplitude, so it does not compare across subjects. HbR the same: cardiac_band_power_hbr.

Cardiac band share

Cardiac band (HbO) (cardiac_band_frac_hbo). Share of HbO power in the cardiac band, 0 to 1. Descriptive; read SCI and PSP for pulse quality. HbR the same: cardiac_band_frac_hbr.

Respiration band power

Resp band power (HbO, µM²/Hz) (resp_band_power_hbo). Average HbO spectral density in the respiration band. Descriptive. HbR the same: resp_band_power_hbr.

Respiration band share

Resp band (HbO) (resp_band_frac_hbo). Share of HbO power in the respiration band, 0 to 1. Descriptive. HbR the same: resp_band_frac_hbr.

Short-channel share

Short-channel share HbO (short_share_hbo). Share of each long channel’s HbO variance the fitted short-channel regressors carry, averaged over the kept long channels, 0 to 1. Descriptive. HbR and HbT the same: short_share_hbr, short_share_hbt.

% data retained (pct_data_retained)

Share of the recording outside BAD_ spans.

Higher is better. The report colours it green at 80 % or above and red below 60 %.

GLM residual#

Only for a task GLM. The GLM’s t values assume that the noise model has removed the correlation over time from the residual; these metrics show whether it did. The report draws the residual spectrum in its GLM section.

Residual low-band power

Residual low-band power HbO (whitening_lowband_hbo). Whitened GLM residual power at 0.01-0.1 Hz over white noise: above 1 inflates t, below 1 deflates it; aim for 1, so no better end. HbR the same: whitening_lowband_hbr.

The run report#

nirspipe writes one HTML page per run, and a subject index that links every run and condition page. A page loads its figures from the subject’s figures/ folder, so keep the two together when you move or share a report. Under --combine-runs the index also shows each joined series: each run’s length and kept time, the joined signal and the joined connectivity. Open a page directly in a browser, or through the rating viewer.

Every report follows one layout: a summary, the processing steps in order, Quality Metrics (the tables), Quality Figures, and the run record last. A figure that fails to build leaves a placeholder and an entry under Errors & Warnings; the rest of the page still renders.

Summary#

The subject, the recording’s duration, the screening rule (the SCI line and the share of passing windows a channel needs), the command, the settings, and every setting nobody typed, with whether --config or the mode set it. An age-based DPF is printed with where its age came from and the factor it gave each wavelength, for example age 30 from --population adult (6.30, 5.23) or participant's age 19 (5.97, 4.91). Run notes follow: anything the run had to decide for itself, such as channels whose separation falls between the short and long ranges.

If the recording’s optodes could not be placed on the head, the summary says so. Everything drawn on the brain is then not anatomical; the short/long split and the screening are not affected.

A run with excluded time gets an Excluded time section under Quality Metrics: the kept seconds, each span with where it came from, and per condition its kept seconds and trials (Excluded time).

Preprocessing#

  • Raw signal. Every channel’s raw intensity, with the condition blocks shaded, beside the event table. Channels are listed by source, then detector number, with a pair’s two wavelengths together; short channels sit in their own block below, in lighter shades, and rejected ones are grey. Click a trace to see that channel’s HbO/HbR and spectrum below. Under it, the mean spectrum of the optical density, one mean per channel set with each channel faint behind it and the heart rate marked.

  • Signal quality. Heatmaps of windowed SCI, PSP and CV (channels by time) against the run’s lines, then the same windows on the head with a slider, and the 3D brain views with each channel coloured by SCI. On the brain views each source and detector is filled by the share of its long channels that were rejected: a solid red optode lost all of them, which points at that optode rather than at its channels.

  • Motion. The motion trace (GVTD) above a picture of every channel’s signal, before and after correction on one scale. The motion sensor is drawn above it when the recording has one. A per-channel selector and a zoom on the largest motion events show what the correction did.

  • HbO / HbR. How HbO and HbR correlate in each channel. Healthy channels usually show a negative correlation, but so can a dead channel, because noise at the two wavelengths converts to anticorrelated HbO and HbR; rejected channels are therefore ranked apart.

  • Short-channel regression. When short channels were regressed out, a head map of how much of each long channel’s variance the short-channel regressors carried. A high share means much of that channel was scalp or systemic signal. Descriptive: nothing is rejected on it.

  • Nuisance correlations. How the series a regression removes (the short-channel, aux and drift regressors, the motion trace, and the motion sensor where there is one) correlate with each other and with the global signal, the mean of the kept long channels.

  • Spectra by stage. The mean spectrum before and after postprocessing, with the cardiac and respiration bands and the filter cutoffs marked. After a high-pass, the first and last stretch of the run (one period of the cutoff) partly show the filter settling rather than data.

  • Epoch preview (task data). The event timeline, the average response per condition, maps of the response on the head stepped by a slider, and each trial as an image. A condition with fewer than three trials is drawn on its own scale, and one with a single trial is named in the run notes. When the run applied no low-pass, these figures are smoothed for display only, so the heartbeat does not show as a ripple.

Postprocessing#

  • glm. The design matrix, each condition’s betas on the cortex and, with --contrast-file, each t contrast drawn the same way. The numbers behind the maps are in desc-glm_nirsmap.tsv and desc-contrast_nirsmap.tsv. A last panel checks whether the noise model left the residual white.

  • denoise. The filter settings and the signal after denoising; with --fc, the connectivity figures.

  • rest. mALFF on the cortex, the correlation matrices with ALFF and fALFF beside them, and, with --roi-mapping, the region matrix and the seed maps.

The channel correlation matrices show every kept long channel, grouped by region with --roi-mapping and otherwise listed by source, then detector number, on a colour scale centred on 0.

Reading the rest figures. ALFF is how strongly a channel’s signal fluctuates at rest. mALFF divides it by the run’s average over its long channels, so 1 is an average long channel and 1.5 one half again as strong. A low value means the signal there is quiet, not that the channel is poor, and since each run has its own scale, compare colours between runs only as a pattern. A seed map colours each channel by how it follows the seed region: red when it rises and falls with the seed, blue when it moves against it.

Warning

Without short-channel regression, scalp and systemic blood flow reach every channel alike, so every channel can correlate strongly with every seed. A seed map that is red everywhere then shows this shared signal, not a brain network.

Quality Metrics#

Run summary. All the run’s metrics in one table, with columns All, Long and Short. Read the verdict off Long, the only coloured column; Short tells you whether the short-channel regressors can be trusted. A cell reading before → after shows a metric across a processing step. Hover a label for what it measures and which way is good. Seven metrics are marked as the ones that decide whether a run is usable: channel retention, data retained, GVTD share above threshold, band-passed GVTD p95, windowed SCI, passing windows and HbO–HbR correlation.

The run summary table of a run report

The run summary of one run. A cell with an arrow holds the value before and after a step.#

Indicator

Green

Yellow

Red

Channel retention

≥ 90 %

70–90 %

< 70 %

Mean SCI (whole run)

≥ 0.75

0.5–0.75

< 0.5

Passing windows

≥ 75 %

50–75 %

< 50 %

Flat channels

0

1

≥ 2

% data retained

≥ 80 %

60–80 %

< 60 %

An uncoloured metric has no cutoff; it has not passed anything. None of these averages rejects a channel; only the screening does.

Region coverage. With --roi-mapping: the long channels each region lists, and how many the screening and your own marks left. A region with none left has no value in any output built per region.

Per-channel table. One row per source-detector pair, by source then detector number: its region, its nearest cortical region, its status and its quality values, grouped into long, short and neither. Status is BAD for a channel the screening rejected and BAD (manual) for one you rejected. After short-channel regression, the table also gives each long channel’s short-channel share.

Quality Figures#

  • By denoising stage. Each metric across the processing stages, so you can see what each step did.

  • By channel. A pass/fail grid over status, passing windows, SCI, CV, PSP and SNR, long channels first, each set by source then detector number. Without --psp-threshold, PSP has no line to pass or fail, so its row is coloured from 0 to 0.1 instead, greener when higher, with a colour bar beside the grid.

  • By condition. With --by-condition: whether each channel passes in each condition on its own. A guide to choosing conditions; it rejects nothing.

  • By trial. Every trial scored on its own. The colour compares trials within a row; it is not a threshold. Trials shorter than 5 s are not scored.

A pass/fail grid of status, passing windows, SCI, CV, PSP and SNR per channel

The pass/fail grid by channel and wavelength, long channels first. S2_D2 is rejected with a green SCI cell: the cell averages SCI over windows, and rejection counts the windows that clear both lines.#

A channel can be BAD while its SCI cell is green: the cell is the average SCI over the run, but rejection counts how many windows pass. A channel that is good for half the run and bad for the other half can have a fine average and still be rejected.

Run record#

The last part of the page holds the errors and warnings, the run’s provenance graph with every output file and the step that made it (Sidecars and provenance), the Methods paragraph and the software versions. Every run also gets MNE’s own report beside the page, <run>_desc-mne_report.html.

Condition pages#

A condition page is a view of the run, not a separate analysis: every rejection on it is the run’s. It shows apart which channels fail in this condition and the share of windows passing in condition. Its GLM map comes from the one model fitted over the whole run. File names keep only the letters and digits of a condition’s name, so two conditions such as go-left and go_left would share a file. Neither then gets a page, and the run page reports this as an error.

Raw report#

nirspipe-qc bids_dir output_dir participant reports on raw recordings before any analysis: it prepares each one with the same steps and settings as nirspipe (screening, motion correction, haemoglobin) and draws the recording as delivered on a page of its own, named like its run report. Each subject runs on its own, so one failure does not stop the rest. It takes the same screening, separation, --population, --bad-channels, --keep-spans, --bad-spans and --bids-filter-file flags as nirspipe.

Note

Give nirspipe-qc the same screening settings you give nirspipe, or the raw report and the run report will describe different channel sets.

A recording that screening cannot judge (for example one that is too short) would stop nirspipe, but the raw report still draws it, rejects nothing and says why above its channel table. A recording whose every channel fails is drawn too, with every channel marked. --motion-correction (default tddr) is the correction each recording is prepared with, written into stages/ as nirspipe writes it, and the report shows the recording before and after it. Screening is measured before it, on the recording as delivered. --epoch-qc adds the per-trial section and --by-condition one page per condition. Raw reports have no Methods paragraph, since they describe a recording rather than an analysis. The record it writes, sub-<label>/logs/<stem>_desc-raw.toml, reruns the same report with nirspipe-qc --config.

The page has the same order as the run report, and its summary and metric names read the same. The raw signal is unfiltered, so its averages and trial images are smoothed for display only.

Cohort reports#

Cohort of runs#

nirspipe-qc ... group (or nirspipe ... group) gathers every run’s quality record into desc-subjects_qc.tsv, one row per run, and draws desc-subjects_report.html. A run with both a pipeline and a raw record uses the pipeline’s. desc-subjects_qc.json describes every column.

desc-conditions_qc.tsv holds the same numbers per condition: one row per run and condition, under the same column names, each measured over the condition’s window, with the window itself (onset, duration), its kept_s outside every BAD_ span and the counted_windows its passing share counts. A condition’s channel_retention_rate is the share of channels passing in that condition. It helps choose which conditions to keep and rejects nothing: the data were processed under the run’s own verdict, as on the condition pages. desc-conditions_qc.json describes every column.

Panel

Shows

Not finished

Only when some subject’s last run, of nirspipe or nirspipe-qc, failed or was stopped: the subject, its status, when it started and the first line of its error.

Overview

One row per metric, one dot per run, placed by how far it is from the cohort median.

Distributions

Each metric across runs; click a point to open its report.

By condition

Where the records carry conditions: each metric per condition, one line per run.

Over time

Windowed SCI, CV and motion per channel set, every run pale under the cohort median.

Connectivity before and after the regression

Where runs computed connectivity after a regression: every connection’s r before it and after it, one curve per run. A regression that removed a shared signal moves the curves toward 0.

Connectivity against movement

Per task, whether connections are stronger in the runs where the head moved more: each connection’s r across runs between movement and its connectivity, beside the spread expected with no relation, and against the distance between its two channels. The values are in desc-fcmovement_qc.tsv.

Outliers

Runs that sit far from the cohort over many metrics at once, with the metrics that put them there. The place to start.

Quality Metrics

The cohort summary; Channels kept, how many subjects kept each source-detector pair, per task; Optodes, the share of each source’s and detector’s long channels rejected over the task’s runs, where an optode that loses most of its channels points at the optode; Regions, with --roi-mapping at this level, how many runs kept none of a region’s long channels; and every value in a sortable table.

Every per-task panel and table pools the runs of a task, whatever their acq. When more than half of a task’s runs read as if their two wavelength labels were swapped (the cardiac HbO/HbR ratio, Coupling and signal level), the page says so and names the runs.

Box plots of coupling and retention metrics across a cohort, one point per run

One Distributions chart of a six-run cohort, each point a run, split by channel set.#

For your own analysis, read desc-subjects_qc.tsv directly: it is tab-separated with n/a for a missing value, and its first column, bids_name, is the run’s file name, from which you can read the subject, session, task and run.

There is no report over one window of time; to get one, crop the recordings first (Cropping).

Cohort of dyads#

With --pairs-csv, nirspipe-qc ... group also gathers each dyad’s raw record into desc-groups_qc.tsv, one row per dyad, task and session, and draws desc-groups_report.html. It shows what matters for a pair and not for one person; it measures no synchrony.

Panel

Shows

Shared usable time

One bar per dyad: how much of the recording a channel pair is good in both members at once, and whose loss the rest is.

Where the time went

The usable share per channel pair, and per condition for the dyads that lost the most. A pair that is poor in every dyad points at the cap, not at a dyad.

Quality Metrics

The cohort summary and every dyad’s numbers.

usable_stretch_s is the typical longest unbroken usable stretch, which matters because coherence needs continuous data. Every share in the table is a fraction from 0 to 1, and desc-groups_qc.json describes every column.

desc-groupconditions_qc.tsv holds the same for each condition: one row per dyad and condition, read from the dyad’s usable-time table, under the same column names. It has no usable_stretch_s, which needs the windows in their order.

Dyad reports#

Raw dyad report#

nirspipe-qc bids_dir output_dir group --pairs-csv pairs.csv writes one page per group, task and session. Run the participant level on every member into the same output_dir first: each member is read with the settings, verdict and prepared recordings (stages/) of its own raw report, so the two pages agree. A member without one fails its dyad with a message naming the command to run, and the cohort page is still written. A tree written by an older nirspipe-qc, without stages/, is refused the same way: rerun the participant level. It measures no synchrony; that is the analysis, run on the preprocessed signal.

Section

Content

Alignment

How each member was shifted onto the shared clock, and how far each block’s onset differs between members, red beyond two samples.

Per-channel signals

Both members’ traces and spectra, one channel at a time.

Shared usable time

The usable share per channel pair and condition.

Motion

Both members’ motion traces, and when they moved at the same time, before and after correction; a green strip marks spans where every member spiked at once.

Where on the head

Each member’s passing windows on the montage, per block and with a slider.

Member and dyad metrics

Each member’s numbers side by side, the heart rate among them, and the dyad’s own: pairs good in every member, shared movement, the largest offset. With --roi-mapping, each region’s long channels kept in each member.

Channel decisions

Each member’s per-channel table side by side, with the rating decision.

Shared usable time of one dyad per channel pair over the recording

Shared usable time of one dyad: each channel pair’s windows passing in both members, in one member only or in neither, below the members’ windowed SCI, PSP and CV and the condition blocks, on the shared clock.#

When the members were screened with different lines or cardiac bands, the figures draw no shared line and a note names each member’s.

Dyad analysis report#

nirspipe-hyper writes one page for the whole recording, one per condition and, with three or more members, one per pairing of members.

Section

Content

Summary

The members, the stage and band, the alignment, the regions, and the levels the arrows were drawn against.

Coherence maps

Coherence over time and frequency per channel pair, with the cone of influence and each condition’s span. Excluded time is washed out.

Coherence matrices

The band mean of each chromophore, per channel and per region pairing.

ISC

The correlation matrix and a circle of the pairings that stand out.

All values

Every number behind the panels, one row per pairing.

Member metrics

Each member’s quality numbers, the heart rate among them; on a condition page, that window’s.

By condition

Each member’s channels, with the whole-run screening every coherence used and how each channel did in each condition.

The dyad index, group-<id>_desc-index_report.html, lists every analysed window with its coherence, the share outside the cone of influence, how many values beat the null, and the ISC. A cell far from the dyad’s other windows is marked. nirspipe-hyper-groupnull writes its own page per task at the tree root (Hyperscanning).

Rating#

nirspipe-rate opens an existing report with a rating bar: a verdict per report section and, on a raw run page, a decision per channel. The report file itself is never changed. Opened directly in a browser, it shows the bar greyed out. Reopening the viewer reloads what you saved, so you can pick up where you left off.

Command

Serves

Default port

nirspipe-rate rate OUTPUT_DIR

Every subject’s index and the run reports it links

8765

nirspipe-rate raw OUTPUT_DIR --participant-label <id>

One subject’s raw reports and their condition pages; --session-label, --task-label and --run-label narrow it to some recordings

5052

nirspipe-rate hyper OUTPUT_DIR --group-id <id> --task-label <t> --pairs-csv <file>

One dyad’s raw report, in the raw QC tree

5053

If the default port is busy, the next free one is used. When more than one person rates the same reports, each starts the viewer with --rater and their initials, for example nirspipe-rate raw OUTPUT_DIR --participant-label 01 --rater QY. Each rater’s verdicts, channel decisions and marked stretches then go to files of their own, so nobody overwrites anyone else, and the rating bar shows who is rating. Without --rater, everyone shares one set of files.

Click a section’s cell to cycle unrated, good, bad and other; ctrl-click adds a comment. Click a channel chip to cycle undecided, good and bad; a red tint marks a pair the screening rejected but does not decide for you. Channel decisions apply to the whole run, so condition pages take none.

On a raw run page, Mark bad stretches under the Events table lets you drag across the Raw Signal plot to mark a stretch as bad. Each stretch is listed with editable start and end, and is saved as you go.

Using the ratings. nirspipe-rate export TREE [TREE ...] collects the channel decisions into desc-ratedchannels_qc.tsv: per rated run, the pairs rated bad in bad_channels and the pairs rated good in keep_channels. Pass it to nirspipe --bad-channels; a pair you rated good is kept even when screening rejected it (Tables that name recordings). Marked stretches go to desc-ratedspans_qc.tsv, for nirspipe --bad-spans (Choosing stretches of a recording). Each page’s final verdict is listed in desc-ratedpages_qc.tsv, for reading only. The dyad viewer keeps the members’ decisions in the raw QC tree too, so one export covers both.

With several raters, the exported tables carry a rater column, but nirspipe applies one rater’s decisions and refuses a table that holds several. Export the rater you want with nirspipe-rate export TREE --rater QY, or settle the raters’ tables into one yourself and blank its rater column.

A pair rated both bad and good for one recording is listed as a warning, and nirspipe refuses the table until you settle it in the viewer. A recording that is unusable as a whole is left out by not selecting it: a subject through --participant-label, a dyad by deleting its pairs.csv row before nirspipe-hyper runs.

The ratings are saved beside the reports:

Viewer

Section ratings

Channel decisions

rate

sub-<id>/[ses-<s>/]nirs/<page>_desc-rating_qc.json, every save also in logs/group_ratings.jsonl

none

raw

sub-<id>/[ses-<s>/]nirs/<page>_desc-rawrating_qc.json, every save also in logs/group_raw_ratings.jsonl

sub-<id>/[ses-<s>/]nirs/sub-<id>[_ses-<s>]_task-<t>_desc-rawdecision_qc.json, and marked stretches in ..._desc-rawspans_qc.json

hyper

group-<id>/[ses-<s>/]nirs/<group run>_desc-rawrating_qc.json

each member’s desc-rawdecision_qc.json, beside the member’s raw report in the same tree

With --rater QY, each of these files carries rater-QY before its desc-, for example sub-01_task-rest_rater-QY_desc-rawdecision_qc.json; the .jsonl logs keep their names and record the rater with every save.

The GUI’s Raw QC page opens these viewers and runs the export for you (GUI).

Methods text#

The run report and the dyad analysis report carry a Methods paragraph, ready to paste, with its references, as text, Markdown and LaTeX. It describes the steps that actually ran with the values they used; a skipped step leaves no sentence. nirspipe-hyper-groupnull writes its own paragraph in logs/. Raw reports carry none. Read it before you paste it, and check that it matches what you intended to run. An example:

fNIRS data were processed using NIRSPipe vX.Y.Z. Optode positions were placed on the fsaverage template by registering the 26 labelled 10-5 landmarks the recording carried onto the same points on the template with a rotation, translation and single scale fitted in least squares; the optodes then lay a median 2.4 mm from the template scalp. Raw intensity signals were converted to optical density (OD) using MNE-Python (Gramfort et al., 2013). Channels were screened in non-overlapping 10 s windows: a window passed when its scalp coupling index (SCI), measured in the 0.7–1.5 Hz cardiac band (Pollonini et al., 2014), was at least 0.8. Channels passing in fewer than 75% of their windows were marked as bad. Peak spectral power (PSP) was computed in the same windows and reported without a threshold. Motion artifacts in the OD were corrected with temporal derivative distribution repair (TDDR) (Fishburn et al., 2019). Haemoglobin concentration changes (HbO, HbR) were computed from the OD with the modified Beer-Lambert law (Delpy et al., 1988; Cope & Delpy, 1988), using a differential pathlength factor (DPF) of 6. Data were bandpass filtered (0.01–0.5 Hz) using a zero-phase Butterworth filter (order 4, applied forward and backward). Finally, nuisance signals were removed by regressing an orthogonal basis spanning the retained short channels (HbO and HbR decomposed together) out of each channel in a model with no task regressors, fitted with ordinary least squares without prewhitening; all subsequent analysis used the residuals (Yücel et al., 2021).

The hyperscanning sentences still cite placeholder entries whose author reads TODO-ADD-...; replace them before submitting.

Figure files#

Every figure is saved in a figures/ folder beside the pages that show it: sub-<label>/figures/, group-<id>/figures/, or figures/ at the root for the cohort pages. .html files are interactive figures and .png files static ones at 300 dpi, named after the run and the panel, for example sub-01_task-rest_desc-carpet_nirs.html.