Brian includes a system for physical units. The base units are defined by their
standard SI unit names: amp/ampere, kilogram/kilogramme,
second, metre/meter, mole/mol, kelvin, and candela.
In addition to these base units, Brian defines a set of derived units:
coulomb, farad, gram/gramme, hertz, joule, liter/
litre, molar, pascal, ohm, siemens, volt, watt,
together with prefixed versions (e.g. msiemens=0.001*siemens) using the
prefixes p,n,u,m,k,M,G,T (two exceptions to this rule: kilogram
is not defined with any additional prefixes, and metre and meter are
additionaly defined with the “centi” prefix, i.e. cmetre/cmeter).
For convenience, a couple of additional useful standard abbreviations such as
cm (instead of cmetre/cmeter), nS (instead of nsiemens),
ms (instead of msecond), Hz (instead of hertz), mM
(instead of mmolar) are included. To avoid clashes with common variable
names, no one-letter abbreviations are provided (e.g. you can use mV or
nS, but notV or S).

Brian only supports temperatures defined in °K, using the provided kelvin
unit object. Other conventions such as °C, or °F are not compatible with Brian’s
unit system, because they cannot be expressed as a multiplicative scaling of the
SI base unit kelvin (their zero point is different). However, in biological
experiments and modeling, temperatures are typically reported in °C. How to use
such temperatures depends on whether they are used as temperature differences
or as absolute temperatures:

temperature differences

Their major use case is the correction of time constants for differences in
temperatures based on the Q10 temperature coefficient.
In this case, all temperatures can directly use kelvin even though the
temperatures are reported in Celsius, since temperature differences in
Celsius and Kelvin are identical.

Earlier versions of Brian had a celsius unit which was in fact
identical to kelvin. While this gave the correct results for
temperature differences, it did not correctly work for absolute
temperatures. To avoid confusion and possible misinterpretation,
the celsius unit has therefore been removed.

The brian2.units.constants package provides a range of physical constants that
can be useful for detailed biological models. Brian provides the following
constants:

Constant

Symbol(s)

Brian name

Value

Avogadro constant

\(N_A, L\)

avogadro_constant

\(6.022140857\times 10^{23}\,\mathrm{mol}^{-1}\)

Boltzmann constant

\(k\)

boltzmann_constant

\(1.38064852\times 10^{-23}\,\mathrm{J}\,\mathrm{K}^{-1}\)

Electric constant

\(\epsilon_0\)

electric_constant

\(8.854187817\times 10^{-12}\,\mathrm{F}\,\mathrm{m}^{-1}\)

Electron mass

\(m_e\)

electron_mass

\(9.10938356\times 10^{-31}\,\mathrm{kg}\)

Elementary charge

\(e\)

elementary_charge

\(1.6021766208\times 10^{-19}\,\mathrm{C}\)

Faraday constant

\(F\)

faraday_constant

\(96485.33289\,\mathrm{C}\,\mathrm{mol}^{-1}\)

Gas constant

\(R\)

gas_constant

\(8.3144598\,\mathrm{J}\,\mathrm{mol}^{-1}\,\mathrm{K}^{-1}\)

Magnetic constant

\(\mu_0\)

magnetic_constant

\(12.566370614\times 10^{-7}\,\mathrm{N}\,\mathrm{A}^{-2}\)

Molar mass constant

\(M_u\)

molar_mass_constant

\(1\times 10^{-3}\,\mathrm{kg}\,\mathrm{mol}^{-1}\)

0°C

zero_celsius

\(273.15\,\mathrm{K}\)

Note that these constants are not imported by default, you will have to
explicitly import them from brian2.units.constants. During the import, you
can also give them shorter names using Python’s from...import...as...
syntax. For example, to calculate the \(\frac{RT}{F}\) factor that appears
in the Goldman–Hodgkin–Katz voltage equation
you can use:

Brian generates standard names for units, combining the unit name (e.g.
“siemens”) with a prefixes (e.g. “m”), and also generates squared and cubed
versions by appending a number. For example, the units “msiemens”, “siemens2”,
“usiemens3” are all predefined. You can import these units from the package
brian2.units.allunits – accordingly, an
frombrian2.units.allunitsimport* will result in everything from
Ylumen3 (cubed yotta lumen) to ymol (yocto mole) being imported.

A better choice is normally to do frombrian2.unitsimport* or import
everything frombrian2import* which only imports the units mentioned in
the introductory paragraph (base units, derived units, and some standard
abbreviations).

In-place operations on quantity arrays change the underlying array, in the
same way as for standard numpy arrays. This means, that any other variables
referencing the same object will be affected as well: