Event-triggered application of general functions of time

11 views
Skip to first unread message

Wilhelm Braun

unread,
Mar 10, 2020, 9:52:38 AM3/10/20
to Brian Development
Dear all,

I wonder whether it is possible to apply general functions of time, defined by a standard python function (and not a differential equation), in an event-based fashion, so that, for example, every time an event is triggered, a specific time-dependent oscillatory current is added to the neuron. I know that a workaround can be to use a TimedArray, but there, one needs to know when exactly the events will happen, which is in general not the case.

Thanks a lot for your answer.

Best wishes,

Wilhelm

Marcel Stimberg

unread,
Mar 10, 2020, 12:00:54 PM3/10/20
to brian-de...@googlegroups.com
Hi Wilhelm,

if you want these functions of time to overlap (e.g. to define synaptic
currents where a new spike can arrive before the current from the
previous spike is back to zero), then there is unfortunately no good
solution at the moment (we started some discussion about this topic in
https://github.com/brian-team/brian2/issues/1170). The only solution
would be to manually write a function in the target language or to use a
network_operation.

However, if the events are discrete in the sense that there is only one
function (per neuron) "replayed" at a time, then you should be able to
use a TimedArray for that purpose:

current = TimedArray(...)
eqs = '''
dv/dt = ... + I ... : volt
I = current(t - trigger_time) : amp
trigger_time : second
'''

And then have some event (e.g. the reset or the on_pre of a Synapses
object) set "trigger_time = t".

This assumes that the last entry of the array in "current" is 0 (because
when t-trigger_time exceeds the length of the array, the last value will
be used). You'd also have to set the trigger_time to some value like
-1000*second to avoid to have an event triggered in the very beginning.

Hope that helps, best

  Marcel


Wilhelm Braun

unread,
Mar 10, 2020, 1:35:20 PM3/10/20
to Brian Development
Thanks Marcel, that's what I needed. I didn't know TimedArray could be used in this way.

Best, Wilhelm
Reply all
Reply to author
Forward
0 new messages