Outputs and Quality Control
Every extraction command in neuroresp writes the same five core files into --out. Once you know that layout, you can inspect quality, analyse individual breaths, or pass waveforms to neuroresp denoise the same way across fMRI, belts, airway flow, and M/EEG. See Usage for command syntax and FAQ for common interpretation questions.
Shared outputs
Running extract, belt, airflow, motion track, or meg creates a run folder like this:
sub-01/rest/
├── qc.png # Four-panel diagnostic plot
├── summary.json # Run-level rate, variability, and QC status
├── breaths.tsv # One row per complete breath cycle
├── respiration.csv # Continuous waveform, phase, RV, RVT, and masks
├── sub-01_task-rest_desc-mri_physio.tsv.gz
├── sub-01_task-rest_desc-mri_physio.json
└── metadata.json # Run settings and acquisition details
| File | What to use it for |
|---|---|
qc.png |
Open first to check the spectrum, zoomed waveform, slow drift or motion, and summary card. Pass --no-plot to skip it. |
summary.json |
Run-level table for group analysis: breathing rate, timing variability, depth variability, coverage, and QC status. |
breaths.tsv |
One row per complete breath with onset, peak, and end times, duration, rate, excursion, clipped flag, and segment ID. |
respiration.csv |
Uniform-grid waveform, Glover phase, rv_amp, rvt, and quality masks. Pass this file directly to neuroresp denoise. |
*_physio.tsv.gz + .json |
Headerless BIDS-style physiology stream and sidecar with sampling rate, start time, columns, units, and polarity convention. |
Every standalone CLI command records neuroresp_version and waveform units in summary.json (mm for MRI and motion tracking, L for calibrated airflow volume proxies, native sidecar units when supplied for belts, and a.u. otherwise), with matching units in metadata.json when written.
Every gap, loose-strap interval, or sensor switch starts a new segment. Lagged variability metrics (duration_rmssd_s, innov_sd_ar1_s, amp_lsd) and spectral shares are always computed inside uninterrupted segments from a single sensor.
Quality metrics
Each run records an overall status of pass, warn, or fail, along with descriptive flags.
| Modality | What is checked | Main screening thresholds |
|---|---|---|
fMRI (extract) |
Unfiltered spectral SNR, shot coverage, stillness, motion spikes, and harmonic locking | SNR below 3 dB warns. Coverage below 90% warns and below 75% fails. Stillness of 20% or more, spikes of 5% or more, or a narrow spectral line near a k / TR harmonic warns. Fewer than two peaks fails. |
Belt & airflow (belt, airflow) |
Rail saturation, loose-strap dropouts, clipped cycles, and sigh censoring | Clipped cycles are excluded from depth variability, and any rail clipping censors sigh_rate_per_min. Rail clipping above 5% marks depth_valid false. |
ECG (meg) |
Physical modulation above quantisation noise, RSA polarity confidence, and rate shifts | Unmodulated ECG traces fail QC and have phase invalidated. Sustained rate shifts of at least 6 bpm and a 1.5x ratio set rate_nonstationary. |
MEG head coils (meg --source chpi) |
Active carrier or fiducial geometry preflight, quiet coverage, and head fidgets | Coverage below 75% warns and below 25% fails. |
Command-specific outputs
fMRI extraction (neuroresp extract)
In addition to the five shared files, extract saves per-shot registration estimates in slice_stacks.csv and acquisition metadata in metadata.json, including the share of respiratory power that lies above the volume Nyquist limit.
respiration.csv column |
Units | Meaning |
|---|---|---|
time_s |
s | Timestamp from volume 0 onset |
raw_pe_mm |
mm | Centred PE displacement across observed spans, NaN in gaps |
respiration |
mm | Filtered 0.10–0.50 Hz displacement, set to 0 during stillness (native units in summary.json / metadata.json for other sensors) |
respiration_z |
z | Standardised waveform over active observed samples |
phase_rad |
rad | Glover signed rank phase in [-pi, pi], NaN in gaps, stillness, and spikes |
stillness_mask |
0 / 1 | Sustained low excursion lasting 3 s or longer |
motion_spike_mask |
0 / 1 | Isolated shot jumps above 5 MAD masked before interpolation |
rv_amp, rvt |
mm, mm/s | Six-second rolling SD and breath excursion divided by cycle duration |
observed_mask |
0 / 1 | Grid support from finite shots, 0 across extended gaps |
fMRI denoising (neuroresp denoise)
Writes <prefix>_confounds.tsv with one row per retained volume, a matching JSON sidecar, and optionally the cleaned 4D NIfTI via --nifti-out. Interior unobserved spans are zeroed in fast RETROICOR harmonics while slow predictors interpolate across finite observed anchors.
The JSON sidecar records three groups of provenance metadata:
- Timing:
TimingMode,RepetitionTime,VolumeOffsetSec,TimingSource(explicit,sidecar_starttime, ormidpoint_default), andDiscardedVolumes. - Design and orthogonalisation:
SlowPredictors,MotionColumns,OrthogonalisedAgainstTedana, andRejectedComponents. - Gap imputation:
UnobservedFraction,ImputedSlowFraction,MaxImputedSlowGapSec, andImputedSlowVolumeIndices. Gaps longer than 10 s raise an imputation warning.
Hardware belts and chest-wall states (neuroresp belt)
Separates rail saturation from loose-strap dropouts and defaults to polarity_known: unknown unless the caller supplies --polarity-known true or false. By default, saturation detects explicit ADC rails or flat runs of at least 80 ms at empirical extrema. Passing --dc-coupled restricts clipping checks to explicit rails so genuine breath holds stay intact. Any rail clipping censors sigh_rate_per_min, and dual-band runs (--second-column) flag negative channel correlations below -0.2.
Passing --states adds a belt_states summary block and two 10 Hz chest-wall tables using state codes 1 (expansion), -1 (recoil), 2 (flat after expansion), 0 (flat after recoil), and 999 (uncertain):
belt_states.tsv: Complete expansion-to-expansion cycles with activeexpansion_sandrecoil_s, terminalpeak_dwell_sandtrough_dwell_s, separate mid-movement interruption durations,expansion_recoil_ratio, and cycle fractions.belt_state_runs.tsv: Contiguous state intervals whosestate_nameseparates terminal peak or trough dwell from within-movement interruptions.
Direct airway outputs
neuroresp airflow writes linearised airway flow to the BIDS *_desc-airflow_physio.tsv.gz stream alongside observed, clipped, flatline, and pause masks. In respiration.csv, it stores the detrended integral of flow as a relative lung-volume proxy so neuroresp denoise assigns opposite phases to full-lung and empty-lung pauses. Sustained zero-flow holds of 4 s or longer drop rvt to zero.
breaths.tsv fields |
Meaning |
|---|---|
start_s, insp_end_s, exp_start_s, exp_end_s, end_s |
Active flow edges at 10% of each phase's peak, closed by the next inspiratory onset |
insp_peak_s, exp_peak_s, q_peak_in, q_peak_ex |
Peak times and positive flow magnitudes for inspiration and expiration |
duration_s, inst_rate_bpm, ti_s, te_active_s, inh_pause_s, exp_pause_s |
Cycle duration, instantaneous rate, active phase durations, and pause durations |
duty_cycle, ie_ratio, tptif_ti, tptef_te, peak_timing_asym |
Active Ti / duration, active Ti / Te, relative peak times, and peak-timing asymmetry |
flatness_in, flatness_ex, log_peak_flow_ratio |
Mean-to-peak flow ratio in each active phase and log ratio of peak flows |
vt_l, vt_ti_l_s |
Inspiratory volume in litres and mean inspiratory flow, n/a unless calibrated and unclipped |
clipped, segment, source, polarity_known |
Per-cycle rail flag, contiguous segment ID, source label, and orientation |
Calibrated recordings with usable depths and at most 5% rail clipping report three ventilation estimands in summary.json:
ve_l_min(alsove_complete_cycles_l_min): summed complete-cycle volume divided by complete-cycle time.ve_observed_l_min: summed complete-cycle volume divided by total observed time, including zero-flow breath holds.ve_observed_flow_l_min: integral of all observed positive flow over total observed time, including partial edge breaths.
Airflow defines sighs above 1.75 times median VT, compared with twice median excursion on belts, and its ie_ratio_median compares active inspiration to active expiration without pauses.
Motion logs and belt/MRI fusion (neuroresp motion, neuroresp fuse)
neuroresp motion:decensorwritesfd.tsv(raw_fd_mm,adjusted_fd_mm, and censor masks) andqc.png.trackwrites the five shared tracker and breath files withpolarity_known: false.separateandppbwritecomponents.tsvandfield.tsv.metadata.jsonrecords the detected motion format and units.neuroresp fuse: Writesfused_breaths.tsv,summary.json,qc.png, andoverlay_qc.pngwhen source waveforms exist. With source waveforms present, it also writesfused_respiration.csv(time_s,respiration,respiration_sd,p05,p95,belt_bad), repairing clipped or dropped belt stretches using MRI B0 and optional--ecg. Each cycle records itssource, andsegmentincrements at every sensor switch. Depth summaries setdepth_valid: falsewhen belt and MRI units mix, and sigh rate is censored whenever belt clipping occurs or clipped belt cycles are dropped.fused_coverage_fracreports the temporal union of retained cycles over the scan window alongside separatebelt_coverage_fracandmri_coverage_frac.
MEG and EEG (neuroresp meg)
Writes the five shared files plus <prefix>_qc.json, keeping observed_mask (samples bracketed by observed beats or accepted head poses) distinct from valid (observed samples passing envelope and modulation QC). ECG runs emit *_desc-ecg_physio.tsv.gz; head-coil runs for both Elekta cHPI and CTF HLC emit *_desc-chpi_physio.tsv.gz, chpi_qc.png, and a 4 Hz CSV keeping anatomical pitch_deg and ap_mm. Paired runs (--source both) place the ECG outputs inside ecg/ and write overlay_qc.png.
Standalone head-coil cycles set polarity_known: false, changing to approximate when an unambiguous simultaneous ECG passes the head-coil polarity gate. <prefix>_qc.json stores carrier and pose checks for Elekta, or hardware: ctf_hlc fiducial-geometry checks for CTF, alongside quiet coverage, fidget fraction, axis rates, and the independent 1/f spectral guard.
Batch outputs (neuroresp batch)
Each manifest row writes a run folder under sub-XX/[ses-YY/]func/<run_id>/ with BIDS-style _physio.tsv.gz streams, summary tables, QC plots, and run_status.json. This is a custom cohort layout rather than a strict bids-validator derivative tree. The batch root also writes a dataset_description.json with GeneratedBy provenance when none exists.
| Cohort file | Contents |
|---|---|
manifest.tsv |
Selected BIDS entities, source paths, and relative output folders |
cohort_runs.tsv |
One row per planned run with execution status, QC flags, metrics, source coverage_frac, separate fused_coverage_frac, sensor shares, and errors |
participants_summary.tsv |
Per-participant run and QC counts, median rate and variability, mean coverage, and mean spectral SNR |
cohort_qc.json, cohort_qc.png |
Cohort totals, flag frequencies, Nyquist-aliasing share, and cohort QC figure |
Example QC and alignment figures
Run-level extraction commands generate a four-panel qc.png, zooming Panel B to a 60-second window on recordings longer than 90 seconds. Paired belt/MRI and head-coil/ECG runs also save overlay_qc.png.
Single-band TR 2.0 s extraction (neuroresp extract) and belt alignment


Direct airway flow (neuroresp airflow)

Hardware belt clipping (neuroresp belt), MRI rescue overlay, and cycle fusion (neuroresp fuse)



Framewise displacement decensoring (neuroresp motion decensor)

ECG-derived respiration (neuroresp meg)

Active-coil MEG cHPI respiration (neuroresp meg --source chpi|both)

