本文整理汇总了Python中neo.test.generate_datasets.get_fake_value函数的典型用法代码示例。如果您正苦于以下问题:Python get_fake_value函数的具体用法?Python get_fake_value怎么用?Python get_fake_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_fake_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test__get_fake_values
def test__get_fake_values(self):
self.annotations['seed'] = 0
channel_indexes = get_fake_value('channel_indexes', np.ndarray, seed=0,
dim=1, dtype='i')
name = get_fake_value('name', str, seed=1, obj=Unit)
description = get_fake_value('description', str, seed=2, obj='Unit')
file_origin = get_fake_value('file_origin', str)
attrs1 = {'name': name,
'description': description,
'file_origin': file_origin}
attrs2 = attrs1.copy()
attrs2.update(self.annotations)
res11 = get_fake_values(Unit, annotate=False, seed=0)
res12 = get_fake_values('Unit', annotate=False, seed=0)
res21 = get_fake_values(Unit, annotate=True, seed=0)
res22 = get_fake_values('Unit', annotate=True, seed=0)
assert_arrays_equal(res11.pop('channel_indexes'), channel_indexes)
assert_arrays_equal(res12.pop('channel_indexes'), channel_indexes)
assert_arrays_equal(res21.pop('channel_indexes'), channel_indexes)
assert_arrays_equal(res22.pop('channel_indexes'), channel_indexes)
self.assertEqual(res11, attrs1)
self.assertEqual(res12, attrs1)
self.assertEqual(res21, attrs2)
self.assertEqual(res22, attrs2)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:27,代码来源:test_unit.py
示例2: check_creation
def check_creation(self, rcg):
assert_neo_object_is_compliant(rcg)
seed = rcg.annotations['seed']
for i, rchan in enumerate(rcg.recordingchannels):
self.assertEqual(rchan.name, rcg.channel_names[i].astype(str))
self.assertEqual(rchan.index, rcg.channel_indexes[i])
for i, unit in enumerate(rcg.units):
for sigarr in rcg.analogsignalarrays:
self.assertEqual(unit.channel_indexes[0],
sigarr.channel_index[i])
targ2 = get_fake_value('name', str, seed=seed+2,
obj=RecordingChannelGroup)
self.assertEqual(rcg.name, targ2)
targ3 = get_fake_value('description', str,
seed=seed+3, obj=RecordingChannelGroup)
self.assertEqual(rcg.description, targ3)
targ4 = get_fake_value('file_origin', str)
self.assertEqual(rcg.file_origin, targ4)
targ5 = get_annotations()
targ5['seed'] = seed
self.assertEqual(rcg.annotations, targ5)
self.assertTrue(hasattr(rcg, 'recordingchannels'))
self.assertTrue(hasattr(rcg, 'units'))
self.assertTrue(hasattr(rcg, 'analogsignalarrays'))
self.assertEqual(len(rcg.recordingchannels), self.nchildren)
self.assertEqual(len(rcg.units), self.nchildren)
self.assertEqual(len(rcg.analogsignalarrays), self.nchildren)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:35,代码来源:test_recordingchannelgroup.py
示例3: check_creation
def check_creation(self, chx):
assert_neo_object_is_compliant(chx)
seed = chx.annotations['seed']
# for i, unit in enumerate(chx.units):
# for sigarr in chx.analogsignals:
# self.assertEqual(unit.channel_indexes[0],
# sigarr.channel_index[i])
targ2 = get_fake_value('name', str, seed=seed+4,
obj=ChannelIndex)
self.assertEqual(chx.name, targ2)
targ3 = get_fake_value('description', str,
seed=seed+5, obj=ChannelIndex)
self.assertEqual(chx.description, targ3)
targ4 = get_fake_value('file_origin', str)
self.assertEqual(chx.file_origin, targ4)
targ5 = get_annotations()
targ5['seed'] = seed
self.assertEqual(chx.annotations, targ5)
self.assertTrue(hasattr(chx, 'units'))
self.assertTrue(hasattr(chx, 'analogsignals'))
self.assertEqual(len(chx.units), self.nchildren)
self.assertEqual(len(chx.analogsignals), self.nchildren)
开发者ID:msenoville,项目名称:python-neo,代码行数:30,代码来源:test_channelindex.py
示例4: test__get_fake_values
def test__get_fake_values(self):
self.annotations['seed'] = 0
times = get_fake_value('times', pq.Quantity, seed=0, dim=1)
labels = get_fake_value('labels', np.ndarray, seed=1, dim=1, dtype='S')
name = get_fake_value('name', str, seed=2, obj=Event)
description = get_fake_value('description', str,
seed=3, obj='Event')
file_origin = get_fake_value('file_origin', str)
attrs1 = {'name': name,
'description': description,
'file_origin': file_origin}
attrs2 = attrs1.copy()
attrs2.update(self.annotations)
res11 = get_fake_values(Event, annotate=False, seed=0)
res12 = get_fake_values('Event', annotate=False, seed=0)
res21 = get_fake_values(Event, annotate=True, seed=0)
res22 = get_fake_values('Event', annotate=True, seed=0)
assert_arrays_equal(res11.pop('times'), times)
assert_arrays_equal(res12.pop('times'), times)
assert_arrays_equal(res21.pop('times'), times)
assert_arrays_equal(res22.pop('times'), times)
assert_arrays_equal(res11.pop('labels'), labels)
assert_arrays_equal(res12.pop('labels'), labels)
assert_arrays_equal(res21.pop('labels'), labels)
assert_arrays_equal(res22.pop('labels'), labels)
self.assertEqual(res11, attrs1)
self.assertEqual(res12, attrs1)
self.assertEqual(res21, attrs2)
self.assertEqual(res22, attrs2)
开发者ID:msenoville,项目名称:python-neo,代码行数:33,代码来源:test_event.py
示例5: test__get_fake_values
def test__get_fake_values(self):
self.annotations["seed"] = 0
time = get_fake_value("time", pq.Quantity, seed=0, dim=0)
label = get_fake_value("label", str, seed=1)
name = get_fake_value("name", str, seed=2, obj=Event)
description = get_fake_value("description", str, seed=3, obj="Event")
file_origin = get_fake_value("file_origin", str)
attrs1 = {"label": label, "name": name, "description": description, "file_origin": file_origin}
attrs2 = attrs1.copy()
attrs2.update(self.annotations)
res11 = get_fake_values(Event, annotate=False, seed=0)
res12 = get_fake_values("Event", annotate=False, seed=0)
res21 = get_fake_values(Event, annotate=True, seed=0)
res22 = get_fake_values("Event", annotate=True, seed=0)
assert_arrays_equal(res11.pop("time"), time)
assert_arrays_equal(res12.pop("time"), time)
assert_arrays_equal(res21.pop("time"), time)
assert_arrays_equal(res22.pop("time"), time)
self.assertEqual(res11, attrs1)
self.assertEqual(res12, attrs1)
self.assertEqual(res21, attrs2)
self.assertEqual(res22, attrs2)
开发者ID:bal47,项目名称:python-neo,代码行数:25,代码来源:test_event.py
示例6: test__get_fake_values
def test__get_fake_values(self):
self.annotations['seed'] = 0
index = get_fake_value('index', int, seed=0)
coordinate = get_fake_value('coordinate', pq.Quantity, seed=1, dim=1)
name = get_fake_value('name', str, seed=2, obj=RecordingChannel)
description = get_fake_value('description', str, seed=3,
obj='RecordingChannel')
file_origin = get_fake_value('file_origin', str)
attrs1 = {'index': index,
'name': name,
'description': description,
'file_origin': file_origin}
attrs2 = attrs1.copy()
attrs2.update(self.annotations)
res11 = get_fake_values(RecordingChannel, annotate=False, seed=0)
res12 = get_fake_values('RecordingChannel', annotate=False, seed=0)
res21 = get_fake_values(RecordingChannel, annotate=True, seed=0)
res22 = get_fake_values('RecordingChannel', annotate=True, seed=0)
assert_arrays_equal(res11.pop('coordinate'), coordinate)
assert_arrays_equal(res12.pop('coordinate'), coordinate)
assert_arrays_equal(res21.pop('coordinate'), coordinate)
assert_arrays_equal(res22.pop('coordinate'), coordinate)
self.assertEqual(res11, attrs1)
self.assertEqual(res12, attrs1)
self.assertEqual(res21, attrs2)
self.assertEqual(res22, attrs2)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:29,代码来源:test_recordingchannel.py
示例7: check_creation
def check_creation(self, rchan):
assert_neo_object_is_compliant(rchan)
seed = rchan.annotations['seed']
targ0 = get_fake_value('index', int, seed=seed+0, obj=RecordingChannel)
self.assertEqual(rchan.index, targ0)
targ1 = get_fake_value('coordinate', pq.Quantity, dim=1, seed=seed+1)
assert_arrays_equal(rchan.coordinate, targ1)
targ2 = get_fake_value('name', str, seed=seed+2, obj=RecordingChannel)
self.assertEqual(rchan.name, targ2)
targ3 = get_fake_value('description', str,
seed=seed+3, obj=RecordingChannel)
self.assertEqual(rchan.description, targ3)
targ4 = get_fake_value('file_origin', str)
self.assertEqual(rchan.file_origin, targ4)
targ5 = get_annotations()
targ5['seed'] = seed
self.assertEqual(rchan.annotations, targ5)
self.assertTrue(hasattr(rchan, 'analogsignals'))
self.assertTrue(hasattr(rchan, 'irregularlysampledsignals'))
self.assertEqual(len(rchan.analogsignals), self.nchildren)
self.assertEqual(len(rchan.irregularlysampledsignals), self.nchildren)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:30,代码来源:test_recordingchannel.py
示例8: check_creation
def check_creation(self, unit):
assert_neo_object_is_compliant(unit)
seed = unit.annotations['seed']
targ0 = get_fake_value('channel_indexes', np.ndarray, dim=1, dtype='i',
seed=seed+0)
assert_arrays_equal(unit.channel_indexes, targ0)
targ1 = get_fake_value('name', str, seed=seed+1, obj=Unit)
self.assertEqual(unit.name, targ1)
targ2 = get_fake_value('description', str,
seed=seed+2, obj=Unit)
self.assertEqual(unit.description, targ2)
targ3 = get_fake_value('file_origin', str)
self.assertEqual(unit.file_origin, targ3)
targ4 = get_annotations()
targ4['seed'] = seed
self.assertEqual(unit.annotations, targ4)
self.assertTrue(hasattr(unit, 'spikes'))
self.assertTrue(hasattr(unit, 'spiketrains'))
self.assertEqual(len(unit.spikes), self.nchildren)
self.assertEqual(len(unit.spiketrains), self.nchildren)
开发者ID:ChrisNolan1992,项目名称:python-neo,代码行数:28,代码来源:test_unit.py
示例9: test__str
def test__str(self):
name = 'test__str'
datatype = str
targ = str(np.random.randint(100000))
res = get_fake_value(name, datatype, seed=0)
self.assertTrue(isinstance(res, str))
self.assertEqual(targ, res)
开发者ID:INM-6,项目名称:python-neo,代码行数:8,代码来源:test_generate_datasets.py
示例10: test__int
def test__int(self):
name = 'test__int'
datatype = int
targ = np.random.randint(100)
res = get_fake_value(name, datatype, seed=0)
self.assertTrue(isinstance(res, int))
self.assertEqual(targ, res)
开发者ID:INM-6,项目名称:python-neo,代码行数:8,代码来源:test_generate_datasets.py
示例11: test__float
def test__float(self):
name = 'test__float'
datatype = float
targ = 1000. * np.random.random()
res = get_fake_value(name, datatype, seed=0)
self.assertTrue(isinstance(res, float))
self.assertEqual(targ, res)
开发者ID:INM-6,项目名称:python-neo,代码行数:8,代码来源:test_generate_datasets.py
示例12: test__datetime
def test__datetime(self):
name = 'test__datetime'
datatype = datetime
targ = datetime.fromtimestamp(1000000000 * np.random.random())
res = get_fake_value(name, datatype, seed=0)
self.assertTrue(isinstance(res, datetime))
self.assertEqual(res, targ)
开发者ID:INM-6,项目名称:python-neo,代码行数:8,代码来源:test_generate_datasets.py
示例13: test__file_origin
def test__file_origin(self):
name = 'file_origin'
datatype = str
targ = 'test_file.txt'
res = get_fake_value(name, datatype, seed=0)
self.assertTrue(isinstance(res, str))
self.assertEqual(targ, res)
self.assertRaises(ValueError, get_fake_value, name, datatype, dim=1)
self.assertRaises(ValueError, get_fake_value, name, np.ndarray)
开发者ID:INM-6,项目名称:python-neo,代码行数:11,代码来源:test_generate_datasets.py
示例14: test__t_stop
def test__t_stop(self):
name = 't_stop'
datatype = pq.Quantity
targ = 1.0 * pq.millisecond
res = get_fake_value(name, datatype)
self.assertTrue(isinstance(res, pq.Quantity))
self.assertEqual(res.units, pq.millisecond)
assert_arrays_equal(targ, res)
self.assertRaises(ValueError, get_fake_value, name, datatype, dim=1)
self.assertRaises(ValueError, get_fake_value, name, np.ndarray)
开发者ID:INM-6,项目名称:python-neo,代码行数:12,代码来源:test_generate_datasets.py
示例15: test__sampling_rate
def test__sampling_rate(self):
name = 'sampling_rate'
datatype = pq.Quantity
targ = 10000.0 * pq.Hz
res = get_fake_value(name, datatype)
self.assertTrue(isinstance(res, pq.Quantity))
self.assertEqual(res.units, pq.Hz)
assert_arrays_equal(targ, res)
self.assertRaises(ValueError, get_fake_value, name, datatype, dim=1)
self.assertRaises(ValueError, get_fake_value, name, np.ndarray)
开发者ID:INM-6,项目名称:python-neo,代码行数:12,代码来源:test_generate_datasets.py
示例16: test__get_fake_values
def test__get_fake_values(self):
self.annotations['seed'] = 0
name = get_fake_value('name', str, seed=0, obj=Unit)
description = get_fake_value('description', str, seed=1, obj='Unit')
file_origin = get_fake_value('file_origin', str)
attrs1 = {'name': name,
'description': description,
'file_origin': file_origin}
attrs2 = attrs1.copy()
attrs2.update(self.annotations)
res11 = get_fake_values(Unit, annotate=False, seed=0)
res12 = get_fake_values('Unit', annotate=False, seed=0)
res21 = get_fake_values(Unit, annotate=True, seed=0)
res22 = get_fake_values('Unit', annotate=True, seed=0)
self.assertEqual(res11, attrs1)
self.assertEqual(res12, attrs1)
self.assertEqual(res21, attrs2)
self.assertEqual(res22, attrs2)
开发者ID:INM-6,项目名称:python-neo,代码行数:21,代码来源:test_unit.py
示例17: test__description
def test__description(self):
name = 'description'
datatype = str
obj = Segment
targ = 'test Segment ' + str(np.random.randint(100000))
res = get_fake_value(name, datatype, seed=0, obj=obj)
self.assertTrue(isinstance(res, str))
self.assertEqual(targ, res)
self.assertRaises(ValueError, get_fake_value, name, datatype, dim=1)
self.assertRaises(ValueError, get_fake_value, name, np.ndarray)
开发者ID:INM-6,项目名称:python-neo,代码行数:12,代码来源:test_generate_datasets.py
示例18: test__name
def test__name(self):
name = 'name'
datatype = str
obj = 'Block'
targ = 'Block' + str(np.random.randint(100000))
res = get_fake_value(name, datatype, seed=0, obj=obj)
self.assertTrue(isinstance(res, str))
self.assertEqual(targ, res)
self.assertRaises(ValueError, get_fake_value, name, datatype, dim=1)
self.assertRaises(ValueError, get_fake_value, name, np.ndarray)
开发者ID:INM-6,项目名称:python-neo,代码行数:12,代码来源:test_generate_datasets.py
示例19: check_creation
def check_creation(self, blk):
assert_neo_object_is_compliant(blk)
seed = blk.annotations['seed']
targ0 = get_fake_value('file_datetime', datetime, seed=seed+0)
self.assertEqual(blk.file_datetime, targ0)
targ1 = get_fake_value('rec_datetime', datetime, seed=seed+1)
self.assertEqual(blk.rec_datetime, targ1)
targ2 = get_fake_value('index', int, seed=seed+2, obj=Block)
self.assertEqual(blk.index, targ2)
targ3 = get_fake_value('name', str, seed=seed+3, obj=Block)
self.assertEqual(blk.name, targ3)
targ4 = get_fake_value('description', str, seed=seed+4, obj=Block)
self.assertEqual(blk.description, targ4)
targ5 = get_fake_value('file_origin', str)
self.assertEqual(blk.file_origin, targ5)
targ6 = get_annotations()
targ6['seed'] = seed
self.assertEqual(blk.annotations, targ6)
self.assertTrue(hasattr(blk, 'channel_indexes'))
self.assertTrue(hasattr(blk, 'segments'))
self.assertEqual(len(blk.channel_indexes), self.nchildren)
self.assertEqual(len(blk.segments), self.nchildren)
开发者ID:msenoville,项目名称:python-neo,代码行数:32,代码来源:test_block.py
示例20: test__get_fake_values
def test__get_fake_values(self):
self.annotations['seed'] = 0
file_datetime = get_fake_value('file_datetime', datetime, seed=0)
rec_datetime = get_fake_value('rec_datetime', datetime, seed=1)
index = get_fake_value('index', int, seed=2)
name = get_fake_value('name', str, seed=3, obj=Block)
description = get_fake_value('description', str, seed=4, obj='Block')
file_origin = get_fake_value('file_origin', str)
attrs1 = {'file_datetime': file_datetime,
'rec_datetime': rec_datetime,
'index': index,
'name': name,
'description': description,
'file_origin': file_origin}
attrs2 = attrs1.copy()
attrs2.update(self.annotations)
res11 = get_fake_values(Block, annotate=False, seed=0)
res12 = get_fake_values('Block', annotate=False, seed=0)
res21 = get_fake_values(Block, annotate=True, seed=0)
res22 = get_fake_values('Block', annotate=True, seed=0)
self.assertEqual(res11, attrs1)
self.assertEqual(res12, attrs1)
self.assertEqual(res21, attrs2)
self.assertEqual(res22, attrs2)
开发者ID:msenoville,项目名称:python-neo,代码行数:26,代码来源:test_block.py
注:本文中的neo.test.generate_datasets.get_fake_value函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论