本文整理匯總了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