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
f6a0c574
Commit
f6a0c574
authored
Jan 23, 2025
by
Yan Zhaojun
Browse files
update
parent
bd72dad4
Pipeline
#7844
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
csst_mci_sim/mci_data/mci_all_9K.config
deleted
100755 → 0
View file @
bd72dad4
[
TEST
]
dir_path
=
mci_sim
/
MCI_inputData
/
result_path
=
mci_sim
/
mci_sim_result
/
ver
=
C10
#size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232
xsize
=
9216
ysize
=
9232
##overscanx = column, overscany =row
prescan
=
27
overscan
=
320
#charge trap information file
parallelTrapfile
=
MCI_inputData
/
data
/
cdm_euclid_parallel
.
dat
serialTrapfile
=
MCI_inputData
/
data
/
cdm_euclid_serial
.
dat
#cosmetic defects input file
cosmeticsFile_g
=
MCI_inputData
/
data
/
Cosmetics_g
.
txt
cosmeticsFile_r
=
MCI_inputData
/
data
/
Cosmetics_r
.
txt
cosmeticsFile_i
=
MCI_inputData
/
data
/
Cosmetics_i
.
txt
###comicray information file
cosmicraylengths
=
MCI_inputData
/
data
/
cdf_cr_length
.
dat
cosmicraydistance
=
MCI_inputData
/
data
/
cdf_cr_total
.
dat
##################################################
#### ####
####Control flags (can be yes/no, true/false) ####
##################################################
cosmicRays
=
yes
darknoise
=
yes
cosmetics
=
yes
radiationDamage
=
yes
bleeding
=
yes
overscans
=
yes
nonlinearity
=
yes
readoutNoise
=
yes
skyback
=
yes
TianceEffect
=
yes
intscale
=
yes
ghosts
=
yes
shutterEffect
=
yes
flatfieldM
=
yes
PRNUeffect
=
yes
appFatt
=
no
sky_shift_rot
=
yes
distortion
=
yes
sim_star
=
no
sim_galaxy
=
yes
save_starpsf
=
no
save_cosmicrays
=
no
lensing
=
yes
##############################################
##############################################
#CCD properties
fullwellcapacity
=
90000
#dark noise in electrons per second
dark
=
0
.
001
#exposure to simulate, exposure time
exptime
=
300
.
0
###PNRU matrix sigma
flatsigma
=
0
.
001
### cosmicray coveringFraction
coveringFraction
=
0
.
1
#offset from the object, note that at the moment this is fixed, but in reality a focal plane position dependent.
ghostOffsetX
=
100
ghostOffsetY
=
100
ghostRatio
=
1
e
-
04
####treering effect,bright fatter effect and difusion effect
treering
=
0
.
1
fatter
=
1
.
0
difusion
=
0
.
1
### the choosen Filters in three CCDs
filter_g
=
u
filter_r
=
F555W
filter_i
=
F814W
##['G_filters']=["F275W", "F280N","NUV", "WU", "CBU", "F343N", "u", "F373N", "F395N"," F336W"]
##['R_filters']=["F487N", "F502N", "CBV", "r", "F656N", "F658N", "F467M", "F555W", "F606W", "F673N"]
##['I_filters']=["z", "y", "F815N", "CBI", "F925N", "F960M", "F968N", "F845M" ,"F850LP" ,"F814W"]
####################
g_gain1
=
1
.
53
g_gain2
=
1
.
54
g_gain3
=
1
.
55
g_gain4
=
1
.
53
g_gain5
=
1
.
51
g_gain6
=
1
.
56
g_gain7
=
1
.
58
g_gain8
=
1
.
53
g_gain9
=
1
.
54
g_gain10
=
1
.
57
g_gain11
=
1
.
51
g_gain12
=
1
.
53
g_gain13
=
1
.
55
g_gain14
=
1
.
57
g_gain15
=
1
.
53
g_gain16
=
1
.
52
#######################
g_rdnois1
=
4
.
53
g_rdnois2
=
4
.
54
g_rdnois3
=
4
.
55
g_rdnois4
=
4
.
53
g_rdnois5
=
4
.
51
g_rdnois6
=
4
.
56
g_rdnois7
=
4
.
58
g_rdnois8
=
4
.
53
g_rdnois9
=
4
.
54
g_rdnois10
=
4
.
57
g_rdnois11
=
4
.
51
g_rdnois12
=
4
.
53
g_rdnois13
=
4
.
55
g_rdnois14
=
4
.
57
g_rdnois15
=
4
.
53
g_rdnois16
=
4
.
52
############################
g_detbia1
=
500
g_detbia2
=
510
g_detbia3
=
514
g_detbia4
=
520
g_detbia5
=
524
g_detbia6
=
540
g_detbia7
=
530
g_detbia8
=
532
g_detbia9
=
534
g_detbia10
=
526
g_detbia11
=
532
g_detbia12
=
516
g_detbia13
=
540
g_detbia14
=
560
g_detbia15
=
536
g_detbia16
=
528
############################
r_gain1
=
1
.
52
r_gain2
=
1
.
54
r_gain3
=
1
.
52
r_gain4
=
1
.
55
r_gain5
=
1
.
56
r_gain6
=
1
.
52
r_gain7
=
1
.
54
r_gain8
=
1
.
6
r_gain9
=
1
.
54
r_gain10
=
1
.
52
r_gain11
=
1
.
54
r_gain12
=
1
.
57
r_gain13
=
1
.
52
r_gain14
=
1
.
55
r_gain15
=
1
.
52
r_gain16
=
1
.
55
################################
r_rdnois1
=
4
.
23
r_rdnois2
=
4
.
24
r_rdnois3
=
4
.
25
r_rdnois4
=
4
.
23
r_rdnois5
=
4
.
21
r_rdnois6
=
4
.
26
r_rdnois7
=
4
.
28
r_rdnois8
=
4
.
23
r_rdnois9
=
4
.
24
r_rdnois10
=
4
.
27
r_rdnois11
=
4
.
21
r_rdnois12
=
4
.
23
r_rdnois13
=
4
.
25
r_rdnois14
=
4
.
27
r_rdnois15
=
4
.
23
r_rdnois16
=
4
.
22
###################################
r_detbia1
=
600
r_detbia2
=
610
r_detbia3
=
614
r_detbia4
=
620
r_detbia5
=
624
r_detbia6
=
640
r_detbia7
=
630
r_detbia8
=
632
r_detbia9
=
634
r_detbia10
=
626
r_detbia11
=
632
r_detbia12
=
616
r_detbia13
=
640
r_detbia14
=
660
r_detbia15
=
636
r_detbia16
=
628
###################################
i_gain1
=
1
.
62
i_gain2
=
1
.
64
i_gain3
=
1
.
62
i_gain4
=
1
.
65
i_gain5
=
1
.
66
i_gain6
=
1
.
62
i_gain7
=
1
.
64
i_gain8
=
1
.
6
i_gain9
=
1
.
64
i_gain10
=
1
.
62
i_gain11
=
1
.
64
i_gain12
=
1
.
67
i_gain13
=
1
.
62
i_gain14
=
1
.
65
i_gain15
=
1
.
62
i_gain16
=
1
.
65
###################################
i_rdnois1
=
4
.
63
i_rdnois2
=
4
.
64
i_rdnois3
=
4
.
65
i_rdnois4
=
4
.
63
i_rdnois5
=
4
.
61
i_rdnois6
=
4
.
66
i_rdnois7
=
4
.
68
i_rdnois8
=
4
.
63
i_rdnois9
=
4
.
64
i_rdnois10
=
4
.
67
i_rdnois11
=
4
.
61
i_rdnois12
=
4
.
63
i_rdnois13
=
4
.
65
i_rdnois14
=
4
.
67
i_rdnois15
=
4
.
63
i_rdnois16
=
4
.
62
#######################################
i_detbia1
=
400
i_detbia2
=
410
i_detbia3
=
414
i_detbia4
=
420
i_detbia5
=
424
i_detbia6
=
440
i_detbia7
=
430
i_detbia8
=
432
i_detbia9
=
434
i_detbia10
=
426
i_detbia11
=
432
i_detbia12
=
416
i_detbia13
=
440
i_detbia14
=
460
i_detbia15
=
436
i_detbia16
=
428
####### end #######################
csst_mci_sim/support/sed.py
View file @
f6a0c574
...
@@ -121,103 +121,103 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'):
...
@@ -121,103 +121,103 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'):
# SED Template
# SED Template
class
Gal_Temp
():
#
class Gal_Temp():
"""
#
"""
Template of Galaxy SED
#
Template of Galaxy SED
"""
#
"""
def
__init__
(
self
,
log
,
path
):
#
def __init__(self, log, path):
#
#
#
# parent = os.path.dirname(os.path.realpath(__file__))
#
# parent = os.path.dirname(os.path.realpath(__file__))
self
.
path
=
path
#
self.path = path
hdulist
=
fits
.
open
(
#
hdulist = fits.open(
self
.
path
+
'MCI_inputData/SED_Code/seddata/galaxy_temp.fits'
)
#
self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits')
if
len
(
hdulist
)
<
4
:
#
if len(hdulist) < 4:
log
.
error
(
#
log.error(
'Data error in galaxy_temp.fits file, please check!!!'
)
#
'Data error in galaxy_temp.fits file, please check!!!')
raise
ValueError
(
#
raise ValueError(
'Data error in galaxy_temp.fits file, please check!!!'
)
#
'Data error in galaxy_temp.fits file, please check!!!')
self
.
wave
=
hdulist
[
1
].
data
[
'wave'
]
#
self.wave = hdulist[1].data['wave']
self
.
flux
=
hdulist
[
2
].
data
#
self.flux = hdulist[2].data
self
.
age_grid
=
hdulist
[
3
].
data
[
'logAge'
]
#
self.age_grid = hdulist[3].data['logAge']
self
.
feh_grid
=
hdulist
[
3
].
data
[
'FeH'
]
#
self.feh_grid = hdulist[3].data['FeH']
def
toMag
(
self
,
redshift
=
0
):
#
def toMag(self, redshift=0):
"""Calculating magnitude
#
"""Calculating magnitude
Args:
#
Args:
redshift (float, optional): redshift of spectra. Defaults to 0.
#
redshift (float, optional): redshift of spectra. Defaults to 0.
"""
#
"""
wave
=
self
.
wave
*
(
1
+
redshift
)
#
wave = self.wave * (1 + redshift)
self
.
umag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_u'
)
#
self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u')
self
.
gmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_g'
)
#
self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g')
self
.
rmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_r'
)
#
self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r')
self
.
imag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_i'
)
#
self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i')
self
.
zmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'SDSS_z'
)
#
self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z')
class
Star_Temp
():
#
class Star_Temp():
"""
#
"""
Template of Stellar SED
#
Template of Stellar SED
"""
#
"""
def
__init__
(
self
,
path
):
#
def __init__(self, path):
#
#
#
self
.
path
=
path
#
self.path = path
# parent = os.path.dirname(os.path.realpath(__file__))
#
# parent = os.path.dirname(os.path.realpath(__file__))
# print("获取其父目录——" + parent) # 从当前文件路径中获取目录
#
# print("获取其父目录——" + parent) # 从当前文件路径中获取目录
hdulist
=
fits
.
open
(
#
hdulist = fits.open(
os
.
path
.
join
(
path
,
'MCI_inputData/SED_Code/seddata/stellar_temp_wrong.fits'
))
#
os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp_wrong.fits'))
if
len
(
hdulist
)
<
4
:
#
if len(hdulist) < 4:
self
.
log
.
error
(
#
self.log.error(
'Data error in galaxy_temp.fits file, please check!!!'
)
#
'Data error in galaxy_temp.fits file, please check!!!')
raise
ValueError
(
#
raise ValueError(
'Data error in galaxy_temp.fits file, please check!!!'
)
#
'Data error in galaxy_temp.fits file, please check!!!')
self
.
wave
=
hdulist
[
1
].
data
[
'wave'
]
#
self.wave = hdulist[1].data['wave']
self
.
flux
=
hdulist
[
2
].
data
#
self.flux = hdulist[2].data
self
.
Teff_grid
=
hdulist
[
3
].
data
[
'Teff'
]
#
self.Teff_grid = hdulist[3].data['Teff']
self
.
FeH_grid
=
hdulist
[
3
].
data
[
'FeH'
]
#
self.FeH_grid = hdulist[3].data['FeH']
self
.
bpmag
=
flux_to_mag
(
self
.
wave
,
self
.
flux
,
path
,
band
=
'GAIA_bp'
)
#
self.bpmag = flux_to_mag(self.wave, self.flux, path, band='GAIA_bp')
self
.
rpmag
=
flux_to_mag
(
self
.
wave
,
self
.
flux
,
path
,
band
=
'GAIA_rp'
)
#
self.rpmag = flux_to_mag(self.wave, self.flux, path, band='GAIA_rp')
def
toMag
(
self
):
#
def toMag(self):
wave
=
self
.
wave
#
wave = self.wave
self
.
bpmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'GAIA_bp'
)
#
self.bpmag = flux_to_mag(wave, self.flux, self.path, band='GAIA_bp')
self
.
rpmag
=
flux_to_mag
(
wave
,
self
.
flux
,
self
.
path
,
band
=
'GAIA_rp'
)
#
self.rpmag = flux_to_mag(wave, self.flux, self.path, band='GAIA_rp')
# -------------
# -------------
# SED Modelling
# SED Modelling
def
Model_Stellar_SED
(
wave
,
bp
,
rp
,
temp
):
#
def Model_Stellar_SED(wave, bp, rp, temp):
"""Modelling stellar SED based on bp, rp magnitude
#
"""Modelling stellar SED based on bp, rp magnitude
Args:
#
Args:
wave (float): Wavelength
#
wave (float): Wavelength
bp (float): Magnitude of GAIA BP band
#
bp (float): Magnitude of GAIA BP band
rp (float): Magnitude of GAIA RP band
#
rp (float): Magnitude of GAIA RP band
temp (class): Class of stellar template
#
temp (class): Class of stellar template
Returns:
#
Returns:
float array: Spectral energy distribution of stellar SED,
#
float array: Spectral energy distribution of stellar SED,
which have the same length to the input wave
#
which have the same length to the input wave
"""
#
"""
color0
=
bp
-
rp
#
color0 = bp - rp
colors
=
temp
.
bpmag
-
temp
.
rpmag
#
colors = temp.bpmag - temp.rpmag
idx
=
np
.
argmin
(
np
.
abs
(
colors
-
color0
))
#
idx = np.argmin(np.abs(colors - color0))
flux0
=
temp
.
flux
[
idx
]
#
flux0 = temp.flux[idx]
flux1
=
np
.
interp
(
wave
,
temp
.
wave
,
flux0
)
#
flux1 = np.interp(wave, temp.wave, flux0)
flux
=
calibrate
(
wave
,
flux1
,
rp
,
band
=
'GAIA_rp'
)
#
flux = calibrate(wave, flux1, rp, band='GAIA_rp')
return
flux
#
return flux
def
Model_Galaxy_SED
(
wave
,
ugriz
,
z
,
temp
,
path
):
def
Model_Galaxy_SED
(
wave
,
ugriz
,
z
,
temp
,
path
):
...
...
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