exclude_intervals#

pypillometry.exclude_intervals(intervals)#

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

Exclude periods that are not part of the analysis (e.g., breaks or the calibration at the start).

The periods are stored with the object as the recording-wide "excluded" layer (see get_excluded()), which masks all variables (also those added later), so that functions that ignore masked data (e.g., scale(), get_segments()) also ignore the excluded periods. Unlike other masked data (blinks, artifacts), excluded periods are not treated as missing data: blink detection cuts blinks at them, and blinks that end in an excluded period are not interpolated. Blinks detected before keep their layer.

The layer moves with the samples (crop(), downsample(), remove_intervals(), …). Calling the method again adds to the excluded periods; clear_layer("excluded") removes them.

Parameters:
  • intervals (Intervals, Epochs or list of tuple) – the periods to exclude: 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, e.g., [(0, 2 * u.min)]; "<start>" and "<end>" stand for the start and end of the recording, e.g., [(10 * u.min, "<end>")]); 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)

See also

keep_intervals

exclude everything outside the given periods

Examples

>>> breaks = d.get_intervals(start="break_start", end="break_end", units="ms")
>>> d = d.exclude_intervals(breaks)
>>> d = d.exclude_intervals([(0, 2 * u.min)])