本文整理匯總了Python中neo.core.event.Event.annotate方法的典型用法代碼示例。如果您正苦於以下問題:Python Event.annotate方法的具體用法?Python Event.annotate怎麽用?Python Event.annotate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類neo.core.event.Event
的用法示例。
在下文中一共展示了Event.annotate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_time_slice_differnt_units
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [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'])
示例2: test__children
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test__children(self):
params = {'test2': 'y1', 'test3': True}
evt = Event([1.1, 1.5, 1.7]*pq.ms,
labels=np.array(['test event 1',
'test event 2',
'test event 3'], dtype='S'),
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)
segment = Segment(name='seg1')
segment.events = [evt]
segment.create_many_to_one_relationship()
self.assertEqual(evt._single_parent_objects, ('Segment',))
self.assertEqual(evt._multi_parent_objects, ())
self.assertEqual(evt._single_parent_containers, ('segment',))
self.assertEqual(evt._multi_parent_containers, ())
self.assertEqual(evt._parent_objects, ('Segment',))
self.assertEqual(evt._parent_containers, ('segment',))
self.assertEqual(len(evt.parents), 1)
self.assertEqual(evt.parents[0].name, 'seg1')
assert_neo_object_is_compliant(evt)
示例3: test_time_slice_differnt_units
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [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__children
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test__children(self):
params = {"test2": "y1", "test3": True}
evt = Event(
1.5 * pq.ms,
label="test epoch",
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)
segment = Segment(name="seg1")
segment.events = [evt]
segment.create_many_to_one_relationship()
self.assertEqual(evt._single_parent_objects, ("Segment",))
self.assertEqual(evt._multi_parent_objects, ())
self.assertEqual(evt._single_parent_containers, ("segment",))
self.assertEqual(evt._multi_parent_containers, ())
self.assertEqual(evt._parent_objects, ("Segment",))
self.assertEqual(evt._parent_containers, ("segment",))
self.assertEqual(len(evt.parents), 1)
self.assertEqual(evt.parents[0].name, "seg1")
assert_neo_object_is_compliant(evt)
示例5: test__pretty
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test__pretty(self):
evt = Event([1.1, 1.5, 1.7] * pq.ms,
labels=np.array(['test event 1', 'test event 2', 'test event 3'], dtype='S'),
name='test', description='tester', file_origin='test.file')
evt.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(evt)
prepr = pretty(evt)
targ = ("Event\nname: '%s'\ndescription: '%s'\nannotations: %s"
"" % (evt.name, evt.description, pretty(evt.annotations)))
self.assertEqual(prepr, targ)
示例6: test__pretty
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test__pretty(self):
evt = Event(1.5 * pq.ms, label="test epoch", name="test", description="tester", file_origin="test.file")
evt.annotate(targ1=1.1, targ0=[1])
assert_neo_object_is_compliant(evt)
prepr = pretty(evt)
targ = "Event\nname: '%s'\ndescription: '%s'\nannotations: %s" % (
evt.name,
evt.description,
pretty(evt.annotations),
)
self.assertEqual(prepr, targ)
示例7: test_Event_repr
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test_Event_repr(self):
params = {'test2': 'y1', 'test3': True}
evt = Event([1.1, 1.5, 1.7] * pq.ms,
labels=np.array(['test event 1', 'test event 2', 'test event 3'], dtype='S'),
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 = ('<Event: test event [email protected] ms, test event [email protected] ms, ' + 'test event [email protected] ms>')
res = repr(evt)
self.assertEqual(targ, res)
示例8: test_time_slice_empty
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [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'])
示例9: test_Event_creation
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test_Event_creation(self):
params = {'testarg2': 'yes', 'testarg3': True}
evt = Event(1.5*pq.ms,
label='test epoch', name='test', description='tester',
file_origin='test.file',
testarg1=1, **params)
evt.annotate(testarg1=1.1, testarg0=[1, 2, 3])
assert_neo_object_is_compliant(evt)
self.assertEqual(evt.time, 1.5*pq.ms)
self.assertEqual(evt.label, 'test epoch')
self.assertEqual(evt.name, 'test')
self.assertEqual(evt.description, 'tester')
self.assertEqual(evt.file_origin, 'test.file')
self.assertEqual(evt.annotations['testarg0'], [1, 2, 3])
self.assertEqual(evt.annotations['testarg1'], 1.1)
self.assertEqual(evt.annotations['testarg2'], 'yes')
self.assertTrue(evt.annotations['testarg3'])
示例10: test_time_slice_out_of_boundries
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [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'])
示例11: test_time_slice_empty
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [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)
示例12: test__children
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test__children(self):
params = {'testarg2': 'yes', 'testarg3': True}
evt = Event(1.5*pq.ms,
label='test epoch', name='test', description='tester',
file_origin='test.file',
testarg1=1, **params)
evt.annotate(testarg1=1.1, testarg0=[1, 2, 3])
assert_neo_object_is_compliant(evt)
segment = Segment(name='seg1')
segment.events = [evt]
segment.create_many_to_one_relationship()
self.assertEqual(evt._container_child_objects, ())
self.assertEqual(evt._data_child_objects, ())
self.assertEqual(evt._single_parent_objects, ('Segment',))
self.assertEqual(evt._multi_child_objects, ())
self.assertEqual(evt._multi_parent_objects, ())
self.assertEqual(evt._child_properties, ())
self.assertEqual(evt._single_child_objects, ())
self.assertEqual(evt._container_child_containers, ())
self.assertEqual(evt._data_child_containers, ())
self.assertEqual(evt._single_child_containers, ())
self.assertEqual(evt._single_parent_containers, ('segment',))
self.assertEqual(evt._multi_child_containers, ())
self.assertEqual(evt._multi_parent_containers, ())
self.assertEqual(evt._child_objects, ())
self.assertEqual(evt._child_containers, ())
self.assertEqual(evt._parent_objects, ('Segment',))
self.assertEqual(evt._parent_containers, ('segment',))
self.assertEqual(evt.children, ())
self.assertEqual(len(evt.parents), 1)
self.assertEqual(evt.parents[0].name, 'seg1')
evt.create_many_to_one_relationship()
evt.create_many_to_many_relationship()
evt.create_relationship()
assert_neo_object_is_compliant(evt)
示例13: test_slice
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test_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[5:8]
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)
示例14: test_Event_creation
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test_Event_creation(self):
params = {'test2': 'y1', 'test3': True}
evt = Event([1.1, 1.5, 1.7]*pq.ms,
labels=np.array(['test event 1',
'test event 2',
'test event 3'], dtype='S'),
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)
assert_arrays_equal(evt.times, [1.1, 1.5, 1.7]*pq.ms)
assert_arrays_equal(evt.labels, np.array(['test event 1',
'test event 2',
'test event 3'], dtype='S'))
self.assertEqual(evt.name, 'test')
self.assertEqual(evt.description, 'tester')
self.assertEqual(evt.file_origin, 'test.file')
self.assertEqual(evt.annotations['test0'], [1, 2])
self.assertEqual(evt.annotations['test1'], 1.1)
self.assertEqual(evt.annotations['test2'], 'y1')
self.assertTrue(evt.annotations['test3'])
示例15: test_Event_creation
# 需要導入模塊: from neo.core.event import Event [as 別名]
# 或者: from neo.core.event.Event import annotate [as 別名]
def test_Event_creation(self):
params = {"test2": "y1", "test3": True}
evt = Event(
1.5 * pq.ms,
label="test epoch",
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)
self.assertEqual(evt.time, 1.5 * pq.ms)
self.assertEqual(evt.label, "test epoch")
self.assertEqual(evt.name, "test")
self.assertEqual(evt.description, "tester")
self.assertEqual(evt.file_origin, "test.file")
self.assertEqual(evt.annotations["test0"], [1, 2])
self.assertEqual(evt.annotations["test1"], 1.1)
self.assertEqual(evt.annotations["test2"], "y1")
self.assertTrue(evt.annotations["test3"])