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
Show whitespace changes
Inline
Side-by-side
csst_mci_sim/csst_mci_sim.py
View file @
9dc4a371
...
...
@@ -43,6 +43,8 @@ The approximate sequence of events in the simulator is as follows:
#. Finally the simulated image is converted to a FITS file, a WCS is assigned
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.
The code has been tested, but nevertheless bugs may be lurking in corners, so
please report any weird or inconsistent simulations to the author.
...
...
@@ -936,6 +938,7 @@ class MCIsimulator():
self
.
save_starpsf
=
self
.
config
.
getboolean
(
self
.
section
,
'save_starpsf'
)
self
.
save_cosmicrays
=
self
.
config
.
getboolean
(
self
.
section
,
'save_cosmicrays'
)
self
.
lensing
=
self
.
config
.
getboolean
(
self
.
section
,
'lensing'
)
###############################################3#################################
self
.
booleans
=
dict
(
cosmicRays
=
self
.
cosmicRays
,
...
...
@@ -959,7 +962,8 @@ class MCIsimulator():
sim_star
=
self
.
sim_star
,
sim_galaxy
=
self
.
sim_galaxy
,
save_starpsf
=
self
.
save_starpsf
,
save_cosmicrays
=
self
.
save_cosmicrays
)
save_cosmicrays
=
self
.
save_cosmicrays
,
lensing
=
self
.
lensing
)
#####################################################################
...
...
@@ -1963,6 +1967,18 @@ class MCIsimulator():
self
.
information
[
'ra_obj'
]
=
self
.
information
[
'star_ra'
]
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
####################################################################
##################################################################################
...
...
@@ -2012,17 +2028,7 @@ class MCIsimulator():
############ 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'
])
...
...
@@ -2107,9 +2113,17 @@ class MCIsimulator():
for
k2
in
(
range
(
nk2
)):
###
print
(
'k2='
,
k2
)
#
# Lens_SED_IMG_0.025_230606
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
))
if
not
os
.
path
.
exists
(
filename
):
...
...
@@ -2119,6 +2133,13 @@ class MCIsimulator():
srcs_cat
=
fits
.
open
(
filename
)
#### load galaxy SED fitsfile ###
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
)
...
...
@@ -4649,9 +4670,9 @@ class MCIsimulator():
if
'losimg'
in
dir
():
self
.
log
.
info
(
'Generate los 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_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_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_C3_'+str(simnumber)+'.fits',losimg['i'], overwrite=True)
self
.
img_fits_save
(
losimg
[
'g'
],
'gal_ori_C1_'
+
str
(
simnumber
))
self
.
img_fits_save
(
losimg
[
'r'
],
'gal_ori_C2_'
+
str
(
simnumber
))
...
...
@@ -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_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_C2_'
+
str
(
simnumber
))
self
.
img_fits_save
(
self
.
image_g
,
'full_ori_C3_'
+
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_C3_'+str(simnumber))
#########################################################################################################
...
...
csst_mci_sim/mci_data/mci_all_9K.config
View file @
9dc4a371
[
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
...
...
@@ -65,19 +70,21 @@ flatfieldM = yes
PRNUeffect
=
yes
appFatt
=
yes
appFatt
=
no
sky_shift_rot
=
yes
distortion
=
yes
sim_star
=
yes
sim_star
=
no
sim_galaxy
=
yes
save_starpsf
=
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