本文整理汇总了Python中neo.core.SpikeTrain.channel_index方法的典型用法代码示例。如果您正苦于以下问题:Python SpikeTrain.channel_index方法的具体用法?Python SpikeTrain.channel_index怎么用?Python SpikeTrain.channel_index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.SpikeTrain
的用法示例。
在下文中一共展示了SpikeTrain.channel_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__issue_285
# 需要导入模块: from neo.core import SpikeTrain [as 别名]
# 或者: from neo.core.SpikeTrain import channel_index [as 别名]
def test__issue_285(self):
##Spiketrain
train = SpikeTrain([3, 4, 5] * pq.s, t_stop=10.0)
unit = Unit()
train.unit = unit
unit.spiketrains.append(train)
epoch = Epoch([0, 10, 20], [2, 2, 2], ["a", "b", "c"], units="ms")
blk = Block()
seg = Segment()
seg.spiketrains.append(train)
seg.epochs.append(epoch)
epoch.segment = seg
blk.segments.append(seg)
reader = PickleIO(filename="blk.pkl")
reader.write(blk)
reader = PickleIO(filename="blk.pkl")
r_blk = reader.read_block()
r_seg = r_blk.segments[0]
self.assertIsInstance(r_seg.spiketrains[0].unit, Unit)
self.assertIsInstance(r_seg.epochs[0], Epoch)
os.remove('blk.pkl')
##Epoch
train = Epoch(times=np.arange(0, 30, 10)*pq.s,durations=[10, 5, 7]*pq.ms,labels=np.array(['btn0', 'btn1', 'btn2'], dtype='S'))
train.segment = Segment()
unit = Unit()
unit.spiketrains.append(train)
blk = Block()
seg = Segment()
seg.spiketrains.append(train)
blk.segments.append(seg)
reader = PickleIO(filename="blk.pkl")
reader.write(blk)
reader = PickleIO(filename="blk.pkl")
r_blk = reader.read_block()
r_seg = r_blk.segments[0]
self.assertIsInstance(r_seg.spiketrains[0].segment, Segment)
os.remove('blk.pkl')
##Event
train = Event(np.arange(0, 30, 10)*pq.s,labels=np.array(['trig0', 'trig1', 'trig2'],dtype='S'))
train.segment = Segment()
unit = Unit()
unit.spiketrains.append(train)
blk = Block()
seg = Segment()
seg.spiketrains.append(train)
blk.segments.append(seg)
reader = PickleIO(filename="blk.pkl")
reader.write(blk)
reader = PickleIO(filename="blk.pkl")
r_blk = reader.read_block()
r_seg = r_blk.segments[0]
self.assertIsInstance(r_seg.spiketrains[0].segment, Segment)
os.remove('blk.pkl')
##IrregularlySampledSignal
train = IrregularlySampledSignal([0.0, 1.23, 6.78], [1, 2, 3],units='mV', time_units='ms')
train.segment = Segment()
unit = Unit()
train.channel_index = ChannelIndex(1)
unit.spiketrains.append(train)
blk = Block()
seg = Segment()
seg.spiketrains.append(train)
blk.segments.append(seg)
blk.segments[0].block = blk
reader = PickleIO(filename="blk.pkl")
reader.write(blk)
reader = PickleIO(filename="blk.pkl")
r_blk = reader.read_block()
r_seg = r_blk.segments[0]
self.assertIsInstance(r_seg.spiketrains[0].segment, Segment)
self.assertIsInstance(r_seg.spiketrains[0].channel_index, ChannelIndex)
os.remove('blk.pkl')