Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with delta kernel convolution in inline expression #993

Open
clinssen opened this issue Nov 23, 2023 · 1 comment · May be fixed by #1050
Open

Issue with delta kernel convolution in inline expression #993

clinssen opened this issue Nov 23, 2023 · 1 comment · May be fixed by #1050
Labels

Comments

@clinssen
Copy link
Contributor

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 clinssen added the bug label Nov 23, 2023
@clinssen
Copy link
Contributor Author

  • Should we generate a dummy, temporary variable for a convolution with a delta kernel?
  • Should spiking input port names be allowed inside ODEs?
    • It's ambiguous where the discretization happens when we write a spike inside a continuous-time ODE expression: for example, mathematically it's not clear how to read dx/dt = -x + delta(t) * x(t), do you take the x(t) before or after x has been updated?
  • Should convolutions be allowed at all?
    • Convolve mixes discrete-time events with differential equations, but is common notation in neuroscience.
    • Disadvantages:
      • intial values cannot be set other than zero
      • extra state variables generated behind the scenes
      • current convolutions/kernels system only works for a few isolated cases (say we have the kernel erf(sqrt(t))**2 * heaviside(t))
    • N.B. if convolutions are disallowed, writing kernel as direct function of time no longer possible (e.g. (e / tau_syn_inh) * t * exp(-t / tau_syn_inh)).

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant