本文整理汇总了Python中neo.core.epoch.Epoch.annotate方法的典型用法代码示例。如果您正苦于以下问题:Python Epoch.annotate方法的具体用法?Python Epoch.annotate怎么用?Python Epoch.annotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.epoch.Epoch
的用法示例。
在下文中一共展示了Epoch.annotate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_time_slice_differnt_units
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test_time_slice_differnt_units(self):
params = {'test2': 'y1', 'test3': True}
epc = Epoch([1.1, 1.5, 1.7]*pq.ms, durations=[20, 40, 60]*pq.ns,
labels=np.array(['test epoch 1',
'test epoch 2',
'test epoch 3'], dtype='S'),
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
targ = Epoch([1.5]*pq.ms, durations=[40]*pq.ns,
labels=np.array(['test epoch 2'], dtype='S'),
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
targ.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(targ)
t_start = 0.0012 * pq.s
t_stop = 0.0016 * pq.s
result = epc.time_slice(t_start, t_stop)
assert_arrays_equal(result.times, targ.times)
assert_arrays_equal(result.durations, targ.durations)
assert_arrays_equal(result.labels, targ.labels)
self.assertEqual(result.name, targ.name)
self.assertEqual(result.description, targ.description)
self.assertEqual(result.file_origin, targ.file_origin)
self.assertEqual(result.annotations['test0'], targ.annotations['test0'])
self.assertEqual(result.annotations['test1'], targ.annotations['test1'])
self.assertEqual(result.annotations['test2'], targ.annotations['test2'])
示例2: test__children
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test__children(self):
params = {'test2': 'y1', 'test3': True}
epc = Epoch([1.1, 1.5, 1.7]*pq.ms, durations=[20, 40, 60]*pq.ns,
labels=np.array(['test epoch 1',
'test epoch 2',
'test epoch 3'], dtype='S'),
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
segment = Segment(name='seg1')
segment.epochs = [epc]
segment.create_many_to_one_relationship()
self.assertEqual(epc._single_parent_objects, ('Segment',))
self.assertEqual(epc._multi_parent_objects, ())
self.assertEqual(epc._single_parent_containers, ('segment',))
self.assertEqual(epc._multi_parent_containers, ())
self.assertEqual(epc._parent_objects, ('Segment',))
self.assertEqual(epc._parent_containers, ('segment',))
self.assertEqual(len(epc.parents), 1)
self.assertEqual(epc.parents[0].name, 'seg1')
assert_neo_object_is_compliant(epc)
示例3: test_time_slice_none_both
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test_time_slice_none_both(self):
params = {'test2': 'y1', 'test3': True}
arr_ann = {'index': np.arange(3), 'test': ['a', 'b', 'c']}
epc = Epoch([1.1, 1.5, 1.7] * pq.ms, durations=[20, 40, 60] * pq.ns,
labels=np.array(['test epoch 1', 'test epoch 2', 'test epoch 3'], dtype='S'),
name='test', description='tester', file_origin='test.file', test1=1,
array_annotations=arr_ann, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
targ = Epoch([1.1, 1.5, 1.7] * pq.ms, durations=[20, 40, 60] * pq.ns,
labels=np.array(['test epoch 1', 'test epoch 2', 'test epoch 3'], dtype='S'),
name='test', description='tester', file_origin='test.file', test1=1,
array_annotations=arr_ann, **params)
targ.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(targ)
t_start = None
t_stop = None
result = epc.time_slice(t_start, t_stop)
assert_arrays_equal(result.times, targ.times)
assert_arrays_equal(result.durations, targ.durations)
assert_arrays_equal(result.labels, targ.labels)
self.assertEqual(result.name, targ.name)
self.assertEqual(result.description, targ.description)
self.assertEqual(result.file_origin, targ.file_origin)
self.assertEqual(result.annotations['test0'], targ.annotations['test0'])
self.assertEqual(result.annotations['test1'], targ.annotations['test1'])
self.assertEqual(result.annotations['test2'], targ.annotations['test2'])
assert_arrays_equal(result.array_annotations['index'], np.array([0, 1, 2]))
assert_arrays_equal(result.array_annotations['test'], np.array(['a', 'b', 'c']))
self.assertIsInstance(result.array_annotations, ArrayDict)
示例4: test_time_slice_empty
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test_time_slice_empty(self):
params = {'test2': 'y1', 'test3': True}
epc = Epoch([]*pq.ms, durations=[]*pq.ns,
labels=np.array([], dtype='S'),
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
targ = Epoch([]*pq.ms, durations=[]*pq.ns,
labels=np.array([], dtype='S'),
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
targ.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(targ)
t_start = 1.2
t_stop = 1.6
result = epc.time_slice(t_start, t_stop)
assert_arrays_equal(result.times, targ.times)
assert_arrays_equal(result.durations, targ.durations)
assert_arrays_equal(result.labels, targ.labels)
self.assertEqual(result.name, targ.name)
self.assertEqual(result.description, targ.description)
self.assertEqual(result.file_origin, targ.file_origin)
self.assertEqual(result.annotations['test0'], targ.annotations['test0'])
self.assertEqual(result.annotations['test1'], targ.annotations['test1'])
self.assertEqual(result.annotations['test2'], targ.annotations['test2'])
示例5: test__pretty
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test__pretty(self):
epc = Epoch(1.5*pq.ms, duration=20*pq.ns,
label='test epoch', name='test', description='tester',
file_origin='test.file')
epc.annotate(targ1=1.1, targ0=[1])
assert_neo_object_is_compliant(epc)
prepr = pretty(epc)
targ = ("Epoch\nname: '%s'\ndescription: '%s'\nannotations: %s" %
(epc.name, epc.description, pretty(epc.annotations)))
self.assertEqual(prepr, targ)
示例6: test__pretty
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test__pretty(self):
epc = Epoch([1.1, 1.5, 1.7] * pq.ms, durations=[20, 40, 60] * pq.ns,
labels=np.array(['test epoch 1', 'test epoch 2', 'test epoch 3'], dtype='S'),
name='test', description='tester', file_origin='test.file')
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
prepr = pretty(epc)
targ = ("Epoch\nname: '%s'\ndescription: '%s'\nannotations: %s"
"" % (epc.name, epc.description, pretty(epc.annotations)))
self.assertEqual(prepr, targ)
示例7: test_Epoch_repr
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test_Epoch_repr(self):
params = {'test2': 'y1', 'test3': True}
epc = Epoch([1.1, 1.5, 1.7] * pq.ms, durations=[20, 40, 60] * pq.ns,
labels=np.array(['test epoch 1', 'test epoch 2', 'test epoch 3'], dtype='S'),
name='test', description='tester', file_origin='test.file', test1=1, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
targ = ('<Epoch: test epoch [email protected] ms for 20.0 ns, '
+ 'test epoch [email protected] ms for 40.0 ns, '
+ 'test epoch [email protected] ms for 60.0 ns>')
res = repr(epc)
self.assertEqual(targ, res)
示例8: test_epoch_creation
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test_epoch_creation(self):
params = {'test2': 'y1', 'test3': True}
epc = Epoch(1.5*pq.ms, duration=20*pq.ns,
label='test epoch', name='test', description='tester',
file_origin='test.file',
test1=1, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
self.assertEqual(epc.time, 1.5*pq.ms)
self.assertEqual(epc.duration, 20*pq.ns)
self.assertEqual(epc.label, 'test epoch')
self.assertEqual(epc.name, 'test')
self.assertEqual(epc.description, 'tester')
self.assertEqual(epc.file_origin, 'test.file')
self.assertEqual(epc.annotations['test0'], [1, 2])
self.assertEqual(epc.annotations['test1'], 1.1)
self.assertEqual(epc.annotations['test2'], 'y1')
self.assertTrue(epc.annotations['test3'])
示例9: test__children
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test__children(self):
params = {'testarg2': 'yes', 'testarg3': True}
epc = Epoch(1.5*pq.ms, duration=20*pq.ns,
label='test epoch', name='test', description='tester',
file_origin='test.file',
testarg1=1, **params)
epc.annotate(testarg1=1.1, testarg0=[1, 2, 3])
assert_neo_object_is_compliant(epc)
segment = Segment(name='seg1')
segment.epochs = [epc]
segment.create_many_to_one_relationship()
self.assertEqual(epc._container_child_objects, ())
self.assertEqual(epc._data_child_objects, ())
self.assertEqual(epc._single_parent_objects, ('Segment',))
self.assertEqual(epc._multi_child_objects, ())
self.assertEqual(epc._multi_parent_objects, ())
self.assertEqual(epc._child_properties, ())
self.assertEqual(epc._single_child_objects, ())
self.assertEqual(epc._container_child_containers, ())
self.assertEqual(epc._data_child_containers, ())
self.assertEqual(epc._single_child_containers, ())
self.assertEqual(epc._single_parent_containers, ('segment',))
self.assertEqual(epc._multi_child_containers, ())
self.assertEqual(epc._multi_parent_containers, ())
self.assertEqual(epc._child_objects, ())
self.assertEqual(epc._child_containers, ())
self.assertEqual(epc._parent_objects, ('Segment',))
self.assertEqual(epc._parent_containers, ('segment',))
self.assertEqual(epc.children, ())
self.assertEqual(len(epc.parents), 1)
self.assertEqual(epc.parents[0].name, 'seg1')
epc.create_many_to_one_relationship()
epc.create_many_to_many_relationship()
epc.create_relationship()
assert_neo_object_is_compliant(epc)
示例10: test_Epoch_creation
# 需要导入模块: from neo.core.epoch import Epoch [as 别名]
# 或者: from neo.core.epoch.Epoch import annotate [as 别名]
def test_Epoch_creation(self):
params = {'test2': 'y1', 'test3': True}
epc = Epoch([1.1, 1.5, 1.7]*pq.ms, durations=[20, 40, 60]*pq.ns,
labels=np.array(['test epoch 1',
'test epoch 2',
'test epoch 3'], dtype='S'),
name='test', description='tester',
file_origin='test.file',
test1=1, **params)
epc.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(epc)
assert_arrays_equal(epc.times, [1.1, 1.5, 1.7]*pq.ms)
assert_arrays_equal(epc.durations, [20, 40, 60]*pq.ns)
assert_arrays_equal(epc.labels, np.array(['test epoch 1',
'test epoch 2',
'test epoch 3'], dtype='S'))
self.assertEqual(epc.name, 'test')
self.assertEqual(epc.description, 'tester')
self.assertEqual(epc.file_origin, 'test.file')
self.assertEqual(epc.annotations['test0'], [1, 2])
self.assertEqual(epc.annotations['test1'], 1.1)
self.assertEqual(epc.annotations['test2'], 'y1')
self.assertTrue(epc.annotations['test3'])