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
9dc4a371
Commit
9dc4a371
authored
Oct 17, 2024
by
Yan Zhaojun
Browse files
update
parent
f8cd51b5
Pipeline
#7035
failed with stage
in 0 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
csst_mci_sim/csst_mci_sim.py
View file @
9dc4a371
...
@@ -42,6 +42,8 @@ The approximate sequence of events in the simulator is as follows:
...
@@ -42,6 +42,8 @@ The approximate sequence of events in the simulator is as follows:
#. Add a given bias level and discretise the counts (the output is going to be in 16bit unsigned integers).
#. Add a given bias level and discretise the counts (the output is going to be in 16bit unsigned integers).
#. Finally the simulated image is converted to a FITS file, a WCS is assigned
#. Finally the simulated image is converted to a FITS file, a WCS is assigned
and the output is saved to the current working directory.
and the output is saved to the current working directory.
# add galaxy lensing effect to self.information['lensing'], set this parameter in .config file; update@24.10.16
.. Warning:: The code is still work in progress and new features are being added.
.. Warning:: The code is still work in progress and new features are being added.
The code has been tested, but nevertheless bugs may be lurking in corners, so
The code has been tested, but nevertheless bugs may be lurking in corners, so
...
@@ -936,6 +938,7 @@ class MCIsimulator():
...
@@ -936,6 +938,7 @@ class MCIsimulator():
self
.
save_starpsf
=
self
.
config
.
getboolean
(
self
.
section
,
'save_starpsf'
)
self
.
save_starpsf
=
self
.
config
.
getboolean
(
self
.
section
,
'save_starpsf'
)
self
.
save_cosmicrays
=
self
.
config
.
getboolean
(
self
.
section
,
'save_cosmicrays'
)
self
.
save_cosmicrays
=
self
.
config
.
getboolean
(
self
.
section
,
'save_cosmicrays'
)
self
.
lensing
=
self
.
config
.
getboolean
(
self
.
section
,
'lensing'
)
###############################################3#################################
###############################################3#################################
self
.
booleans
=
dict
(
cosmicRays
=
self
.
cosmicRays
,
self
.
booleans
=
dict
(
cosmicRays
=
self
.
cosmicRays
,
...
@@ -959,7 +962,8 @@ class MCIsimulator():
...
@@ -959,7 +962,8 @@ class MCIsimulator():
sim_star
=
self
.
sim_star
,
sim_star
=
self
.
sim_star
,
sim_galaxy
=
self
.
sim_galaxy
,
sim_galaxy
=
self
.
sim_galaxy
,
save_starpsf
=
self
.
save_starpsf
,
save_starpsf
=
self
.
save_starpsf
,
save_cosmicrays
=
self
.
save_cosmicrays
)
save_cosmicrays
=
self
.
save_cosmicrays
,
lensing
=
self
.
lensing
)
#####################################################################
#####################################################################
...
@@ -1963,6 +1967,18 @@ class MCIsimulator():
...
@@ -1963,6 +1967,18 @@ class MCIsimulator():
self
.
information
[
'ra_obj'
]
=
self
.
information
[
'star_ra'
]
self
.
information
[
'ra_obj'
]
=
self
.
information
[
'star_ra'
]
self
.
information
[
'dec_obj'
]
=
self
.
information
[
'star_dec'
]
self
.
information
[
'dec_obj'
]
=
self
.
information
[
'star_dec'
]
losscale
=
self
.
information
[
'pixel_size'
]
rotTelPos
=
self
.
information
[
'rotTelPos'
]
rotSkyPos
=
self
.
information
[
'rotSkyPos'
]
theta
=
rotTelPos
-
rotSkyPos
center_ra
=
self
.
information
[
'T_disRa'
]
+
self
.
information
[
'star_ra'
]
center_dec
=
self
.
information
[
'T_disDec'
]
+
self
.
information
[
'star_dec'
]
self
.
information
[
'ra_pnt0'
]
=
center_ra
self
.
information
[
'dec_pnt0'
]
=
center_dec
####################################################################
####################################################################
##################################################################################
##################################################################################
...
@@ -1999,10 +2015,10 @@ class MCIsimulator():
...
@@ -1999,10 +2015,10 @@ class MCIsimulator():
# 'zodi': zodi_ifs,
# 'zodi': zodi_ifs,
# 'earthshine': earthshine_ifs})
# 'earthshine': earthshine_ifs})
self
.
zodiacal_wave
=
wave_mci
# in A
self
.
zodiacal_wave
=
wave_mci
# in A
self
.
zodiacal_flux
=
zodi_mci
self
.
zodiacal_flux
=
zodi_mci
self
.
earthshine_wave
=
wave_mci
# A
self
.
earthshine_wave
=
wave_mci
# A
self
.
earthshine_flux
=
earthshine_mci
self
.
earthshine_flux
=
earthshine_mci
########################################################################################
########################################################################################
...
@@ -2012,17 +2028,7 @@ class MCIsimulator():
...
@@ -2012,17 +2028,7 @@ class MCIsimulator():
############ load galaxy data with SED ############################
############ load galaxy data with SED ############################
losscale
=
self
.
information
[
'pixel_size'
]
rotTelPos
=
self
.
information
[
'rotTelPos'
]
rotSkyPos
=
self
.
information
[
'rotSkyPos'
]
theta
=
rotTelPos
-
rotSkyPos
center_ra
=
self
.
information
[
'T_disRa'
]
+
self
.
information
[
'star_ra'
]
center_dec
=
self
.
information
[
'T_disDec'
]
+
self
.
information
[
'star_dec'
]
self
.
information
[
'ra_pnt0'
]
=
center_ra
self
.
information
[
'dec_pnt0'
]
=
center_dec
self
.
information
[
'target'
]
=
deg2HMS
(
self
.
information
[
'star_ra'
],
self
.
information
[
'star_dec'
])
self
.
information
[
'target'
]
=
deg2HMS
(
self
.
information
[
'star_ra'
],
self
.
information
[
'star_dec'
])
...
@@ -2107,8 +2113,16 @@ class MCIsimulator():
...
@@ -2107,8 +2113,16 @@ class MCIsimulator():
for
k2
in
(
range
(
nk2
)):
###
for
k2
in
(
range
(
nk2
)):
###
print
(
'k2='
,
k2
)
print
(
'k2='
,
k2
)
#
# Lens_SED_IMG_0.025_230606
filename
=
self
.
information
[
'dir_path'
]
+
'MCI_inputData/galaxy_Input/noLens_SED_IMG_0.025_230626/Lens_img_cut_IMG_'
+
str
(
k2
+
1
)
+
'.fits'
if
self
.
lensing
:
filename
=
self
.
information
[
'dir_path'
]
+
'MCI_inputData/galaxy_Input/Lens_SED_IMG_0.025_230606/Lens_img_cut_IMG_'
+
str
(
k2
+
1
)
+
'.fits'
else
:
filename
=
self
.
information
[
'dir_path'
]
+
'MCI_inputData/galaxy_Input/noLens_SED_IMG_0.025_230626/Lens_img_cut_IMG_'
+
str
(
k2
+
1
)
+
'.fits'
self
.
log
.
info
(
'galaxy_Input image path is: %s'
%
(
filename
))
self
.
log
.
info
(
'galaxy_Input image path is: %s'
%
(
filename
))
...
@@ -2119,7 +2133,14 @@ class MCIsimulator():
...
@@ -2119,7 +2133,14 @@ class MCIsimulator():
srcs_cat
=
fits
.
open
(
filename
)
srcs_cat
=
fits
.
open
(
filename
)
#### load galaxy SED fitsfile ###
#### load galaxy SED fitsfile ###
filename
=
self
.
information
[
'dir_path'
]
+
'MCI_inputData/galaxy_Input/noLens_SED_IMG_0.025_230626/Lens_img_cut_SED_'
+
str
(
k2
+
1
)
+
'.fits'
if
self
.
lensing
:
filename
=
self
.
information
[
'dir_path'
]
+
'MCI_inputData/galaxy_Input/Lens_SED_IMG_0.025_230606/Lens_img_cut_SED_'
+
str
(
k2
+
1
)
+
'.fits'
else
:
filename
=
self
.
information
[
'dir_path'
]
+
'MCI_inputData/galaxy_Input/noLens_SED_IMG_0.025_230626/Lens_img_cut_SED_'
+
str
(
k2
+
1
)
+
'.fits'
srcs_sed
=
fits
.
open
(
filename
)
srcs_sed
=
fits
.
open
(
filename
)
self
.
log
.
info
(
'galaxy_Input SED path is: %s'
%
(
filename
))
self
.
log
.
info
(
'galaxy_Input SED path is: %s'
%
(
filename
))
...
@@ -4649,9 +4670,9 @@ class MCIsimulator():
...
@@ -4649,9 +4670,9 @@ class MCIsimulator():
if
'losimg'
in
dir
():
if
'losimg'
in
dir
():
self
.
log
.
info
(
'Generate los finished...'
)
self
.
log
.
info
(
'Generate los finished...'
)
print
(
'losimage finished'
)
print
(
'losimage finished'
)
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/galimg_C1_'
+
str
(
simnumber
)
+
'.fits'
,
losimg
[
'g'
],
overwrite
=
True
)
#
fits.writeto(self.result_path+'/ori_Sky/galimg_C1_'+str(simnumber)+'.fits',losimg['g'], overwrite=True)
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/galimg_C2_'
+
str
(
simnumber
)
+
'.fits'
,
losimg
[
'r'
],
overwrite
=
True
)
#
fits.writeto(self.result_path+'/ori_Sky/galimg_C2_'+str(simnumber)+'.fits',losimg['r'], overwrite=True)
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/galimg_C3_'
+
str
(
simnumber
)
+
'.fits'
,
losimg
[
'i'
],
overwrite
=
True
)
#
fits.writeto(self.result_path+'/ori_Sky/galimg_C3_'+str(simnumber)+'.fits',losimg['i'], overwrite=True)
self
.
img_fits_save
(
losimg
[
'g'
],
'gal_ori_C1_'
+
str
(
simnumber
))
self
.
img_fits_save
(
losimg
[
'g'
],
'gal_ori_C1_'
+
str
(
simnumber
))
self
.
img_fits_save
(
losimg
[
'r'
],
'gal_ori_C2_'
+
str
(
simnumber
))
self
.
img_fits_save
(
losimg
[
'r'
],
'gal_ori_C2_'
+
str
(
simnumber
))
...
@@ -4679,9 +4700,9 @@ class MCIsimulator():
...
@@ -4679,9 +4700,9 @@ class MCIsimulator():
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/original_C2_'
+
str
(
simnumber
)
+
'.fits'
,
self
.
image_r
,
overwrite
=
True
)
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/original_C2_'
+
str
(
simnumber
)
+
'.fits'
,
self
.
image_r
,
overwrite
=
True
)
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/original_C3_'
+
str
(
simnumber
)
+
'.fits'
,
self
.
image_i
,
overwrite
=
True
)
fits
.
writeto
(
self
.
result_path
+
'/ori_Sky/original_C3_'
+
str
(
simnumber
)
+
'.fits'
,
self
.
image_i
,
overwrite
=
True
)
self
.
img_fits_save
(
self
.
image_g
,
'full_ori_C1_'
+
str
(
simnumber
))
#
self.img_fits_save(self.image_g, 'full_ori_C1_'+str(simnumber))
self
.
img_fits_save
(
self
.
image_g
,
'full_ori_C2_'
+
str
(
simnumber
))
#
self.img_fits_save(self.image_g, 'full_ori_C2_'+str(simnumber))
self
.
img_fits_save
(
self
.
image_g
,
'full_ori_C3_'
+
str
(
simnumber
))
#
self.img_fits_save(self.image_g, 'full_ori_C3_'+str(simnumber))
#########################################################################################################
#########################################################################################################
...
...
csst_mci_sim/mci_data/mci_all_9K.config
View file @
9dc4a371
[
TEST
]
[
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
#size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232
xsize
=
9216
xsize
=
9216
...
@@ -65,19 +70,21 @@ flatfieldM = yes
...
@@ -65,19 +70,21 @@ flatfieldM = yes
PRNUeffect
=
yes
PRNUeffect
=
yes
appFatt
=
yes
appFatt
=
no
sky_shift_rot
=
yes
sky_shift_rot
=
yes
distortion
=
yes
distortion
=
yes
sim_star
=
yes
sim_star
=
no
sim_galaxy
=
yes
sim_galaxy
=
yes
save_starpsf
=
no
save_starpsf
=
no
save_cosmicrays
=
no
save_cosmicrays
=
no
lensing
=
yes
##############################################
##############################################
##############################################
##############################################
...
...
csst_mci_sim/support/__pycache__/MCIinstrumentModel.cpython-311.pyc
0 → 100644
View file @
9dc4a371
File added
csst_mci_sim/support/__pycache__/__init__.cpython-311.pyc
0 → 100644
View file @
9dc4a371
File added
csst_mci_sim/support/__pycache__/cosmicrays.cpython-311.pyc
0 → 100644
View file @
9dc4a371
File added
csst_mci_sim/support/__pycache__/logger.cpython-311.pyc
0 → 100644
View file @
9dc4a371
File added
csst_mci_sim/support/__pycache__/sed.cpython-311.pyc
0 → 100644
View file @
9dc4a371
File added
csst_mci_sim/support/__pycache__/shao.cpython-311.pyc
0 → 100644
View file @
9dc4a371
File added
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