nirspipe.io.snirf#
snirf file read/write (wraps MNE-NIRS + h5py).
Module Contents#
Functions#
SNIRF metadata strings arrive as bytes, 0-d arrays or 1-element arrays. |
|
The data’s first time stamp in seconds, and the factor taking the file’s time unit to seconds. |
|
The short decimal mne’s rate estimate from this time vector stands for, when the two differ by float noise only. |
|
mne’s SNIRF reader, with the events kept on the data when the file’s clock does not start at 0. |
|
Read a SNIRF and restore its pipeline stage from the desc- entity. |
Data#
API#
- nirspipe.io.snirf.logger = 'get_logger(...)'#
- nirspipe.io.snirf.write_snirf(raw: mne.io.Raw, out_path: pathlib.Path) None#
- nirspipe.io.snirf.RESIDUAL_STAGES = ('errts', 'errtsbroad')#
- nirspipe.io.snirf.text_field(value) str#
SNIRF metadata strings arrive as bytes, 0-d arrays or 1-element arrays.
NIRx writes an aux channel’s name as an HDF5 scalar.
- nirspipe.io.snirf.time_frame(handle) tuple[float, float]#
The data’s first time stamp in seconds, and the factor taking the file’s time unit to seconds.
- nirspipe.io.snirf.clean_rate(times, scale: float = 1.0) float | None#
The short decimal mne’s rate estimate from this time vector stands for, when the two differ by float noise only.
- nirspipe.io.snirf.read_raw_snirf(path: pathlib.Path | str, **kwargs: Any) mne.io.Raw#
mne’s SNIRF reader, with the events kept on the data when the file’s clock does not start at 0.
mne starts the data at 0 but keeps the stims on the file’s clock, in its unit, and drops those that then fall past the end. Its rate estimate is also freed of float noise, so a recording and the stages written from it read at the same rate (see
clean_rate()). An event the file lists twice is kept once.
- nirspipe.io.snirf.read_snirf(path: pathlib.Path | str, **kwargs: Any) mne.io.Raw#
Read a SNIRF and restore its pipeline stage from the desc- entity.
The lineage stamp lives in info[“temp”] and does not survive the SNIRF round trip, so the filename carries it instead: the writer derived desc- from the stamp, this reads the same string back. Files with no desc- entity are BIDS inputs and stamp as “raw”. Bad-channel marks and the bandpass the file went through are restored from the sidecar for the same reason.