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


Python Block.recordingchannelgroups方法代码示例

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


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

示例1: test__children

# 需要导入模块: from neo.core import Block [as 别名]
# 或者: from neo.core.Block import recordingchannelgroups [as 别名]
    def test__children(self):
        blk = Block(name='block1')
        blk.recordingchannelgroups = [self.rcg1]
        blk.create_many_to_one_relationship()

        self.assertEqual(self.rcg1._container_child_objects, ('Unit',))
        self.assertEqual(self.rcg1._data_child_objects, ('AnalogSignalArray',))
        self.assertEqual(self.rcg1._single_parent_objects, ('Block',))
        self.assertEqual(self.rcg1._multi_child_objects, ('RecordingChannel',))
        self.assertEqual(self.rcg1._multi_parent_objects, ())
        self.assertEqual(self.rcg1._child_properties, ())

        self.assertEqual(self.rcg1._single_child_objects,
                         ('Unit', 'AnalogSignalArray',))

        self.assertEqual(self.rcg1._container_child_containers, ('units',))
        self.assertEqual(self.rcg1._data_child_containers,
                         ('analogsignalarrays',))
        self.assertEqual(self.rcg1._single_child_containers,
                         ('units', 'analogsignalarrays'))
        self.assertEqual(self.rcg1._single_parent_containers, ('block',))
        self.assertEqual(self.rcg1._multi_child_containers,
                         ('recordingchannels',))
        self.assertEqual(self.rcg1._multi_parent_containers, ())

        self.assertEqual(self.rcg1._child_objects,
                         ('Unit', 'AnalogSignalArray', 'RecordingChannel'))
        self.assertEqual(self.rcg1._child_containers,
                         ('units', 'analogsignalarrays', 'recordingchannels'))
        self.assertEqual(self.rcg1._parent_objects, ('Block',))
        self.assertEqual(self.rcg1._parent_containers, ('block',))

        self.assertEqual(len(self.rcg1.children),
                         (len(self.units1) +
                          len(self.rchan1) +
                          len(self.sigarr1)))
        self.assertEqual(self.rcg1.children[0].name, self.unitnames1[0])
        self.assertEqual(self.rcg1.children[1].name, self.unitnames1[1])
        self.assertEqual(self.rcg1.children[2].name, self.sigarrnames1[0])
        self.assertEqual(self.rcg1.children[3].name, self.sigarrnames1[1])
        self.assertEqual(self.rcg1.children[4].name, self.rchannames1[0])
        self.assertEqual(self.rcg1.children[5].name, self.rchannames1[1])
        self.assertEqual(len(self.rcg1.parents), 1)
        self.assertEqual(self.rcg1.parents[0].name, 'block1')

        self.rcg1.create_many_to_one_relationship()
        self.rcg1.create_many_to_many_relationship()
        self.rcg1.create_relationship()
        assert_neo_object_is_compliant(self.rcg1)
开发者ID:NeuroArchive,项目名称:python-neo,代码行数:51,代码来源:test_recordingchannelgroup.py

示例2: test__construct_subsegment_by_unit

# 需要导入模块: from neo.core import Block [as 别名]
# 或者: from neo.core.Block import recordingchannelgroups [as 别名]
    def test__construct_subsegment_by_unit(self):
        nb_seg = 3
        nb_unit = 7
        unit_with_sig = np.array([0, 2, 5])
        signal_types = ['Vm', 'Conductances']
        sig_len = 100

        #recordingchannelgroups
        rcgs = [RecordingChannelGroup(name='Vm',
                                      channel_indexes=unit_with_sig),
                RecordingChannelGroup(name='Conductance',
                                      channel_indexes=unit_with_sig)]

        # Unit
        all_unit = []
        for u in range(nb_unit):
            un = Unit(name='Unit #%d' % u, channel_indexes=np.array([u]))
            assert_neo_object_is_compliant(un)
            all_unit.append(un)

        blk = Block()
        blk.recordingchannelgroups = rcgs
        for s in range(nb_seg):
            seg = Segment(name='Simulation %s' % s)
            for j in range(nb_unit):
                st = SpikeTrain([1, 2], units='ms',
                                t_start=0., t_stop=10)
                st.unit = all_unit[j]

            for t in signal_types:
                anasigarr = AnalogSignalArray(np.zeros((sig_len,
                                                        len(unit_with_sig))),
                                              units='nA',
                                              sampling_rate=1000.*pq.Hz,
                                              channel_indexes=unit_with_sig)
                seg.analogsignalarrays.append(anasigarr)

        blk.create_many_to_one_relationship()
        for unit in all_unit:
            assert_neo_object_is_compliant(unit)
        for rcg in rcgs:
            assert_neo_object_is_compliant(rcg)
        assert_neo_object_is_compliant(blk)

        # what you want
        newseg = seg.construct_subsegment_by_unit(all_unit[:4])
        assert_neo_object_is_compliant(newseg)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:49,代码来源:test_segment.py

