keep_intervals#

pypillometry.keep_intervals(intervals)#

Pipeline step for keep_intervals() (d | pp.keep_intervals(...)).

Exclude everything outside the given periods (e.g., keep only the task blocks or the fMRI run).

Same as exclude_intervals(intervals.complement(d)): the time before, between and after the periods is excluded (see exclude_intervals()). Periods that are already excluded stay excluded, also if they are within intervals.

Parameters:
  • intervals (Intervals, Epochs or list of tuple) – the periods to keep: an Intervals object (e.g., from get_intervals(); in time units or sample indices), Epochs or a list of (start, end) tuples (in ms, or with units; "<start>" and "<end>" stand for the start and end of the recording); ends are exclusive

  • inplace (bool or None, optional) – if True, make change in-place and return the object; if False, make and return copy before making changes; if None, use the object-level setting (specified in the constructor)

Return type:

EyeData

Returns:

the object with the excluded periods (self or a copy, depending on inplace)

Examples

>>> run = d.get_intervals(start="rsfMRI_ONSET", end="rsfMRI_END", units="ms")
>>> d = d.keep_intervals(run)