def time_slice(self, t_start, t_stop):
'''
Creates a new :class:`Epoch` corresponding to the time slice of
the original :class:`Epoch` between (and including) times
:attr:`t_start` and :attr:`t_stop`. Either parameter can also be None
to use infinite endpoints for the time interval.
'''
_t_start = t_start
_t_stop = t_stop
if t_start is None:
_t_start = -np.inf
if t_stop is None:
_t_stop = np.inf
indices = (self >= _t_start) & (self <= _t_stop)
new_epc = self[indices]
new_epc.durations = self.durations[indices]
new_epc.labels = self.labels[indices]
return new_epc
评论列表
文章目录