Marcel Stimberg
unread,May 20, 2020, 12:15:58 PM5/20/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to brians...@googlegroups.com
Hi Jean-Philippe,
indeed, the definition of V_soma is cyclical and Brian therefore refuses
it. In principle, you should be able to solve this by marking the
equation for V_soma as "(constant over dt)" This way, it would calculate
V_soma once at the beginning of the time step, using the current value
of I_intrinsic_soma (i.e., based on the last timestep's values). It
would therefore not run into the issue with the recursive definition. I
assume this is what is done in the C++ code? Or do they really solve
this as an implicit problem (where V_soma(t) depends on V_soma(t))?
Unfortunately, marking the equation as (constant over dt) does not work
in your case, due to the way the equations are analysed currently. I
think that's a bug, I'll open an issue about it.
All that said, you can reproduce the "constant over dt" solution
manually. Instead of writing V_soma as part of the equations, you only
include it as "V_soma : volt". Then, you ask Brian to update it at the
beginning of every time step:
neurons = NeuronGroup(...)
neurons.run_regularly('V_soma = V_dend - I_intrinsic_soma/g_ds',
when='before_groups')
It's a bit of an implementation detail whether to use
when='before_groups' or when='after_groups'. This should only change the
assignments to the V_soma values to the time steps if you record them
with a StateMonitor, i.e. does the updated V_soma value "belong" to the
current or the next time step.
Hope that makes sense, best
Marcel