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_mci_sim
Commits
5f8779ad
Commit
5f8779ad
authored
Apr 14, 2024
by
Yan Zhaojun
Browse files
test
parent
e0768565
Pipeline
#4057
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_mci_sim/csst_mci_sim.py
View file @
5f8779ad
...
...
@@ -2031,7 +2031,7 @@ class MCIsimulator():
st_magz
=
[]
self
.
log
.
info
(
'load star catlog 777777777'
)
#################### generate star image ##########
if
self
.
debug
:
...
...
@@ -2047,7 +2047,10 @@ class MCIsimulator():
Nstar
=
nstar
-
8
for
j
in
tqdm
(
range
(
Nstar
)):
### nsrcs length
for
j
in
tqdm
(
range
(
Nstar
)):
### nsrcs length
self
.
log
.
info
(
'begin iteration........'
)
if
j
<
nsrcs
-
8
:
starRa
=
3600.0
*
(
newRa
[
j
]
)
# ra of star, arcsecond
...
...
@@ -2140,13 +2143,19 @@ class MCIsimulator():
wave
=
np
.
linspace
(
2500
,
11000
,
8501
)
# Input redshift
redshift
=
0
self
.
log
.
info
(
'load star catlog 777777777'
)
# Loading galaxy SED template
t
=
sed
.
Gal_Temp
()
t
=
sed
.
Gal_Temp
(
self
.
information
[
'dir_path'
]
)
# Calculating the magnitude (u, g, r, i, z) of each template
t
.
toMag
(
redshift
=
redshift
)
# Calculating flux
ugriz
=
np
.
array
([
umag
,
gmag
,
rmag
,
imag
,
zmag
])
star_flux
=
sed
.
Model_Galaxy_SED
(
wave
,
ugriz
,
redshift
,
t
)
star_flux
=
sed
.
Model_Galaxy_SED
(
wave
,
ugriz
,
redshift
,
t
)
self
.
log
.
info
(
'load star catlog 888888888888'
)
else
:
...
...
@@ -2158,19 +2167,22 @@ class MCIsimulator():
wave
=
np
.
linspace
(
2500
,
11000
,
8501
)
# Input redshift
redshift
=
0
redshift
=
0
# Loading galaxy SED template
t
=
sed
.
Gal_Temp
()
t
=
sed
.
Gal_Temp
(
self
.
information
[
'dir_path'
]
)
# Calculating the magnitude (u, g, r, i, z) of each template
t
.
toMag
(
redshift
=
redshift
)
# Calculating flux
ugriz
=
np
.
array
([
umag
,
gmag
,
rmag
,
imag
,
zmag
])
star_flux
=
sed
.
Model_Galaxy_SED
(
wave
,
ugriz
,
redshift
,
t
)
#########################################
self
.
log
.
info
(
'load star catlog 99999999'
)
##cal_SED_photons(self, flux_arr):
intscales
,
PSF_eff_weight
=
self
.
cal_SED_photons
(
star_flux
)
self
.
information
[
'dir_path 99999999999999'
]
gx
=
dict
()
gy
=
dict
()
...
...
csst_mci_sim/support/sed.py
View file @
5f8779ad
...
...
@@ -56,7 +56,7 @@ def reddening(wave, flux, ebv = 0.0, law = 'calzetti', Rv = 4.05):
fluxNew
=
flux
/
(
10.
**
(
0.4
*
ebv
*
curve
))
return
fluxNew
def
flux_to_mag
(
wave
,
flux
,
band
=
'GAIA_bp'
):
def
flux_to_mag
(
wave
,
flux
,
path
,
band
=
'GAIA_bp'
):
"""Convert flux of given spectra to magnitude
Args:
...
...
@@ -68,11 +68,11 @@ def flux_to_mag(wave, flux, band='GAIA_bp'):
float: value of magnitude
"""
# /home/yan/MCI_sim/MCI_input/SED_Code/data
import
os
##
import os
parent
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
###
parent = os.path.dirname(os.path.realpath(__file__))
band
=
ascii
.
read
(
pa
rent
+
'
/seddata/'
+
band
+
'.dat'
)
band
=
ascii
.
read
(
pa
th
+
'MCI_inputData/SED_Code
/seddata/'
+
band
+
'.dat'
)
wave0
=
band
[
'col1'
]
curv0
=
band
[
'col2'
]
...
...
@@ -120,12 +120,13 @@ class Gal_Temp():
Template of Galaxy SED
"""
def
__init__
(
self
):
import
os
def
__init__
(
self
,
path
):
parent
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
###import os
hdulist
=
fits
.
open
(
parent
+
'/seddata/galaxy_temp.fits'
)
###parent = os.path.dirname(os.path.realpath(__file__))
hdulist
=
fits
.
open
(
path
+
'MCI_inputData/SED_Code/seddata/galaxy_temp.fits'
)
self
.
wave
=
hdulist
[
1
].
data
[
'wave'
]
self
.
flux
=
hdulist
[
2
].
data
self
.
age_grid
=
hdulist
[
3
].
data
[
'logAge'
]
...
...
@@ -149,14 +150,14 @@ class Star_Temp():
Template of Stellar SED
"""
def
__init__
(
self
):
def
__init__
(
self
,
path
):
import
os
##
import os
parent
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
####
parent = os.path.dirname(os.path.realpath(__file__))
###print("获取其父目录——" + parent) # 从当前文件路径中获取目录
hdulist
=
fits
.
open
(
pa
rent
+
'
/seddata/stellar_temp.fits'
)
hdulist
=
fits
.
open
(
pa
th
+
'MCI_inputData/SED_Code
/seddata/stellar_temp.fits'
)
self
.
wave
=
hdulist
[
1
].
data
[
'wave'
]
self
.
flux
=
hdulist
[
2
].
data
self
.
Teff_grid
=
hdulist
[
3
].
data
[
'Teff'
]
...
...
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