Loading csst_ifs_sim/csst_ifs_sim.py +80 −83 Original line number Original line Diff line number Diff line Loading @@ -1829,7 +1829,6 @@ class IFSsimulator(): ############################################################################## ############################################################################## ############################################################################## ############################################################################## def zodiacal(self, ra, dec, time): def zodiacal(self, ra, dec, time): """ """ Parameters Parameters Loading Loading @@ -2411,7 +2410,6 @@ class IFSsimulator(): def applyDarkCurrent(self): def applyDarkCurrent(self): """ """ Returns Returns ------- ------- Loading Loading @@ -2474,7 +2472,7 @@ class IFSsimulator(): 'dark4_r value error, it shoub be in [0.0001, 0.001]!') 'dark4_r value error, it shoub be in [0.0001, 0.001]!') raise ValueError( raise ValueError( 'dark4_r value error, it shoub be in [0.0001, 0.001]!') 'dark4_r value error, it shoub be in [0.0001, 0.001]!') ########################################################################### # ################################################################# # blue zone 4 # blue zone 4 self.image_b[0:1024, 0:2048] += self.information['exptime'] * \ self.image_b[0:1024, 0:2048] += self.information['exptime'] * \ Loading Loading @@ -2561,7 +2559,7 @@ class IFSsimulator(): # Number of hot and dead pixels from MSSL/Euclid/TR/12003 Issue 2 Draft b # Number of hot and dead pixels from MSSL/Euclid/TR/12003 Issue 2 Draft b .. Warning:: This method does not work if the input file has exactly one line. Warning:: This method does not work if the input file has exactly one line. """ """ cosmetics = np.loadtxt( cosmetics = np.loadtxt( self.information['dir_path']+self.information['cosmeticsfile_b']) self.information['dir_path']+self.information['cosmeticsfile_b']) Loading @@ -2579,6 +2577,8 @@ class IFSsimulator(): self.log.info('Adding cosmetic defects to blue channel:') self.log.info('Adding cosmetic defects to blue channel:') for xc, yc, val in zip(x, y, value): for xc, yc, val in zip(x, y, value): if 0 <= xc <= 1024 and 50 < yc % 2418 <= 2048+50: if 0 <= xc <= 1024 and 50 < yc % 2418 <= 2048+50: # # # # self.image[yc, xc] = val # self.image[yc, xc] = val self.image_b[xc, yc] = val self.image_b[xc, yc] = val # cosmetics_b[xc,yc]=val # cosmetics_b[xc,yc]=val Loading Loading @@ -2618,7 +2618,7 @@ class IFSsimulator(): # #output information to a FITS file # #output information to a FITS file # self.log.info('Save cosmetics images fits file to calibration_Data file ') # self.log.info('Save cosmetics images fits file to calibration_Data file ') ################################################################################ # ############################################################################ def applyRadiationDamage(self): def applyRadiationDamage(self): """ """ Loading Loading @@ -2940,7 +2940,7 @@ class IFSsimulator(): # fourth part, means old zone 2 # fourth part, means old zone 2 self.image_b[0:1344, 2418*3:2418*4] /= self.information['gain4_b'] self.image_b[0:1344, 2418*3:2418*4] /= self.information['gain4_b'] ############################################################################ # ################################################################### # ######################### # ######################### # red zone 4 # red zone 4 Loading @@ -2957,7 +2957,7 @@ class IFSsimulator(): # 3 # 3 #################################################################################### # ############################################################################ def applyBias(self): def applyBias(self): """ """ Loading @@ -2973,7 +2973,7 @@ class IFSsimulator(): The value of bias is read from the configure file and stored The value of bias is read from the configure file and stored in the information dictionary (key bias). in the information dictionary (key bias). # """ """ if self.information['bias1_b'] > 2000 or self.information['bias1_b'] < 100: if self.information['bias1_b'] > 2000 or self.information['bias1_b'] < 100: Loading Loading @@ -3039,7 +3039,7 @@ class IFSsimulator(): # zone 2 # zone 2 self.image_b[0:1344, 2418*3:2418*4] += self.information['bias4_b'] self.image_b[0:1344, 2418*3:2418*4] += self.information['bias4_b'] ############################################################################ # ############################################################## self.log.info('Bias counts were added to the blue image') self.log.info('Bias counts were added to the blue image') Loading @@ -3057,7 +3057,7 @@ class IFSsimulator(): # zone 2 # zone 2 self.image_r[0:1856, 3442*3:3442*4] += self.information['bias4_r'] self.image_r[0:1856, 3442*3:3442*4] += self.information['bias4_r'] ####################################################################### # ################################################################### self.log.info('Bias counts were added to the red image') self.log.info('Bias counts were added to the red image') Loading Loading @@ -3097,7 +3097,7 @@ class IFSsimulator(): self.log.error( self.log.error( 'Cannot include pre- and overscan because of an unknown quadrant!') 'Cannot include pre- and overscan because of an unknown quadrant!') ##################################################################### # ################################################################# canvas = np.zeros((self.information['redsize'], canvas = np.zeros((self.information['redsize'], (self.information['redsize'] + self.information['prescanx'] + self.information['ovrscanx']))) (self.information['redsize'] + self.information['prescanx'] + self.information['ovrscanx']))) Loading Loading @@ -3260,8 +3260,7 @@ class IFSsimulator(): self.image_r = np.rint(self.image_r).astype(int) self.image_r = np.rint(self.image_r).astype(int) self.log.info('Maximum and total values of the image are %i and %i, respectively' % (np.max(self.image_r), self.log.info('Maximum and total values of the image are %i and %i, respectively' % (np.max(self.image_r), np.sum(self.image_r))) np.sum(self.image_r))) # ############################################################################ ################################################################################################## # def applyImageShift(self): # def applyImageShift(self): # """ # """ Loading Loading @@ -3386,6 +3385,7 @@ class IFSsimulator(): y1 = 2418+prescan y1 = 2418+prescan y2 = y1+2048 y2 = y1+2048 temp[x1:x2, y1:y2] = imgb[0:1024, 0:2048] temp[x1:x2, y1:y2] = imgb[0:1024, 0:2048] # ## third part, old OSE, down to up ################### # ## third part, old OSE, down to up ################### x1 = 0 x1 = 0 x2 = x1+1024 x2 = x1+1024 Loading Loading @@ -3575,7 +3575,7 @@ class IFSsimulator(): ofd_b.header['NAXIS'] = (0, 'number of array dimensions') ofd_b.header['NAXIS'] = (0, 'number of array dimensions') ofd_b.header['NEXTEND'] = (np.int16(1), 'number of array dimensions') ofd_b.header['NEXTEND'] = (np.int16(1), 'number of array dimensions') ############################################################################################ # #################################################################### temp = write_end.utcnow() temp = write_end.utcnow() data_time = temp.strftime("%Y-%m-%dT%H:%M:%S.%f") data_time = temp.strftime("%Y-%m-%dT%H:%M:%S.%f") ofd_b.header['DATE'] = ( ofd_b.header['DATE'] = ( Loading Loading @@ -4244,7 +4244,7 @@ class IFSsimulator(): hdu_r.header[str1] = (read_start[:21], com1) hdu_r.header[str1] = (read_start[:21], com1) hdu_r.header[str2] = (read_end[:21], com2) hdu_r.header[str2] = (read_end[:21], com2) #################################################################################### # ################################################################### hdu_r.header['DETTEMP0'] = (np.float32( hdu_r.header['DETTEMP0'] = (np.float32( 0.0), 'detector temperature at EXPT0_1 (K)') 0.0), 'detector temperature at EXPT0_1 (K)') hdu_r.header['DETTEMP1'] = (np.float32( hdu_r.header['DETTEMP1'] = (np.float32( Loading Loading @@ -4445,11 +4445,8 @@ class IFSsimulator(): return return # ############################################################################ ######################################################################################################################################################################################################################################################## # ############################################################################ ################################################################################### ################################################################################## def CalskyNoise(self, lam): def CalskyNoise(self, lam): """ """ Loading Loading
csst_ifs_sim/csst_ifs_sim.py +80 −83 Original line number Original line Diff line number Diff line Loading @@ -1829,7 +1829,6 @@ class IFSsimulator(): ############################################################################## ############################################################################## ############################################################################## ############################################################################## def zodiacal(self, ra, dec, time): def zodiacal(self, ra, dec, time): """ """ Parameters Parameters Loading Loading @@ -2411,7 +2410,6 @@ class IFSsimulator(): def applyDarkCurrent(self): def applyDarkCurrent(self): """ """ Returns Returns ------- ------- Loading Loading @@ -2474,7 +2472,7 @@ class IFSsimulator(): 'dark4_r value error, it shoub be in [0.0001, 0.001]!') 'dark4_r value error, it shoub be in [0.0001, 0.001]!') raise ValueError( raise ValueError( 'dark4_r value error, it shoub be in [0.0001, 0.001]!') 'dark4_r value error, it shoub be in [0.0001, 0.001]!') ########################################################################### # ################################################################# # blue zone 4 # blue zone 4 self.image_b[0:1024, 0:2048] += self.information['exptime'] * \ self.image_b[0:1024, 0:2048] += self.information['exptime'] * \ Loading Loading @@ -2561,7 +2559,7 @@ class IFSsimulator(): # Number of hot and dead pixels from MSSL/Euclid/TR/12003 Issue 2 Draft b # Number of hot and dead pixels from MSSL/Euclid/TR/12003 Issue 2 Draft b .. Warning:: This method does not work if the input file has exactly one line. Warning:: This method does not work if the input file has exactly one line. """ """ cosmetics = np.loadtxt( cosmetics = np.loadtxt( self.information['dir_path']+self.information['cosmeticsfile_b']) self.information['dir_path']+self.information['cosmeticsfile_b']) Loading @@ -2579,6 +2577,8 @@ class IFSsimulator(): self.log.info('Adding cosmetic defects to blue channel:') self.log.info('Adding cosmetic defects to blue channel:') for xc, yc, val in zip(x, y, value): for xc, yc, val in zip(x, y, value): if 0 <= xc <= 1024 and 50 < yc % 2418 <= 2048+50: if 0 <= xc <= 1024 and 50 < yc % 2418 <= 2048+50: # # # # self.image[yc, xc] = val # self.image[yc, xc] = val self.image_b[xc, yc] = val self.image_b[xc, yc] = val # cosmetics_b[xc,yc]=val # cosmetics_b[xc,yc]=val Loading Loading @@ -2618,7 +2618,7 @@ class IFSsimulator(): # #output information to a FITS file # #output information to a FITS file # self.log.info('Save cosmetics images fits file to calibration_Data file ') # self.log.info('Save cosmetics images fits file to calibration_Data file ') ################################################################################ # ############################################################################ def applyRadiationDamage(self): def applyRadiationDamage(self): """ """ Loading Loading @@ -2940,7 +2940,7 @@ class IFSsimulator(): # fourth part, means old zone 2 # fourth part, means old zone 2 self.image_b[0:1344, 2418*3:2418*4] /= self.information['gain4_b'] self.image_b[0:1344, 2418*3:2418*4] /= self.information['gain4_b'] ############################################################################ # ################################################################### # ######################### # ######################### # red zone 4 # red zone 4 Loading @@ -2957,7 +2957,7 @@ class IFSsimulator(): # 3 # 3 #################################################################################### # ############################################################################ def applyBias(self): def applyBias(self): """ """ Loading @@ -2973,7 +2973,7 @@ class IFSsimulator(): The value of bias is read from the configure file and stored The value of bias is read from the configure file and stored in the information dictionary (key bias). in the information dictionary (key bias). # """ """ if self.information['bias1_b'] > 2000 or self.information['bias1_b'] < 100: if self.information['bias1_b'] > 2000 or self.information['bias1_b'] < 100: Loading Loading @@ -3039,7 +3039,7 @@ class IFSsimulator(): # zone 2 # zone 2 self.image_b[0:1344, 2418*3:2418*4] += self.information['bias4_b'] self.image_b[0:1344, 2418*3:2418*4] += self.information['bias4_b'] ############################################################################ # ############################################################## self.log.info('Bias counts were added to the blue image') self.log.info('Bias counts were added to the blue image') Loading @@ -3057,7 +3057,7 @@ class IFSsimulator(): # zone 2 # zone 2 self.image_r[0:1856, 3442*3:3442*4] += self.information['bias4_r'] self.image_r[0:1856, 3442*3:3442*4] += self.information['bias4_r'] ####################################################################### # ################################################################### self.log.info('Bias counts were added to the red image') self.log.info('Bias counts were added to the red image') Loading Loading @@ -3097,7 +3097,7 @@ class IFSsimulator(): self.log.error( self.log.error( 'Cannot include pre- and overscan because of an unknown quadrant!') 'Cannot include pre- and overscan because of an unknown quadrant!') ##################################################################### # ################################################################# canvas = np.zeros((self.information['redsize'], canvas = np.zeros((self.information['redsize'], (self.information['redsize'] + self.information['prescanx'] + self.information['ovrscanx']))) (self.information['redsize'] + self.information['prescanx'] + self.information['ovrscanx']))) Loading Loading @@ -3260,8 +3260,7 @@ class IFSsimulator(): self.image_r = np.rint(self.image_r).astype(int) self.image_r = np.rint(self.image_r).astype(int) self.log.info('Maximum and total values of the image are %i and %i, respectively' % (np.max(self.image_r), self.log.info('Maximum and total values of the image are %i and %i, respectively' % (np.max(self.image_r), np.sum(self.image_r))) np.sum(self.image_r))) # ############################################################################ ################################################################################################## # def applyImageShift(self): # def applyImageShift(self): # """ # """ Loading Loading @@ -3386,6 +3385,7 @@ class IFSsimulator(): y1 = 2418+prescan y1 = 2418+prescan y2 = y1+2048 y2 = y1+2048 temp[x1:x2, y1:y2] = imgb[0:1024, 0:2048] temp[x1:x2, y1:y2] = imgb[0:1024, 0:2048] # ## third part, old OSE, down to up ################### # ## third part, old OSE, down to up ################### x1 = 0 x1 = 0 x2 = x1+1024 x2 = x1+1024 Loading Loading @@ -3575,7 +3575,7 @@ class IFSsimulator(): ofd_b.header['NAXIS'] = (0, 'number of array dimensions') ofd_b.header['NAXIS'] = (0, 'number of array dimensions') ofd_b.header['NEXTEND'] = (np.int16(1), 'number of array dimensions') ofd_b.header['NEXTEND'] = (np.int16(1), 'number of array dimensions') ############################################################################################ # #################################################################### temp = write_end.utcnow() temp = write_end.utcnow() data_time = temp.strftime("%Y-%m-%dT%H:%M:%S.%f") data_time = temp.strftime("%Y-%m-%dT%H:%M:%S.%f") ofd_b.header['DATE'] = ( ofd_b.header['DATE'] = ( Loading Loading @@ -4244,7 +4244,7 @@ class IFSsimulator(): hdu_r.header[str1] = (read_start[:21], com1) hdu_r.header[str1] = (read_start[:21], com1) hdu_r.header[str2] = (read_end[:21], com2) hdu_r.header[str2] = (read_end[:21], com2) #################################################################################### # ################################################################### hdu_r.header['DETTEMP0'] = (np.float32( hdu_r.header['DETTEMP0'] = (np.float32( 0.0), 'detector temperature at EXPT0_1 (K)') 0.0), 'detector temperature at EXPT0_1 (K)') hdu_r.header['DETTEMP1'] = (np.float32( hdu_r.header['DETTEMP1'] = (np.float32( Loading Loading @@ -4445,11 +4445,8 @@ class IFSsimulator(): return return # ############################################################################ ######################################################################################################################################################################################################################################################## # ############################################################################ ################################################################################### ################################################################################## def CalskyNoise(self, lam): def CalskyNoise(self, lam): """ """ Loading