Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/scipy/constants/__init__.py: 100%
14 statements
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-12 06:31 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2023-12-12 06:31 +0000
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``yocto`` :math:`10^{-24}`
113============ =================================================================
115Binary prefixes
116---------------
118============ =================================================================
119``kibi`` :math:`2^{10}`
120``mebi`` :math:`2^{20}`
121``gibi`` :math:`2^{30}`
122``tebi`` :math:`2^{40}`
123``pebi`` :math:`2^{50}`
124``exbi`` :math:`2^{60}`
125``zebi`` :math:`2^{70}`
126``yobi`` :math:`2^{80}`
127============ =================================================================
129Mass
130----
132================= ============================================================
133``gram`` :math:`10^{-3}` kg
134``metric_ton`` :math:`10^{3}` kg
135``grain`` one grain in kg
136``lb`` one pound (avoirdupous) in kg
137``pound`` one pound (avoirdupous) in kg
138``blob`` one inch version of a slug in kg (added in 1.0.0)
139``slinch`` one inch version of a slug in kg (added in 1.0.0)
140``slug`` one slug in kg (added in 1.0.0)
141``oz`` one ounce in kg
142``ounce`` one ounce in kg
143``stone`` one stone in kg
144``grain`` one grain in kg
145``long_ton`` one long ton in kg
146``short_ton`` one short ton in kg
147``troy_ounce`` one Troy ounce in kg
148``troy_pound`` one Troy pound in kg
149``carat`` one carat in kg
150``m_u`` atomic mass constant (in kg)
151``u`` atomic mass constant (in kg)
152``atomic_mass`` atomic mass constant (in kg)
153================= ============================================================
155Angle
156-----
158================= ============================================================
159``degree`` degree in radians
160``arcmin`` arc minute in radians
161``arcminute`` arc minute in radians
162``arcsec`` arc second in radians
163``arcsecond`` arc second in radians
164================= ============================================================
167Time
168----
170================= ============================================================
171``minute`` one minute in seconds
172``hour`` one hour in seconds
173``day`` one day in seconds
174``week`` one week in seconds
175``year`` one year (365 days) in seconds
176``Julian_year`` one Julian year (365.25 days) in seconds
177================= ============================================================
180Length
181------
183===================== ============================================================
184``inch`` one inch in meters
185``foot`` one foot in meters
186``yard`` one yard in meters
187``mile`` one mile in meters
188``mil`` one mil in meters
189``pt`` one point in meters
190``point`` one point in meters
191``survey_foot`` one survey foot in meters
192``survey_mile`` one survey mile in meters
193``nautical_mile`` one nautical mile in meters
194``fermi`` one Fermi in meters
195``angstrom`` one Angstrom in meters
196``micron`` one micron in meters
197``au`` one astronomical unit in meters
198``astronomical_unit`` one astronomical unit in meters
199``light_year`` one light year in meters
200``parsec`` one parsec in meters
201===================== ============================================================
203Pressure
204--------
206================= ============================================================
207``atm`` standard atmosphere in pascals
208``atmosphere`` standard atmosphere in pascals
209``bar`` one bar in pascals
210``torr`` one torr (mmHg) in pascals
211``mmHg`` one torr (mmHg) in pascals
212``psi`` one psi in pascals
213================= ============================================================
215Area
216----
218================= ============================================================
219``hectare`` one hectare in square meters
220``acre`` one acre in square meters
221================= ============================================================
224Volume
225------
227=================== ========================================================
228``liter`` one liter in cubic meters
229``litre`` one liter in cubic meters
230``gallon`` one gallon (US) in cubic meters
231``gallon_US`` one gallon (US) in cubic meters
232``gallon_imp`` one gallon (UK) in cubic meters
233``fluid_ounce`` one fluid ounce (US) in cubic meters
234``fluid_ounce_US`` one fluid ounce (US) in cubic meters
235``fluid_ounce_imp`` one fluid ounce (UK) in cubic meters
236``bbl`` one barrel in cubic meters
237``barrel`` one barrel in cubic meters
238=================== ========================================================
240Speed
241-----
243================== ==========================================================
244``kmh`` kilometers per hour in meters per second
245``mph`` miles per hour in meters per second
246``mach`` one Mach (approx., at 15 C, 1 atm) in meters per second
247``speed_of_sound`` one Mach (approx., at 15 C, 1 atm) in meters per second
248``knot`` one knot in meters per second
249================== ==========================================================
252Temperature
253-----------
255===================== =======================================================
256``zero_Celsius`` zero of Celsius scale in Kelvin
257``degree_Fahrenheit`` one Fahrenheit (only differences) in Kelvins
258===================== =======================================================
260.. autosummary::
261 :toctree: generated/
263 convert_temperature
265Energy
266------
268==================== =======================================================
269``eV`` one electron volt in Joules
270``electron_volt`` one electron volt in Joules
271``calorie`` one calorie (thermochemical) in Joules
272``calorie_th`` one calorie (thermochemical) in Joules
273``calorie_IT`` one calorie (International Steam Table calorie, 1956) in Joules
274``erg`` one erg in Joules
275``Btu`` one British thermal unit (International Steam Table) in Joules
276``Btu_IT`` one British thermal unit (International Steam Table) in Joules
277``Btu_th`` one British thermal unit (thermochemical) in Joules
278``ton_TNT`` one ton of TNT in Joules
279==================== =======================================================
281Power
282-----
284==================== =======================================================
285``hp`` one horsepower in watts
286``horsepower`` one horsepower in watts
287==================== =======================================================
289Force
290-----
292==================== =======================================================
293``dyn`` one dyne in newtons
294``dyne`` one dyne in newtons
295``lbf`` one pound force in newtons
296``pound_force`` one pound force in newtons
297``kgf`` one kilogram force in newtons
298``kilogram_force`` one kilogram force in newtons
299==================== =======================================================
301Optics
302------
304.. autosummary::
305 :toctree: generated/
307 lambda2nu
308 nu2lambda
310References
311==========
313.. [CODATA2018] CODATA Recommended Values of the Fundamental
314 Physical Constants 2018.
316 https://physics.nist.gov/cuu/Constants/
318"""
319# Modules contributed by BasSw (wegwerp@gmail.com)
320from ._codata import *
321from ._constants import *
322from ._codata import _obsolete_constants, physical_constants
324# Deprecated namespaces, to be removed in v2.0.0
325from . import codata, constants
327_constant_names_list = [(_k.lower(), _k, _v)
328 for _k, _v in physical_constants.items()
329 if _k not in _obsolete_constants]
330_constant_names = "\n".join(["``%s``%s %s %s" % (_x[1], " "*(66-len(_x[1])),
331 _x[2][0], _x[2][1])
332 for _x in sorted(_constant_names_list)])
333if __doc__:
334 __doc__ = __doc__ % dict(constant_names=_constant_names)
336del _constant_names
337del _constant_names_list
339__all__ = [s for s in dir() if not s.startswith('_')]
341from scipy._lib._testutils import PytestTester
342test = PytestTester(__name__)
343del PytestTester