Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/scipy/constants/__init__.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1r"""
2==================================
3Constants (:mod:`scipy.constants`)
4==================================
6.. currentmodule:: scipy.constants
8Physical and mathematical constants and units.
11Mathematical constants
12======================
14================ =================================================================
15``pi`` Pi
16``golden`` Golden ratio
17``golden_ratio`` Golden ratio
18================ =================================================================
21Physical constants
22==================
24=========================== =================================================================
25``c`` speed of light in vacuum
26``speed_of_light`` speed of light in vacuum
27``mu_0`` the magnetic constant :math:`\mu_0`
28``epsilon_0`` the electric constant (vacuum permittivity), :math:`\epsilon_0`
29``h`` the Planck constant :math:`h`
30``Planck`` the Planck constant :math:`h`
31``hbar`` :math:`\hbar = h/(2\pi)`
32``G`` Newtonian constant of gravitation
33``gravitational_constant`` Newtonian constant of gravitation
34``g`` standard acceleration of gravity
35``e`` elementary charge
36``elementary_charge`` elementary charge
37``R`` molar gas constant
38``gas_constant`` molar gas constant
39``alpha`` fine-structure constant
40``fine_structure`` fine-structure constant
41``N_A`` Avogadro constant
42``Avogadro`` Avogadro constant
43``k`` Boltzmann constant
44``Boltzmann`` Boltzmann constant
45``sigma`` Stefan-Boltzmann constant :math:`\sigma`
46``Stefan_Boltzmann`` Stefan-Boltzmann constant :math:`\sigma`
47``Wien`` Wien displacement law constant
48``Rydberg`` Rydberg constant
49``m_e`` electron mass
50``electron_mass`` electron mass
51``m_p`` proton mass
52``proton_mass`` proton mass
53``m_n`` neutron mass
54``neutron_mass`` neutron mass
55=========================== =================================================================
58Constants database
59------------------
61In addition to the above variables, :mod:`scipy.constants` also contains the
622018 CODATA recommended values [CODATA2018]_ database containing more physical
63constants.
65.. autosummary::
66 :toctree: generated/
68 value -- Value in physical_constants indexed by key
69 unit -- Unit in physical_constants indexed by key
70 precision -- Relative precision in physical_constants indexed by key
71 find -- Return list of physical_constant keys with a given string
72 ConstantWarning -- Constant sought not in newest CODATA data set
74.. data:: physical_constants
76 Dictionary of physical constants, of the format
77 ``physical_constants[name] = (value, unit, uncertainty)``.
79Available constants:
81====================================================================== ====
82%(constant_names)s
83====================================================================== ====
86Units
87=====
89SI prefixes
90-----------
92============ =================================================================
93``yotta`` :math:`10^{24}`
94``zetta`` :math:`10^{21}`
95``exa`` :math:`10^{18}`
96``peta`` :math:`10^{15}`
97``tera`` :math:`10^{12}`
98``giga`` :math:`10^{9}`
99``mega`` :math:`10^{6}`
100``kilo`` :math:`10^{3}`
101``hecto`` :math:`10^{2}`
102``deka`` :math:`10^{1}`
103``deci`` :math:`10^{-1}`
104``centi`` :math:`10^{-2}`
105``milli`` :math:`10^{-3}`
106``micro`` :math:`10^{-6}`
107``nano`` :math:`10^{-9}`
108``pico`` :math:`10^{-12}`
109``femto`` :math:`10^{-15}`
110``atto`` :math:`10^{-18}`
111``zepto`` :math:`10^{-21}`
112============ =================================================================
114Binary prefixes
115---------------
117============ =================================================================
118``kibi`` :math:`2^{10}`
119``mebi`` :math:`2^{20}`
120``gibi`` :math:`2^{30}`
121``tebi`` :math:`2^{40}`
122``pebi`` :math:`2^{50}`
123``exbi`` :math:`2^{60}`
124``zebi`` :math:`2^{70}`
125``yobi`` :math:`2^{80}`
126============ =================================================================
128Mass
129----
131================= ============================================================
132``gram`` :math:`10^{-3}` kg
133``metric_ton`` :math:`10^{3}` kg
134``grain`` one grain in kg
135``lb`` one pound (avoirdupous) in kg
136``pound`` one pound (avoirdupous) in kg
137``blob`` one inch version of a slug in kg (added in 1.0.0)
138``slinch`` one inch version of a slug in kg (added in 1.0.0)
139``slug`` one slug in kg (added in 1.0.0)
140``oz`` one ounce in kg
141``ounce`` one ounce in kg
142``stone`` one stone in kg
143``grain`` one grain in kg
144``long_ton`` one long ton in kg
145``short_ton`` one short ton in kg
146``troy_ounce`` one Troy ounce in kg
147``troy_pound`` one Troy pound in kg
148``carat`` one carat in kg
149``m_u`` atomic mass constant (in kg)
150``u`` atomic mass constant (in kg)
151``atomic_mass`` atomic mass constant (in kg)
152================= ============================================================
154Angle
155-----
157================= ============================================================
158``degree`` degree in radians
159``arcmin`` arc minute in radians
160``arcminute`` arc minute in radians
161``arcsec`` arc second in radians
162``arcsecond`` arc second in radians
163================= ============================================================
166Time
167----
169================= ============================================================
170``minute`` one minute in seconds
171``hour`` one hour in seconds
172``day`` one day in seconds
173``week`` one week in seconds
174``year`` one year (365 days) in seconds
175``Julian_year`` one Julian year (365.25 days) in seconds
176================= ============================================================
179Length
180------
182===================== ============================================================
183``inch`` one inch in meters
184``foot`` one foot in meters
185``yard`` one yard in meters
186``mile`` one mile in meters
187``mil`` one mil in meters
188``pt`` one point in meters
189``point`` one point in meters
190``survey_foot`` one survey foot in meters
191``survey_mile`` one survey mile in meters
192``nautical_mile`` one nautical mile in meters
193``fermi`` one Fermi in meters
194``angstrom`` one Angstrom in meters
195``micron`` one micron in meters
196``au`` one astronomical unit in meters
197``astronomical_unit`` one astronomical unit in meters
198``light_year`` one light year in meters
199``parsec`` one parsec in meters
200===================== ============================================================
202Pressure
203--------
205================= ============================================================
206``atm`` standard atmosphere in pascals
207``atmosphere`` standard atmosphere in pascals
208``bar`` one bar in pascals
209``torr`` one torr (mmHg) in pascals
210``mmHg`` one torr (mmHg) in pascals
211``psi`` one psi in pascals
212================= ============================================================
214Area
215----
217================= ============================================================
218``hectare`` one hectare in square meters
219``acre`` one acre in square meters
220================= ============================================================
223Volume
224------
226=================== ========================================================
227``liter`` one liter in cubic meters
228``litre`` one liter in cubic meters
229``gallon`` one gallon (US) in cubic meters
230``gallon_US`` one gallon (US) in cubic meters
231``gallon_imp`` one gallon (UK) in cubic meters
232``fluid_ounce`` one fluid ounce (US) in cubic meters
233``fluid_ounce_US`` one fluid ounce (US) in cubic meters
234``fluid_ounce_imp`` one fluid ounce (UK) in cubic meters
235``bbl`` one barrel in cubic meters
236``barrel`` one barrel in cubic meters
237=================== ========================================================
239Speed
240-----
242================== ==========================================================
243``kmh`` kilometers per hour in meters per second
244``mph`` miles per hour in meters per second
245``mach`` one Mach (approx., at 15 C, 1 atm) in meters per second
246``speed_of_sound`` one Mach (approx., at 15 C, 1 atm) in meters per second
247``knot`` one knot in meters per second
248================== ==========================================================
251Temperature
252-----------
254===================== =======================================================
255``zero_Celsius`` zero of Celsius scale in Kelvin
256``degree_Fahrenheit`` one Fahrenheit (only differences) in Kelvins
257===================== =======================================================
259.. autosummary::
260 :toctree: generated/
262 convert_temperature
264Energy
265------
267==================== =======================================================
268``eV`` one electron volt in Joules
269``electron_volt`` one electron volt in Joules
270``calorie`` one calorie (thermochemical) in Joules
271``calorie_th`` one calorie (thermochemical) in Joules
272``calorie_IT`` one calorie (International Steam Table calorie, 1956) in Joules
273``erg`` one erg in Joules
274``Btu`` one British thermal unit (International Steam Table) in Joules
275``Btu_IT`` one British thermal unit (International Steam Table) in Joules
276``Btu_th`` one British thermal unit (thermochemical) in Joules
277``ton_TNT`` one ton of TNT in Joules
278==================== =======================================================
280Power
281-----
283==================== =======================================================
284``hp`` one horsepower in watts
285``horsepower`` one horsepower in watts
286==================== =======================================================
288Force
289-----
291==================== =======================================================
292``dyn`` one dyne in newtons
293``dyne`` one dyne in newtons
294``lbf`` one pound force in newtons
295``pound_force`` one pound force in newtons
296``kgf`` one kilogram force in newtons
297``kilogram_force`` one kilogram force in newtons
298==================== =======================================================
300Optics
301------
303.. autosummary::
304 :toctree: generated/
306 lambda2nu
307 nu2lambda
309References
310==========
312.. [CODATA2018] CODATA Recommended Values of the Fundamental
313 Physical Constants 2018.
315 https://physics.nist.gov/cuu/Constants/
317"""
318# Modules contributed by BasSw (wegwerp@gmail.com)
319from .codata import *
320from .constants import *
321from .codata import _obsolete_constants
323_constant_names = [(_k.lower(), _k, _v)
324 for _k, _v in physical_constants.items()
325 if _k not in _obsolete_constants]
326_constant_names = "\n".join(["``%s``%s %s %s" % (_x[1], " "*(66-len(_x[1])),
327 _x[2][0], _x[2][1])
328 for _x in sorted(_constant_names)])
329if __doc__:
330 __doc__ = __doc__ % dict(constant_names=_constant_names)
332del _constant_names
334__all__ = [s for s in dir() if not s.startswith('_')]
336from scipy._lib._testutils import PytestTester
337test = PytestTester(__name__)
338del PytestTester