本文整理汇总了Python中brian2.Synapses.delay方法的典型用法代码示例。如果您正苦于以下问题:Python Synapses.delay方法的具体用法?Python Synapses.delay怎么用?Python Synapses.delay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类brian2.Synapses
的用法示例。
在下文中一共展示了Synapses.delay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_store_restore_magic
# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import delay [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_[:])
示例2: create_net
# 需要导入模块: from brian2 import Synapses [as 别名]
# 或者: from brian2.Synapses import delay [as 别名]
def create_net():
# Use a bit of a complicated spike and connection pattern with
# heterogeneous delays
# Note: it is important that all objects have the same name, this would
# be the case if we were running this in a new process but to not rely
# on garbage collection we will assign explicit names here
source = SpikeGeneratorGroup(5, np.arange(5).repeat(3),
[3, 4, 1, 2, 3, 7, 5, 4, 1, 0, 5, 9, 7, 8, 9]*ms,
name='source')
target = NeuronGroup(10, 'v:1', name='target')
synapses = Synapses(source, target, model='w:1', pre='v+=w', connect='j>=i',
name='synapses')
synapses.w = 'i*1.0 + j*2.0'
synapses.delay = '(5-i)*ms'
state_mon = StateMonitor(target, 'v', record=True, name='statemonitor')
input_spikes = SpikeMonitor(source, name='input_spikes')
net = Network(source, target, synapses, state_mon, input_spikes)
return net