Loading csst_mci_sim/csst_mci_sim.py +44 −23 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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, Loading @@ -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 ) ##################################################################### Loading Loading @@ -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 #################################################################### ################################################################################## Loading Loading @@ -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']) Loading Loading @@ -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): Loading @@ -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) Loading Loading @@ -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)) Loading Loading @@ -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)) ######################################################################################################### Loading csst_mci_sim/mci_data/mci_all_9K.config +9 −2 Original line number Diff line number Diff line [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 Loading Loading @@ -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 ############################################## ############################################## Loading csst_mci_sim/support/__pycache__/MCIinstrumentModel.cpython-311.pyc 0 → 100644 +1.75 KiB File added.No diff preview for this file type. View file csst_mci_sim/support/__pycache__/__init__.cpython-311.pyc 0 → 100644 +188 B File added.No diff preview for this file type. View file csst_mci_sim/support/__pycache__/cosmicrays.cpython-311.pyc 0 → 100644 +12.2 KiB File added.No diff preview for this file type. View file Loading
csst_mci_sim/csst_mci_sim.py +44 −23 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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, Loading @@ -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 ) ##################################################################### Loading Loading @@ -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 #################################################################### ################################################################################## Loading Loading @@ -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']) Loading Loading @@ -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): Loading @@ -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) Loading Loading @@ -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)) Loading Loading @@ -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)) ######################################################################################################### Loading
csst_mci_sim/mci_data/mci_all_9K.config +9 −2 Original line number Diff line number Diff line [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 Loading Loading @@ -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 ############################################## ############################################## Loading
csst_mci_sim/support/__pycache__/MCIinstrumentModel.cpython-311.pyc 0 → 100644 +1.75 KiB File added.No diff preview for this file type. View file
csst_mci_sim/support/__pycache__/__init__.cpython-311.pyc 0 → 100644 +188 B File added.No diff preview for this file type. View file
csst_mci_sim/support/__pycache__/cosmicrays.cpython-311.pyc 0 → 100644 +12.2 KiB File added.No diff preview for this file type. View file