Commit 0b24318d authored by Yan Zhaojun's avatar Yan Zhaojun
Browse files

update

parent da9116fc
Pipeline #7136 failed with stage
in 0 seconds
...@@ -827,8 +827,8 @@ class StrayLight(object): ...@@ -827,8 +827,8 @@ class StrayLight(object):
def caculateEarthShineFilter(self, filter='i'): def caculateEarthShineFilter(self, filter='i'):
""" """
# #
# #
Parameters Parameters
---------- ----------
filter : TYPE, optional filter : TYPE, optional
...@@ -1829,7 +1829,6 @@ class IFSsimulator(): ...@@ -1829,7 +1829,6 @@ class IFSsimulator():
############################################################################## ##############################################################################
############################################################################## ##############################################################################
def zodiacal(self, ra, dec, time): def zodiacal(self, ra, dec, time):
""" """
Parameters Parameters
...@@ -2411,7 +2410,6 @@ class IFSsimulator(): ...@@ -2411,7 +2410,6 @@ class IFSsimulator():
def applyDarkCurrent(self): def applyDarkCurrent(self):
""" """
Returns Returns
------- -------
...@@ -2474,17 +2472,17 @@ class IFSsimulator(): ...@@ -2474,17 +2472,17 @@ 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'] * \
self.information['dark2_b'] self.information['dark2_b']
########## zone 1 ################# # ######### zone 1 #################
self.image_b[1024:2048, 0:2048] += self.information['exptime'] * \ self.image_b[1024:2048, 0:2048] += self.information['exptime'] * \
self.information['dark3_b'] self.information['dark3_b']
########## zone 3 ################### # ######### zone 3 ###################
self.image_b[0:1024, 2048:4096] += self.information['exptime'] * \ self.image_b[0:1024, 2048:4096] += self.information['exptime'] * \
self.information['dark1_b'] self.information['dark1_b']
...@@ -2495,12 +2493,12 @@ class IFSsimulator(): ...@@ -2495,12 +2493,12 @@ class IFSsimulator():
# red zone 4 # red zone 4
self.image_r[0:1536, 0:3072] += self.information['exptime'] * \ self.image_r[0:1536, 0:3072] += self.information['exptime'] * \
self.information['dark2_r'] self.information['dark2_r']
########## zone 1 ################# # ######### zone 1 #################
self.image_r[1536:3712, 0:3072] += self.information['exptime'] * \ self.image_r[1536:3712, 0:3072] += self.information['exptime'] * \
self.information['dark3_r'] self.information['dark3_r']
########## zone 3 ################### # ######### zone 3 ###################
self.image_r[0:1536, 3072:6144] += self.information['exptime'] * \ self.image_r[0:1536, 3072:6144] += self.information['exptime'] * \
self.information['dark1_r'] self.information['dark1_r']
...@@ -2509,8 +2507,8 @@ class IFSsimulator(): ...@@ -2509,8 +2507,8 @@ class IFSsimulator():
self.information['dark4_r'] self.information['dark4_r']
############################################################################## # #############################################################################
############################################################################## # #############################################################################
def applyPoissonNoise(self): def applyPoissonNoise(self):
""" """
...@@ -2559,9 +2557,9 @@ class IFSsimulator(): ...@@ -2559,9 +2557,9 @@ class IFSsimulator():
""" """
Apply cosmetic defects described in the input file. Apply cosmetic defects described in the input file.
#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'])
...@@ -2579,7 +2577,9 @@ class IFSsimulator(): ...@@ -2579,7 +2577,9 @@ 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
self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val)) self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val))
...@@ -2599,12 +2599,12 @@ class IFSsimulator(): ...@@ -2599,12 +2599,12 @@ class IFSsimulator():
for xc, yc, val in zip(x, y, value): for xc, yc, val in zip(x, y, value):
if 0 <= xc <= 1536 and 50 < yc % 3442 <= 3072+50: if 0 <= xc <= 1536 and 50 < yc % 3442 <= 3072+50:
#self.image[yc, xc] = val # self.image[yc, xc] = val
self.image_r[xc, yc] = val self.image_r[xc, yc] = val
# cosmetics_r[yc,xc]=val # cosmetics_r[yc,xc]=val
self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val)) self.log.info('x=%i, y=%i, value=%f' % (xc, yc, val))
####### save cosmetics image code #### # ###### save cosmetics image code ####
# if self.simnumber<2: # if self.simnumber<2:
# #save cosmic ray image map # #save cosmic ray image map
...@@ -2618,7 +2618,7 @@ class IFSsimulator(): ...@@ -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):
""" """
...@@ -2754,17 +2754,17 @@ class IFSsimulator(): ...@@ -2754,17 +2754,17 @@ class IFSsimulator():
self.image_b[0:1024+overscan, 0:2048+prescan+overscan] += np.random.normal( self.image_b[0:1024+overscan, 0:2048+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn2_b'], size=(1344, 2418)) loc=0.0, scale=self.information['rn2_b'], size=(1344, 2418))
########## zone 3, OSG ################# # ######### zone 3, OSG #################
np.random.seed() np.random.seed()
self.image_b[0:1024+overscan, 2418:2418+2048+prescan+overscan] += np.random.normal( self.image_b[0:1024+overscan, 2418:2418+2048+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn1_b'], size=(1344, 2418)) loc=0.0, scale=self.information['rn1_b'], size=(1344, 2418))
########## zone 1, OSE ################### # ######### zone 1, OSE ###################
np.random.seed() np.random.seed()
self.image_b[0:1024+overscan, 2418*2:2418*2+2048+prescan+overscan] += np.random.normal( self.image_b[0:1024+overscan, 2418*2:2418*2+2048+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn3_b'], size=(1344, 2418)) loc=0.0, scale=self.information['rn3_b'], size=(1344, 2418))
########## zone 2, OSF ############### # ######### zone 2, OSF ###############
np.random.seed() np.random.seed()
self.image_b[0:1024+overscan, 2418*3:2418*3+2048+prescan+overscan] += np.random.normal( self.image_b[0:1024+overscan, 2418*3:2418*3+2048+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn4_b'], size=(1344, 2418)) loc=0.0, scale=self.information['rn4_b'], size=(1344, 2418))
...@@ -2776,17 +2776,17 @@ class IFSsimulator(): ...@@ -2776,17 +2776,17 @@ class IFSsimulator():
self.image_r[0:1536+overscan, 0:3072+prescan+overscan] += np.random.normal( self.image_r[0:1536+overscan, 0:3072+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn2_r'], size=(1856, 3442)) loc=0.0, scale=self.information['rn2_r'], size=(1856, 3442))
########## zone 3 ,OSG ################# # ######### zone 3 ,OSG #################
np.random.seed() np.random.seed()
self.image_r[0:1536+overscan, 3442:3442+3072+prescan+overscan] += np.random.normal( self.image_r[0:1536+overscan, 3442:3442+3072+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn1_r'], size=(1856, 3442)) loc=0.0, scale=self.information['rn1_r'], size=(1856, 3442))
########## zone 1 ,OSE ################### # ######### zone 1 ,OSE ###################
np.random.seed() np.random.seed()
self.image_r[0:1536+overscan, 3442*2:3442*2+3072+prescan+overscan] += np.random.normal( self.image_r[0:1536+overscan, 3442*2:3442*2+3072+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn3_r'], size=(1856, 3442)) loc=0.0, scale=self.information['rn3_r'], size=(1856, 3442))
########## zone 2,OSF ########### # ######### zone 2,OSF ###########
np.random.seed() np.random.seed()
self.image_r[0:1536+overscan, 3442*3:3442*3+3072+prescan+overscan] += np.random.normal( self.image_r[0:1536+overscan, 3442*3:3442*3+3072+prescan+overscan] += np.random.normal(
loc=0.0, scale=self.information['rn4_r'], size=(1856, 3442)) loc=0.0, scale=self.information['rn4_r'], size=(1856, 3442))
...@@ -2812,17 +2812,17 @@ class IFSsimulator(): ...@@ -2812,17 +2812,17 @@ class IFSsimulator():
self.image_b[0:1024+overscan, prescan:2048 + self.image_b[0:1024+overscan, prescan:2048 +
prescan] += self.frame_b_4[0:1024+overscan, 0:2048] prescan] += self.frame_b_4[0:1024+overscan, 0:2048]
########## zone 3, OSG ################# # ######### zone 3, OSG #################
self.image_b[0:1024+overscan, prescan+2418:2418+2048 + self.image_b[0:1024+overscan, prescan+2418:2418+2048 +
prescan] += self.frame_b_3[0:1024+overscan, 0:2048] prescan] += self.frame_b_3[0:1024+overscan, 0:2048]
########## zone 1, OSE ################### # ######### zone 1, OSE ###################
self.image_b[0:1024+overscan, prescan+2418*2:2418*2 + self.image_b[0:1024+overscan, prescan+2418*2:2418*2 +
2048+prescan] += self.frame_b_1[0:1024+overscan, 0:2048] 2048+prescan] += self.frame_b_1[0:1024+overscan, 0:2048]
########## zone 2, OSF ############### # ######### zone 2, OSF ###############
self.image_b[0:1024+overscan, prescan+2418*3:2418*3 + self.image_b[0:1024+overscan, prescan+2418*3:2418*3 +
2048+prescan] += self.frame_b_2[0:1024+overscan, 0:2048] 2048+prescan] += self.frame_b_2[0:1024+overscan, 0:2048]
...@@ -2836,16 +2836,16 @@ class IFSsimulator(): ...@@ -2836,16 +2836,16 @@ class IFSsimulator():
self.image_r[0:1536+overscan, prescan+3442*0:3442*0 + self.image_r[0:1536+overscan, prescan+3442*0:3442*0 +
3072+prescan] += self.frame_r_4[0:1536+overscan, 0:3072] 3072+prescan] += self.frame_r_4[0:1536+overscan, 0:3072]
########## zone 3 ,OSG ################# # ######### zone 3 ,OSG #################
self.image_r[0:1536+overscan, prescan+3442*1:3442*1 + self.image_r[0:1536+overscan, prescan+3442*1:3442*1 +
3072+prescan] += self.frame_r_3[0:1536+overscan, 0:3072] 3072+prescan] += self.frame_r_3[0:1536+overscan, 0:3072]
########## zone 1 ,OSE ################### # ######### zone 1 ,OSE ###################
self.image_r[0:1536+overscan, prescan+3442*2:3442*2 + self.image_r[0:1536+overscan, prescan+3442*2:3442*2 +
3072+prescan] += self.frame_r_1[0:1536+overscan, 0:3072] 3072+prescan] += self.frame_r_1[0:1536+overscan, 0:3072]
########## zone 2,OSF ########### # ######### zone 2,OSF ###########
self.image_r[0:1536+overscan, prescan+3442*3:3442*3 + self.image_r[0:1536+overscan, prescan+3442*3:3442*3 +
3072+prescan] += self.frame_r_2[0:1536+overscan, 0:3072] 3072+prescan] += self.frame_r_2[0:1536+overscan, 0:3072]
...@@ -2928,36 +2928,36 @@ class IFSsimulator(): ...@@ -2928,36 +2928,36 @@ class IFSsimulator():
# # zone 2 # # zone 2
# self.image_b[0:1344, 2418*3:2418*4] /= self.information['gain2_b'] # self.image_b[0:1344, 2418*3:2418*4] /= self.information['gain2_b']
################# update @2024.10.18 ### # ################ update @2024.10.18 ###
# first part, menas old blue zone 4 # first part, menas old blue zone 4
self.image_b[0:1344, 0:2418] /= self.information['gain1_b'] self.image_b[0:1344, 0:2418] /= self.information['gain1_b']
##########second part, means old zone 3 ################# # #########second part, means old zone 3 #################
self.image_b[0:1344, 2418:2418*2] /= self.information['gain2_b'] self.image_b[0:1344, 2418:2418*2] /= self.information['gain2_b']
##########third part, means old zone 1 ################### # #########third part, means old zone 1 ###################
self.image_b[0:1344, 2418*2:2418*3] /= self.information['gain3_b'] self.image_b[0:1344, 2418*2:2418*3] /= self.information['gain3_b']
# 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
self.image_r[0:1856, 0:3442] /= self.information['gain1_r'] self.image_r[0:1856, 0:3442] /= self.information['gain1_r']
########## zone 3 ################# # ######### zone 3 #################
self.image_r[0:1856, 3442:3442*2] /= self.information['gain2_r'] self.image_r[0:1856, 3442:3442*2] /= self.information['gain2_r']
########## zone 1 ################### # ######### zone 1 ###################
self.image_r[0:1856, 3442*2:3442*3] /= self.information['gain3_r'] self.image_r[0:1856, 3442*2:3442*3] /= self.information['gain3_r']
# zone 2 # zone 2
self.image_r[0:1856, 3442*3:3442*4] /= self.information['gain4_r'] self.image_r[0:1856, 3442*3:3442*4] /= self.information['gain4_r']
# 3 # 3
#################################################################################### # ############################################################################
def applyBias(self): def applyBias(self):
""" """
...@@ -2973,7 +2973,7 @@ class IFSsimulator(): ...@@ -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:
...@@ -3030,16 +3030,16 @@ class IFSsimulator(): ...@@ -3030,16 +3030,16 @@ class IFSsimulator():
# blue zone 4 # blue zone 4
self.image_b[0:1344, 0:2418] += self.information['bias2_b'] self.image_b[0:1344, 0:2418] += self.information['bias2_b']
########## zone 3 ################# # ######### zone 3 #################
self.image_b[0:1344, 2418:2418*2] += self.information['bias1_b'] self.image_b[0:1344, 2418:2418*2] += self.information['bias1_b']
########## zone 1 ################### # ######### zone 1 ###################
self.image_b[0:1344, 2418*2:2418*3] += self.information['bias3_b'] self.image_b[0:1344, 2418*2:2418*3] += self.information['bias3_b']
# 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')
...@@ -3048,16 +3048,16 @@ class IFSsimulator(): ...@@ -3048,16 +3048,16 @@ class IFSsimulator():
# red zone 4 # red zone 4
self.image_r[0:1856, 0:3442] += self.information['bias2_r'] self.image_r[0:1856, 0:3442] += self.information['bias2_r']
########## zone 3 ################# # ######### zone 3 #################
self.image_r[0:1856, 3442:3442*2] += self.information['bias1_r'] self.image_r[0:1856, 3442:3442*2] += self.information['bias1_r']
########## zone 1 ################### # ######### zone 1 ###################
self.image_r[0:1856, 3442*2:3442*3] += self.information['bias3_r'] self.image_r[0:1856, 3442*2:3442*3] += self.information['bias3_r']
# 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')
...@@ -3097,7 +3097,7 @@ class IFSsimulator(): ...@@ -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'])))
...@@ -3147,7 +3147,7 @@ class IFSsimulator(): ...@@ -3147,7 +3147,7 @@ class IFSsimulator():
overload = value - self.information['fullwellcapacity'] overload = value - self.information['fullwellcapacity']
if overload > 0.: if overload > 0.:
overload /= 2. overload /= 2.
#self.image[j, i] -= overload # self.image[j, i] -= overload
self.image_b[j, i] -= overload self.image_b[j, i] -= overload
sum += overload sum += overload
...@@ -3165,14 +3165,14 @@ class IFSsimulator(): ...@@ -3165,14 +3165,14 @@ class IFSsimulator():
# second round - from top to bottom (bleeding was half'd already, so now full) # second round - from top to bottom (bleeding was half'd already, so now full)
overload = value - self.information['fullwellcapacity'] overload = value - self.information['fullwellcapacity']
if overload > 0.: if overload > 0.:
#self.image[-j-1, i] -= overload # self.image[-j-1, i] -= overload
self.image_b[-j-1, i] -= overload self.image_b[-j-1, i] -= overload
sum += overload sum += overload
elif sum > 0.: elif sum > 0.:
if -overload > sum: if -overload > sum:
overload = -sum overload = -sum
#self.image[-j-1, i] -= overload # self.image[-j-1, i] -= overload
self.image_b[-j-1, i] -= overload self.image_b[-j-1, i] -= overload
sum += overload sum += overload
...@@ -3185,14 +3185,14 @@ class IFSsimulator(): ...@@ -3185,14 +3185,14 @@ class IFSsimulator():
overload = value - self.information['fullwellcapacity'] overload = value - self.information['fullwellcapacity']
if overload > 0.: if overload > 0.:
overload /= 2. overload /= 2.
#self.image[j, i] -= overload # self.image[j, i] -= overload
self.image_r[j, i] -= overload self.image_r[j, i] -= overload
sum += overload sum += overload
elif sum > 0.: elif sum > 0.:
if -overload > sum: if -overload > sum:
overload = -sum overload = -sum
#self.image[j, i] -= overload # self.image[j, i] -= overload
self.image_r[j, i] -= overload self.image_r[j, i] -= overload
sum += overload sum += overload
...@@ -3203,14 +3203,14 @@ class IFSsimulator(): ...@@ -3203,14 +3203,14 @@ class IFSsimulator():
# second round - from top to bottom (bleeding was half'd already, so now full) # second round - from top to bottom (bleeding was half'd already, so now full)
overload = value - self.information['fullwellcapacity'] overload = value - self.information['fullwellcapacity']
if overload > 0.: if overload > 0.:
#self.image[-j-1, i] -= overload # self.image[-j-1, i] -= overload
self.image_r[-j-1, i] -= overload self.image_r[-j-1, i] -= overload
sum += overload sum += overload
elif sum > 0.: elif sum > 0.:
if -overload > sum: if -overload > sum:
overload = -sum overload = -sum
#self.image[-j-1, i] -= overload # self.image[-j-1, i] -= overload
self.image_r[-j-1, i] -= overload self.image_r[-j-1, i] -= overload
sum += overload sum += overload
...@@ -3260,8 +3260,7 @@ class IFSsimulator(): ...@@ -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):
# """ # """
...@@ -3386,14 +3385,15 @@ class IFSsimulator(): ...@@ -3386,14 +3385,15 @@ 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
y1 = 2418*2+prescan y1 = 2418*2+prescan
y2 = y1+2048 y2 = y1+2048
temp[x1:x2, y1:y2] = np.flipud(imgb[1024:2048, 0:2048]) temp[x1:x2, y1:y2] = np.flipud(imgb[1024:2048, 0:2048])
########## fourth part, old OSF part; down to yp ,left to right ####### # ######### fourth part, old OSF part; down to yp ,left to right #######
x1 = 0 x1 = 0
x2 = x1+1024 x2 = x1+1024
...@@ -3446,7 +3446,7 @@ class IFSsimulator(): ...@@ -3446,7 +3446,7 @@ class IFSsimulator():
y1 = 0+prescan y1 = 0+prescan
y2 = y1+3072 y2 = y1+3072
temp[x1:x2, y1:y2] = np.fliplr(imgr[0:1536, 3072:6144]) temp[x1:x2, y1:y2] = np.fliplr(imgr[0:1536, 3072:6144])
########## second part, old OSH ,no change; ################# # ######### second part, old OSH ,no change; #################
# np.fliplr(b2) ## left to right # np.fliplr(b2) ## left to right
# np.flipud(b3) ## down to up # np.flipud(b3) ## down to up
x1 = 0 x1 = 0
...@@ -3455,14 +3455,14 @@ class IFSsimulator(): ...@@ -3455,14 +3455,14 @@ class IFSsimulator():
y1 = 3442+prescan y1 = 3442+prescan
y2 = y1+3072 y2 = y1+3072
temp[x1:x2, y1:y2] = imgr[0:1536, 0:3072] temp[x1:x2, y1:y2] = imgr[0:1536, 0:3072]
########## third part , old OSE , down to up ############################ # ######### third part , old OSE , down to up ############################
x1 = 0 x1 = 0
x2 = x1+1536 x2 = x1+1536
y1 = 3442*2+prescan y1 = 3442*2+prescan
y2 = y1+3072 y2 = y1+3072
temp[x1:x2, y1:y2] = np.flipud(imgr[1536:3072, 0:3072]) temp[x1:x2, y1:y2] = np.flipud(imgr[1536:3072, 0:3072])
########## fourth part, old OSF, down to up ,left to right ################ # ######### fourth part, old OSF, down to up ,left to right ################
x1 = 0 x1 = 0
x2 = x1+1536 x2 = x1+1536
...@@ -3566,7 +3566,7 @@ class IFSsimulator(): ...@@ -3566,7 +3566,7 @@ class IFSsimulator():
self.file_r = self.result_path+'/calibration_Data/'+filename_r+'.fits' self.file_r = self.result_path+'/calibration_Data/'+filename_r+'.fits'
# create a new FITS file, using HDUList instance # create a new FITS file, using HDUList instance
##### layer 0 #### # #### layer 0 ####
ofd_b = fits.PrimaryHDU() ofd_b = fits.PrimaryHDU()
...@@ -3575,7 +3575,7 @@ class IFSsimulator(): ...@@ -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'] = (
...@@ -3589,7 +3589,7 @@ class IFSsimulator(): ...@@ -3589,7 +3589,7 @@ class IFSsimulator():
ofd_b.header['EQUINOX'] = (float(2000.0), '') ofd_b.header['EQUINOX'] = (float(2000.0), '')
ofd_b.header['FITSSWV'] = ( ofd_b.header['FITSSWV'] = (
'ifs_sim_0.8.03', 'FITS creating software version') 'ifs_sim_0.8.03', 'FITS creating software version')
######### Object information ############# # ######## Object information #############
if self.source == 'SCI' or self.source == 'COMP': if self.source == 'SCI' or self.source == 'COMP':
ofd_b.header['OBJECT'] = ( ofd_b.header['OBJECT'] = (
self.information['name_obj'][:30], 'object name') self.information['name_obj'][:30], 'object name')
...@@ -3640,7 +3640,7 @@ class IFSsimulator(): ...@@ -3640,7 +3640,7 @@ class IFSsimulator():
####################################################################### #######################################################################
######## Telescope information ############### # ####### Telescope information ###############
ofd_b.header['REFFRAME'] = ('CSSTGSC-1.0', 'guiding catalog version') ofd_b.header['REFFRAME'] = ('CSSTGSC-1.0', 'guiding catalog version')
ofd_b.header['DATE-OBS'] = (data_time[:21], ofd_b.header['DATE-OBS'] = (data_time[:21],
...@@ -3741,7 +3741,7 @@ class IFSsimulator(): ...@@ -3741,7 +3741,7 @@ class IFSsimulator():
ofd_b.header['DATASUM'] = (data_time[:19], ss2) ofd_b.header['DATASUM'] = (data_time[:19], ss2)
########## ##########
########## finish header for 0 layer ###################### # ######### finish header for 0 layer ######################
############################################################# #############################################################
# header # header
# new image HDU, blue channel, layer 1 # new image HDU, blue channel, layer 1
...@@ -3777,7 +3777,7 @@ class IFSsimulator(): ...@@ -3777,7 +3777,7 @@ class IFSsimulator():
hdu_b.header['BUNIT'] = ('ADU', 'physical unit of array values') hdu_b.header['BUNIT'] = ('ADU', 'physical unit of array values')
####################################################################### #######################################################################
######### instrument information ################################### # ######## instrument information ###################################
if self.source == 'SCI' or self.source == 'COMP': if self.source == 'SCI' or self.source == 'COMP':
hdu_b.header['CMIRRPOS'] = ( hdu_b.header['CMIRRPOS'] = (
...@@ -3808,7 +3808,7 @@ class IFSsimulator(): ...@@ -3808,7 +3808,7 @@ class IFSsimulator():
###################################################################### ######################################################################
#################### detector information########################## # ################### detector information##########################
hdu_b.header['CAMERA'] = ('Blue', 'camera of IFS') hdu_b.header['CAMERA'] = ('Blue', 'camera of IFS')
hdu_b.header['DETSN'] = ('CCD231-c4-00', 'detector serial number') hdu_b.header['DETSN'] = ('CCD231-c4-00', 'detector serial number')
...@@ -3870,7 +3870,7 @@ class IFSsimulator(): ...@@ -3870,7 +3870,7 @@ class IFSsimulator():
hdu_b.header['DETTEMP1'] = (np.float32( hdu_b.header['DETTEMP1'] = (np.float32(
0.0), 'detector temperature at EXPT1_'+str(k+1)+' (K)') 0.0), 'detector temperature at EXPT1_'+str(k+1)+' (K)')
#######################end revised on 2024.2.27 ### # ######################end revised on 2024.2.27 ###
hdu_b.header['BIN_X'] = ( hdu_b.header['BIN_X'] = (
np.int16(1), 'bin number in X (wavelength)') np.int16(1), 'bin number in X (wavelength)')
...@@ -3927,7 +3927,7 @@ class IFSsimulator(): ...@@ -3927,7 +3927,7 @@ class IFSsimulator():
hdu_b.header['Hole'] = ('yes', 'apply hole to LAMP') hdu_b.header['Hole'] = ('yes', 'apply hole to LAMP')
##################################################################### #####################################################################
#################### red camera ###################### # ################### red camera ######################
# create a new FITS file, using HDUList instance # create a new FITS file, using HDUList instance
ofd_r = fits.PrimaryHDU() ofd_r = fits.PrimaryHDU()
...@@ -4008,7 +4008,7 @@ class IFSsimulator(): ...@@ -4008,7 +4008,7 @@ class IFSsimulator():
####################################################################### #######################################################################
######## Telescope information ############### # ####### Telescope information ###############
ofd_r.header['REFFRAME'] = ('CSSTGSC-1.0', 'guiding catalog version') ofd_r.header['REFFRAME'] = ('CSSTGSC-1.0', 'guiding catalog version')
ofd_r.header['DATE-OBS'] = (data_time[:21], ofd_r.header['DATE-OBS'] = (data_time[:21],
...@@ -4121,7 +4121,7 @@ class IFSsimulator(): ...@@ -4121,7 +4121,7 @@ class IFSsimulator():
ofd_r.header['DATASUM'] = (data_time[:19], ss2) ofd_r.header['DATASUM'] = (data_time[:19], ss2)
########## ##########
########## finish header for 0 layer ###################### # ######### finish header for 0 layer ######################
############################################################# #############################################################
# header # header
...@@ -4156,7 +4156,7 @@ class IFSsimulator(): ...@@ -4156,7 +4156,7 @@ class IFSsimulator():
hdu_r.header['BZERO'] = (np.float64(32768), '') hdu_r.header['BZERO'] = (np.float64(32768), '')
hdu_r.header['BUNIT'] = ('ADU', 'physical unit of array values') hdu_r.header['BUNIT'] = ('ADU', 'physical unit of array values')
######### instrument information ###### # ######## instrument information ######
if self.source == 'SCI' or self.source == 'COMP': if self.source == 'SCI' or self.source == 'COMP':
...@@ -4186,7 +4186,7 @@ class IFSsimulator(): ...@@ -4186,7 +4186,7 @@ class IFSsimulator():
hdu_r.header['IFSSTAT'] = ( hdu_r.header['IFSSTAT'] = (
np.int32(0), 'IFS components status parameter') np.int32(0), 'IFS components status parameter')
################### detector information############################ # ################## detector information############################
hdu_r.header['CAMERA'] = ('Red', 'camera of IFS') hdu_r.header['CAMERA'] = ('Red', 'camera of IFS')
hdu_r.header['DETSN'] = ('CCD231-c6-00', 'detector serial number') hdu_r.header['DETSN'] = ('CCD231-c6-00', 'detector serial number')
...@@ -4244,7 +4244,7 @@ class IFSsimulator(): ...@@ -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(
...@@ -4302,7 +4302,7 @@ class IFSsimulator(): ...@@ -4302,7 +4302,7 @@ class IFSsimulator():
if self.source == 'LAMP' and self.information['holemask'] == 'yes': if self.source == 'LAMP' and self.information['holemask'] == 'yes':
hdu_r.header['Hole'] = ('yes', 'apply hole to LAMP') hdu_r.header['Hole'] = ('yes', 'apply hole to LAMP')
######################### #########################
hdu1 = fits.PrimaryHDU(header=ofd_b.header) hdu1 = fits.PrimaryHDU(header=ofd_b.header)
hdu2 = fits.PrimaryHDU(header=ofd_r.header) hdu2 = fits.PrimaryHDU(header=ofd_r.header)
...@@ -4445,11 +4445,8 @@ class IFSsimulator(): ...@@ -4445,11 +4445,8 @@ class IFSsimulator():
return return
# ############################################################################
######################################################################################################################################################################################################################################################## # ############################################################################
###################################################################################
##################################################################################
def CalskyNoise(self, lam): def CalskyNoise(self, lam):
""" """
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment