Loading csst_mci_sim/csst_mci_sim.py +37 −29 Original line number Diff line number Diff line Loading @@ -1447,17 +1447,15 @@ class MCIsimulator(): self.star = df0[1].data ### try: self.star['ra'][10] except NameError: if 'ra' not in self.star.names: print('no ra') self.log.error( 'Error,no ra data in the star_cat catlog file ') raise ValueError( 'Error,no ra data in the star_cat catlog file ') # try: self.star['dec'][10] except NameError: if 'dec' not in self.star.names: print('no ra') self.log.error( 'Error,no dec data in the star_cat catlog file ') raise ValueError( Loading Loading @@ -1853,10 +1851,10 @@ class MCIsimulator(): imag = self.star['imag'][j] zmag = self.star['zmag'][j] flag = (umag > 0 and gmag > 0 and rmag > 0 and imag > 0 and zmag > 0) # if j==426: # print('debug error') if flag is False: if np.isnan(umag) or np.isnan(gmag) or np.isnan(rmag) or np.isnan(imag) or np.isnan(zmag): continue wave = np.linspace(2500, 11000, 8501) Loading @@ -1864,7 +1862,7 @@ class MCIsimulator(): redshift = 0 # Loading galaxy SED template t = sed.Gal_Temp(self.information['dir_path']) t = sed.Gal_Temp(self.log, self.information['dir_path']) # Calculating the magnitude (u, g, r, i, z) of each template t.toMag(redshift=redshift) # Calculating flux Loading Loading @@ -2376,6 +2374,13 @@ class MCIsimulator(): srcs_sed = fits.open(filename) self.log.info('galaxy_Input SED path is: %s' % (filename)) # if len(srcs_cat) != len(srcs_sed): # self.log.error( 'Error,image data do not mach sed data in the input galaxy data file ') raise ValueError( 'Error,image data do not mach sed data in the input galaxy data file ') # ##### do Tiance Effect ### ra_list = [] Loading Loading @@ -3887,7 +3892,8 @@ class MCIsimulator(): hdu_g.header['RADECSYS'] = ( 'ICRS', 'coordinate system of the object') hdu_g.header['EQUINOX'] = (float(2000.1), '') hdu_g.header['FITSSWV'] = ('csst_mci_sim_3.0.0', 'FITS creating software version') hdu_g.header['FITSSWV'] = ( 'csst_mci_sim_3.0.0', 'FITS creating software version') ######################################## Loading Loading @@ -4438,7 +4444,8 @@ class MCIsimulator(): hdu_r.header['RADECSYS'] = ( 'ICRS', 'coordinate system of the object') hdu_r.header['EQUINOX'] = (float(2000.1), '') hdu_r.header['FITSSWV'] = ('csst_mci_sim_3.0.0', 'FITS creating software version') hdu_r.header['FITSSWV'] = ( 'csst_mci_sim_3.0.0', 'FITS creating software version') ######################################## Loading Loading @@ -4989,7 +4996,8 @@ class MCIsimulator(): hdu_i.header['RADECSYS'] = ( 'ICRS', 'coordinate system of the object') hdu_i.header['EQUINOX'] = (float(2000.1), '') hdu_i.header['FITSSWV'] = ('csst_mci_sim_3.0.0', 'FITS creating software version') hdu_i.header['FITSSWV'] = ( 'csst_mci_sim_3.0.0', 'FITS creating software version') ######################################## Loading Loading @@ -5762,7 +5770,7 @@ class MCIsimulator(): if self.cosmicRays: self.addCosmicRays() print('addCosmicRays finisth') print('addCosmicRays finished') ################################################## if self.skyback: Loading @@ -5773,7 +5781,7 @@ class MCIsimulator(): if self.darknoise: self.applyDarkCurrent() print('applyDarkCurrent finisth') print('applyDarkCurrent finished') ################################################# Loading @@ -5788,7 +5796,7 @@ class MCIsimulator(): self.image_g = self.applyBleeding(self.image_g.copy()) self.image_r = self.applyBleeding(self.image_r.copy()) self.image_i = self.applyBleeding(self.image_i.copy()) print('apply bleeding effect finisth') print('apply bleeding effect finished') ################################################ Loading Loading @@ -5828,13 +5836,13 @@ class MCIsimulator(): self.image_g = self.image_g/1.0 self.image_r = self.image_r/1.0 self.image_i = self.image_i/1.0 print('apply gain finish') print('apply gain finished') ###################################################################### # size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232 if self.information['xsize'] == 9216 and self.information['ysize'] == 9232 and self.overscans: self.applyBias() print('apply bias finish') print('apply bias finished') else: self.image_g = self.image_g+500.0 self.image_r = self.image_r+500.0 Loading csst_mci_sim/support/sed.py +13 −6 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ class Gal_Temp(): Template of Galaxy SED """ def __init__(self, path): def __init__(self, log, path): # Loading @@ -134,6 +134,13 @@ class Gal_Temp(): self.path = path hdulist = fits.open( self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits') if len(hdulist) < 4: log.error( 'Data error in galaxy_temp.fits file, please check!!!') raise ValueError( 'Data error in galaxy_temp.fits file, please check!!!') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.age_grid = hdulist[3].data['logAge'] Loading @@ -141,7 +148,6 @@ class Gal_Temp(): def toMag(self, redshift=0): """Calculating magnitude Args: redshift (float, optional): redshift of spectra. Defaults to 0. """ Loading @@ -165,13 +171,14 @@ class Star_Temp(): # parent = os.path.dirname(os.path.realpath(__file__)) # print("获取其父目录——" + parent) # 从当前文件路径中获取目录 hdulist = fits.open( os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp.fits')) os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp_wrong.fits')) if hdulist[1].data['wave'] == [] or hdulist[2].data == [] or hdulist[3].data['Teff'] == [] or hdulist[3].data['FeH'] == []: if len(hdulist) < 4: self.log.error( 'Data error in tellar_temp.fits file, please check!!!') 'Data error in galaxy_temp.fits file, please check!!!') raise ValueError( 'Data error in tellar_temp.fits file, please check!!!') 'Data error in galaxy_temp.fits file, please check!!!') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data Loading Loading
csst_mci_sim/csst_mci_sim.py +37 −29 Original line number Diff line number Diff line Loading @@ -1447,17 +1447,15 @@ class MCIsimulator(): self.star = df0[1].data ### try: self.star['ra'][10] except NameError: if 'ra' not in self.star.names: print('no ra') self.log.error( 'Error,no ra data in the star_cat catlog file ') raise ValueError( 'Error,no ra data in the star_cat catlog file ') # try: self.star['dec'][10] except NameError: if 'dec' not in self.star.names: print('no ra') self.log.error( 'Error,no dec data in the star_cat catlog file ') raise ValueError( Loading Loading @@ -1853,10 +1851,10 @@ class MCIsimulator(): imag = self.star['imag'][j] zmag = self.star['zmag'][j] flag = (umag > 0 and gmag > 0 and rmag > 0 and imag > 0 and zmag > 0) # if j==426: # print('debug error') if flag is False: if np.isnan(umag) or np.isnan(gmag) or np.isnan(rmag) or np.isnan(imag) or np.isnan(zmag): continue wave = np.linspace(2500, 11000, 8501) Loading @@ -1864,7 +1862,7 @@ class MCIsimulator(): redshift = 0 # Loading galaxy SED template t = sed.Gal_Temp(self.information['dir_path']) t = sed.Gal_Temp(self.log, self.information['dir_path']) # Calculating the magnitude (u, g, r, i, z) of each template t.toMag(redshift=redshift) # Calculating flux Loading Loading @@ -2376,6 +2374,13 @@ class MCIsimulator(): srcs_sed = fits.open(filename) self.log.info('galaxy_Input SED path is: %s' % (filename)) # if len(srcs_cat) != len(srcs_sed): # self.log.error( 'Error,image data do not mach sed data in the input galaxy data file ') raise ValueError( 'Error,image data do not mach sed data in the input galaxy data file ') # ##### do Tiance Effect ### ra_list = [] Loading Loading @@ -3887,7 +3892,8 @@ class MCIsimulator(): hdu_g.header['RADECSYS'] = ( 'ICRS', 'coordinate system of the object') hdu_g.header['EQUINOX'] = (float(2000.1), '') hdu_g.header['FITSSWV'] = ('csst_mci_sim_3.0.0', 'FITS creating software version') hdu_g.header['FITSSWV'] = ( 'csst_mci_sim_3.0.0', 'FITS creating software version') ######################################## Loading Loading @@ -4438,7 +4444,8 @@ class MCIsimulator(): hdu_r.header['RADECSYS'] = ( 'ICRS', 'coordinate system of the object') hdu_r.header['EQUINOX'] = (float(2000.1), '') hdu_r.header['FITSSWV'] = ('csst_mci_sim_3.0.0', 'FITS creating software version') hdu_r.header['FITSSWV'] = ( 'csst_mci_sim_3.0.0', 'FITS creating software version') ######################################## Loading Loading @@ -4989,7 +4996,8 @@ class MCIsimulator(): hdu_i.header['RADECSYS'] = ( 'ICRS', 'coordinate system of the object') hdu_i.header['EQUINOX'] = (float(2000.1), '') hdu_i.header['FITSSWV'] = ('csst_mci_sim_3.0.0', 'FITS creating software version') hdu_i.header['FITSSWV'] = ( 'csst_mci_sim_3.0.0', 'FITS creating software version') ######################################## Loading Loading @@ -5762,7 +5770,7 @@ class MCIsimulator(): if self.cosmicRays: self.addCosmicRays() print('addCosmicRays finisth') print('addCosmicRays finished') ################################################## if self.skyback: Loading @@ -5773,7 +5781,7 @@ class MCIsimulator(): if self.darknoise: self.applyDarkCurrent() print('applyDarkCurrent finisth') print('applyDarkCurrent finished') ################################################# Loading @@ -5788,7 +5796,7 @@ class MCIsimulator(): self.image_g = self.applyBleeding(self.image_g.copy()) self.image_r = self.applyBleeding(self.image_r.copy()) self.image_i = self.applyBleeding(self.image_i.copy()) print('apply bleeding effect finisth') print('apply bleeding effect finished') ################################################ Loading Loading @@ -5828,13 +5836,13 @@ class MCIsimulator(): self.image_g = self.image_g/1.0 self.image_r = self.image_r/1.0 self.image_i = self.image_i/1.0 print('apply gain finish') print('apply gain finished') ###################################################################### # size of the output image array, xsize is column, ysize is row, xsize = 9216,ysize = 9232 if self.information['xsize'] == 9216 and self.information['ysize'] == 9232 and self.overscans: self.applyBias() print('apply bias finish') print('apply bias finished') else: self.image_g = self.image_g+500.0 self.image_r = self.image_r+500.0 Loading
csst_mci_sim/support/sed.py +13 −6 Original line number Diff line number Diff line Loading @@ -126,7 +126,7 @@ class Gal_Temp(): Template of Galaxy SED """ def __init__(self, path): def __init__(self, log, path): # Loading @@ -134,6 +134,13 @@ class Gal_Temp(): self.path = path hdulist = fits.open( self.path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits') if len(hdulist) < 4: log.error( 'Data error in galaxy_temp.fits file, please check!!!') raise ValueError( 'Data error in galaxy_temp.fits file, please check!!!') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.age_grid = hdulist[3].data['logAge'] Loading @@ -141,7 +148,6 @@ class Gal_Temp(): def toMag(self, redshift=0): """Calculating magnitude Args: redshift (float, optional): redshift of spectra. Defaults to 0. """ Loading @@ -165,13 +171,14 @@ class Star_Temp(): # parent = os.path.dirname(os.path.realpath(__file__)) # print("获取其父目录——" + parent) # 从当前文件路径中获取目录 hdulist = fits.open( os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp.fits')) os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp_wrong.fits')) if hdulist[1].data['wave'] == [] or hdulist[2].data == [] or hdulist[3].data['Teff'] == [] or hdulist[3].data['FeH'] == []: if len(hdulist) < 4: self.log.error( 'Data error in tellar_temp.fits file, please check!!!') 'Data error in galaxy_temp.fits file, please check!!!') raise ValueError( 'Data error in tellar_temp.fits file, please check!!!') 'Data error in galaxy_temp.fits file, please check!!!') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data Loading