Loading csst_mci_sim/csst_mci_sim.py +19 −7 Original line number Diff line number Diff line Loading @@ -2031,7 +2031,7 @@ class MCIsimulator(): st_magz=[] self.log.info('load star catlog 777777777') #################### generate star image ########## if self.debug: Loading @@ -2049,6 +2049,9 @@ class MCIsimulator(): for j in tqdm(range(Nstar)): ### nsrcs length self.log.info('begin iteration........') if j<nsrcs-8: starRa = 3600.0*( newRa[j] ) # ra of star, arcsecond starDec = 3600.0*( newDec[j] ) # dec of star, arcsecond Loading Loading @@ -2140,13 +2143,19 @@ class MCIsimulator(): wave = np.linspace(2500, 11000, 8501) # Input redshift redshift = 0 self.log.info('load star catlog 777777777') # Loading galaxy SED template t=sed.Gal_Temp() t=sed.Gal_Temp(self.information['dir_path']) # Calculating the magnitude (u, g, r, i, z) of each template t.toMag(redshift=redshift) # Calculating flux ugriz = np.array([umag, gmag, rmag, imag, zmag]) star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t) self.log.info('load star catlog 888888888888') else: Loading @@ -2159,18 +2168,21 @@ class MCIsimulator(): wave = np.linspace(2500, 11000, 8501) # Input redshift redshift = 0 # Loading galaxy SED template t=sed.Gal_Temp() t=sed.Gal_Temp(self.information['dir_path']) # Calculating the magnitude (u, g, r, i, z) of each template t.toMag(redshift=redshift) # Calculating flux ugriz = np.array([umag, gmag, rmag, imag, zmag]) star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t) ######################################### self.log.info('load star catlog 99999999') ##cal_SED_photons(self, flux_arr): intscales,PSF_eff_weight=self.cal_SED_photons(star_flux) self.information['dir_path 99999999999999'] gx=dict() gy=dict() Loading csst_mci_sim/support/sed.py +13 −12 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ def reddening(wave, flux, ebv = 0.0, law = 'calzetti', Rv = 4.05): fluxNew = flux / (10. ** (0.4 * ebv * curve)) return fluxNew def flux_to_mag(wave, flux, band='GAIA_bp'): def flux_to_mag(wave, flux, path, band='GAIA_bp'): """Convert flux of given spectra to magnitude Args: Loading @@ -68,11 +68,11 @@ def flux_to_mag(wave, flux, band='GAIA_bp'): float: value of magnitude """ # /home/yan/MCI_sim/MCI_input/SED_Code/data import os ##import os parent = os.path.dirname(os.path.realpath(__file__)) ###parent = os.path.dirname(os.path.realpath(__file__)) band = ascii.read(parent+'/seddata/' + band + '.dat') band = ascii.read(path+'MCI_inputData/SED_Code/seddata/' + band + '.dat') wave0= band['col1'] curv0= band['col2'] Loading Loading @@ -120,12 +120,13 @@ class Gal_Temp(): Template of Galaxy SED """ def __init__(self): import os def __init__(self,path): parent = os.path.dirname(os.path.realpath(__file__)) ###import os hdulist = fits.open(parent+'/seddata/galaxy_temp.fits') ###parent = os.path.dirname(os.path.realpath(__file__)) hdulist = fits.open(path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.age_grid = hdulist[3].data['logAge'] Loading @@ -149,14 +150,14 @@ class Star_Temp(): Template of Stellar SED """ def __init__(self): def __init__(self,path): import os ##import os parent = os.path.dirname(os.path.realpath(__file__)) ####parent = os.path.dirname(os.path.realpath(__file__)) ###print("获取其父目录——" + parent) # 从当前文件路径中获取目录 hdulist = fits.open(parent+'/seddata/stellar_temp.fits') hdulist = fits.open(path+'MCI_inputData/SED_Code/seddata/stellar_temp.fits') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.Teff_grid = hdulist[3].data['Teff'] Loading Loading
csst_mci_sim/csst_mci_sim.py +19 −7 Original line number Diff line number Diff line Loading @@ -2031,7 +2031,7 @@ class MCIsimulator(): st_magz=[] self.log.info('load star catlog 777777777') #################### generate star image ########## if self.debug: Loading @@ -2049,6 +2049,9 @@ class MCIsimulator(): for j in tqdm(range(Nstar)): ### nsrcs length self.log.info('begin iteration........') if j<nsrcs-8: starRa = 3600.0*( newRa[j] ) # ra of star, arcsecond starDec = 3600.0*( newDec[j] ) # dec of star, arcsecond Loading Loading @@ -2140,13 +2143,19 @@ class MCIsimulator(): wave = np.linspace(2500, 11000, 8501) # Input redshift redshift = 0 self.log.info('load star catlog 777777777') # Loading galaxy SED template t=sed.Gal_Temp() t=sed.Gal_Temp(self.information['dir_path']) # Calculating the magnitude (u, g, r, i, z) of each template t.toMag(redshift=redshift) # Calculating flux ugriz = np.array([umag, gmag, rmag, imag, zmag]) star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t) self.log.info('load star catlog 888888888888') else: Loading @@ -2159,18 +2168,21 @@ class MCIsimulator(): wave = np.linspace(2500, 11000, 8501) # Input redshift redshift = 0 # Loading galaxy SED template t=sed.Gal_Temp() t=sed.Gal_Temp(self.information['dir_path']) # Calculating the magnitude (u, g, r, i, z) of each template t.toMag(redshift=redshift) # Calculating flux ugriz = np.array([umag, gmag, rmag, imag, zmag]) star_flux = sed.Model_Galaxy_SED(wave, ugriz, redshift, t) ######################################### self.log.info('load star catlog 99999999') ##cal_SED_photons(self, flux_arr): intscales,PSF_eff_weight=self.cal_SED_photons(star_flux) self.information['dir_path 99999999999999'] gx=dict() gy=dict() Loading
csst_mci_sim/support/sed.py +13 −12 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ def reddening(wave, flux, ebv = 0.0, law = 'calzetti', Rv = 4.05): fluxNew = flux / (10. ** (0.4 * ebv * curve)) return fluxNew def flux_to_mag(wave, flux, band='GAIA_bp'): def flux_to_mag(wave, flux, path, band='GAIA_bp'): """Convert flux of given spectra to magnitude Args: Loading @@ -68,11 +68,11 @@ def flux_to_mag(wave, flux, band='GAIA_bp'): float: value of magnitude """ # /home/yan/MCI_sim/MCI_input/SED_Code/data import os ##import os parent = os.path.dirname(os.path.realpath(__file__)) ###parent = os.path.dirname(os.path.realpath(__file__)) band = ascii.read(parent+'/seddata/' + band + '.dat') band = ascii.read(path+'MCI_inputData/SED_Code/seddata/' + band + '.dat') wave0= band['col1'] curv0= band['col2'] Loading Loading @@ -120,12 +120,13 @@ class Gal_Temp(): Template of Galaxy SED """ def __init__(self): import os def __init__(self,path): parent = os.path.dirname(os.path.realpath(__file__)) ###import os hdulist = fits.open(parent+'/seddata/galaxy_temp.fits') ###parent = os.path.dirname(os.path.realpath(__file__)) hdulist = fits.open(path+'MCI_inputData/SED_Code/seddata/galaxy_temp.fits') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.age_grid = hdulist[3].data['logAge'] Loading @@ -149,14 +150,14 @@ class Star_Temp(): Template of Stellar SED """ def __init__(self): def __init__(self,path): import os ##import os parent = os.path.dirname(os.path.realpath(__file__)) ####parent = os.path.dirname(os.path.realpath(__file__)) ###print("获取其父目录——" + parent) # 从当前文件路径中获取目录 hdulist = fits.open(parent+'/seddata/stellar_temp.fits') hdulist = fits.open(path+'MCI_inputData/SED_Code/seddata/stellar_temp.fits') self.wave = hdulist[1].data['wave'] self.flux = hdulist[2].data self.Teff_grid = hdulist[3].data['Teff'] Loading