nestml icon indicating copy to clipboard operation
nestml copied to clipboard

Sender_id information available in the update block

Open rbonometto opened this issue 1 year ago • 4 comments

Hello everyone, I am currently working on a SNN implementation of a closed-loop control system to simulate the role of cerebellum in motor control. I am trying to develop in NESTML a model of a neuron to perform state estimation as explained in https://direct.mit.edu/neco/article/34/9/1893/112384/Bayesian-Integration-in-a-Spiking-Neural-System. To do so, I would need to use in the update block the information of which neuron has sent a specific spike (sender_id in NEST); however, I haven't found a way to do so. As a workaround, I tried to define a different port for each neuron through vectorized ports, to then establish one to one connections but the problem still persists as vectorized ports don't seem to support indexing through variables, neither in the definition in the state block: fbk_spikes[N_fbk] <- spike nor to access their content in the update block: fbk_buffer[index] = fbk_spikes[i]. In this last case, the generated code in the cpp file is: S_.fbk_buffer[index] = (0.001 * B_.spike_inputs_grid_sum_[FBK_SPIKES_0 - MIN_SPIKE_RECEPTOR]);} whatever the value of i, which raises a 'make all' error.

rbonometto avatar Apr 12 '24 10:04 rbonometto

Hi, thanks for writing in! I think defining vector input ports are the way to go here. @pnbabu: could you look into what the issue is with addressing using a variable? This should work and it might be just a small fix.

clinssen avatar Apr 12 '24 15:04 clinssen

@rbonometto Hi, could you please share a simple reproducible version of your model so that I can see locally what's going wrong?

pnbabu avatar Apr 15 '24 12:04 pnbabu

@pnbabu sure! This is what I wrote so far: state_neuron.zip

rbonometto avatar Apr 15 '24 14:04 rbonometto

@rbonometto The issue with vector input ports is fixed in this PR: https://github.com/nest/nestml/pull/1042 Thank you for pointing it out! Could you please pull these changes and check if they work for you?

Note that with these changes, the vector input ports are indexed starting from 0. So please change your models accordingly. Please don't hesitate to reach out if you have further questions.

pnbabu avatar Apr 25 '24 10:04 pnbabu

Fixed by #1042

pnbabu avatar May 15 '24 13:05 pnbabu