本文整理汇总了Python中neo.core.event.Event.time_slice方法的典型用法代码示例。如果您正苦于以下问题:Python Event.time_slice方法的具体用法?Python Event.time_slice怎么用?Python Event.time_slice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.event.Event
的用法示例。
在下文中一共展示了Event.time_slice方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__time_slice
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def test__time_slice(self):
data = [2, 3, 4, 5] * pq.ms
evt = Event(data, foo='bar')
evt1 = evt.time_slice(2.2 * pq.ms, 4.2 * pq.ms)
assert_arrays_equal(evt1.times, [3, 4] * pq.ms)
self.assertEqual(evt.annotations, evt1.annotations)
evt2 = evt.time_slice(None, 4.2 * pq.ms)
assert_arrays_equal(evt2.times, [2, 3, 4] * pq.ms)
evt3 = evt.time_slice(2.2 * pq.ms, None)
assert_arrays_equal(evt3.times, [3, 4, 5] * pq.ms)
示例2: test_time_slice_differnt_units
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def test_time_slice_differnt_units(self):
params = {'test2': 'y1', 'test3': True}
evt = Event([0.1, 0.5, 1.1, 1.5, 1.7, 2.2, 2.9, 3.1, 3.3]*pq.ms,
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
assert_neo_object_is_compliant(evt)
evt.annotate(test1=1.1, test0=[1, 2])
targ = Event([ 2.2, 2.9 ]*pq.ms,
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
assert_neo_object_is_compliant(targ)
targ.annotate(test1=1.1, test0=[1, 2])
t_start = 0.002 * pq.s
t_stop = 0.003 * pq.s
result = evt.time_slice(t_start, t_stop)
assert_arrays_equal(targ, result)
self.assertEqual(targ.name, result.name)
self.assertEqual(targ.description, result.description)
self.assertEqual(targ.file_origin, result.file_origin)
self.assertEqual(targ.annotations['test0'], result.annotations['test0'])
self.assertEqual(targ.annotations['test1'], result.annotations['test1'])
self.assertEqual(targ.annotations['test2'], result.annotations['test2'])
示例3: test_time_slice_differnt_units
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def test_time_slice_differnt_units(self):
params = {'test2': 'y1', 'test3': True}
arr_ann = {'index': np.arange(9), 'test': np.arange(100, 109)}
evt = Event([0.1, 0.5, 1.1, 1.5, 1.7, 2.2, 2.9, 3.1, 3.3] * pq.ms, name='test',
description='tester', file_origin='test.file', test1=1,
array_annotations=arr_ann, **params)
assert_neo_object_is_compliant(evt)
evt.annotate(test1=1.1, test0=[1, 2])
targ = Event([2.2, 2.9] * pq.ms, name='test', description='tester',
file_origin='test.file', test1=1, **params)
assert_neo_object_is_compliant(targ)
targ.annotate(test1=1.1, test0=[1, 2])
t_start = 0.002 * pq.s
t_stop = 0.003 * pq.s
result = evt.time_slice(t_start, t_stop)
assert_arrays_equal(targ, result)
self.assertEqual(targ.name, result.name)
self.assertEqual(targ.description, result.description)
self.assertEqual(targ.file_origin, result.file_origin)
self.assertEqual(targ.annotations['test0'], result.annotations['test0'])
self.assertEqual(targ.annotations['test1'], result.annotations['test1'])
self.assertEqual(targ.annotations['test2'], result.annotations['test2'])
assert_arrays_equal(result.array_annotations['index'], np.arange(5, 7))
assert_arrays_equal(result.array_annotations['test'], np.arange(105, 107))
self.assertIsInstance(result.array_annotations, ArrayDict)
示例4: test_time_slice_empty
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def test_time_slice_empty(self):
params = {'test2': 'y1', 'test3': True}
evt = Event([]*pq.ms,
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
evt.annotate(test1=1.1, test0=[1, 2])
result = evt.time_slice(t_start=0.0001, t_stop=30.0 )
assert_neo_object_is_compliant(evt)
assert_arrays_equal(evt, result)
self.assertEqual(evt.name, result.name)
self.assertEqual(evt.description, result.description)
self.assertEqual(evt.file_origin, result.file_origin)
self.assertEqual(evt.annotations['test0'], result.annotations['test0'])
self.assertEqual(evt.annotations['test1'], result.annotations['test1'])
self.assertEqual(evt.annotations['test2'], result.annotations['test2'])
示例5: test_time_slice_out_of_boundries
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def test_time_slice_out_of_boundries(self):
params = {'test2': 'y1', 'test3': True}
evt = Event([0.1, 0.5, 1.1, 1.5, 1.7, 2.2, 2.9, 3.0, 3.1, 3.3]*pq.ms,
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
evt.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(evt)
targ = evt
result = evt.time_slice(t_start=0.0001, t_stop=30.0 )
assert_arrays_equal(targ, result)
self.assertEqual(evt.name, result.name)
self.assertEqual(evt.description, result.description)
self.assertEqual(evt.file_origin, result.file_origin)
self.assertEqual(evt.annotations['test0'], result.annotations['test0'])
self.assertEqual(evt.annotations['test1'], result.annotations['test1'])
self.assertEqual(evt.annotations['test2'], result.annotations['test2'])
示例6: test_time_slice_empty
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def test_time_slice_empty(self):
params = {'test2': 'y1', 'test3': True}
arr_ann = {'index': np.array([]), 'test': np.array([])}
evt = Event([] * pq.ms, name='test', description='tester', file_origin='test.file',
test1=1, array_annotations=arr_ann, **params)
evt.annotate(test1=1.1, test0=[1, 2])
result = evt.time_slice(t_start=0.0001, t_stop=30.0)
assert_neo_object_is_compliant(evt)
assert_arrays_equal(evt, result)
self.assertEqual(evt.name, result.name)
self.assertEqual(evt.description, result.description)
self.assertEqual(evt.file_origin, result.file_origin)
self.assertEqual(evt.annotations['test0'], result.annotations['test0'])
self.assertEqual(evt.annotations['test1'], result.annotations['test1'])
self.assertEqual(evt.annotations['test2'], result.annotations['test2'])
assert_arrays_equal(result.array_annotations['index'], np.asarray([]))
assert_arrays_equal(result.array_annotations['test'], np.asarray([]))
self.assertIsInstance(result.array_annotations, ArrayDict)
示例7: tests_time_slice
# 需要导入模块: from neo.core.event import Event [as 别名]
# 或者: from neo.core.event.Event import time_slice [as 别名]
def tests_time_slice(self):
params = {'test2': 'y1', 'test3': True}
arr_ann = {'index': np.arange(10), 'test': np.arange(100, 110)}
evt = Event([0.1, 0.5, 1.1, 1.5, 1.7, 2.2, 2.9, 3.0, 3.1, 3.3] * pq.ms, name='test',
description='tester', file_origin='test.file', test1=1,
array_annotations=arr_ann, **params)
evt.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(evt)
targ = Event([2.2, 2.9, 3.0] * pq.ms)
result = evt.time_slice(t_start=2.0, t_stop=3.0)
assert_arrays_equal(targ, result)
self.assertEqual(evt.name, result.name)
self.assertEqual(evt.description, result.description)
self.assertEqual(evt.file_origin, result.file_origin)
self.assertEqual(evt.annotations['test0'], result.annotations['test0'])
self.assertEqual(evt.annotations['test1'], result.annotations['test1'])
self.assertEqual(evt.annotations['test2'], result.annotations['test2'])
assert_arrays_equal(result.array_annotations['index'], np.arange(5, 8))
assert_arrays_equal(result.array_annotations['test'], np.arange(105, 108))
self.assertIsInstance(result.array_annotations, ArrayDict)