nirspipe.pipeline.combine_runs#
Runs of one task joined into one series, for --combine-runs.
Each run is z-scored per channel before the runs are joined in run order, so that a run with a larger variance does not outweigh the others in a correlation taken across the joined series. The mean and SD come from the run’s kept frames, the ones a correlation reads. A channel takes part only in the runs where it is good; its frames in the others are NaN, so a correlation over the joined series reads each pair over the frames both channels have.
Module Contents#
Functions#
Each row centred and scaled by its mean and SD (ddof 0) over the kept frames; a flat row is zero. |
|
The runs z-scored over their kept frames and joined in order, with each run’s onset in seconds. |
|
Each ROI averaged per run over that run’s good members, z-scored over its kept frames and joined. |
API#
- nirspipe.pipeline.combine_runs.zscore_kept(data: numpy.ndarray, keep: numpy.ndarray) numpy.ndarray#
Each row centred and scaled by its mean and SD (ddof 0) over the kept frames; a flat row is zero.
[[1, 2, 3, 100]], keep [True, True, True, False] -> [[-1.22, 0, 1.22, 120.02]]
- nirspipe.pipeline.combine_runs.join_runs(raws: list[mne.io.BaseRaw], absent: list[set[str]] | None = None) tuple[mne.io.RawArray, list[float]]#
The runs z-scored over their kept frames and joined in order, with each run’s onset in seconds.
A channel’s frames are NaN in a run where it is
absent(by default the run’s bad channels). The first run’s info carries over, its bad channels replaced by those bad in every run; each run’s annotations keep their place within it. Refused when the runs differ in channels or rate.
- nirspipe.pipeline.combine_runs.join_roi_signals(raws: list[mne.io.BaseRaw], labels: list[str], roi_map: dict[str, list[str]], chromophore: str) tuple[dict[str, np.ndarray], dict[str, dict[str, list[str]]]]#
Each ROI averaged per run over that run’s good members, z-scored over its kept frames and joined.
Returns
({roi: joined signal}, {run label: {roi: members}}). An ROI is NaN in a run where none of its channels is good, and left out when that holds in every run.