Loading csst_mci_sim/csst_mci_sim.py +135 −135 Original line number Diff line number Diff line Loading @@ -105,10 +105,10 @@ def get_file_extension(filename): return extension ########################################################## """ Charge Transfer Inefficiency ============================ This file contains a simple class to run a CDM03 CTI model developed by Alex Short (ESA). This now contains both the official CDM03 and a new version that allows different trap Loading Loading @@ -237,7 +237,7 @@ class CDM03bidir(): :return: image that has been run through the CDM03 model :rtype: ndarray """"" # # return data iflip = iquadrant / 2 Loading Loading @@ -293,7 +293,7 @@ def ill2flux(E, path): # use template from sky_bkg (background_spec_hst.dat) filename = path+'MCI_inputData/refs/background_spec_hst.dat' cat_spec = pd.read_csv(filename, sep='\s+', header=None, comment='#') cat_spec = pd.read_csv(filename, sep='\\s+', header=None, comment='#') wave0 = cat_spec[0].values # A spec0 = cat_spec[2].values # erg/s/cm^2/A/arcsec^2 Loading Loading @@ -351,7 +351,7 @@ def earth_angle(time_jd, x_sat, y_sat, z_sat, ra_obj, dec_obj): def CCDnonLinearityModel(data, beta=6e-7): """ ## The non-linearity is modelled based on the results presented. :param data: data to which the non-linearity model is being applied to :type data: ndarray Loading Loading @@ -522,7 +522,7 @@ def jd2mjd(jd): def dt2hmd(dt): ## dt is datetime # dt is datetime hour = dt.hour minute = dt.minute second = dt.second Loading Loading @@ -758,7 +758,7 @@ PSF interpolation for MCI_sim ''' ###find neighbors-KDtree ### # find neighbors-KDtree ### def findNeighbors(tx, ty, px, py, dn=5): """ Loading @@ -782,7 +782,7 @@ def findNeighbors(tx, ty, px, py, dn=5): return indexq ############################################################################### ###PSF-IDW### # PSF-IDW### def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, dn=5, IDWindex=3, OnlyNeighbors=True): Loading @@ -807,10 +807,10 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, dn=5, IDWindex=3, OnlyNeighbo ngy, ngx = PSFMat[:, :, 0, 0].shape # PSF data size #################################### ####### my code ###### # my code ###### psfWeight = np.zeros([dn]) if OnlyNeighbors == True: if OnlyNeighbors: neigh = findNeighbors(px, py, cen_col, cen_row, dn) Loading Loading @@ -929,10 +929,10 @@ class MCIsimulator(): # self.config.readfp(open(self.configfile)) self.config.read_file(open(self.configfile)) ####### ########################################################################### ####### ####### def processConfigs(self): """ Processes configuration information and save the information to a dictionary self.information. Loading Loading @@ -998,7 +998,7 @@ class MCIsimulator(): self.section, 'save_cosmicrays') self.lensing = self.config.getboolean(self.section, 'lensing') ###############################################3################################# # ################################# self.booleans = dict(cosmicRays=self.cosmicRays, darknoise=self.darknoise, cosmetics=self.cosmetics, Loading Loading @@ -1026,8 +1026,8 @@ class MCIsimulator(): return ############################################################################## # ############################################################################## # ############################################################################# def _createEmpty(self): """ Loading @@ -1035,8 +1035,8 @@ class MCIsimulator(): add g r i channel images; Creates lensing parameters; """ self.image_g = np.zeros( (self.information['ysize'], self.information['xsize']), dtype=float) self.image_r = np.zeros( Loading Loading @@ -1103,7 +1103,7 @@ class MCIsimulator(): self.source = sourcein ##print('print information:', self.information) # print('print information:', self.information) ########################################################################### Loading @@ -1128,7 +1128,7 @@ class MCIsimulator(): self.result_path = self.information['result_path'] + \ self.source+"_"+result_day if os.path.isdir(self.result_path) == False: if os.path.isdir(self.result_path) is False: os.mkdir(self.result_path) os.mkdir(self.result_path+'/cali_Data') os.mkdir(self.result_path+'/log_Data') Loading Loading @@ -1810,7 +1810,7 @@ class MCIsimulator(): flag = (umag > 0 and gmag > 0 and rmag > 0 and imag > 0 and zmag > 0) if flag == False: if flag is False: continue wave = np.linspace(2500, 11000, 8501) Loading Loading @@ -2067,7 +2067,7 @@ class MCIsimulator(): # interpolated zodical surface brightness at 0.5 um zodi = pd.read_csv( self.information['dir_path']+'MCI_inputData/refs/zodi_map.dat', sep='\s+', header=None, comment='#') self.information['dir_path']+'MCI_inputData/refs/zodi_map.dat', sep='\\s+', header=None, comment='#') beta_angle = np.array([0, 5, 10, 15, 20, 25, 30, 45, 60, 75]) lamda_angle = np.array([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180]) Loading @@ -2077,7 +2077,7 @@ class MCIsimulator(): # read the zodical spectrum in the ecliptic cat_spec = pd.read_csv( self.information['dir_path']+'MCI_inputData/refs/solar_spec.dat', sep='\s+', header=None, comment='#') self.information['dir_path']+'MCI_inputData/refs/solar_spec.dat', sep='\\s+', header=None, comment='#') wave = cat_spec[0].values # A spec0 = cat_spec[1].values # 10^-8 W m^�? sr^�? μm^�? zodi_norm = 252 # 10^-8 W m^�? sr^�? μm^�? Loading Loading @@ -2115,7 +2115,7 @@ class MCIsimulator(): dec = -34.155241212932374 # halo_id = 229600100382 if self.sim_star == False: if self.sim_star is False: self.information['star_ra'] = ra self.information['star_dec'] = dec Loading @@ -2138,7 +2138,7 @@ class MCIsimulator(): self.information['ra_pnt0'] = center_ra self.information['dec_pnt0'] = center_dec #################################################################### ################################################################################## # ################################################################### time_jd = time2jd(self.dt) Loading Loading @@ -2663,12 +2663,12 @@ class MCIsimulator(): fullimg['i'] = final_image['i'].array return fullimg ############################################# ################################# ############################################################################### ########### ############################################################################### ################ def generatePRNU(self, ave=1.0, sigma=0.01): """ Loading Loading @@ -2744,8 +2744,8 @@ class MCIsimulator(): Because the pixel-to-pixel non-uniformity effect (i.e. multiplicative) flat fielding takes place before CTI and other effects, the flat field file must be the same size as the pixels that see the sky. """ the sky.""" # generate flatfiledfile, with flatsigma = self.information['flatsigma'] Loading Loading @@ -3192,7 +3192,7 @@ class MCIsimulator(): # end for return #################################################################################### ############################################################################## def applyBias(self): """ Loading Loading @@ -3271,10 +3271,10 @@ class MCIsimulator(): hdulist_g.writeto(file_g, overwrite=True) return #################################################################################### ########### ######## ############################################################################## ###### def applyBleeding(self, img, direction='not_horizon'): """ Loading Loading @@ -5452,10 +5452,10 @@ class MCIsimulator(): self.log.info('dis_ra(in pixel)=%f, dis_dec(in pixel)=%f, sky_rot(in deg)=%f' % ( dis_ra*3600/0.05, dis_dec*3600/0.05, theta.deg)) ####################################################################################################### ################################################################### ############################################################################# ######### simulate star images from star SED data ################## ################################################################## # ######## simulate star images from star SED data ########### if self.sim_star: ########################### Loading Loading @@ -5659,8 +5659,8 @@ class MCIsimulator(): print('Souce is not correct and programe will return') sys.exit(1) ######################################################################################################################## ######################################################################################################################## ########################################################################### ######################################################################### # Apply flat-field large scale structure for one chip if self.flatfieldM: Loading Loading
csst_mci_sim/csst_mci_sim.py +135 −135 Original line number Diff line number Diff line Loading @@ -105,10 +105,10 @@ def get_file_extension(filename): return extension ########################################################## """ Charge Transfer Inefficiency ============================ This file contains a simple class to run a CDM03 CTI model developed by Alex Short (ESA). This now contains both the official CDM03 and a new version that allows different trap Loading Loading @@ -237,7 +237,7 @@ class CDM03bidir(): :return: image that has been run through the CDM03 model :rtype: ndarray """"" # # return data iflip = iquadrant / 2 Loading Loading @@ -293,7 +293,7 @@ def ill2flux(E, path): # use template from sky_bkg (background_spec_hst.dat) filename = path+'MCI_inputData/refs/background_spec_hst.dat' cat_spec = pd.read_csv(filename, sep='\s+', header=None, comment='#') cat_spec = pd.read_csv(filename, sep='\\s+', header=None, comment='#') wave0 = cat_spec[0].values # A spec0 = cat_spec[2].values # erg/s/cm^2/A/arcsec^2 Loading Loading @@ -351,7 +351,7 @@ def earth_angle(time_jd, x_sat, y_sat, z_sat, ra_obj, dec_obj): def CCDnonLinearityModel(data, beta=6e-7): """ ## The non-linearity is modelled based on the results presented. :param data: data to which the non-linearity model is being applied to :type data: ndarray Loading Loading @@ -522,7 +522,7 @@ def jd2mjd(jd): def dt2hmd(dt): ## dt is datetime # dt is datetime hour = dt.hour minute = dt.minute second = dt.second Loading Loading @@ -758,7 +758,7 @@ PSF interpolation for MCI_sim ''' ###find neighbors-KDtree ### # find neighbors-KDtree ### def findNeighbors(tx, ty, px, py, dn=5): """ Loading @@ -782,7 +782,7 @@ def findNeighbors(tx, ty, px, py, dn=5): return indexq ############################################################################### ###PSF-IDW### # PSF-IDW### def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, dn=5, IDWindex=3, OnlyNeighbors=True): Loading @@ -807,10 +807,10 @@ def psfMaker_IDW(px, py, PSFMat, cen_col, cen_row, dn=5, IDWindex=3, OnlyNeighbo ngy, ngx = PSFMat[:, :, 0, 0].shape # PSF data size #################################### ####### my code ###### # my code ###### psfWeight = np.zeros([dn]) if OnlyNeighbors == True: if OnlyNeighbors: neigh = findNeighbors(px, py, cen_col, cen_row, dn) Loading Loading @@ -929,10 +929,10 @@ class MCIsimulator(): # self.config.readfp(open(self.configfile)) self.config.read_file(open(self.configfile)) ####### ########################################################################### ####### ####### def processConfigs(self): """ Processes configuration information and save the information to a dictionary self.information. Loading Loading @@ -998,7 +998,7 @@ class MCIsimulator(): self.section, 'save_cosmicrays') self.lensing = self.config.getboolean(self.section, 'lensing') ###############################################3################################# # ################################# self.booleans = dict(cosmicRays=self.cosmicRays, darknoise=self.darknoise, cosmetics=self.cosmetics, Loading Loading @@ -1026,8 +1026,8 @@ class MCIsimulator(): return ############################################################################## # ############################################################################## # ############################################################################# def _createEmpty(self): """ Loading @@ -1035,8 +1035,8 @@ class MCIsimulator(): add g r i channel images; Creates lensing parameters; """ self.image_g = np.zeros( (self.information['ysize'], self.information['xsize']), dtype=float) self.image_r = np.zeros( Loading Loading @@ -1103,7 +1103,7 @@ class MCIsimulator(): self.source = sourcein ##print('print information:', self.information) # print('print information:', self.information) ########################################################################### Loading @@ -1128,7 +1128,7 @@ class MCIsimulator(): self.result_path = self.information['result_path'] + \ self.source+"_"+result_day if os.path.isdir(self.result_path) == False: if os.path.isdir(self.result_path) is False: os.mkdir(self.result_path) os.mkdir(self.result_path+'/cali_Data') os.mkdir(self.result_path+'/log_Data') Loading Loading @@ -1810,7 +1810,7 @@ class MCIsimulator(): flag = (umag > 0 and gmag > 0 and rmag > 0 and imag > 0 and zmag > 0) if flag == False: if flag is False: continue wave = np.linspace(2500, 11000, 8501) Loading Loading @@ -2067,7 +2067,7 @@ class MCIsimulator(): # interpolated zodical surface brightness at 0.5 um zodi = pd.read_csv( self.information['dir_path']+'MCI_inputData/refs/zodi_map.dat', sep='\s+', header=None, comment='#') self.information['dir_path']+'MCI_inputData/refs/zodi_map.dat', sep='\\s+', header=None, comment='#') beta_angle = np.array([0, 5, 10, 15, 20, 25, 30, 45, 60, 75]) lamda_angle = np.array([0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 60, 75, 90, 105, 120, 135, 150, 165, 180]) Loading @@ -2077,7 +2077,7 @@ class MCIsimulator(): # read the zodical spectrum in the ecliptic cat_spec = pd.read_csv( self.information['dir_path']+'MCI_inputData/refs/solar_spec.dat', sep='\s+', header=None, comment='#') self.information['dir_path']+'MCI_inputData/refs/solar_spec.dat', sep='\\s+', header=None, comment='#') wave = cat_spec[0].values # A spec0 = cat_spec[1].values # 10^-8 W m^�? sr^�? μm^�? zodi_norm = 252 # 10^-8 W m^�? sr^�? μm^�? Loading Loading @@ -2115,7 +2115,7 @@ class MCIsimulator(): dec = -34.155241212932374 # halo_id = 229600100382 if self.sim_star == False: if self.sim_star is False: self.information['star_ra'] = ra self.information['star_dec'] = dec Loading @@ -2138,7 +2138,7 @@ class MCIsimulator(): self.information['ra_pnt0'] = center_ra self.information['dec_pnt0'] = center_dec #################################################################### ################################################################################## # ################################################################### time_jd = time2jd(self.dt) Loading Loading @@ -2663,12 +2663,12 @@ class MCIsimulator(): fullimg['i'] = final_image['i'].array return fullimg ############################################# ################################# ############################################################################### ########### ############################################################################### ################ def generatePRNU(self, ave=1.0, sigma=0.01): """ Loading Loading @@ -2744,8 +2744,8 @@ class MCIsimulator(): Because the pixel-to-pixel non-uniformity effect (i.e. multiplicative) flat fielding takes place before CTI and other effects, the flat field file must be the same size as the pixels that see the sky. """ the sky.""" # generate flatfiledfile, with flatsigma = self.information['flatsigma'] Loading Loading @@ -3192,7 +3192,7 @@ class MCIsimulator(): # end for return #################################################################################### ############################################################################## def applyBias(self): """ Loading Loading @@ -3271,10 +3271,10 @@ class MCIsimulator(): hdulist_g.writeto(file_g, overwrite=True) return #################################################################################### ########### ######## ############################################################################## ###### def applyBleeding(self, img, direction='not_horizon'): """ Loading Loading @@ -5452,10 +5452,10 @@ class MCIsimulator(): self.log.info('dis_ra(in pixel)=%f, dis_dec(in pixel)=%f, sky_rot(in deg)=%f' % ( dis_ra*3600/0.05, dis_dec*3600/0.05, theta.deg)) ####################################################################################################### ################################################################### ############################################################################# ######### simulate star images from star SED data ################## ################################################################## # ######## simulate star images from star SED data ########### if self.sim_star: ########################### Loading Loading @@ -5659,8 +5659,8 @@ class MCIsimulator(): print('Souce is not correct and programe will return') sys.exit(1) ######################################################################################################################## ######################################################################################################################## ########################################################################### ######################################################################### # Apply flat-field large scale structure for one chip if self.flatfieldM: Loading