| 1 |
r""" |
| 2 |
A module providing some physical units as `Quantity` objects. Note that these |
| 3 |
units are not imported by wildcard imports (e.g. `from brian2 import *`), they |
| 4 |
have to be imported explicitly. You can use ``import ... as ...`` to import them |
| 5 |
with shorter names, e.g.:: |
| 6 |
|
| 7 |
from brian2.units.constants import faraday_constant as F |
| 8 |
|
| 9 |
The available constants are: |
| 10 |
|
| 11 |
==================== ================== ======================= ================================================================== |
| 12 |
Constant Symbol(s) Brian name Value |
| 13 |
==================== ================== ======================= ================================================================== |
| 14 |
Avogadro constant :math:`N_A, L` ``avogadro_constant`` :math:`6.022140857\times 10^{23}\,\mathrm{mol}^{-1}` |
| 15 |
Boltzmann constant :math:`k` ``boltzmann_constant`` :math:`1.38064852\times 10^{-23}\,\mathrm{J}\,\mathrm{K}^{-1}` |
| 16 |
Electric constant :math:`\epsilon_0` ``electric_constant`` :math:`8.854187817\times 10^{-12}\,\mathrm{F}\,\mathrm{m}^{-1}` |
| 17 |
Electron mass :math:`m_e` ``electron_mass`` :math:`9.10938356\times 10^{-31}\,\mathrm{kg}` |
| 18 |
Elementary charge :math:`e` ``elementary_charge`` :math:`1.6021766208\times 10^{-19}\,\mathrm{C}` |
| 19 |
Faraday constant :math:`F` ``faraday_constant`` :math:`96485.33289\,\mathrm{C}\,\mathrm{mol}^{-1}` |
| 20 |
Gas constant :math:`R` ``gas_constant`` :math:`8.3144598\,\mathrm{J}\,\mathrm{mol}^{-1}\,\mathrm{K}^{-1}` |
| 21 |
Magnetic constant :math:`\mu_0` ``magnetic_constant`` :math:`12.566370614\times 10^{-7}\,\mathrm{N}\,\mathrm{A}^{-2}` |
| 22 |
Molar mass constant :math:`M_u` ``molar_mass_constant`` :math:`1\times 10^{-3}\,\mathrm{kg}\,\mathrm{mol}^{-1}` |
| 23 |
0°C ``zero_celsius`` :math:`273.15\,\mathrm{K}` |
| 24 |
==================== ================== ======================= ================================================================== |
| 25 |
""" |
| 26 |
|
| 27 |
import numpy as np |
| 28 |
|
| 29 |
from .allunits import ( |
| 30 |
amp, |
| 31 |
coulomb, |
| 32 |
farad, |
| 33 |
gram, |
| 34 |
joule, |
| 35 |
kelvin, |
| 36 |
kilogram, |
| 37 |
meter, |
| 38 |
mole, |
| 39 |
newton, |
| 40 |
) |
| 41 |
from .fundamentalunits import Unit |
| 42 |
|
| 43 |
Unit.automatically_register_units = False |
| 44 |
|
| 45 |
#: Avogadro constant (http://physics.nist.gov/cgi-bin/cuu/Value?na) |
| 46 |
avogadro_constant = 6.022140857e23 / mole |
| 47 |
#: Boltzmann constant (physics.nist.gov/cgi-bin/cuu/Value?k) |
| 48 |
boltzmann_constant = 1.38064852e-23 * joule / kelvin |
| 49 |
#: electric constant (http://physics.nist.gov/cgi-bin/cuu/Value?ep0) |
| 50 |
electric_constant = 8.854187817e-12 * farad / meter |
| 51 |
#: Electron rest mass (physics.nist.gov/cgi-bin/cuu/Value?me) |
| 52 |
electron_mass = 9.10938356e-31 * kilogram |
| 53 |
#: Elementary charge (physics.nist.gov/cgi-bin/cuu/Value?e) |
| 54 |
elementary_charge = 1.6021766208e-19 * coulomb |
| 55 |
#: Faraday constant (http://physics.nist.gov/cgi-bin/cuu/Value?f) |
| 56 |
faraday_constant = 96485.33289 * coulomb / mole |
| 57 |
#: gas constant (http://physics.nist.gov/cgi-bin/cuu/Value?r) |
| 58 |
gas_constant = 8.3144598 * joule / mole / kelvin |
| 59 |
#: Magnetic constant (http://physics.nist.gov/cgi-bin/cuu/Value?mu0) |
| 60 |
magnetic_constant = 4 * np.pi * 1e-7 * newton / amp**2 |
| 61 |
#: Molar mass constant (http://physics.nist.gov/cgi-bin/cuu/Value?mu) |
| 62 |
molar_mass_constant = 1 * gram / mole |
| 63 |
#: zero degree Celsius |
| 64 |
zero_celsius = 273.15 * kelvin |
| 65 |
|
| 66 |
Unit.automatically_register_units = True |