Dhruva2 / NeuronBuilder.jl

Builds conductance based neural networks iteratively, from ion channels and synapses
MIT License
24 stars 4 forks source link

Missing units + scaling #7

Open wsphillips opened 3 years ago

wsphillips commented 3 years ago

Potential issues leading to incorrect model behavior:

  1. gating variables are being initialized to zero (instead of steady-state values).

  2. units aren't being scaled (i.e. the maximal conductances in the Prinz papers is given in mS/cm²).

  3. I don't see membrane capacitance accounted for anywhere in "build neuron", which makes the total voltage equation in build_neuron incorrect.

Regarding getting the parameters correct, there's some details I found in:

https://pubmed.ncbi.nlm.nih.gov/12574423/

and

https://pubmed.ncbi.nlm.nih.gov/12944532/

Namely the area and capacitance used in the models are given. I haven't yet found what value they chose for gsyn, but it looks like "typical" values from a reference text might suffice.

Dhruva2 commented 3 years ago
  1. It would be good to initialise defaults of each ion channel/synapse state as the steady-state values at resting potential or the initial membrane potential. I don't think that is what is killing the model though, as they will quickly settle, at which the model is ready to spike.

  2. Yes, the next thing to do is to figure out how to add units to this, which I completely omitted.

  3. I used as my template a model AB neuron that displays correct behaviour, but where the equations are normalised so the capacitance is one: (see https://github.com/Dhruva2/MyModelMenagerie.jl/blob/master/src/models/STG_Liu.jl , which I copied from code from the Marder lab on the same neuron).

    • In the short term, passing capacitance as an extra parameter to build_neuron would suffice.
    • In the medium term, I think there should be two separate abstract type hierarchies. One (which exists) for ion channels and synapses, which are zero-capacitance ports. Another (which doesn't) for spatial components (like somas), which are themselves passive, but have a capacitance (or geometric properties from which a capacitance can be calculated).

Thanks for the links!

wsphillips commented 3 years ago

Yeah, this will all resolve if we have unit checking (likely via Unitful.jl). Standard capacitance of 1E-6 F/cm^2 (1 µF/cm²) needed to be scaled to match since the gbar values are provided in mS/cm^2. Adding specific membrane capacitance defaulting at 0.001 mF/cm² has improved things on my end (see #8 )

It may not even require all that much effort. A lazy workaround could be to say that neurons have a surface area of 1 by default, and otherwise enforce unit matching via Unitful types.

What's still giving problems at the moment (I think) is appropriate values for maximal synaptic conductance. These I can't find values for so far in the literature and afaik may be rather arbitrary since it's just a reflection of synaptic strength (i.e. not tied to membrane area). Currently, there's either EPSPs that are too weak or blow up the model depending on which order of magnitude you choose in your scripts.

sg-s commented 3 years ago
1. gating variables are being initialized to zero (instead of steady-state values).

this should not matter too much -- ideally the way you want to do it is to set m, h to m_inf, h_inf values, but i would bet that this is not why it's not working

lungd commented 3 years ago

Potential issues leading to incorrect model behavior:

  1. gating variables are being initialized to zero (instead of steady-state values).
  2. units aren't being scaled (i.e. the maximal conductances in the Prinz papers is given in mS/cm²).
  3. I don't see membrane capacitance accounted for anywhere in "build neuron", which makes the total voltage equation in build_neuron incorrect.

Regarding getting the parameters correct, there's some details I found in:

https://pubmed.ncbi.nlm.nih.gov/12574423/

and

https://pubmed.ncbi.nlm.nih.gov/12944532/

Namely the area and capacitance used in the models are given. I haven't yet found what value they chose for gsyn, but it looks like "typical" values from a reference text might suffice.

RE 1. There is an issue already

wsphillips commented 3 years ago

I've tracked down a source of error that is similar to #10 -- synaptic conductance in the original Prinz papers was set to be on the range of 1-100nS, while membrane ion channel gbar values are supplied as per unit area. By not accounting for area, you're implicitly assuming surface area = 1 cm^2. But the gs quoted in the paper is already scaled to the surface area of the neurons they're modeling, which is given as 0.628e-3 cm^2.

You can hack it to work by just multiplying the synaptic conductances by 1e-9/(0.628e-3*1e-3), which gives a "area-less" mS/cm² to match the rest of your model.

Similar issue arises for capcitance not being scaled. (ref: previous comments) See #8 for fixes to both capacitance and synaptic conductances. I think #10 is the last issue to solve.