arbor-sim / arbor

The Arbor multi-compartment neural network simulation library.
https://arbor-sim.org
BSD 3-Clause "New" or "Revised" License
107 stars 60 forks source link

Restrict membrane within user defined range #1843

Closed schmitts closed 1 year ago

schmitts commented 2 years ago

Typical computational neuroscience models, like LIF and AdEx, restrict the membrane voltage to below the threshold. To allow to replicate results, e.g., the AdEx Naud patterns (https://dx.doi.org/10.1007%2Fs00422-008-0264-7), it is crucial that the membrane voltage does not exceed the threshold.

1841 implements clipping of the membrane to user defined ranges.

This functionality is also vital for modelling (analog) neuromorphic circuits that have an intrisic range (like up to 1.8 V).

bcumming commented 2 years ago

Such constraints are not entirely compatible with the cable cell model, which is based on the cable equation.

Instead of coercing the cable cell model to implement cell models like LIF and AdEx, we could consider implementing a new cell type for AdEx that implements the specific model that you have in mind.

schmitts commented 2 years ago

I do not want to turn Arbor into a point neuron simulator, but I need to have a starting point from which I can turn the point neuron model into a compartmental (cable) model. Treating one CV as a substitute for a point neuron model would allow for that.

And for the neuromorphic model I want to use the gap junctions, i.e., compartments coupled via a conductance. Would that work out of the box with a custom cell type?

Voltage clamps #1343 also sound like easily implemented by just manipulating/forcing the voltage on a compartment to be within some range (ie. min=max).

I don't want to do anything that is "wrong" (numerically or alike) but if it is correct enough and allows to extend the model to a real multi-compartment model later with only minimal changes, that sounds like a good way forward to me.

brenthuisman commented 2 years ago

Just to make sure: when you say scale up, do you mean to have a few compartments or really an arbitrarily large number of compartments, and all the rest that Arbor's cable_cell has?

schmitts commented 2 years ago

Just to make sure: when you say scale up, do you mean to have a few compartments or really an arbitrarily large number of compartments, and all the rest that Arbor's cable_cell has?

We want a smooth transition in terms of compartments: one, few, many. I don't see how we should gain insight when starting with morphological detailed neurons. We need to bootstrap ourselves.

brenthuisman commented 2 years ago

As it stands, this request (and anything manipulating the voltage without a mechanism) breaks an assumption in the cable_cell, and would require a bit more work (we've looked at the PR and we were not sure what would happen on the GPU for instance). That's why our first idea was to build out a new point neuron cell kind, and learn from that how these features can be kept performant across hardware. https://github.com/arbor-sim/arbor/issues/1605 is meant to lower the threshold for such experiments, without potentially breaking performance of the cable_cell when such a feature is used. We will need to re-prioritize that issue if you are certain that nothing less will do :) .

Last try to see if another way is possible: it is just the morphology that you need? I.e. would the entire cell 'have AdEx' and nothing else (besides potentially clipping of the membrane voltage or other voltage manipulation in general)?

schmitts commented 2 years ago

Last try to see if another way is possible: it is just the morphology that you need? I.e. would the entire cell 'have AdEx' and nothing else (besides potentially clipping of the membrane voltage or other voltage manipulation in general)?

I guess my laundry list would be:

thorstenhater commented 2 years ago

As of now this hangs in limbo: Clipping Um breaks the cable model, yet there's some need for it. Your list reads like you need the full cable model plus membrane potential manipulation, so I suggest we add it in the following way:

schmitts commented 2 years ago

Is the order in which mechanisms are executed deterministic? It would be important that the mech that manipulates (e.g. clips) the membrane voltage is run before any other.

thorstenhater commented 2 years ago

Currently we run all reversal potential mechanisms then current and state updates of all other mechanisms. I would suggest making a POTENTIAL mechanism kind that run in a separate phase, so

  1. erev-mechs: write E_r
  2. non-erev-non-pot-mechs
    • current
    • state
    • concentrations
    • ...
  3. pot-mechs

where the potential phase can go first, last, between ...

Inside a phase though, order is undefined but stable, ie it may change between runs but not during a run.

thorstenhater commented 2 years ago

@schmitts is this still open? Would the suggestion help?

schmitts commented 2 years ago

@thorstenhater The suggestion would help, but is the infrastructure already in place to do so?

schmitts commented 2 years ago

@thorstenhater ping

thorstenhater commented 2 years ago

Yes, the infrastructure would support it, but we'd need to devise a new mechanism kind that's doing the actual clamping. Likely it'd look similar to this

NEURON {
  POTENTIAL_PROCESS clamp
}

BREAKPOINT {
  v = max(v_hi, min(v_lo, v))
}

But I'll need to convince myself that this is the proper approach. I have some concerns, though.

thorstenhater commented 1 year ago

This is done as of #2033