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


Python Segment.epochs方法代码示例

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


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

示例1: test__children

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import epochs [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)
开发者ID:Silmathoron,项目名称:python-neo,代码行数:31,代码来源:test_epoch.py

示例2: _read_segment

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

示例3: test__children

# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import epochs [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)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:44,代码来源:test_epoch.py


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