Natural units
Function to convert back and forth between SI and Natural units. The constants \(c, \hbar, \epsilon_0, k_B\) are equal to 1.
- unitconvert.natural.factorNatural(q)
Find the conversion factor that is used to convert the given quantity q to and from Natural units and SI units
- Args :
q (astropy quantity) : the quantity for which unit conversion must be done
- Returns :
(dictionary) : the conversion factor in terms of \(c, \hbar, \epsilon_0, k_B\)
- Example :
>>> from unitconvert.natural import factorNatural >>> from astropy import units as u >>> factorNatural(1*u.m) {'hbar': 1.0, 'c': 1.0, 'k_B': 0, 'eps0': 0.0}
- unitconvert.natural.fromNatural(q, finalUnits)
Convert the given astropy quantity q in natural units to SI units
- Args :
q (astropy quantity) : the quantity which needs to be converted
finalUnits (astropy quantity) : the base units to which quantity needs to be converted back.
For instance both meters and seconds have the same units eV in Natural units. Therefore we need to specify the SI unit to which we need to convert it back to.
- Returns :
(astropy quantity) : the input quantity q in SI units
- Example :
>>> from unitconvert.natural import fromNatural >>> from astropy import units as u >>> fromNatural(5067730.7161564/u.eV,u.m) <Quantity 1. m>
- unitconvert.natural.toNatural(q)
Convert the given astropy quantity q in SI units to Natural units
- Args :
q (astropy quantity) : the quantity which needs to be converted
- Returns :
(astropy quantity) : the input quantity q in natural units
- Example :
>>> from unitconvert.natural import toNatural >>> from astropy import units as u >>> toNatural(1*u.m) <Quantity 5067730.7161564 1 / eV>