nirspipe.pipeline.hyper.group_io#

Reading a hyperscanning group’s files off disk; who is in it is nirspipe.io.groups.

Finds and loads; does not align and does not judge. Depends on no other group module.

Module Contents#

Functions#

load_group_raw_bids

Load raw CW-amplitude SNIRF from BIDS for each group member.

load_group_haemo

Load one haemoglobin stage per subject, selected by its desc entity.

warn_outside_passband

Warn when a requested frequency range reaches past the band the files record.

unfiltered_stage_note

A sentence for the ISC panel when the files record no bandpass, else None.

Data#

API#

nirspipe.pipeline.hyper.group_io.logger = 'get_logger(...)'#
nirspipe.pipeline.hyper.group_io.load_group_raw_bids(bids_dir: pathlib.Path, group: list[nirspipe.io.groups.GroupEntry]) → dict[str, mne.io.Raw]#

Load raw CW-amplitude SNIRF from BIDS for each group member.

Returns {subject_id: raw_intensity}. Raises MissingDerivativesError if no SNIRF is found for any member.

nirspipe.pipeline.hyper.group_io.load_group_haemo(output_dir: pathlib.Path, group: list[nirspipe.io.groups.GroupEntry], desc: str = 'preproc') → dict[str, mne.io.Raw]#

Load one haemoglobin stage per subject, selected by its desc entity.

“preproc” is Beer-Lambert output, the stage every montage has. Anything the post pipeline wrote is equally valid input here: “filtered”, “resampled”, “errts” (the confound-regression residual).

Returns {subject_id: raw_haemo}. Raises MissingDerivativesError if any SNIRF is absent, StageError if one holds optical density rather than concentration.

nirspipe.pipeline.hyper.group_io.warn_outside_passband(raws: dict[str, mne.io.Raw], fmin: float, fmax: float) → None#

Warn when a requested frequency range reaches past the band the files record.

Reported rather than enforced: a wider range is occasionally deliberate. The band comes from the sidecar, so it is what the file went through rather than what was asked for.

nirspipe.pipeline.hyper.group_io.unfiltered_stage_note(raws: dict[str, mne.io.Raw], isc_band: tuple[float | None, float | None] | None = None) → str | None#

A sentence for the ISC panel when the files record no bandpass, else None.

ISC is a whole-record zero-lag correlation and so has no frequency axis to keep drift out of; on an unfiltered stage it is dominated by the slowest component present. WTC is unaffected, since its band mean averages only the cells inside the requested band.

--desc defaults to preproc, which is Beer-Lambert output and is not bandpassed, so the default is the case this warns about.

The low edge comes from the sidecar through the lineage stamp, the same route warn_outside_passband() reads, so a file whose sidecar is missing looks the same as one that was never filtered. The wording says “record no bandpass” rather than “are unfiltered” for that reason. A cosine drift basis counts: it empties the band below its cutoff just as the filter does, so a run that used one and no bandpass is not warned about. Nor is one whose isc_band has a low edge: the correlation is then high-passed itself.