本文整理汇总了Python中brian2.NeuronGroup.rates方法的典型用法代码示例。如果您正苦于以下问题:Python NeuronGroup.rates方法的具体用法?Python NeuronGroup.rates怎么用?Python NeuronGroup.rates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类brian2.NeuronGroup
的用法示例。
在下文中一共展示了NeuronGroup.rates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_store_restore_magic
# 需要导入模块: from brian2 import NeuronGroup [as 别名]
# 或者: from brian2.NeuronGroup import rates [as 别名]
def test_store_restore_magic():
source = NeuronGroup(10, '''dv/dt = rates : 1
rates : Hz''', threshold='v>1', reset='v=0')
source.rates = 'i*100*Hz'
target = NeuronGroup(10, 'v:1')
synapses = Synapses(source, target, model='w:1', pre='v+=w', connect='i==j')
synapses.w = 'i*1.0'
synapses.delay = 'i*ms'
state_mon = StateMonitor(target, 'v', record=True)
spike_mon = SpikeMonitor(source)
store() # default time slot
run(10*ms)
store('second')
run(10*ms)
v_values = state_mon.v[:, :]
spike_indices, spike_times = spike_mon.it_
restore() # Go back to beginning
assert magic_network.t == 0*ms
run(20*ms)
assert defaultclock.t == 20*ms
assert_equal(v_values, state_mon.v[:, :])
assert_equal(spike_indices, spike_mon.i[:])
assert_equal(spike_times, spike_mon.t_[:])
# Go back to middle
restore('second')
assert magic_network.t == 10*ms
run(10*ms)
assert defaultclock.t == 20*ms
assert_equal(v_values, state_mon.v[:, :])
assert_equal(spike_indices, spike_mon.i[:])
assert_equal(spike_times, spike_mon.t_[:])