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


Python Segment.events方法代码示例

本文整理汇总了Python中neo.core.Segment.events方法的典型用法代码示例。如果您正苦于以下问题:Python Segment.events方法的具体用法?Python Segment.events怎么用?Python Segment.events使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neo.core.Segment的用法示例。


在下文中一共展示了Segment.events方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test__children

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import events [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

示例2: test__children

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import events [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: _read_segment

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import events [as 别名]
    def _read_segment(self, node, parent):
        attributes = self._get_standard_attributes(node)
        segment = Segment(**attributes)

        signals = []
        for name, child_node in node['analogsignals'].items():
            if "AnalogSignal" in name:
                signals.append(self._read_analogsignal(child_node, parent=segment))
        if signals and self.merge_singles:
            segment.unmerged_analogsignals = signals  # signals will be merged later
            signals = []
        for name, child_node in node['analogsignalarrays'].items():
            if "AnalogSignalArray" in name:
                signals.append(self._read_analogsignalarray(child_node, parent=segment))
        segment.analogsignals = signals

        irr_signals = []
        for name, child_node in node['irregularlysampledsignals'].items():
            if "IrregularlySampledSignal" in name:
                irr_signals.append(self._read_irregularlysampledsignal(child_node, parent=segment))
        if irr_signals and self.merge_singles:
            segment.unmerged_irregularlysampledsignals = irr_signals
            irr_signals = []
        segment.irregularlysampledsignals = irr_signals

        epochs = []
        for name, child_node in node['epochs'].items():
            if "Epoch" in name:
                epochs.append(self._read_epoch(child_node, parent=segment))
        if self.merge_singles:
            epochs = self._merge_data_objects(epochs)
        for name, child_node in node['epocharrays'].items():
            if "EpochArray" in name:
                epochs.append(self._read_epocharray(child_node, parent=segment))
        segment.epochs = epochs

        events = []
        for name, child_node in node['events'].items():
            if "Event" in name:
                events.append(self._read_event(child_node, parent=segment))
        if self.merge_singles:
            events = self._merge_data_objects(events)
        for name, child_node in node['eventarrays'].items():
            if "EventArray" in name:
                events.append(self._read_eventarray(child_node, parent=segment))
        segment.events = events

        spiketrains = []
        for name, child_node in node['spikes'].items():
            raise NotImplementedError('Spike objects not yet handled.')
        for name, child_node in node['spiketrains'].items():
            if "SpikeTrain" in name:
                spiketrains.append(self._read_spiketrain(child_node, parent=segment))
        segment.spiketrains = spiketrains

        segment.block = parent
        return segment
开发者ID:CINPLA,项目名称:python-neo,代码行数:59,代码来源:hdf5io.py

示例4: test__children

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import events [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

示例5: proc_src_comments

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import events [as 别名]
def proc_src_comments(srcfile, filename):
    '''Get the comments in an src file that has been#!N
    processed by the official
    matlab function.  See proc_src for details'''
    comm_seg = Segment(name='Comments', file_origin=filename)
    commentarray = srcfile['comments'].flatten()[0]
    senders = [res[0] for res in commentarray['sender'].flatten()]
    texts = [res[0] for res in commentarray['text'].flatten()]
    timeStamps = [res[0, 0] for res in commentarray['timeStamp'].flatten()]

    timeStamps = np.array(timeStamps, dtype=np.float32)
    t_start = timeStamps.min()
    timeStamps = pq.Quantity(timeStamps - t_start, units=pq.d).rescale(pq.s)
    texts = np.array(texts, dtype='S')
    senders = np.array(senders, dtype='S')
    t_start = brainwaresrcio.convert_brainwaresrc_timestamp(t_start.tolist())

    comments = Event(times=timeStamps, labels=texts, senders=senders)
    comm_seg.events = [comments]
    comm_seg.rec_datetime = t_start

    return comm_seg
开发者ID:INM-6,项目名称:python-neo,代码行数:24,代码来源:test_brainwaresrcio.py


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