When to use 'special units' in equations?

Hi, I’m new to Brian and a bit confused about the unit options for equations. The documentation says that “There are also three special “units” that can be used: 1 denotes a dimensionless floating point variable, boolean and integer denote dimensionless variables of the respective kind.”; but I couldn’t find an explanation for the purpose of these special units and when to use them. The tutorials just tell you to specify units in general but not really why which one should be used.

Sorry if this is a stupid question, please point me in the right direction

Hi @tim-ufer. With these “special units”, we are a bit abusing terminology: usually, the units after the colon are actually about physical units, i.e. specifying the physical dimensions of the variable, e.g. voltage in volt, length in meters, time in seconds, etc. “1” is a shorthand for dimensionless variables (either used in simplified models, or for things like “synaptic conductance relative to the leak conductance of the cell”). Internally, all of these variables are stored as floating point values, which is normally what you want. There are other use cases for model variables, though, e.g. you might want to store the total number of spikes a neuron emitted, some kind of index or discrete category, etc. In that case, storing the value as a floating point variable does not make sense, and could potentially even lead to some tricky rounding/comparison issues. In these cases, you should instead define the variable with integer as the “unit” – the fact that it is a dimensionless variable, is implicit in this declaration. The same goes for boolean, you might have some variable in your model that represents a switch (cell is active, synapse is plastic, etc.), in that case it makes sense to store it as a True/False value. The refractoriness of a cell is internally handled in this way, for example.

Hope that makes sense?

1 Like