本文整理汇总了Python中pyNN.mock.setup函数的典型用法代码示例。如果您正苦于以下问题:Python setup函数的具体用法?Python setup怎么用?Python setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
sim.setup(num_processes=2, rank=1, min_delay=0.123)
self.p1 = sim.Population(4, sim.IF_cond_exp(), structure=space.Line())
self.p2 = sim.Population(5, sim.HH_cond_exp(), structure=space.Line())
assert_array_equal(self.p2._mask_local, numpy.array([0,1,0,1,0], dtype=bool))
random.mpi_rank = 1
random.num_processes = 2
开发者ID:bernhardkaplan,项目名称:PyNN,代码行数:7,代码来源:test_connectors.py
示例2: setUp
def setUp(self):
sim.setup(num_processes=2, rank=1, min_delay=0.123)
self.p1 = sim.Population(4, sim.IF_cond_exp(), structure=space.Line())
self.p2 = sim.Population(5, sim.HH_cond_exp(), structure=space.Line())
assert_array_equal(self.p2._mask_local,
numpy.array([0, 1, 0, 1, 0], dtype=bool))
connection_list = [
(0, 0, 0.0, 1.0),
(3, 0, 0.0, 1.0),
(2, 3, 0.0, 1.0), # local
(2, 2, 0.0, 1.0),
(0, 1, 0.0, 1.0), # local
]
list_connector = connectors.FromListConnector(connection_list)
syn = sim.StaticSynapse()
self.ref_prj = sim.Projection(self.p1, self.p2, list_connector, syn)
self.orig_gather_dict = recording.gather_dict # create reference to original function
# The gather_dict function in recording needs to be temporarily replaced so it can work with
# a mock version of the function to avoid it throwing an mpi4py import error when setting
# the rank in pyNN.mock by hand to > 1
def mock_gather_dict(D, all=False):
return D
recording.gather_dict = mock_gather_dict
开发者ID:jougs,项目名称:PyNN,代码行数:25,代码来源:test_connectors.py
示例3: 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()
开发者ID:JoelChavas,项目名称:PyNN,代码行数:7,代码来源:test_simulation_control.py
示例4: setUp
def setUp(self):
sim.setup(num_processes=2, rank=1, min_delay=0.123)
self.p1 = sim.Population(9, sim.IF_cond_exp(),
structure=space.Grid2D(aspect_ratio=1.0, dx=1.0, dy=1.0))
self.p2 = sim.Population(9, sim.HH_cond_exp(),
structure=space.Grid2D(aspect_ratio=1.0, dx=1.0, dy=1.0))
assert_array_equal(self.p2._mask_local, numpy.array([1, 0, 1, 0, 1, 0, 1, 0, 1], dtype=bool))
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:7,代码来源:test_connectors.py
示例5: setUp
def setUp(self):
sim.setup()
self.p1 = sim.Population(7, sim.IF_cond_exp())
self.p2 = sim.Population(4, sim.IF_cond_exp())
self.p3 = sim.Population(5, sim.IF_curr_alpha())
self.syn1 = sim.StaticSynapse(weight=0.123, delay=0.5)
self.random_connect = sim.FixedNumberPostConnector(n=2)
self.syn2 = sim.StaticSynapse(weight=0.456, delay=0.4)
self.all2all = sim.AllToAllConnector()
开发者ID:bernhardkaplan,项目名称:PyNN,代码行数:9,代码来源:test_projection.py
示例6: setUp
def setUp(self, sim=sim, **extra):
sim.setup(**extra)
self.p1 = sim.Population(7, sim.IF_cond_exp())
self.p2 = sim.Population(4, sim.IF_cond_exp())
self.p3 = sim.Population(5, sim.IF_curr_alpha())
self.syn1 = sim.StaticSynapse(weight=0.006, delay=0.5)
self.random_connect = sim.FixedNumberPostConnector(n=2)
self.syn2 = sim.StaticSynapse(weight=0.012, delay=0.4)
self.all2all = sim.AllToAllConnector()
self.syn3 = sim.TsodyksMarkramSynapse(weight=0.012, delay=0.6, U=0.2, tau_rec=50)
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:10,代码来源:test_projection.py
示例7: test_callbacks
def test_callbacks(self):
total_time = 100.
callback_steps = [10., 10., 20., 25.]
# callbacks are called at 0. and after every step
expected_callcount = [11, 11, 6, 5]
num_callbacks = len(callback_steps)
callback_callcount = [0] * num_callbacks
def make_callback(idx):
def callback(time):
callback_callcount[idx] += 1
return time + callback_steps[idx]
return callback
callbacks = [make_callback(i) for i in range(num_callbacks)]
sim.setup(timestep=0.1, min_delay=0.1)
sim.run_until(total_time, callbacks=callbacks)
self.assertTrue(all(callback_callcount[i] == expected_callcount[i]
for i in range(num_callbacks)))
开发者ID:jougs,项目名称:PyNN,代码行数:21,代码来源:test_simulation_control.py
示例8: test_reset
def test_reset(self):
sim.setup()
sim.run(1000.0)
sim.reset()
self.assertEqual(sim.get_current_time(), 0.0)
开发者ID:jougs,项目名称:PyNN,代码行数:5,代码来源:test_simulation_control.py
示例9: setUp
def setUp(self, sim=sim, **extra):
self.MIN_DELAY = 0.123
sim.setup(num_processes=2, rank=1, min_delay=0.123, **extra)
开发者ID:Huitzilo,项目名称:PyNN,代码行数:3,代码来源:test_connectors_parallel.py
示例10: test_max_delay
def test_max_delay(self):
sim.setup(max_delay=9.87)
self.assertEqual(sim.get_max_delay(), 9.87)
开发者ID:jougs,项目名称:PyNN,代码行数:3,代码来源:test_simulation_control.py
示例11: test_end
def test_end(self, sim=sim):
sim.setup(**self.extra)
sim.end() # need a better test
开发者ID:JoelChavas,项目名称:PyNN,代码行数:3,代码来源:test_simulation_control.py
示例12: test_run
def test_run(self):
sim.setup()
self.assertEqual(sim.run(1000.0), 1000.0)
self.assertEqual(sim.run(1000.0), 2000.0)
开发者ID:jougs,项目名称:PyNN,代码行数:4,代码来源:test_simulation_control.py
示例13: setUp
def setUp(self):
sim.setup()
开发者ID:jougs,项目名称:PyNN,代码行数:2,代码来源:test_population.py
示例14: test_end
def test_end(self):
sim.setup()
sim.end() # need a better test
开发者ID:jougs,项目名称:PyNN,代码行数:3,代码来源:test_simulation_control.py
示例15: test_min_delay
def test_min_delay(self, sim=sim):
sim.setup(0.123, min_delay=0.246, **self.extra)
self.assertEqual(sim.get_min_delay(), 0.246)
sim.end()
开发者ID:JoelChavas,项目名称:PyNN,代码行数:4,代码来源:test_simulation_control.py
示例16: 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
示例17: test_run_twice
def test_run_twice(self, sim=sim):
sim.setup(**self.extra)
self.assertAlmostEqual(sim.run(100.0), 100.0)
self.assertAlmostEqual(sim.run(100.0), 200.0)
sim.end()
开发者ID:JoelChavas,项目名称:PyNN,代码行数:5,代码来源:test_simulation_control.py
示例18: test_reset
def test_reset(self, sim=sim):
sim.setup(**self.extra)
sim.run(100.0)
sim.reset()
self.assertEqual(sim.get_current_time(), 0.0)
sim.end()
开发者ID:JoelChavas,项目名称:PyNN,代码行数:6,代码来源:test_simulation_control.py
示例19: setUp
def setUp(self, sim=sim, **extra):
sim.setup(**extra)
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:2,代码来源:test_assembly.py
示例20: test_current_time
def test_current_time(self):
sim.setup(timestep=0.1)
sim.run(10.1)
self.assertEqual(sim.get_current_time(), 10.1)
sim.run(23.4)
self.assertEqual(sim.get_current_time(), 33.5)
开发者ID:jougs,项目名称:PyNN,代码行数:6,代码来源:test_simulation_control.py
注:本文中的pyNN.mock.setup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论