TimedArray for PoissonGroup rates in Brian2

瀏覽次數:138 次
跳到第一則未讀訊息

olivia...@gmail.com

未讀,
2016年4月6日 下午1:48:032016/4/6
收件者: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

未讀,
2016年4月6日 下午2:15:052016/4/6
收件者: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

回覆所有人
回覆作者
轉寄
0 則新訊息