Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-sims
csst_ifs_gehong
Commits
ce56e48c
Commit
ce56e48c
authored
Apr 15, 2024
by
Feng Shuai
💬
Browse files
Update tests/test_spec1d.py
parent
bf8acf21
Pipeline
#4098
failed with stage
in 0 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
tests/test_spec1d.py
View file @
ce56e48c
...
...
@@ -31,9 +31,9 @@ class test_spec1d(unittest.TestCase):
print
(
"------------------------Test Magnitude---------------------------"
)
print
(
"1. mr=15"
)
sed1
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
sed1
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
print
(
"2. mr=13"
)
sed2
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
13
,
age
=
1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
sed2
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
13
,
age
=
1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
231
)
...
...
@@ -44,9 +44,9 @@ class test_spec1d(unittest.TestCase):
print
(
"---------------------------Test Age-----------------------------"
)
print
(
"1. Age=0.1Gyr"
)
sed1
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
0.1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
sed1
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
0.1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
print
(
"2. Age=1Gyr"
)
sed2
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
sed2
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
232
)
...
...
@@ -57,9 +57,9 @@ class test_spec1d(unittest.TestCase):
print
(
"-----------------------Test Metallicity-------------------------"
)
print
(
"1. [Fe/H]=0.5"
)
sed1
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
sed1
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
print
(
"2. [Fe/H]=-0.5"
)
sed2
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
-
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
sed2
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
-
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
233
)
...
...
@@ -70,9 +70,9 @@ class test_spec1d(unittest.TestCase):
print
(
"------------------------Test Velocity---------------------------"
)
print
(
"1. v=3000km/s"
)
sed1
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
3000
,
vdisp
=
100
,
ebv
=
0
)
sed1
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
3000
,
vdisp
=
100
,
ebv
=
0
)
print
(
"2. v=6000km/s"
)
sed2
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
6000
,
vdisp
=
100
,
ebv
=
0
)
sed2
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0
,
vel
=
6000
,
vdisp
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
234
)
...
...
@@ -83,9 +83,9 @@ class test_spec1d(unittest.TestCase):
print
(
"-------------------Test Velocity Dispersion----------------------"
)
print
(
"1. sigma=180km/s"
)
sed1
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
180
,
ebv
=
0
)
sed1
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
180
,
ebv
=
0
)
print
(
"2. sigma=350km/s"
)
sed2
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
350
,
ebv
=
0
)
sed2
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
350
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
235
)
...
...
@@ -96,9 +96,9 @@ class test_spec1d(unittest.TestCase):
print
(
"----------------------Test Dust Extinction-----------------------"
)
print
(
"1. E(B-V)=0.1"
)
sed1
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0.1
)
sed1
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0.1
)
print
(
"2. E(B-V)=0.3"
)
sed2
=
s
.
StellarContinuum
(
temp
,
inst
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0.3
)
sed2
=
s
.
StellarContinuum
(
inst
,
temp
,
mag
=
15
,
age
=
1
,
feh
=
0.5
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0.3
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
236
)
...
...
@@ -126,9 +126,9 @@ class test_spec1d(unittest.TestCase):
print
(
"------------------------Test Magnitude---------------------------"
)
print
(
"1. mr=15"
)
sed1
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
sed1
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
print
(
"2. mr=13"
)
sed2
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
13
,
teff
=
10000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
sed2
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
13
,
teff
=
10000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
221
)
...
...
@@ -139,9 +139,9 @@ class test_spec1d(unittest.TestCase):
print
(
"------------------------Test Tempreture--------------------------"
)
print
(
"1. Teff=6000K"
)
sed1
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
6000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
sed1
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
6000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
print
(
"1. Teff=10000K"
)
sed2
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
sed2
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
222
)
...
...
@@ -152,9 +152,9 @@ class test_spec1d(unittest.TestCase):
print
(
"-----------------------Test Metallicity--------------------------"
)
print
(
"1. [Fe/H]=-0.5"
)
sed1
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
10000
,
feh
=
-
0.5
,
vel
=
100
,
ebv
=
0
)
sed1
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
10000
,
feh
=
-
0.5
,
vel
=
100
,
ebv
=
0
)
print
(
"2. [Fe/H]=0.5"
)
sed2
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
10000
,
feh
=
0.5
,
vel
=
100
,
ebv
=
0
)
sed2
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
10000
,
feh
=
0.5
,
vel
=
100
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
223
)
...
...
@@ -165,9 +165,9 @@ class test_spec1d(unittest.TestCase):
print
(
"------------------------Test Velocity---------------------------"
)
print
(
"1. v=-200km/s"
)
sed1
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
-
200
,
ebv
=
0
)
sed1
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
-
200
,
ebv
=
0
)
print
(
"2. v=200km/s"
)
sed2
=
s
.
SingleStar
(
temp
,
inst
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
200
,
ebv
=
0
)
sed2
=
s
.
SingleStar
(
inst
,
temp
,
mag
=
15
,
teff
=
10000
,
feh
=
0
,
vel
=
200
,
ebv
=
0
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
224
)
...
...
@@ -199,9 +199,9 @@ class test_spec1d(unittest.TestCase):
print
(
"---------------------Test Total Halpha Flux----------------------"
)
print
(
"1. F_Halpha = 10 * 1e-17 erg/s/cm^2"
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
print
(
"2. F_Halpha = 50 * 1e-17 erg/s/cm^2"
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
50
,
z
h
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
50
,
log
z
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
231
)
...
...
@@ -213,9 +213,9 @@ class test_spec1d(unittest.TestCase):
print
(
"-------------------Test Gas-Phase Metallicity--------------------"
)
print
(
"1. [Z/H] = 0"
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
0
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
0
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
print
(
"2. [Z/H] = -0.5"
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
0.5
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
0.5
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
232
)
...
...
@@ -227,9 +227,9 @@ class test_spec1d(unittest.TestCase):
print
(
"-------------------------Test Velocity--------------------------"
)
print
(
"1. v=3000km/s"
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
3000
,
vdisp
=
120
,
ebv
=
0.1
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
3000
,
vdisp
=
120
,
ebv
=
0.1
)
print
(
"2. v=6000km/s"
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
6000
,
vdisp
=
120
,
ebv
=
0.1
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
6000
,
vdisp
=
120
,
ebv
=
0.1
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
233
)
...
...
@@ -241,9 +241,9 @@ class test_spec1d(unittest.TestCase):
print
(
"--------------------Test Velocity Dispersion---------------------"
)
print
(
"1. sigma=500km/s"
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
100
,
vdisp
=
500
,
ebv
=
0.1
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
100
,
vdisp
=
500
,
ebv
=
0.1
)
print
(
"2. sigma=100km/s"
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0.1
)
sed2
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
100
,
vdisp
=
100
,
ebv
=
0.1
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
234
)
...
...
@@ -255,9 +255,9 @@ class test_spec1d(unittest.TestCase):
print
(
"----------------------Test Dust Extinction-----------------------"
)
print
(
"1. E(B-V)=0.1"
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.1
)
print
(
"2. E(B-V)=0.3"
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
z
h
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.3
)
sed1
=
s
.
HII_Region
(
inst
,
temp
,
halpha
=
10
,
log
z
=
-
1
,
vel
=
100
,
vdisp
=
120
,
ebv
=
0.3
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
235
)
...
...
@@ -291,11 +291,11 @@ class test_spec1d(unittest.TestCase):
print
(
"1. z=0.2"
)
sed1
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e5
,
edd_ratio
=
0.05
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
print
(
"2. z=0.4"
)
sed2
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e5
,
edd_ratio
=
0.05
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
40000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
40000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
221
)
...
...
@@ -309,11 +309,11 @@ class test_spec1d(unittest.TestCase):
print
(
"1. Mbh=1e6"
)
sed1
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e6
,
edd_ratio
=
0.05
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
print
(
"2. Mbh=5e6"
)
sed2
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
5e6
,
edd_ratio
=
0.05
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
222
)
...
...
@@ -327,11 +327,11 @@ class test_spec1d(unittest.TestCase):
print
(
"1. Edd Ratio = 1.0"
)
sed1
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e5
,
edd_ratio
=
1.0
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
print
(
"2. Edd Ratio = 0.1"
)
sed2
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e5
,
edd_ratio
=
0.1
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
223
)
...
...
@@ -345,11 +345,11 @@ class test_spec1d(unittest.TestCase):
print
(
"1. E(B-V)=0.1"
)
sed1
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e5
,
edd_ratio
=
0.05
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.1
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.1
,
dist
=
20
)
print
(
"2. E(B-V)=0.3"
)
sed2
=
s
.
AGN
(
inst
,
temp
,
bhmass
=
1e5
,
edd_ratio
=
0.05
,
halpha_broad
=
100
,
halpha_narrow
=
100
,
vdisp_broad
=
2000
,
vdisp_narrow
=
500
,
vel
=
20000
,
z
h
=
0
,
ebv
=
0.3
,
dist
=
20
)
vel
=
20000
,
log
z
=
0
,
ebv
=
0.3
,
dist
=
20
)
if
np
.
sum
(
sed1
.
flux
)
!=
np
.
sum
(
sed2
.
flux
):
print
(
"No Problem!"
)
plt
.
subplot
(
224
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment