gastropy.neuro.fmri.create_volume_windows

gastropy.neuro.fmri.create_volume_windows#

gastropy.neuro.fmri.create_volume_windows(onsets, tr, n_volumes)[source]#

Create volume window index pairs from trigger onsets.

Maps trigger onset times to (start_idx, end_idx) pairs at the fMRI sampling rate (1/TR Hz).

Parameters:
  • onsets (array_like) – Trigger onset times in seconds (from find_scanner_triggers).

  • tr (float) – Repetition time in seconds.

  • n_volumes (int) – Expected number of volumes (windows are capped at this count).

Returns:

windows – List of (start_idx, end_idx) pairs for each volume.

Return type:

list of tuple

Examples

>>> onsets = np.arange(0, 100, 1.856)  # ~54 volumes
>>> windows = create_volume_windows(onsets, tr=1.856, n_volumes=50)