Week 4 report (June 17 to June 23)
Sections | Summary |
---|---|
Minutes of Meeting (Meeting date: 17 June,2020) |
- Having simple and short naming conventions - Adding/updating collector methods to handle identifiers and initializers - Raising warnings when specific Brian component is not yet supported with standard export - Handling multiple run()s and with build options like `build_on_run` - Adding run_regularly and monitors to standard exporter - Dealing with dimension vs unit usage in dictionary representation |
Tasks | - Changes in current PRs as asked in review comments - Have simple and short names for the functions/files - Implement warning/NotImplemeneted Exception raising when encountered unsupported Brian objects - Add collectors for identifiers and initializers - Support multiple run()s and necessary build options - Add run_regularly and monitors |
Work done | - New Exportdevice to inform Brian to run in this mode - Made changes for PR as asked in review - Changed naming of the files - Raise NotImplemented error for non-supported objects - Add collectors for identifiers and initializers |
Problems or doubts faced |
- Identifying run_regularly from CodeRunner object (currently checking object name) - Getting ‘dt’\’clock’ from CodeRunner - Using ‘variableview_set_with_expression_conditional’, ‘variableview_set_with_expression’ and ‘variableview_set_with_index_array’ |
Issue associated | brian-team/brian2tools/issues/26 |
Pull Request associated |
brian-team/brian2tools/pull/31 |
The week was mainly on PR #31 that dealt with creating
new device mode to run Brian. Now the work got lot more interesting as from now we have access to all run time variables
and can use the device like other device modes (only to set device name in set_device
).
Referring Standalone
and nmlexport
were really useful to refer.
A simple usecase to run Brian in baseexport
device and collect information from collectors
after the PR merge,
from brian2 import *
from brian2 import baseexport
set_device('baseexport')
eqs = ''' dv/dt = (v_rest - v) / tau :volt '''
v_rest = -70 * mV
v_th = 0.8 * volt
tau = 10 * ms
grp = NeuronGroup(1, eqs, threshold = 'v > v_th',
reset = 'v = v_rest', refractory = 2 * ms,
method = 'euler')
run(10 * ms)
Now the information are available with neat dictionary format and to run in debug mode (to print
the dictionary in stdout
, we should add device.build(debug=True)
and pass False
to build_on_run
)
For example,
from brian2 import *
from brian2 import baseexport
set_device('baseexport', build_on_run=False)
eqs = ''' dv/dt = (v_rest - v) / tau :volt '''
v_rest = -70 * mV
v_th = 0.8 * volt
tau = 10 * ms
grp = NeuronGroup(1, eqs, threshold = 'v > v_th',
reset = 'v = v_rest', refractory = 2 * ms,
method = 'euler')
run(10 * ms)
device.build(debug=True)
The output will be a cool dictionary of information about the simulation. Although the now
device looks very generalized, the Brian objects it supports are very basic (in fact only NeuronGroup
and similar types). Adding initializers was a big part because, they are very flexible in Brian2 and
covering all special and corner cases is very important to have standard model description.