示例3: test__children

# 需要导入模块: from neo.core import Block [as 别名]
# 或者: from neo.core.Block import recordingchannelgroups [as 别名]
    def test__children(self):
        blk = Block(name='block1')
        blk.recordingchannelgroups = [self.rcg1]
        blk.create_many_to_one_relationship()

        self.assertEqual(self.rcg1._container_child_objects, ('Unit',))
        self.assertEqual(self.rcg1._data_child_objects, ('AnalogSignalArray',))
        self.assertEqual(self.rcg1._single_parent_objects, ('Block',))
        self.assertEqual(self.rcg1._multi_child_objects, ('RecordingChannel',))
        self.assertEqual(self.rcg1._multi_parent_objects, ())
        self.assertEqual(self.rcg1._child_properties, ())

        self.assertEqual(self.rcg1._single_child_objects,
                         ('Unit', 'AnalogSignalArray',))

        self.assertEqual(self.rcg1._container_child_containers, ('units',))
        self.assertEqual(self.rcg1._data_child_containers,
                         ('analogsignalarrays',))
        self.assertEqual(self.rcg1._single_child_containers,
                         ('units', 'analogsignalarrays'))
        self.assertEqual(self.rcg1._single_parent_containers, ('block',))
        self.assertEqual(self.rcg1._multi_child_containers,
                         ('recordingchannels',))
        self.assertEqual(self.rcg1._multi_parent_containers, ())

        self.assertEqual(self.rcg1._child_objects,
                         ('Unit', 'AnalogSignalArray', 'RecordingChannel'))
        self.assertEqual(self.rcg1._child_containers,
                         ('units', 'analogsignalarrays', 'recordingchannels'))
        self.assertEqual(self.rcg1._parent_objects, ('Block',))
        self.assertEqual(self.rcg1._parent_containers, ('block',))

        self.assertEqual(len(self.rcg1._single_children), 2*self.nchildren)
        self.assertEqual(len(self.rcg1._multi_children), self.nchildren)
        self.assertEqual(len(self.rcg1.data_children), self.nchildren)
        self.assertEqual(len(self.rcg1.data_children_recur),
                         self.nchildren + 4*self.nchildren**2)
        self.assertEqual(len(self.rcg1.container_children), 2*self.nchildren)
        self.assertEqual(len(self.rcg1.container_children_recur),
                         2*self.nchildren)
        self.assertEqual(len(self.rcg1.children), 3*self.nchildren)
        self.assertEqual(len(self.rcg1.children_recur),
                         3*self.nchildren + 4*self.nchildren**2)

        assert_same_sub_schema(list(self.rcg1._multi_children), self.rchans1)
        assert_same_sub_schema(list(self.rcg1._single_children),
                               self.units1a + self.sigarrs1a,
                               exclude=['channel_index'])

        assert_same_sub_schema(list(self.rcg1.container_children),
                               self.units1a + self.rchans1)
        assert_same_sub_schema(list(self.rcg1.container_children_recur),
                               self.units1a + self.rchans1)

        assert_same_sub_schema(list(self.rcg1.data_children), self.sigarrs1a,
                               exclude=['channel_index'])
        assert_same_sub_schema(list(self.rcg1.data_children_recur),
                               self.sigarrs1a +
                               self.spikes1[:2] + self.trains1[:2] +
                               self.spikes1[2:] + self.trains1[2:] +
                               self.sigs1[:2] + self.irsigs1[:2] +
                               self.sigs1[2:] + self.irsigs1[2:],
                               exclude=['channel_index'])

        assert_same_sub_schema(list(self.rcg1.children),
                               self.sigarrs1a + self.units1a + self.rchans1a,
                               exclude=['channel_index'])
        assert_same_sub_schema(list(self.rcg1.children_recur),
                               self.sigarrs1a +
                               self.spikes1[:2] + self.trains1[:2] +
                               self.spikes1[2:] + self.trains1[2:] +
                               self.sigs1[:2] + self.irsigs1[:2] +
                               self.sigs1[2:] + self.irsigs1[2:] +
                               self.units1a + self.rchans1a,
                               exclude=['channel_index'])

        self.assertEqual(len(self.rcg1.parents), 1)
        self.assertEqual(self.rcg1.parents[0].name, 'block1')
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:80,代码来源:test_recordingchannelgroup.py


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