Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
YAPSUT
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michele Maris
YAPSUT
Commits
65161c2d
Commit
65161c2d
authored
1 year ago
by
Michele Maris
Browse files
Options
Downloads
Patches
Plain Diff
u
parent
9f1297e4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/yapsut/__init__.py
+2
-1
2 additions, 1 deletion
src/yapsut/__init__.py
src/yapsut/mks.py
+33
-21
33 additions, 21 deletions
src/yapsut/mks.py
with
35 additions
and
22 deletions
src/yapsut/__init__.py
+
2
−
1
View file @
65161c2d
# Created : Thu Dec 1 20:04:27 2022
# Created : Thu Dec 1 20:04:27 2022
from
.mks
import
MKS
from
.mks
import
MKS
,
bbMeanPhotonEnergy
from
.blackbody_mks
import
PlanckCn
from
.graphics
import
odot
,
ocirc
,
curveXY2patch
,
SaveFig
,
STANDARDFIG
,
StandardFig
,
ImshowXT
from
.graphics
import
odot
,
ocirc
,
curveXY2patch
,
SaveFig
,
STANDARDFIG
,
StandardFig
,
ImshowXT
from
.pyblocks
import
pyBlocks
from
.pyblocks
import
pyBlocks
from
.AppendableDict
import
AppendableDict
from
.AppendableDict
import
AppendableDict
...
...
This diff is collapsed.
Click to expand it.
src/yapsut/mks.py
+
33
−
21
View file @
65161c2d
...
@@ -20,27 +20,31 @@ class __physical_parameters_mks(object) :
...
@@ -20,27 +20,31 @@ class __physical_parameters_mks(object) :
import
numpy
as
np
import
numpy
as
np
# the table
# the table
self
.
_table
=
pandas
.
read_csv
(
StringIO
(
"""
self
.
_table
=
pandas
.
read_csv
(
StringIO
(
"""
definition , latex_macro, latex_name, symbol, value , units , comment
definition | latex_macro| latex_name| symbol| value | units | comment
speed of light in vacuum , c, speedL, c, 299792458. , m/s ,
speed of light in vacuum | c| speedL | c| 299792458. | m/s |
Planck constant , h, PConst, h, 6.62607015e-34 , J s , also J/Hz
Planck constant | h| PConst | h| 6.62607015e-34 | J s | also J/Hz
reduced Planck constant , hcut, hbar, hbar, 1.0544571817e-34 , J s , also J/Hz is h/2pi
reduced Planck constant | hcut| hbar | hbar| 1.0544571817e-34 | J s | also J/Hz is h/2pi
Avogadro Number , N_{
\\
mathrm{avo}}, Navo, Navo, 6.02214076e23 , 1/mol ,
Avogadro Number | N_{
\\
mathrm{avo}}| Navo | Navo| 6.02214076e23 | 1/mol |
Boltzman constant , k_{
\\
mathrm{B}}, kB, kB, 1.380649e-23 , J/K ,
Boltzman constant | k_{
\\
mathrm{B}}| kB | kB| 1.380649e-23 | J/K |
Universal gas constant , R_{*}, Rgas, Rgas, 8.31446261815324 , J/K/mol , defined as kB*Navo
Universal gas constant | R_{*}| Rgas | Rgas| 8.31446261815324 | J/K/mol | defined as kB*Navo
molar_volume , V_{
\\
mathrm{mol}}, MolVol, Vmol, 22.41396954e-3 , m3/mol , kB(273.15 K)/(101 325 Pa)
molar_volume | V_{
\\
mathrm{mol}}| MolVol | Vmol| 22.41396954e-3 | m3/mol | kB(273.15 K)/(101 325 Pa)
standard atmosphere pressure , p_{
\\
mathrm{atm}}, patm, patm, 101325. , pa ,
standard atmosphere pressure | p_{
\\
mathrm{atm}}| patm | patm| 101325. | pa |
zero Celsius , T_{0^{
\\
circ}
\\
mathrm{C}}, TzCel, T0C, 273.15 , K ,
zero Celsius | T_{0^{
\\
circ}
\\
mathrm{C}}| TzCel | T0C| 273.15 | K |
ev in joule ,
\\
mathrm{J}/
\\
mathrm{ev}, Jev, J_ev, 1.6021766339999e-19 , J/ev ,
ev in joule |
\\
mathrm{J}/
\\
mathrm{ev}| Jev | J_ev| 1.6021766339999e-19 | J/ev |
rad2sed ,
\\
mathrm{rad}/
\\
mathrm{sed}, radTosed, rad2sed, 4.191690043903363e-08, rad s/m , 2*pi/c
rad2sed |
\\
mathrm{rad}/
\\
mathrm{sed}| radTosed | rad2sed| 4.191690043903363e-08| rad s/m | 2*pi/c
Stefan-Boltzman Constant ,
\\
sigma, sigmaSB, sigmaSB, 5.670374419e-8 , W/m2/K4 ,
Stefan-Boltzman Constant |
\\
sigma| sigmaSB | sigmaSB| 5.670374419e-8 | W/m2/K4 |
photons SB constant ,
\\
sigma_{
\\
mathrm{phot}},sigmaSBphot, sigmaSBphot, 2.5247846571310243e-3, micro moles/m2/s/K3,
photons SB constant |
\\
sigma_{
\\
mathrm{phot}}|sigmaSBphot | sigmaSBphot| 2.5247846571310243e-3| micro mol/m2/s/K3|
standard solar temperature , T_{
\\
odot}, Tsun, Tsun, 5772. , K ,
standard solar temperature | T_{
\\
odot}| Tsun | Tsun| 5772. | K |
standard solar radius , R_{
\\
odot}, Rsun, Rsun, 696340e3 , m ,
standard solar radius | R_{
\\
odot}| Rsun | Rsun| 696340e3 | m |
standard AU , \mathrm{AU}, AU, AU, 149597870700. , m , exact
standard AU | \mathrm{AU}| AU | AU| 149597870700. | m | exact
gravitational constant , G_{
\\
mathrm{N}}, GN, GN, 6.67430e-11 , m3/Kg/s2,
gravitational constant | G_{
\\
mathrm{N}}| GN | GN| 6.67430e-11 | m3/Kg/s2|
standard gravitationa acceleration, g_{
\\
mathrm{N}}, gN, gN, 9.80665 , m/s2 ,
standard gravitationa acceleration| g_{
\\
mathrm{N}}| gN | gN| 9.80665 | m/s2 |
parsec ,
\\
mathrm{pc}, pc, pc, 3.08567758149e16 , m , exact
parsec |
\\
mathrm{pc}| pc | pc| 3.08567758149e16 | m | exact
"""
),
sep
=
'
\s*,\s*
'
,
comment
=
'
#
'
,
engine
=
"
python
"
,
index_col
=
None
)
Wien displacement law constant |
\\
lambda_{
\\
mathrm{max}}| lambdaWien | lambdaWien| 2.897771995e-3 | m K | h c / uWien kB
Wien displacement law in frequency|
\\
nu_{
\\
mathrm{max}}| nuWien | nuWien| 9.66592693602719e-12 | K / Hz | lambdaWien/c
Wien displacement law in b.b. x | u_{
\\
mathrm{Wien}}| uWien | uWien| 4.965114231744276303 | | uWien
Black Body mean photon E coeff. | {
\\
tilde E_{
\\
nu}}|meanBBPhotEn| meanBBPhotEn| 3.729378749850374e-23| J / K | sigmaSB/(sigmaSBphot*1e-6*Navo)
"""
),
sep
=
'
\s*\|\s*
'
,
comment
=
'
#
'
,
engine
=
"
python
"
,
index_col
=
None
)
#
#
self
.
_table
[
'
comment
'
]
=
np
.
array
([
''
if
str
(
k
).
lower
()
in
[
'
nan
'
]
else
k
for
k
in
self
.
_table
[
'
comment
'
].
values
])
self
.
_table
[
'
comment
'
]
=
np
.
array
([
''
if
str
(
k
).
lower
()
in
[
'
nan
'
]
else
k
for
k
in
self
.
_table
[
'
comment
'
].
values
])
self
.
_table
[
'
units
'
]
=
np
.
array
([
''
if
str
(
k
).
lower
()
in
[
'
nan
'
]
else
k
for
k
in
self
.
_table
[
'
units
'
].
values
])
self
.
_table
[
'
units
'
]
=
np
.
array
([
''
if
str
(
k
).
lower
()
in
[
'
nan
'
]
else
k
for
k
in
self
.
_table
[
'
units
'
].
values
])
...
@@ -119,6 +123,9 @@ parsec , \\mathrm{pc}, pc,
...
@@ -119,6 +123,9 @@ parsec , \\mathrm{pc}, pc,
def
bbx2wl
(
self
,
x
,
T
)
:
def
bbx2wl
(
self
,
x
,
T
)
:
"""
black body x: x=c*h/kB*T*wl, to wl for given T
"""
"""
black body x: x=c*h/kB*T*wl, to wl for given T
"""
return
self
.
c
*
self
.
h
/
(
T
*
self
.
kB
*
x
)
return
self
.
c
*
self
.
h
/
(
T
*
self
.
kB
*
x
)
def
bbMeanPhotonEnergy
(
self
,
T
)
:
"""
black body mean photon energy for a given T
"""
return
self
.
meanBBPhotEn
*
T
MKS
=
__physical_parameters_mks
()
MKS
=
__physical_parameters_mks
()
def
wl2nu
(
wl
)
:
def
wl2nu
(
wl
)
:
...
@@ -167,3 +174,8 @@ def wl2bbx(wl,T) :
...
@@ -167,3 +174,8 @@ def wl2bbx(wl,T) :
def
bbx2wl
(
x
,
T
)
:
def
bbx2wl
(
x
,
T
)
:
"""
black body x: x=c*h/kB*T*wl, to wl for given T
"""
"""
black body x: x=c*h/kB*T*wl, to wl for given T
"""
return
MKS
.
c
*
MKS
.
h
/
(
T
*
MKS
.
kB
*
x
)
return
MKS
.
c
*
MKS
.
h
/
(
T
*
MKS
.
kB
*
x
)
def
bbMeanPhotonEnergy
(
T
)
:
"""
black body mean photon energy for a given T
"""
return
MKS
.
meanBBPhotEn
*
T
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment