Set Rate of Poisson Generator


#1

Dear all,

I want to set the rate of an entire Poisson Generator Population in a transfer function.

population.rate = 10

only sets the rate of one Poisson Generator to 10. All other generators are unchanged.

What is the correct way of setting the rate of an entire Poisson Generator Population?

Cheers,
Matthias


#2

Dear Mathias,

Did you try to set the rates with an array instead of a single number, just like it is done in this PyNN documentation?

Best regards,
Luc


#3

Dear Luc,

we tried have tried it now, it works in the brain file, however we want to set the rate of a Poisson Generator Population in a transfer function. There we get the following errors:

test_pop.rate = [50.0] * 100
–> float() argument must be a string or a number

test_pop.rate = np.linspace(50.0, 50.0, num = 100)
–> only size-1 arrays can be converted to Python scalars

clientLogger.info(test_pop.rate)
–> 0.0

Cheers,
Matthias


#4

Dear Matthias,

can you share the entire header of your transfer function? In particular the MapSpikeSource decorator which defines the “test_pop” parameter.

Did you define the Poisson generators in your Brain model directly? I am not sure what you mean by Poisson Generator Population. It might be that you are doing something which we are currently not supporting directly.

Cheers,
Sebastian


#5

Hello Sebastian,

Since I am working with Matthias on that problem and it occurred in my part of the code I will write you a minimal example here. The transfer function looks like this:

from std_msgs.msg import Float64
from gazebo_ros_muscle_interface.msg import MuscleStates
from gazebo_msgs.msg import LinkStates
from sensor_msgs.msg import JointState
    
@nrp.MapSpikeSource("test_pop", nrp.brain.refl_neurons, nrp.poisson)

@nrp.MapRobotSubscriber("muscle_states_msg", Topic("/gazebo_muscle_interface/myoarm/muscle_states", MuscleStates))
@nrp.MapRobotSubscriber("link_states_msg", Topic("/gazebo/link_states", gazebo_msgs.msg.LinkStates))
@nrp.MapRobotSubscriber("joint_states_msg", Topic("/joint_states", sensor_msgs.msg.JointState))

@nrp.MapCSVRecorder("recorder", filename="angles.csv", headers=["time", "shoulder", "elbow"])

@nrp.Robot2Neuron()

def setNeurons(t, test_pop, muscle_states_msg, link_states_msg, joint_states_msg, recorder):
    import numpy as np
    
    # test_pop.rate = [50.]*100
    # test_pop.rate = np.linspace(50.0, 50.0, num = 100)	
    test_pop.rate = 50.0
  
    clientLogger.info(test_pop.rate )

The two commented out attempts of setting the rate lead to the error messages Matthias stated in his earlier post. If I only set one number, like here for example 50.0 as a rate, it runs, however all neurons of the post synaptic population (here defined as refl_neurons in the brain model with n = 100) spike at the same time, like seen in the image from the spike train below:

poisson_rate_intransfer

while we would actually expect different spike times, but the same spike rate for the each individual neuron, especially when connected OneToOne. Something like this:

poisson_rate_inbrain

So this is what we want to achieve for the postsynaptic population. Please correct us, if our expectations are wrong.

When setting the spike times in the brain model directly, like

    test_pop.rate = 50.0

I get a spiking poisson population, but it does not seem to trigger any spikes in a post-synaptic population…

Since it is mentioned in this post, that the PoissonGenerator should be defined in the transfer function, because the rate has to be updated in every time step, we used the MapSpikeSource.

I hope this is understandable.
Annika


#6

Dear Annika, dear Matthias,

thank you very much for your comprehensive write up. I can see the issue.

The definition using the MapSpikeSource decorator is the right approach. By default the PoissonGenerator device creates a population of size 1, using an AllToAll Connector. Consequently, you see a spike train similar to your first picture. If you want to specify a larger population size, you need to do so explicitly in the transfer function. By appending a parameter “n”, you can specify the size of the population; using “connector” you can specify the PyNN connector object to be used.

from hbp_nrp_cle.brainsim import simulator as sim

@nrp.MapSpikeSource(“test_pop”, nrp.brain.refl_neurons, nrp.poisson, n=8, connector=sim.OneToOneConnector())

Unfortunately, in testing the code I stumbled upon a bug in the way the NRP relays parameters to nest. I will file a bug report and follow up once I have news.

Cheers,
Sebastian