本文整理汇总了Python中pyNN.mock.get_time_step函数的典型用法代码示例。如果您正苦于以下问题:Python get_time_step函数的具体用法?Python get_time_step怎么用?Python get_time_step使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_time_step函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_record_with_single_variable
def test_record_with_single_variable(self, sim=sim):
p = sim.Population(14, sim.EIF_cond_exp_isfa_ista())
p.record('v')
sim.run(12.3)
data = p.get_data(gather=True).segments[0]
self.assertEqual(len(data.analogsignalarrays), 1)
n_values = int(round(12.3 / sim.get_time_step())) + 1
self.assertEqual(data.analogsignalarrays[0].name, 'v')
self.assertEqual(data.analogsignalarrays[0].shape, (n_values, p.size))
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:9,代码来源:test_population.py
示例2: test_record_with_v_and_spikes
def test_record_with_v_and_spikes(self, sim=sim):
p = sim.Population(2, sim.EIF_cond_exp_isfa_ista())
p.record(('v', 'spikes'))
sim.run(10.0)
data = p.get_data(gather=True).segments[0]
self.assertEqual(len(data.analogsignalarrays), 1)
n_values = int(round(10.0 / sim.get_time_step())) + 1
names = set(arr.name for arr in data.analogsignalarrays)
self.assertEqual(names, set(('v')))
for arr in data.analogsignalarrays:
self.assertEqual(arr.shape, (n_values, p.size))
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:11,代码来源:test_population.py
示例3: test_record_with_multiple_variables
def test_record_with_multiple_variables(self):
p = sim.Population(2, sim.EIF_cond_exp_isfa_ista())
p.record(("v", "w", "gsyn_exc"))
sim.run(10.0)
data = p.get_data(gather=True).segments[0]
self.assertEqual(len(data.analogsignalarrays), 3)
n_values = int(round(10.0 / sim.get_time_step())) + 1
names = set(arr.name for arr in data.analogsignalarrays)
self.assertEqual(names, set(("v", "w", "gsyn_exc")))
for arr in data.analogsignalarrays:
self.assertEqual(arr.shape, (n_values, p.size))
开发者ID:jougs,项目名称:PyNN,代码行数:11,代码来源:test_population.py
示例4: test_record_with_multiple_variables
def test_record_with_multiple_variables(self, sim=sim):
p = sim.Population(4, sim.EIF_cond_exp_isfa_ista())
pv = p[0, 3]
pv.record(('v', 'w', 'gsyn_exc'))
sim.run(10.0)
data = p.get_data(gather=True).segments[0]
self.assertEqual(len(data.analogsignals), 3)
n_values = int(round(10.0 / sim.get_time_step())) + 1
names = set(arr.name for arr in data.analogsignals)
self.assertEqual(names, set(('v', 'w', 'gsyn_exc')))
for arr in data.analogsignals:
self.assertEqual(arr.shape, (n_values, pv.size))
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:12,代码来源:test_populationview.py
示例5: test_get_data_with_gather
def test_get_data_with_gather(self):
t1 = 12.3
t2 = 13.4
t3 = 14.5
p = sim.Population(14, sim.EIF_cond_exp_isfa_ista())
pv = p[::3]
pv.record('v')
sim.run(t1)
# what if we call p.record between two run statements?
# would be nice to get an AnalogSignalArray with a non-zero t_start
# but then need to make sure we get the right initial value
sim.run(t2)
sim.reset()
pv.record('spikes')
pv.record('w')
sim.run(t3)
data = p.get_data(gather=True)
self.assertEqual(len(data.segments), 2)
seg0 = data.segments[0]
self.assertEqual(len(seg0.analogsignalarrays), 1)
v = seg0.analogsignalarrays[0]
self.assertEqual(v.name, 'v')
num_points = int(round((t1 + t2)/sim.get_time_step())) + 1
self.assertEqual(v.shape, (num_points, pv.size))
self.assertEqual(v.t_start, 0.0*pq.ms)
self.assertEqual(v.units, pq.mV)
self.assertEqual(v.sampling_period, 0.1*pq.ms)
self.assertEqual(len(seg0.spiketrains), 0)
seg1 = data.segments[1]
self.assertEqual(len(seg1.analogsignalarrays), 2)
w = seg1.filter(name='w')[0]
self.assertEqual(w.name, 'w')
num_points = int(round(t3/sim.get_time_step())) + 1
self.assertEqual(w.shape, (num_points, pv.size))
self.assertEqual(v.t_start, 0.0)
self.assertEqual(len(seg1.spiketrains), pv.size)
assert_array_equal(seg1.spiketrains[2],
numpy.array([p.first_id+6, p.first_id+6+5]) % t3)
开发者ID:jougs,项目名称:PyNN,代码行数:40,代码来源:test_populationview.py
示例6: test_get_data_with_gather
def test_get_data_with_gather(self, sim=sim):
t1 = 12.3
t2 = 13.4
t3 = 14.5
p1 = sim.Population(11, sim.IF_cond_exp())
p2 = sim.Population(6, sim.IF_cond_alpha())
p3 = sim.Population(3, sim.EIF_cond_exp_isfa_ista())
a = sim.Assembly(p3, p1, p2)
a.record('v')
sim.run(t1)
# what if we call p.record between two run statements?
# would be nice to get an AnalogSignal with a non-zero t_start
# but then need to make sure we get the right initial value
sim.run(t2)
sim.reset()
a.record('spikes')
p3.record('w')
sim.run(t3)
data = a.get_data(gather=True)
self.assertEqual(len(data.segments), 2)
seg0 = data.segments[0]
self.assertEqual(len(seg0.analogsignals), 1)
v = seg0.filter(name='v')[0]
self.assertEqual(v.name, 'v')
num_points = int(round((t1 + t2) / sim.get_time_step())) + 1
self.assertEqual(v.shape, (num_points, a.size))
self.assertEqual(v.t_start, 0.0 * pq.ms)
self.assertEqual(v.units, pq.mV)
self.assertEqual(v.sampling_period, 0.1 * pq.ms)
self.assertEqual(len(seg0.spiketrains), 0)
seg1 = data.segments[1]
self.assertEqual(len(seg1.analogsignals), 2)
w = seg1.filter(name='w')[0]
self.assertEqual(w.name, 'w')
num_points = int(round(t3 / sim.get_time_step())) + 1
self.assertEqual(w.shape, (num_points, p3.size))
self.assertEqual(v.t_start, 0.0)
self.assertEqual(len(seg1.spiketrains), a.size)
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:39,代码来源:test_assembly.py
示例7: test_time_step
def test_time_step(self):
sim.setup(0.123, min_delay=0.246)
self.assertEqual(sim.get_time_step(), 0.123)
开发者ID:jougs,项目名称:PyNN,代码行数:3,代码来源:test_simulation_control.py
示例8: test_time_step
def test_time_step(self, sim=sim):
sim.setup(0.123, min_delay=0.246, **self.extra)
self.assertAlmostEqual(sim.get_time_step(), 0.123)
sim.end()
开发者ID:JoelChavas,项目名称:PyNN,代码行数:4,代码来源:test_simulation_control.py
注:本文中的pyNN.mock.get_time_step函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论