From f6a0c5743ca54086a6416dea335871499470e108 Mon Sep 17 00:00:00 2001 From: yan Date: Thu, 23 Jan 2025 15:05:29 +0800 Subject: [PATCH] update --- csst_mci_sim/mci_data/mci_all_9K.config | 305 ------------------------ csst_mci_sim/support/sed.py | 176 +++++++------- 2 files changed, 88 insertions(+), 393 deletions(-) delete mode 100755 csst_mci_sim/mci_data/mci_all_9K.config diff --git a/csst_mci_sim/mci_data/mci_all_9K.config b/csst_mci_sim/mci_data/mci_all_9K.config deleted file mode 100755 index 53f398a..0000000 --- a/csst_mci_sim/mci_data/mci_all_9K.config +++ /dev/null @@ -1,305 +0,0 @@ -[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 -ysize =9232 - -##overscanx = column, overscany =row -prescan = 27 -overscan = 320 - -#charge trap information file - -parallelTrapfile=MCI_inputData/data/cdm_euclid_parallel.dat - -serialTrapfile=MCI_inputData/data/cdm_euclid_serial.dat - -#cosmetic defects input file -cosmeticsFile_g =MCI_inputData/data/Cosmetics_g.txt - -cosmeticsFile_r =MCI_inputData/data/Cosmetics_r.txt - -cosmeticsFile_i =MCI_inputData/data/Cosmetics_i.txt - - -###comicray information file - -cosmicraylengths=MCI_inputData/data/cdf_cr_length.dat - -cosmicraydistance=MCI_inputData/data/cdf_cr_total.dat - - - -################################################## -#### #### -####Control flags (can be yes/no, true/false) #### -################################################## -cosmicRays = yes - -darknoise = yes - -cosmetics = yes - -radiationDamage= yes - -bleeding = yes - -overscans = yes - -nonlinearity = yes - -readoutNoise = yes - -skyback = yes - -TianceEffect = yes - -intscale = yes - -ghosts = yes - -shutterEffect = yes - -flatfieldM = yes - -PRNUeffect = yes - -appFatt = no - -sky_shift_rot = yes - -distortion = yes - -sim_star = no - -sim_galaxy = yes - -save_starpsf = no - -save_cosmicrays = no - -lensing = yes -############################################## -############################################## - -#CCD properties -fullwellcapacity = 90000 - -#dark noise in electrons per second -dark = 0.001 - -#exposure to simulate, exposure time -exptime = 300.0 - -###PNRU matrix sigma -flatsigma=0.001 - -### cosmicray coveringFraction -coveringFraction=0.1 - - -#offset from the object, note that at the moment this is fixed, but in reality a focal plane position dependent. -ghostOffsetX = 100 -ghostOffsetY = 100 -ghostRatio = 1e-04 - - - -####treering effect,bright fatter effect and difusion effect -treering=0.1 - -fatter=1.0 - -difusion=0.1 - - -### the choosen Filters in three CCDs -filter_g=u -filter_r=F555W -filter_i=F814W - -##['G_filters']=["F275W", "F280N","NUV", "WU", "CBU", "F343N", "u", "F373N", "F395N"," F336W"] -##['R_filters']=["F487N", "F502N", "CBV", "r", "F656N", "F658N", "F467M", "F555W", "F606W", "F673N"] -##['I_filters']=["z", "y", "F815N", "CBI", "F925N", "F960M", "F968N", "F845M" ,"F850LP" ,"F814W"] - -#################### -g_gain1=1.53 -g_gain2=1.54 -g_gain3=1.55 -g_gain4=1.53 -g_gain5=1.51 -g_gain6=1.56 -g_gain7=1.58 -g_gain8=1.53 -g_gain9=1.54 -g_gain10=1.57 -g_gain11=1.51 -g_gain12=1.53 -g_gain13=1.55 -g_gain14=1.57 -g_gain15=1.53 -g_gain16=1.52 - -####################### -g_rdnois1=4.53 -g_rdnois2=4.54 -g_rdnois3=4.55 -g_rdnois4=4.53 -g_rdnois5=4.51 -g_rdnois6=4.56 -g_rdnois7=4.58 -g_rdnois8=4.53 -g_rdnois9=4.54 -g_rdnois10=4.57 -g_rdnois11=4.51 -g_rdnois12=4.53 -g_rdnois13=4.55 -g_rdnois14=4.57 -g_rdnois15=4.53 -g_rdnois16=4.52 - -############################ -g_detbia1=500 -g_detbia2=510 -g_detbia3=514 -g_detbia4=520 -g_detbia5=524 -g_detbia6=540 -g_detbia7=530 -g_detbia8=532 -g_detbia9=534 -g_detbia10=526 -g_detbia11=532 -g_detbia12=516 -g_detbia13=540 -g_detbia14=560 -g_detbia15=536 -g_detbia16=528 - -############################ -r_gain1=1.52 -r_gain2=1.54 -r_gain3=1.52 -r_gain4=1.55 -r_gain5=1.56 -r_gain6=1.52 -r_gain7=1.54 -r_gain8=1.6 -r_gain9=1.54 -r_gain10=1.52 -r_gain11=1.54 -r_gain12=1.57 -r_gain13=1.52 -r_gain14=1.55 -r_gain15=1.52 -r_gain16=1.55 - -################################ -r_rdnois1=4.23 -r_rdnois2=4.24 -r_rdnois3=4.25 -r_rdnois4=4.23 -r_rdnois5=4.21 -r_rdnois6=4.26 -r_rdnois7=4.28 -r_rdnois8=4.23 -r_rdnois9=4.24 -r_rdnois10=4.27 -r_rdnois11=4.21 -r_rdnois12=4.23 -r_rdnois13=4.25 -r_rdnois14=4.27 -r_rdnois15=4.23 -r_rdnois16=4.22 - -################################### -r_detbia1=600 -r_detbia2=610 -r_detbia3=614 -r_detbia4=620 -r_detbia5=624 -r_detbia6=640 -r_detbia7=630 -r_detbia8=632 -r_detbia9=634 -r_detbia10=626 -r_detbia11=632 -r_detbia12=616 -r_detbia13=640 -r_detbia14=660 -r_detbia15=636 -r_detbia16=628 - -################################### -i_gain1=1.62 -i_gain2=1.64 -i_gain3=1.62 -i_gain4=1.65 -i_gain5=1.66 -i_gain6=1.62 -i_gain7=1.64 -i_gain8=1.6 -i_gain9=1.64 -i_gain10=1.62 -i_gain11=1.64 -i_gain12=1.67 -i_gain13=1.62 -i_gain14=1.65 -i_gain15=1.62 -i_gain16=1.65 - -################################### -i_rdnois1=4.63 -i_rdnois2=4.64 -i_rdnois3=4.65 -i_rdnois4=4.63 -i_rdnois5=4.61 -i_rdnois6=4.66 -i_rdnois7=4.68 -i_rdnois8=4.63 -i_rdnois9=4.64 -i_rdnois10=4.67 -i_rdnois11=4.61 -i_rdnois12=4.63 -i_rdnois13=4.65 -i_rdnois14=4.67 -i_rdnois15=4.63 -i_rdnois16=4.62 - -####################################### -i_detbia1=400 -i_detbia2=410 -i_detbia3=414 -i_detbia4=420 -i_detbia5=424 -i_detbia6=440 -i_detbia7=430 -i_detbia8=432 -i_detbia9=434 -i_detbia10=426 -i_detbia11=432 -i_detbia12=416 -i_detbia13=440 -i_detbia14=460 -i_detbia15=436 -i_detbia16=428 - -####### end ####################### - - - - - - - - - - - - diff --git a/csst_mci_sim/support/sed.py b/csst_mci_sim/support/sed.py index 017821e..0804910 100755 --- a/csst_mci_sim/support/sed.py +++ b/csst_mci_sim/support/sed.py @@ -121,103 +121,103 @@ def calibrate(wave, flux, mag, path, band='GAIA_bp'): # SED Template -class Gal_Temp(): - """ - Template of Galaxy SED - """ - - def __init__(self, log, path): - - # - - # parent = os.path.dirname(os.path.realpath(__file__)) - 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'] - self.feh_grid = hdulist[3].data['FeH'] - - def toMag(self, redshift=0): - """Calculating magnitude - Args: - redshift (float, optional): redshift of spectra. Defaults to 0. - """ - wave = self.wave * (1 + redshift) - self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u') - self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g') - self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r') - self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i') - self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z') - - -class Star_Temp(): - """ - Template of Stellar SED - """ - - def __init__(self, path): - - # - self.path = path - # parent = os.path.dirname(os.path.realpath(__file__)) - # print("获取其父目录——" + parent) # 从当前文件路径中获取目录 - hdulist = fits.open( - os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp_wrong.fits')) - - if len(hdulist) < 4: - self.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.Teff_grid = hdulist[3].data['Teff'] - self.FeH_grid = hdulist[3].data['FeH'] - - self.bpmag = flux_to_mag(self.wave, self.flux, path, band='GAIA_bp') - self.rpmag = flux_to_mag(self.wave, self.flux, path, band='GAIA_rp') - - def toMag(self): - wave = self.wave - self.bpmag = flux_to_mag(wave, self.flux, self.path, band='GAIA_bp') - self.rpmag = flux_to_mag(wave, self.flux, self.path, band='GAIA_rp') +# class Gal_Temp(): +# """ +# Template of Galaxy SED +# """ + +# def __init__(self, log, path): + +# # + +# # parent = os.path.dirname(os.path.realpath(__file__)) +# 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'] +# self.feh_grid = hdulist[3].data['FeH'] + +# def toMag(self, redshift=0): +# """Calculating magnitude +# Args: +# redshift (float, optional): redshift of spectra. Defaults to 0. +# """ +# wave = self.wave * (1 + redshift) +# self.umag = flux_to_mag(wave, self.flux, self.path, band='SDSS_u') +# self.gmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_g') +# self.rmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_r') +# self.imag = flux_to_mag(wave, self.flux, self.path, band='SDSS_i') +# self.zmag = flux_to_mag(wave, self.flux, self.path, band='SDSS_z') + + +# class Star_Temp(): +# """ +# Template of Stellar SED +# """ + +# def __init__(self, path): + +# # +# self.path = path +# # parent = os.path.dirname(os.path.realpath(__file__)) +# # print("获取其父目录——" + parent) # 从当前文件路径中获取目录 +# hdulist = fits.open( +# os.path.join(path, 'MCI_inputData/SED_Code/seddata/stellar_temp_wrong.fits')) + +# if len(hdulist) < 4: +# self.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.Teff_grid = hdulist[3].data['Teff'] +# self.FeH_grid = hdulist[3].data['FeH'] + +# self.bpmag = flux_to_mag(self.wave, self.flux, path, band='GAIA_bp') +# self.rpmag = flux_to_mag(self.wave, self.flux, path, band='GAIA_rp') + +# def toMag(self): +# wave = self.wave +# self.bpmag = flux_to_mag(wave, self.flux, self.path, band='GAIA_bp') +# self.rpmag = flux_to_mag(wave, self.flux, self.path, band='GAIA_rp') # ------------- # SED Modelling -def Model_Stellar_SED(wave, bp, rp, temp): - """Modelling stellar SED based on bp, rp magnitude +# def Model_Stellar_SED(wave, bp, rp, temp): +# """Modelling stellar SED based on bp, rp magnitude - Args: - wave (float): Wavelength - bp (float): Magnitude of GAIA BP band - rp (float): Magnitude of GAIA RP band - temp (class): Class of stellar template +# Args: +# wave (float): Wavelength +# bp (float): Magnitude of GAIA BP band +# rp (float): Magnitude of GAIA RP band +# temp (class): Class of stellar template - Returns: - float array: Spectral energy distribution of stellar SED, - which have the same length to the input wave - """ +# Returns: +# float array: Spectral energy distribution of stellar SED, +# which have the same length to the input wave +# """ - color0 = bp - rp - colors = temp.bpmag - temp.rpmag +# color0 = bp - rp +# colors = temp.bpmag - temp.rpmag - idx = np.argmin(np.abs(colors - color0)) - flux0 = temp.flux[idx] - flux1 = np.interp(wave, temp.wave, flux0) - flux = calibrate(wave, flux1, rp, band='GAIA_rp') - return flux +# idx = np.argmin(np.abs(colors - color0)) +# flux0 = temp.flux[idx] +# flux1 = np.interp(wave, temp.wave, flux0) +# flux = calibrate(wave, flux1, rp, band='GAIA_rp') +# return flux def Model_Galaxy_SED(wave, ugriz, z, temp, path): -- GitLab