Skip to content

Commit

Permalink
Added some notes on passing variables to templates
Browse files Browse the repository at this point in the history
  • Loading branch information
thesamovar committed Aug 21, 2013
1 parent 6a1546f commit a1cf422
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions dev/notes_on_passing_variables_to_templates.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,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)

0 comments on commit a1cf422

Please sign in to comment.