本文整理汇总了Python中neo.core.Block.segments方法的典型用法代码示例。如果您正苦于以下问题:Python Block.segments方法的具体用法?Python Block.segments怎么用?Python Block.segments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.Block
的用法示例。
在下文中一共展示了Block.segments方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__children
# 需要导入模块: from neo.core import Block [as 别名]
# 或者: from neo.core.Block import segments [as 别名]
def test__children(self):
blk = Block(name='block1')
blk.segments = [self.seg1]
blk.create_many_to_one_relationship(force=True)
assert_neo_object_is_compliant(self.seg1)
assert_neo_object_is_compliant(blk)
childobjs = ('AnalogSignal',
'Epoch', 'Event',
'IrregularlySampledSignal',
'SpikeTrain')
childconts = ('analogsignals',
'epochs', 'events',
'irregularlysampledsignals',
'spiketrains')
self.assertEqual(self.seg1._container_child_objects, ())
self.assertEqual(self.seg1._data_child_objects, childobjs)
self.assertEqual(self.seg1._single_parent_objects, ('Block',))
self.assertEqual(self.seg1._multi_child_objects, ())
self.assertEqual(self.seg1._multi_parent_objects, ())
self.assertEqual(self.seg1._child_properties, ())
self.assertEqual(self.seg1._single_child_objects, childobjs)
self.assertEqual(self.seg1._container_child_containers, ())
self.assertEqual(self.seg1._data_child_containers, childconts)
self.assertEqual(self.seg1._single_child_containers, childconts)
self.assertEqual(self.seg1._single_parent_containers, ('block',))
self.assertEqual(self.seg1._multi_child_containers, ())
self.assertEqual(self.seg1._multi_parent_containers, ())
self.assertEqual(self.seg1._child_objects, childobjs)
self.assertEqual(self.seg1._child_containers, childconts)
self.assertEqual(self.seg1._parent_objects, ('Block',))
self.assertEqual(self.seg1._parent_containers, ('block',))
totchildren = (self.nchildren*2 + # epoch/event
self.nchildren + # analogsignal
self.nchildren**2 + # spiketrain
self.nchildren) # irregsignal
self.assertEqual(len(self.seg1._single_children), totchildren)
self.assertEqual(len(self.seg1.data_children), totchildren)
self.assertEqual(len(self.seg1.children), totchildren)
self.assertEqual(len(self.seg1.data_children_recur), totchildren)
self.assertEqual(len(self.seg1.children_recur), totchildren)
self.assertEqual(len(self.seg1._multi_children), 0)
self.assertEqual(len(self.seg1.container_children), 0)
self.assertEqual(len(self.seg1.container_children_recur), 0)
children = (self.sigarrs1a +
self.epcs1a + self.evts1a +
self.irsigs1a +
self.trains1a)
assert_same_sub_schema(list(self.seg1._single_children), children)
assert_same_sub_schema(list(self.seg1.data_children), children)
assert_same_sub_schema(list(self.seg1.data_children_recur), children)
assert_same_sub_schema(list(self.seg1.children), children)
assert_same_sub_schema(list(self.seg1.children_recur), children)
self.assertEqual(len(self.seg1.parents), 1)
self.assertEqual(self.seg1.parents[0].name, 'block1')
示例2: test__children
# 需要导入模块: from neo.core import Block [as 别名]
# 或者: from neo.core.Block import segments [as 别名]
def test__children(self):
blk = Block(name='block1')
blk.segments = [self.segment1]
blk.create_many_to_one_relationship()
self.assertEqual(self.segment1._container_child_objects, ())
self.assertEqual(self.segment1._data_child_objects,
('AnalogSignal', 'AnalogSignalArray',
'Epoch', 'EpochArray',
'Event', 'EventArray',
'IrregularlySampledSignal',
'Spike', 'SpikeTrain'))
self.assertEqual(self.segment1._single_parent_objects, ('Block',))
self.assertEqual(self.segment1._multi_child_objects, ())
self.assertEqual(self.segment1._multi_parent_objects, ())
self.assertEqual(self.segment1._child_properties, ())
self.assertEqual(self.segment1._single_child_objects,
('AnalogSignal', 'AnalogSignalArray',
'Epoch', 'EpochArray',
'Event', 'EventArray',
'IrregularlySampledSignal',
'Spike', 'SpikeTrain'))
self.assertEqual(self.segment1._container_child_containers, ())
self.assertEqual(self.segment1._data_child_containers,
('analogsignals', 'analogsignalarrays',
'epochs', 'epocharrays',
'events', 'eventarrays',
'irregularlysampledsignals',
'spikes', 'spiketrains'))
self.assertEqual(self.segment1._single_child_containers,
('analogsignals', 'analogsignalarrays',
'epochs', 'epocharrays',
'events', 'eventarrays',
'irregularlysampledsignals',
'spikes', 'spiketrains'))
self.assertEqual(self.segment1._single_parent_containers, ('block',))
self.assertEqual(self.segment1._multi_child_containers, ())
self.assertEqual(self.segment1._multi_parent_containers, ())
self.assertEqual(self.segment1._child_objects,
('AnalogSignal', 'AnalogSignalArray',
'Epoch', 'EpochArray',
'Event', 'EventArray',
'IrregularlySampledSignal',
'Spike', 'SpikeTrain'))
self.assertEqual(self.segment1._child_containers,
('analogsignals', 'analogsignalarrays',
'epochs', 'epocharrays',
'events', 'eventarrays',
'irregularlysampledsignals',
'spikes', 'spiketrains'))
self.assertEqual(self.segment1._parent_objects, ('Block',))
self.assertEqual(self.segment1._parent_containers, ('block',))
self.assertEqual(len(self.segment1.children),
(len(self.sig1) +
len(self.sigarr1) +
len(self.epoch1) +
len(self.epocharr1) +
len(self.event1) +
len(self.eventarr1) +
len(self.irsig1) +
len(self.spike1) +
len(self.train1)))
self.assertEqual(self.segment1.children[0].name, self.signames1[0])
self.assertEqual(self.segment1.children[1].name, self.signames1[1])
self.assertEqual(self.segment1.children[2].name, self.sigarrnames1[0])
self.assertEqual(self.segment1.children[3].name, self.sigarrnames1[1])
self.assertEqual(self.segment1.children[4].name, self.epochnames1[0])
self.assertEqual(self.segment1.children[5].name, self.epochnames1[1])
self.assertEqual(self.segment1.children[6].name,
self.epocharrnames1[0])
self.assertEqual(self.segment1.children[7].name,
self.epocharrnames1[1])
self.assertEqual(self.segment1.children[8].name, self.eventnames1[0])
self.assertEqual(self.segment1.children[9].name, self.eventnames1[1])
self.assertEqual(self.segment1.children[10].name,
self.eventarrnames1[0])
self.assertEqual(self.segment1.children[11].name,
self.eventarrnames1[1])
self.assertEqual(self.segment1.children[12].name, self.irsignames1[0])
self.assertEqual(self.segment1.children[13].name, self.irsignames1[1])
self.assertEqual(self.segment1.children[14].name, self.spikenames1[0])
self.assertEqual(self.segment1.children[15].name, self.spikenames1[1])
self.assertEqual(self.segment1.children[16].name, self.trainnames1[0])
self.assertEqual(self.segment1.children[17].name, self.trainnames1[1])
self.assertEqual(len(self.segment1.parents), 1)
self.assertEqual(self.segment1.parents[0].name, 'block1')
self.segment1.create_many_to_one_relationship()
self.segment1.create_many_to_many_relationship()
self.segment1.create_relationship()
assert_neo_object_is_compliant(self.segment1)