Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatools/constants.py: 0%
46 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1"""
2Constants file contributed by Adam Leroy
3"""
5# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
6# IMPORTS
7# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
9import numpy as _numpy
11# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
12# CGS PHYSICAL CONSTANTS
13# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
15c = 2.99792458e10 # speed of light CGS
16h = 6.6260755e-27 # Planck's constant CGS
17g = 6.67259e-8 # Grav const CGS
18kb = 1.380658e-16 # Boltzmann's const CGS
19a = 7.56591e-15 # Radiation constant CGS
20sb = 5.67051e-5 # sigma (stefan-boltzmann const) CGS
21qe = 4.803206e-10 # Charge of electron CGS
22ev = 1.60217733e-12 # Electron volt CGS
23na = 6.0221367e23 # Avagadro's Number
24me = 9.1093897e-28 # electron mass CGS
25mp = 1.6726231e-24 # proton mass CGS
26mn = 1.674929e-24 # neutron mass CGS
27mh = 1.673534e-24 # hydrogen mass CGS
28amu = 1.6605402e-24 # atomic mass unit CGS
30# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
31# ASTRONOMICAL CONSTANTS
32# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
34# GENERAL
35au = 1.496e13 # astronomical unit CGS
36pc = 3.0857e18 # parsec CGS
37yr = 3.155815e7 # sidereal year CGS
38ms = 1.98900e+33 # solar mass CGS
39rs = 6.9599e10 # sun's radius CGS
40ls = 3.839e33 # sun's luminosity CGS
41mm = 7.35000e+25 # moon mass CGS
42mer = 5.97400e+27 # earth mass CGS
43rer = 6.378e8 # earth's radius CGS
44medd = 3.60271e+34 # Eddington mass CGS
46# RADIO SPECIFIC
47jy = 1.e-23 # Jansky CGS
48restfreq_hi = 1420405751.786 # 21cm transition (Hz)
49restfreq_co = 115271201800. # CO J=1-0 (Hz)
50cm2perkkms_hi = 1.823e18 # HI column per intensity (thin)
52# OTHER WAVELENGTHS
53ksun = 3.28 # abs K mag of sun (Binney & Merrifield)
55# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
56# GEOMETRY
57# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
59srdeg = 3283.0 # Degrees squared in a steradian
60dtor = 0.0174532925199 # Degrees per radian
61pi = 3.14159265359 # Pi
63# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
64# BASIC PHYSICAL FUNCTIONS
65# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
67def bb_inu(temp_k=None, lam_cm=None):
68 """
69 Planck function. Returns f_nu given T and lambda.
70 """
71 nu = c / lam_cm
72 fnu = 2.0*h*nu**3/c**2 /(_numpy.exp(h*nu/(kb*temp_k))-1.0)
73 return fnu, "erg/s/cm^2/sr/Hz"
75def bb_ilam(temp_k=None, lam_cm=None):
76 """
77 Planck function. Returns f_lambda given T and lambda.
78 """
79 flam = 2.0*h*c**2/lam_cm**5 / (_numpy.exp(h*c/(lam_cm*kb*temp_k))-1.0)
80 return (flam, "erg/s/cm^2/sr/cm")
82def peak_inu(temp_k=None):
83 """
84 Wavelength for peak of F_nu given T.
85 """
86 peak_lam = 2.821439372/kb/temp_k/h
87 peak_nu = c / peak_lam
88 return (peak_lam, "cm")
90def peak_ilam(temp_k=None):
91 """
92 Wavelength for peak of F_lambda given T.
93 """
94 return h*c/kb/temp_k/4.965114231, "cm"
96# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&
97# UNIT CONVERSIONS
98# %&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&%&