pynapple.TsGroup.restrict#
- TsGroup.restrict(ep)[source]#
Restricts a TsGroup object to a set of time intervals delimited by an IntervalSet object
- Parameters:
ep (IntervalSet) – the IntervalSet object
- Returns:
TsGroup object restricted to ep
- Return type:
Examples
>>> import pynapple as nap >>> import numpy as np >>> tmp = {0: nap.Ts(t=np.arange(0, 200), time_units='s'), ... 1: nap.Ts(t=np.arange(0, 200, 0.5), time_units='s'), ... 2: nap.Ts(t=np.arange(0, 300, 0.25), time_units='s')} >>> tsgroup = nap.TsGroup(tmp) >>> ep = nap.IntervalSet(start=0, end=100, time_units='s') >>> newtsgroup = tsgroup.restrict(ep)
All objects within the TsGroup automatically inherit the epochs defined by ep.
>>> newtsgroup.time_support index start end 0 0 100 shape: (1, 2), time unit: sec. >>> newtsgroup[0].time_support index start end 0 0 100 shape: (1, 2), time unit: sec.