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

Regarding automatic conversion to "Neuroscience" units #398

Open PTraeder opened 6 years ago

PTraeder commented 6 years ago

As previously discussed, the current code automatically converts variables of e.g. type s to the respective NEST unit (here: ms).

This is fine for expressions that directly resolve to a higher/lower magnitude of one of the defined "neuroscience" units: nS, Gohm, ms, pF, mV, pA

In the generated code, NESTML variables of e.g. type s are then subject to a factor of 1000 to convert the runtime value in seconds to the corresponding amount of milliseconds. At the same time, a NESTML variables of type ns would, in the corresponding C++ code, be multiplied by 0.000001.

However a variable of e.g. type coulomb (C= s*A) would not be subject to such a conversion since no "neuroscience" target is defined for coulomb. In my understanding it should be subject to a conversion, in this case we could simply multiply the factors for each of the constituting SI base units (s and A) which would result in 10^3 * 10^12. While this would be a solution, it does not make much sense to me.

Should we handle units like coulomb, newton, etc which are not themselves "neuroscience" units in any way? @heplesser @jougs @DimitriPlotnikov @Silmathoron

Silmathoron commented 6 years ago

Sorry for the late reply... To me, it seems that the only important thing is that any value passed to a C++ expression is expressed in the correct NEST units. However, I think that having a coherent approach would be better so that people don't have to think about it too much.

This is a point that was discussed before here and here and I proposed a coherent "neuroscience system" before, which I think should be the coherent unit system for NEST.

I'll let @heplesser and @jougs give their opinion on this proposed system ;)

heplesser commented 6 years ago

Sorry for my very delayed reply. The NEST system of scales for units is based on internal consistency. This we should also apply to units for which we have not yet fixed a scale prefactor. In this case

So electrical charge should be expressed in femto-Coulomb.

Silmathoron commented 5 years ago

Now that we are using astropy, do we care which unit is used in the C++ code for "non-neuroscience" units (i.e. units which do not interact with ms, mV, pA, pF, nS, etc). I don't think so but I would like to make sure it's not the case... So would there be units other than fC that we need to fix?

For reminder, to support detailed conductance-based models we need concentrations, volumes, temperatures, and distances, but I don't think this would interact...