nest / nest-simulator

The NEST simulator
http://www.nest-simulator.org
GNU General Public License v2.0
530 stars 361 forks source link

Failed to set `V_m` in `iaf_psc_alpha` #3248

Closed babsey closed 1 month ago

babsey commented 1 month ago

Describe the bug In aspect to set initial membrane potential 'V_m' in 'iaf_psc_alpha' model, I registered not expected simulation output. It remains at value -70.

To Reproduce Steps to reproduce the behavior:

import nest
n = nest.Create('iaf_psc_alpha', params={'V_m': 0})
vm = nest.Create('voltmeter')
nest.Connect(vm, n)
nest.Simulate(10)
vm.events

The output shows

{'senders': array([1, 1, 1, 1, 1, 1, 1, 1, 1]),
 'times': array([1., 2., 3., 4., 5., 6., 7., 8., 9.]),
 'V_m': array([-70., -70., -70., -70., -70., -70., -70., -70., -70.])}

Expected behavior

{'senders': array([1, 1, 1, 1, 1, 1, 1, 1, 1]),
 'times': array([1., 2., 3., 4., 5., 6., 7., 8., 9.]),
 'V_m': array([0., 0., 0., 0., 0., 0., 0., 0., 0.])}

Desktop/Environment (please complete the following information):

Additional context Add any other context about the problem here.

med-ayssar commented 1 month ago

The params={'V_m': 0} is only considered for initialization, and the value emitted by the neuron to the voltmeter is the sum of two others variables.

  inline double
  get_V_m_() const
  {
    return S_.y3_ + P_.E_L_;
  }

In the update function, S_.y3 is always zero, and thus you get only the value in P_.E_L_, which is -70.

babsey commented 1 month ago

@med-ayssar my mistake. The V_m is driven by E_L. However, the first V_m value should be closer to 0 because of the time constant. Please correct me if I am wrong.

babsey commented 1 month ago

My mistake again, I should set V_m below spike threshold V_th. Now I can see initial value of Vm. :+1: