BhallaLab / moose-core

C++ basecode and python scripting interface
https://moose.ncbs.res.in
GNU General Public License v3.0
15 stars 27 forks source link

Interpolation tables affecting accuracy #486

Open subhacom opened 2 months ago

subhacom commented 2 months ago

Current implementation of HHGate and HHGate2D enforces interpolation tables for obtaining the steady-state values of the parameters for gate dynamics (m_inf, m_tau, etc.). However, this can produce numerical inaccuracies depending on the formula for the state variable. For example, in Maex and deSchutter 1998, the KC channel depends on both voltage and [Ca2+]. The equations are more sensitive to [Ca2+]. The default 3000 divisions for the Ca2+ dimension of the 2D interpolation tables produces quite a bit of error compared to other simulators directly evaluating the formula. Changing this to 10000 improves the results, but not good enough. When the cell spikes, soon the interpolation based implementation goes out of sync with exact evaluation. [Ca2+] with 3000 divisions, only CaHVA, KCa (KC), CaPool, and leak conductance are present Gran98_LEMS_MOOSE_capool_20240903_3000divs

[Ca2+] with 10000 divisions: Gran98_LEMS_MOOSE_capool_20240903_10000divs

  1. A switch to go between lookup tables and exact evaluation may help such cases.
  2. In addition, the minimum and maximum values now depend on what the user decides/some reasonable defaults. However, for formulae are agnostic of realistic ranges. This results in hard to find bugs in simulation (the Maex and de Schutter 98 model is an example, where the [Ca2+] can hit 5 mM, and I was originally setting the upper limit to 2 mM). It will help to provide a warning message for the user whenever the boundaries of the interpolation table are hit.