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 (seeget_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
Intervalsobject (e.g., fromget_intervals(); in time units or sample indices),Epochsor 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 exclusiveinplace (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:
- Returns:
the object with the excluded periods (self or a copy, depending on inplace)
See also
keep_intervalsexclude 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)])