Debian Codegraph @

dev/notes_on_passing_variables_to_templates.txt

raw
1 Template generation keywords:
2
3 code block
4 multiple code blocks
5
6 # Handling lumped variables using the standard mechanisms is not
7 # possible, we therefore also directly give the names of the arrays
8 # to the template. The dummy statement in the second line only serves
9 # the purpose of including the variable in the namespace
10 _target_var_array name (lumped updater)
11
12 ============= StateMonitor ===========================
13
14 record variable names (statemonitor)
15
16 group.variables ['_spikespace', 't', 'v', 'dt', 'lastspike', 'not_refractory']
17 additional_variables {
18 '_t': <Variable(unit=Unit(1), value=<value of type <class 'brian2.memory.dynamicarray.DynamicArray1D'>>, dtype=<type 'numpy.float64'>, scalar=False, constant=False)>,
19 '_clock_t': AttributeVariable(unit=second, obj=Clock(dt=0.10000000000000001 * msecond, name='defaultclock'), attribute='t_', constant=False),
20 '_recorded_v': <Variable(unit=Unit(1), value=<value of type <class 'brian2.memory.dynamicarray.DynamicArray'>>, dtype=dtype('float64'), scalar=False, constant=False)>,
21 '_indices': <ArrayVariable(unit=Unit(1), value=<value of type <type 'numpy.ndarray'>>, dtype=dtype('int32'), scalar=False, constant=True)>,
22 'v': <ArrayVariable(unit=Unit(1), value=<value of type <type 'numpy.ndarray'>>, dtype=dtype('float64'), scalar=False, constant=False)>}
23 resolved_namespace []
24 resolved_namespace2 []
25 variable_indices defaultdict(<function <lambda> at 0x04172570>,
26 {'lastspike': '_idx', 'v': '_idx', 'not_refractory': '_idx'})
27 template_kwds {'_variable_names': ['v']}
28
29 ========================================
30
31 # For C++ code, we need these names explicitly, since not_refractory
32 # and lastspike might also be used in the threshold condition -- the
33 # names will then refer to single (constant) values and cannot be used
34 # for assigning new values
35 array_not_refractory name (threshold)
36 array_lastspike name (threshold)