nest / nestml

A domain specific language for neuron and synapse models in spiking neural network simulation
GNU General Public License v2.0
46 stars 45 forks source link

Issue with delta kernel convolution in inline expression #993

Open clinssen opened 10 months ago

clinssen commented 10 months ago

A convolution with a delta kernel inside an inline expression results in errors during code generation.

For instance:

inline I_syn pA = convolve(K_delta, spikes) * pA
V_m' = (-g_L * (V_bounded - E_L) + I_spike - I_syn - w + I_e + I_stim) / C_m

Making the inline expression "recordable" does not seem to help.

clinssen commented 6 months ago

Equations block handles continuous input currents, but no convolution allowed right now (only convolution with spiking input ports is allowed).

For example:

      equations:
        kernel K = delta(t)
        V_m' = -V_m / tau_m + convolve(K, spikes) * mV / ms   # when does V_m get incremented?

Probably, we want the convolution to happen either just before or just after ODEs are integrated. (N.B. results could be different depending on the numerical integrator that's chosen).

Is the following formulation equivalent?

      equations:
        V_m' = -V_m / tau_m + spikes * mV   # when does V_m get incremented?

Meaning would be in the generated code: spikes is a weighted sum of the spikes that came in during the last timestep. This could be done by generating an extra auxiliary variable (just as we do for other convolutions with kernels other than the delta) even for delta functions.