def _check_time_in_range(value, t_start, t_stop, view=False):
'''
Verify that all times in :attr:`value` are between :attr:`t_start`
and :attr:`t_stop` (inclusive.
If :attr:`view` is True, vies are used for the test.
Using drastically increases the speed, but is only safe if you are
certain that the dtype and units are the same
'''
if not value.size:
return
if view:
value = value.view(np.ndarray)
t_start = t_start.view(np.ndarray)
t_stop = t_stop.view(np.ndarray)
if value.min() < t_start:
raise ValueError("The first spike (%s) is before t_start (%s)" %
(value, t_start))
if value.max() > t_stop:
raise ValueError("The last spike (%s) is after t_stop (%s)" %
(value, t_stop))
评论列表
文章目录