File: notes_on_passing_variables_to_templates.txt

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (36 lines) | stat: -rw-r--r-- 1,881 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Template generation keywords:

code block
multiple code blocks

# Handling lumped variables using the standard mechanisms is not
# possible, we therefore also directly give the names of the arrays
# to the template. The dummy statement in the second line only serves
# the purpose of including the variable in the namespace
_target_var_array name (lumped updater)

============= StateMonitor ===========================

record variable names (statemonitor)

group.variables ['_spikespace', 't', 'v', 'dt', 'lastspike', 'not_refractory']
additional_variables {
	'_t': <Variable(unit=Unit(1), value=<value of type <class 'brian2.memory.dynamicarray.DynamicArray1D'>>, dtype=<type 'numpy.float64'>, scalar=False, constant=False)>,
	'_clock_t': AttributeVariable(unit=second, obj=Clock(dt=0.10000000000000001 * msecond, name='defaultclock'), attribute='t_', constant=False),
	'_recorded_v': <Variable(unit=Unit(1), value=<value of type <class 'brian2.memory.dynamicarray.DynamicArray'>>, dtype=dtype('float64'), scalar=False, constant=False)>,
	'_indices': <ArrayVariable(unit=Unit(1), value=<value of type <type 'numpy.ndarray'>>, dtype=dtype('int32'), scalar=False, constant=True)>,
	'v': <ArrayVariable(unit=Unit(1), value=<value of type <type 'numpy.ndarray'>>, dtype=dtype('float64'), scalar=False, constant=False)>}
resolved_namespace []
resolved_namespace2 []
variable_indices defaultdict(<function <lambda> at 0x04172570>,
	{'lastspike': '_idx', 'v': '_idx', 'not_refractory': '_idx'})
template_kwds {'_variable_names': ['v']}

========================================

# For C++ code, we need these names explicitly, since not_refractory
# and lastspike might also be used in the threshold condition -- the
# names will then refer to single (constant) values and cannot be used
# for assigning new values
array_not_refractory name (threshold)
array_lastspike name (threshold)