Week 10 report (July 29 to August 4)
Sections | Summary |
---|---|
Meeting Summary (29 July 2020) |
Supporting SynapticPathways and overriding Synapses.connect() |
Tasks | - Get pathways details and initializers/connectors handling to preserve order - Complete integration of Synapses to baseexport |
Work done | - collect_Synapses() implementation and add Synapses_connect() to baseexport |
Issue associated | brian-team/brian2tools/issues/38 |
Pull Request associated |
brian-team/brian2tools/pull/39 |
Completed collect_Synapses()
to handle Synapses
and they are added to the run dictionary.
A sample use case example after the PR,
set_device('ExportDevice', build_on_run=False)
model_eqn = '''
dv/dt = (v_th - v)/tau :volt
v_th :volt
'''
tau = 10 * ms
P = NeuronGroup(10, model_eqn, method='euler', threshold='v > 900 * mV')
Q = NeuronGroup(10, model_eqn, method='euler', threshold='v > 700 * mV', reset = 'v = 100 * mV')
P.v_th = 1 * volt
Q.v_th = 1 * volt
eqn = '''
dp/dt = (1 - vp)/taup :1 (event-driven)
taup = 10 * ms :second
v_th_post = v :volt (summed)
w :volt
k :volt
'''
syn = Synapses(P, Q, eqn, on_pre='v += w', on_post = 'v -= w')
syn.connect(i=[0, 1, 2], j = [0, 3, 4], n=2)
run(100 * ms)
device.build(debug=True)
will give an output (shown only Synapses
part),
'synapses': [{'equations': {'k': {'type': 'parameter',
'unit': volt,
'var_type': 'float'},
'p': {'expr': '(1 - vp)/taup',
'flags': ['event-driven'],
'type': 'differential equation',
'unit': radian,
'var_type': 'float'},
'taup': {'expr': '10 * ms',
'type': 'subexpression',
'unit': second,
'var_type': 'float'},
'w': {'type': 'parameter',
'unit': volt,
'var_type': 'float'}},
'name': 'synapses',
'source': 'neurongroup',
'summed_variables': [{'code': '\n'
' '
'_synaptic_var = '
'v\n'
' ',
'dt': 100. * usecond,
'name': 'synapses_summed_variable_v_th_post',
'order': -1,
'target': 'neurongroup_1',
'when': 'groups'}],
'target': 'neurongroup_1'}]
'synaptic_pathways': [{'clock': 100. * usecond,
'code': 'v += w',
'event': 'spike',
'name': 'synapses_pre',
'order': -1,
'prepost': 'pre',
'source': 'neurongroup',
'synapse': 'synapses',
'target': 'neurongroup_1',
'when': 'synapses'},
{'clock': 100. * usecond,
'code': 'v -= w',
'event': 'spike',
'name': 'synapses_post',
'order': 1,
'prepost': 'post',
'source': 'neurongroup_1',
'synapse': 'synapses',
'target': 'neurongroup',
'when': 'synapses'}]}]},
and in the run level,
'synaptic_connections': [{'j': 'k for k in sample(N_post, p=i*1.0/(N_pre-1))',
'n_connections': 2,
'probability': 1.0}],
And yeah, the Synapses
are finally supported, but there were some problems when trying to access things like,
Synapses.w[0:10] = 'rand() * v_init`
similar to Standalone
mode (check the limitations of standalone mode here) and
thus giving us clue on how to handle them in more generalized way like standalone mode.
Written on July 29, 2020