TimedArray for PoissonGroup rates in Brian2

138 views
Skip to first unread message

olivia...@gmail.com

unread,
Apr 6, 2016, 1:48:03 PM4/6/16
to Brian

Hello,

I would like to have a PoissonGroup that takes a TimedArray as input for the rates. All the neurons of the PoissonGroup should have the same rate, but it should change over time.
I wrote something like this:

my_array = baseline_rate*np.ones(Nsteps)*Hz
my_array[start_active : end_active] = active_rate*Hz
Timed_active = TimedArray(my_array, dt=defaultclock.dt)
myPoissonNeuron = PoissonGroup(2000, rates='Timed_active(t)')

This doesn't give me any error. However, if I look at the spike monitor, it seems that I don't get an increase of the firing rate between "start_active" and "end_active". But I looked at Timed_active.values, and it indeed has higher values between start_active and end_active.


Is there a way to make this work?

Or the only way is to cut my simulations in different parts?


Thank you!


Olivia

Marcel Stimberg

unread,
Apr 6, 2016, 2:15:05 PM4/6/16
to brians...@googlegroups.com
Hi Olivia,

> I would like to have a PoissonGroup that takes a TimedArray as input
> for the rates. All the neurons of the PoissonGroup should have the
> same rate, but it should change over time.
> I wrote something like this:
>
> my_array = baseline_rate*np.ones(Nsteps)*Hz
> my_array[start_active : end_active] = active_rate*Hz
> Timed_active = TimedArray(my_array, dt=defaultclock.dt)
> myPoissonNeuron = PoissonGroup(2000, rates='Timed_active(t)')
>
> This doesn't give me any error. However, if I look at the spike
> monitor, it seems that I don't get an increase of the firing rate
> between "start_active" and "end_active". But I looked at
> Timed_active.values, and it indeed has higher values between
> start_active and end_active.

I have to admit this is very confusing and we'd like to make
PoissonGroup work like that at some point but in fact -- as is not
really clear from the documentation, I have to admit -- this use case is
currently not supported. While you *can* give a string expression for
the rates (and therefore you do not get an error), this expression is
evaluated when you construct the PoissonGroup, not at every timestep as
you expected. This means, it calculates Timed_active(0*second) and then
sets the rate to this constant value...

You can use a workaround, though, because PoissonGroup is in fact not
much more than a convenient wrapper around a NeuronGroup. The following
should give you the result you expected:

myPoissonNeuron = NeuronGroup(2000, 'rates = Timed_active(t) : Hz',
threshold='rand() < rates * dt')

I opened an issue on github about this:
https://github.com/brian-team/brian2/issues/660

Best,
Marcel

Reply all
Reply to author
Forward
0 new messages