本文整理汇总了Python中pyNN.mock.run函数的典型用法代码示例。如果您正苦于以下问题:Python run函数的具体用法?Python run怎么用?Python run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_print_v
def test_print_v(self, sim=sim):
p = sim.Population(3, sim.IF_curr_alpha())
p.record_v()
sim.run(10.0)
p.write_data = Mock()
p.print_v("foo.txt")
p.write_data.assert_called_with('foo.txt', 'v', True)
示例2: test_meanSpikeCount
def test_meanSpikeCount(self):
p = sim.Population(14, sim.EIF_cond_exp_isfa_ista())
p.record("spikes")
sim.run(100.0)
p.mean_spike_count = Mock()
p.meanSpikeCount()
p.mean_spike_count.assert_called()
示例3: test_getSpikes
def test_getSpikes(self):
p = sim.Population(3, sim.IF_curr_alpha())
p.record("spikes")
sim.run(10.0)
p.get_data = Mock()
p.getSpikes()
p.get_data.assert_called_with("spikes", True)
示例4: test_print_gsyn
def test_print_gsyn(self):
p = sim.Population(3, sim.IF_cond_alpha())
p.record_gsyn()
sim.run(10.0)
p.write_data = Mock()
p.print_gsyn("foo.txt")
p.write_data.assert_called_with("foo.txt", ["gsyn_exc", "gsyn_inh"], True)
示例5: test_print_gsyn
def test_print_gsyn(self, sim=sim):
p = sim.Population(3, sim.IF_cond_alpha())
p.record_gsyn()
sim.run(10.0)
p.write_data = Mock()
p.print_gsyn("foo.txt")
p.write_data.assert_called_with('foo.txt', ['gsyn_exc', 'gsyn_inh'], True)
示例6: test_get_v
def test_get_v(self, sim=sim):
p = sim.Population(3, sim.IF_curr_alpha())
p.record_v()
sim.run(10.0)
p.get_data = Mock()
p.get_v()
p.get_data.assert_called_with('v', True)
示例7: test_meanSpikeCount
def test_meanSpikeCount(self, sim=sim):
p = sim.Population(14, sim.EIF_cond_exp_isfa_ista())
p.record('spikes')
sim.run(100.0)
p.mean_spike_count = Mock()
p.meanSpikeCount()
self.assertTrue(p.mean_spike_count.called)
示例8: test_get_gsyn
def test_get_gsyn(self, sim=sim):
p = sim.Population(3, sim.IF_cond_alpha())
p.record_gsyn()
sim.run(10.0)
p.get_data = Mock()
p.get_gsyn()
p.get_data.assert_called_with(['gsyn_exc', 'gsyn_inh'], True)
示例9: test_current_time_two_runs
def test_current_time_two_runs(self, sim=sim):
sim.setup(timestep=0.1, **self.extra)
sim.run(10.1)
self.assertAlmostEqual(sim.get_current_time(), 10.1)
sim.run(23.4)
self.assertAlmostEqual(sim.get_current_time(), 33.5)
sim.end()
示例10: test_printSpikes
def test_printSpikes(self, sim=sim):
# TODO: implement assert_deprecated
p = sim.Population(3, sim.IF_curr_alpha())
p.record('spikes')
sim.run(10.0)
p.write_data = Mock()
p.printSpikes("foo.txt")
p.write_data.assert_called_with('foo.txt', 'spikes', True)
示例11: test_get_spike_counts
def test_get_spike_counts(self, sim=sim):
p = sim.Population(3, sim.EIF_cond_exp_isfa_ista())
p.record('spikes')
sim.run(100.0)
self.assertEqual(p.get_spike_counts(),
{p.all_cells[0]: 2,
p.all_cells[1]: 2,
p.all_cells[2]: 2})
示例12: 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))
示例13: test_get_spike_counts
def test_get_spike_counts(self):
p = sim.Population(5, sim.EIF_cond_exp_isfa_ista())
pv = p[0, 1, 4]
pv.record('spikes')
sim.run(100.0)
self.assertEqual(p.get_spike_counts(),
{p.all_cells[0]: 2,
p.all_cells[1]: 2,
p.all_cells[4]: 2})
示例14: test_print_gsyn
def test_print_gsyn(self):
p1 = sim.Population(11, sim.IF_cond_exp())
p2 = sim.Population(11, sim.IF_cond_exp())
a = sim.Assembly(p1, p2, label="test")
a.record_gsyn()
sim.run(10.0)
a.write_data = Mock()
a.print_gsyn("foo.txt")
a.write_data.assert_called_with('foo.txt', ['gsyn_exc', 'gsyn_inh'], True)
示例15: test_mean_spike_count
def test_mean_spike_count(self, sim=sim):
p1 = sim.Population(14, sim.EIF_cond_exp_isfa_ista())
p2 = sim.Population(37, sim.IF_cond_alpha())
a = p1 + p2
p1.record('spikes')
p2.record('spikes')
#a.record('spikes')
sim.run(100.0)
self.assertEqual(a.mean_spike_count(), 2.0) # mock backend always produces two spikes per population