def test_initialize_simulation_runtime(setup): net, dt, duration = setup start_scope() rts = RuntimeSimulator() assert_raises(TypeError, rts.initialize) rts.initialize(net, var_init=None) assert (isinstance(rts.networks['fit'], Network)) assert_raises(KeyError, rts.initialize, empty_net, None) wrong_net = Network(NeuronGroup(1, model, name='neurons2')) assert_raises(Exception, rts.initialize, wrong_net, None) assert_raises(TypeError, rts.initialize, Network)
def test_run_simulation_runtime(setup): net, dt, duration = setup start_scope() rts = RuntimeSimulator() rts.initialize(net, var_init=None) rts.run(duration, {'g': 100, 'E': 10}, ['g', 'E']) I = getattr(rts.networks['fit']['monitor'], 'I') assert_equal(np.shape(I), (1, duration / dt))
def test_run_simulation_runtime_var_init(setup): _, dt, duration = setup start_scope() neurons = NeuronGroup(1, model2, name='neurons') monitor = StateMonitor(neurons, 'v', record=True, name='statemonitor') net = Network(neurons, monitor) rts = RuntimeSimulator() rts.initialize(net, var_init={'v': -60 * mV}) rts.run(duration, {'gL': 100, 'C': 10}, ['gL', 'C'], iteration=0) v = getattr(rts.statemonitor, 'v') assert_equal(np.shape(v), (1, duration / dt))
def test_init(): rts = RuntimeSimulator() assert isinstance(rts, Simulator)