本文整理汇总了Python中neo.core.Segment.eventarrays方法的典型用法代码示例。如果您正苦于以下问题:Python Segment.eventarrays方法的具体用法?Python Segment.eventarrays怎么用?Python Segment.eventarrays使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类neo.core.Segment
的用法示例。
在下文中一共展示了Segment.eventarrays方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test__children
# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import eventarrays [as 别名]
def test__children(self):
params = {'test2': 'y1', 'test3': True}
evta = EventArray([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)
evta.annotate(test1=1.1, test0=[1, 2])
assert_neo_object_is_compliant(evta)
segment = Segment(name='seg1')
segment.eventarrays = [evta]
segment.create_many_to_one_relationship()
self.assertEqual(evta._single_parent_objects, ('Segment',))
self.assertEqual(evta._multi_parent_objects, ())
self.assertEqual(evta._single_parent_containers, ('segment',))
self.assertEqual(evta._multi_parent_containers, ())
self.assertEqual(evta._parent_objects, ('Segment',))
self.assertEqual(evta._parent_containers, ('segment',))
self.assertEqual(len(evta.parents), 1)
self.assertEqual(evta.parents[0].name, 'seg1')
assert_neo_object_is_compliant(evta)
示例2: proc_src_comments
# 需要导入模块: from neo.core import Segment [as 别名]
# 或者: from neo.core.Segment import eventarrays [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 = EventArray(times=timeStamps,
labels=texts,
senders=senders)
comm_seg.eventarrays = [comments]
comm_seg.rec_datetime = t_start
return comm_seg