当前位置: 首页>>代码示例>>Python>>正文


Python Event.annotate方法代码示例

本文整理汇总了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'])
开发者ID:msenoville,项目名称:python-neo,代码行数:30,代码来源:test_event.py

示例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)
开发者ID:msenoville,项目名称:python-neo,代码行数:31,代码来源:test_event.py

示例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)
开发者ID:INM-6,项目名称:python-neo,代码行数:31,代码来源:test_event.py

示例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)
开发者ID:bal47,项目名称:python-neo,代码行数:33,代码来源:test_event.py

示例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)
开发者ID:INM-6,项目名称:python-neo,代码行数:14,代码来源:test_event.py

示例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)
开发者ID:bal47,项目名称:python-neo,代码行数:15,代码来源:test_event.py

示例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)
开发者ID:INM-6,项目名称:python-neo,代码行数:15,代码来源:test_event.py

示例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'])
开发者ID:msenoville,项目名称:python-neo,代码行数:19,代码来源:test_event.py

示例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'])
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:20,代码来源:test_event.py

示例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'])
开发者ID:msenoville,项目名称:python-neo,代码行数:21,代码来源:test_event.py

示例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)
开发者ID:INM-6,项目名称:python-neo,代码行数:21,代码来源:test_event.py

示例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)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:44,代码来源:test_event.py

示例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)
开发者ID:INM-6,项目名称:python-neo,代码行数:24,代码来源:test_event.py

示例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'])
开发者ID:msenoville,项目名称:python-neo,代码行数:25,代码来源:test_event.py

示例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"])
开发者ID:bal47,项目名称:python-neo,代码行数:25,代码来源:test_event.py


注:本文中的neo.core.event.Event.annotate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。