Loading ObservationSim/MockObject/FlatLED.py +24 −10 Original line number Diff line number Diff line Loading @@ -35,12 +35,21 @@ cwaves_fwhm = {'LED1': 110, 'LED2': 120, 'LED3': 200, 'LED4': 300, 'LED5': 300, 'LED8': 260, 'LED9': 400, 'LED10': 370, 'LED11': 500, 'LED12': 1400, 'LED13': 90, 'LED14': 100} # LED_QE = {'LED1': 0.3, 'LED2': 0.4, 'LED13': 0.5, 'LED14': 0.5, 'LED10': 0.4} # e-/ms fluxLED = {'LED1': 0.16478729, 'LED2': 0.084220931, 'LED3': 2.263360617, 'LED4': 2.190623489, 'LED5': 0.703504768, 'LED6': 0.446117963, 'LED7': 0.647122098, 'LED8': 0.922313442, 'LED9': 0.987278143, 'LED10': 2.043989167, 'LED11': 0.612571429, 'LED12': 1.228915663, 'LED13': 0.17029384, 'LED14': 0.27842925} # fluxLED = {'LED1': 0.16478729, 'LED2': 0.084220931, 'LED3': 2.263360617, 'LED4': 2.190623489, 'LED5': 0.703504768, # 'LED6': 0.446117963, 'LED7': 0.647122098, 'LED8': 0.922313442, # 'LED9': 0.987278143, 'LED10': 2.043989167, 'LED11': 0.612571429, 'LED12': 1.228915663, 'LED13': 0.17029384, # 'LED14': 0.27842925} # e-/ms fluxLED = {'LED1': 15, 'LED2': 15, 'LED3': 12.5, 'LED4': 9, 'LED5': 9, 'LED6': 9, 'LED7': 9, 'LED8': 9, 'LED9': 9, 'LED10': 12.5, 'LED11': 15, 'LED12':15, 'LED13': 12.5, 'LED14': 12.5} # fluxLEDL = {'LED1': 10, 'LED2': 10, 'LED3': 10, 'LED4': 10, 'LED5': 10, # 'LED6': 10, 'LED7': 10, 'LED8': 10, 'LED9': 10, 'LED10': 10, 'LED11': 10, 'LED12':10, 'LED13': 10, # 'LED14': 10} mirro_eff = {'GU':0.61, 'GV':0.8, 'GI':0.8} # mirro_eff = {'GU':1, 'GV':1, 'GI':1} class FlatLED(object): def __init__(self, chip,filt, flatDir = None, logger=None): Loading Loading @@ -115,7 +124,7 @@ class FlatLED(object): t_spec = np.trapz(f_spec*ccd_eff*fil_eff, w_list) # print(i, np.mean(unitFlatImg), t_spec, exp_t) unitFlatImg = unitFlatImg * t_spec # print("DEBUG1:---------------",np.mean(unitFlatImg)) ledFlat = ledFlat+unitFlatImg*exp_t return ledFlat Loading @@ -134,6 +143,7 @@ class FlatLED(object): led_wave = cwaves[led_type] led_fwhm = cwaves_fwhm[led_type] led_spec = self.gaussian1d_profile_led(led_wave, led_fwhm) # print("DEBUG1:---------------",np.mean(ledFlat_)) ledspec_map = self.calculateLEDSpec( skyMap=ledFlat_, blueLimit=self.filt.blue_limit, Loading @@ -160,11 +170,15 @@ class FlatLED(object): xlist = np.arange(xc-x_radii, xc+x_radii, 0.5) xlist_ = np.zeros(len(xlist) + 2) xlist_[1:-1] = xlist xlist_[0] = 2550 xlist_[-1] = 10000 xlist_[0] = 2000 xlist_[-1] = 18000 ids1 = xlist>xc-fwhm ids2 = xlist[ids1]<xc+fwhm data = np.exp((-(xlist-xc)*(xlist-xc))/(2*sigma*sigma))/(np.sqrt(2*math.pi)*sigma) scale = 1/np.trapz(data[ids1][ids2], xlist[ids1][ids2]) data_ = np.zeros(len(xlist) + 2) data_[1:-1] = data data_[1:-1] = data*scale # print("DEBUG:-------------------------------",np.sum(data_), scale) return Table(np.array([xlist_.astype(np.float32), data_.astype(np.float32)]).T, names=('WAVELENGTH', 'FLUX')) def calculateLEDSpec(self, skyMap=None, blueLimit=4200, redLimit=6500, Loading Loading @@ -232,7 +246,7 @@ class FlatLED(object): tar_spec=spec, band_start=tbstart, band_end=tbend, conf=conf2, flat_cube=flat_cube, ignoreBeam=['D', 'E']) flat_cube=flat_cube) spec_orders = sdp.compute_spec_orders() Loading Loading @@ -356,7 +370,7 @@ class FlatLED(object): else: fimg = fImg.array fimg = fimg * pixelSize * pixelSize # fimg = fimg * pixelSize * pixelSize return fimg Loading ObservationSim/sim_steps/add_LED_flat.py +9 −2 Original line number Diff line number Diff line Loading @@ -13,8 +13,15 @@ def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param): print("LED OPEN--------") led_obj = FlatLED(chip, filt) led_flat = led_obj.drawObj_LEDFlat(led_type_list=obs_param["LED_TYPE"], exp_t_list=obs_param["LED_TIME"]) pf_map = led_flat chip.img = chip.img + led_flat if obs_param["shutter_effect"] == True: pf_map = pf_map * chip.shutter_img pf_map = np.array(pf_map, dtype='float32') self.updateHeaderInfo(header_flag='ext', keys = ['SHTSTAT'], values = [True]) else: self.updateHeaderInfo(header_flag='ext', keys = ['SHTSTAT','SHTOPEN0','SHTOPEN1','SHTCLOS0','SHTCLOS1'], values = [False,'','','','']) chip.img = chip.img + pf_map return chip, filt, tel, pointing No newline at end of file ObservationSim/sim_steps/readout_output.py +6 −5 Original line number Diff line number Diff line Loading @@ -12,11 +12,6 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param): pre2=chip.prescan_y, over1=chip.overscan_x, over2=chip.overscan_y) if obs_param["add_dark"] == True: ny = int(chip.npix_y/2) base_dark = (ny-1)*(chip.readout_time/ny)*chip.dark_noise chip.img.array[(chip.prescan_y+ny):-(chip.prescan_y+ny),:] = bese_dark return chip, filt, tel, pointing def add_readout_noise(self, chip, filt, tel, pointing, catalog, obs_param): Loading Loading @@ -44,6 +39,12 @@ def quantization_and_output(self, chip, filt, tel, pointing, catalog, obs_param) _, _ = self.prepare_headers(chip=chip, pointing=pointing) self.updateHeaderInfo(header_flag='ext', keys = ['SHTSTAT','SHTOPEN0','SHTOPEN1','SHTCLOS0','SHTCLOS1'], values = [False,'','','','']) gains1 = list(chip.gain_channel[0:8]) gains2 = list(chip.gain_channel[8:]) gains2.reverse() gains = np.append(gains1,gains2) self.updateHeaderInfo(header_flag='ext', keys = ['GAIN01','GAIN02','GAIN03','GAIN04','GAIN05','GAIN06','GAIN07','GAIN08','GAIN09','GAIN10','GAIN11','GAIN12','GAIN13','GAIN14','GAIN15','GAIN16'], values = gains) if obs_param["format_output"] == True: self.chip_output.Log_info(" Apply 1*16 format") chip.img = chip_utils.formatOutput(GSImage=chip.img) Loading config/obs_config_Calibration_BIAS.yaml 0 → 100644 +76 −0 Original line number Diff line number Diff line --- ############################################### # # Configuration file for CSST simulation # For single exposure type: # BIAS # CSST-Sim Group, 2024/01/08 # ############################################### # Observation type obs_type: "BIAS" obs_type_code: "120" obs_id: "00000001" # Define list of chips run_chips: [17] # Define observation sequence call_sequence: # # Accumulate fluxes from objects # led_calib_model: # #"LED": ['LED1','LED2','LED3','LED4','LED5','LED6','LED7','LED8','LED9','LED10','LED11','LED12','LED13','LED14'] or null # #'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '525', 'LED6': '590', 'LED7': '670', # #'LED8': '760', 'LED9': '880', 'LED10': '940', 'LED11': '1050', 'LED12': '1550','LED13': '340', 'LED14': '365' # LED_TYPE: ['LED13'] # LED_TIME: [1.] # # if open shutter effect, led time must be >=2.6s # shutter_effect: NO # flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key # flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if # none,set null,or delete the key # sky_background: # exptime: 150. # [s] # shutter_effect: YES # flat_fielding: YES # enable_straylight_model: YES # flat_level: 20000 # flat_level_filt: g # Apply PRNU to accumulated photons PRNU_effect: {} # Accumulate photons caused by cosmic rays cosmic_rays: {} # Add Poission noise and dark current poisson_and_dark: add_dark: YES # Simulate brighter fatter effects bright_fatter: {} # Add detector defects: hot/warm pixels, bad columns detector_defects: hot_pixels: YES dead_pixels: YES bad_columns: YES # Apply response nonlinearity nonlinearity: {} # Apply CCD Saturation & Blooming blooming: {} # # Run CTE simulation CTE_effect: {} # Add prescan and overscan prescan_overscan: {} # Add bias bias: bias_16channel: YES # Add readout noise readout_noise: {} # Apply gain gain: gain_16channel: YES # Output the final image quantization_and_output: format_output: NO ... No newline at end of file config/obs_config_Calibration.yaml→config/obs_config_Calibration_FLAT.yaml +17 −14 Original line number Diff line number Diff line Loading @@ -3,39 +3,42 @@ # # Configuration file for CSST simulation # For single exposure type: # SCI-WIDE # FLAT # CSST-Sim Group, 2024/01/08 # ############################################### # Observation type obs_type: "DARK" obs_type: "FLAT" obs_type_code: "128" obs_id: "00000001" # Define list of chips run_chips: [8] run_chips: [17] # Define observation sequence call_sequence: # Accumulate fluxes from objects led_calib_model: #"LED": ['LED1','LED2','LED3','LED4','LED5','LED6','LED7','LED8','LED9','LED10','LED11','LED12','LED13','LED14'] or null #'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '545', 'LED6': '590', 'LED7': '670', #'LED8': '760', 'LED9': '940', 'LED10': '940', 'LED11': '1050', 'LED12': '1050','LED13': '340', 'LED14': '365' LED_TYPE: ['LED5'] #'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '525', 'LED6': '590', 'LED7': '670', #'LED8': '760', 'LED9': '880', 'LED10': '940', 'LED11': '1050', 'LED12': '1550','LED13': '340', 'LED14': '365' LED_TYPE: ['LED13'] LED_TIME: [1.] # if open shutter effect, led time must be >=2.6s shutter_effect: NO # flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key # flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if # none,set null,or delete the key sky_background: exptime: 150. # [s] shutter_effect: YES flat_fielding: YES enable_straylight_model: YES flat_level: 20000 flat_level_filt: g # sky_background: # exptime: 150. # [s] # shutter_effect: YES # flat_fielding: YES # enable_straylight_model: YES # flat_level: 20000 # flat_level_filt: g # Apply PRNU to accumulated photons PRNU_effect: {} Loading Loading
ObservationSim/MockObject/FlatLED.py +24 −10 Original line number Diff line number Diff line Loading @@ -35,12 +35,21 @@ cwaves_fwhm = {'LED1': 110, 'LED2': 120, 'LED3': 200, 'LED4': 300, 'LED5': 300, 'LED8': 260, 'LED9': 400, 'LED10': 370, 'LED11': 500, 'LED12': 1400, 'LED13': 90, 'LED14': 100} # LED_QE = {'LED1': 0.3, 'LED2': 0.4, 'LED13': 0.5, 'LED14': 0.5, 'LED10': 0.4} # e-/ms fluxLED = {'LED1': 0.16478729, 'LED2': 0.084220931, 'LED3': 2.263360617, 'LED4': 2.190623489, 'LED5': 0.703504768, 'LED6': 0.446117963, 'LED7': 0.647122098, 'LED8': 0.922313442, 'LED9': 0.987278143, 'LED10': 2.043989167, 'LED11': 0.612571429, 'LED12': 1.228915663, 'LED13': 0.17029384, 'LED14': 0.27842925} # fluxLED = {'LED1': 0.16478729, 'LED2': 0.084220931, 'LED3': 2.263360617, 'LED4': 2.190623489, 'LED5': 0.703504768, # 'LED6': 0.446117963, 'LED7': 0.647122098, 'LED8': 0.922313442, # 'LED9': 0.987278143, 'LED10': 2.043989167, 'LED11': 0.612571429, 'LED12': 1.228915663, 'LED13': 0.17029384, # 'LED14': 0.27842925} # e-/ms fluxLED = {'LED1': 15, 'LED2': 15, 'LED3': 12.5, 'LED4': 9, 'LED5': 9, 'LED6': 9, 'LED7': 9, 'LED8': 9, 'LED9': 9, 'LED10': 12.5, 'LED11': 15, 'LED12':15, 'LED13': 12.5, 'LED14': 12.5} # fluxLEDL = {'LED1': 10, 'LED2': 10, 'LED3': 10, 'LED4': 10, 'LED5': 10, # 'LED6': 10, 'LED7': 10, 'LED8': 10, 'LED9': 10, 'LED10': 10, 'LED11': 10, 'LED12':10, 'LED13': 10, # 'LED14': 10} mirro_eff = {'GU':0.61, 'GV':0.8, 'GI':0.8} # mirro_eff = {'GU':1, 'GV':1, 'GI':1} class FlatLED(object): def __init__(self, chip,filt, flatDir = None, logger=None): Loading Loading @@ -115,7 +124,7 @@ class FlatLED(object): t_spec = np.trapz(f_spec*ccd_eff*fil_eff, w_list) # print(i, np.mean(unitFlatImg), t_spec, exp_t) unitFlatImg = unitFlatImg * t_spec # print("DEBUG1:---------------",np.mean(unitFlatImg)) ledFlat = ledFlat+unitFlatImg*exp_t return ledFlat Loading @@ -134,6 +143,7 @@ class FlatLED(object): led_wave = cwaves[led_type] led_fwhm = cwaves_fwhm[led_type] led_spec = self.gaussian1d_profile_led(led_wave, led_fwhm) # print("DEBUG1:---------------",np.mean(ledFlat_)) ledspec_map = self.calculateLEDSpec( skyMap=ledFlat_, blueLimit=self.filt.blue_limit, Loading @@ -160,11 +170,15 @@ class FlatLED(object): xlist = np.arange(xc-x_radii, xc+x_radii, 0.5) xlist_ = np.zeros(len(xlist) + 2) xlist_[1:-1] = xlist xlist_[0] = 2550 xlist_[-1] = 10000 xlist_[0] = 2000 xlist_[-1] = 18000 ids1 = xlist>xc-fwhm ids2 = xlist[ids1]<xc+fwhm data = np.exp((-(xlist-xc)*(xlist-xc))/(2*sigma*sigma))/(np.sqrt(2*math.pi)*sigma) scale = 1/np.trapz(data[ids1][ids2], xlist[ids1][ids2]) data_ = np.zeros(len(xlist) + 2) data_[1:-1] = data data_[1:-1] = data*scale # print("DEBUG:-------------------------------",np.sum(data_), scale) return Table(np.array([xlist_.astype(np.float32), data_.astype(np.float32)]).T, names=('WAVELENGTH', 'FLUX')) def calculateLEDSpec(self, skyMap=None, blueLimit=4200, redLimit=6500, Loading Loading @@ -232,7 +246,7 @@ class FlatLED(object): tar_spec=spec, band_start=tbstart, band_end=tbend, conf=conf2, flat_cube=flat_cube, ignoreBeam=['D', 'E']) flat_cube=flat_cube) spec_orders = sdp.compute_spec_orders() Loading Loading @@ -356,7 +370,7 @@ class FlatLED(object): else: fimg = fImg.array fimg = fimg * pixelSize * pixelSize # fimg = fimg * pixelSize * pixelSize return fimg Loading
ObservationSim/sim_steps/add_LED_flat.py +9 −2 Original line number Diff line number Diff line Loading @@ -13,8 +13,15 @@ def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param): print("LED OPEN--------") led_obj = FlatLED(chip, filt) led_flat = led_obj.drawObj_LEDFlat(led_type_list=obs_param["LED_TYPE"], exp_t_list=obs_param["LED_TIME"]) pf_map = led_flat chip.img = chip.img + led_flat if obs_param["shutter_effect"] == True: pf_map = pf_map * chip.shutter_img pf_map = np.array(pf_map, dtype='float32') self.updateHeaderInfo(header_flag='ext', keys = ['SHTSTAT'], values = [True]) else: self.updateHeaderInfo(header_flag='ext', keys = ['SHTSTAT','SHTOPEN0','SHTOPEN1','SHTCLOS0','SHTCLOS1'], values = [False,'','','','']) chip.img = chip.img + pf_map return chip, filt, tel, pointing No newline at end of file
ObservationSim/sim_steps/readout_output.py +6 −5 Original line number Diff line number Diff line Loading @@ -12,11 +12,6 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param): pre2=chip.prescan_y, over1=chip.overscan_x, over2=chip.overscan_y) if obs_param["add_dark"] == True: ny = int(chip.npix_y/2) base_dark = (ny-1)*(chip.readout_time/ny)*chip.dark_noise chip.img.array[(chip.prescan_y+ny):-(chip.prescan_y+ny),:] = bese_dark return chip, filt, tel, pointing def add_readout_noise(self, chip, filt, tel, pointing, catalog, obs_param): Loading Loading @@ -44,6 +39,12 @@ def quantization_and_output(self, chip, filt, tel, pointing, catalog, obs_param) _, _ = self.prepare_headers(chip=chip, pointing=pointing) self.updateHeaderInfo(header_flag='ext', keys = ['SHTSTAT','SHTOPEN0','SHTOPEN1','SHTCLOS0','SHTCLOS1'], values = [False,'','','','']) gains1 = list(chip.gain_channel[0:8]) gains2 = list(chip.gain_channel[8:]) gains2.reverse() gains = np.append(gains1,gains2) self.updateHeaderInfo(header_flag='ext', keys = ['GAIN01','GAIN02','GAIN03','GAIN04','GAIN05','GAIN06','GAIN07','GAIN08','GAIN09','GAIN10','GAIN11','GAIN12','GAIN13','GAIN14','GAIN15','GAIN16'], values = gains) if obs_param["format_output"] == True: self.chip_output.Log_info(" Apply 1*16 format") chip.img = chip_utils.formatOutput(GSImage=chip.img) Loading
config/obs_config_Calibration_BIAS.yaml 0 → 100644 +76 −0 Original line number Diff line number Diff line --- ############################################### # # Configuration file for CSST simulation # For single exposure type: # BIAS # CSST-Sim Group, 2024/01/08 # ############################################### # Observation type obs_type: "BIAS" obs_type_code: "120" obs_id: "00000001" # Define list of chips run_chips: [17] # Define observation sequence call_sequence: # # Accumulate fluxes from objects # led_calib_model: # #"LED": ['LED1','LED2','LED3','LED4','LED5','LED6','LED7','LED8','LED9','LED10','LED11','LED12','LED13','LED14'] or null # #'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '525', 'LED6': '590', 'LED7': '670', # #'LED8': '760', 'LED9': '880', 'LED10': '940', 'LED11': '1050', 'LED12': '1550','LED13': '340', 'LED14': '365' # LED_TYPE: ['LED13'] # LED_TIME: [1.] # # if open shutter effect, led time must be >=2.6s # shutter_effect: NO # flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key # flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if # none,set null,or delete the key # sky_background: # exptime: 150. # [s] # shutter_effect: YES # flat_fielding: YES # enable_straylight_model: YES # flat_level: 20000 # flat_level_filt: g # Apply PRNU to accumulated photons PRNU_effect: {} # Accumulate photons caused by cosmic rays cosmic_rays: {} # Add Poission noise and dark current poisson_and_dark: add_dark: YES # Simulate brighter fatter effects bright_fatter: {} # Add detector defects: hot/warm pixels, bad columns detector_defects: hot_pixels: YES dead_pixels: YES bad_columns: YES # Apply response nonlinearity nonlinearity: {} # Apply CCD Saturation & Blooming blooming: {} # # Run CTE simulation CTE_effect: {} # Add prescan and overscan prescan_overscan: {} # Add bias bias: bias_16channel: YES # Add readout noise readout_noise: {} # Apply gain gain: gain_16channel: YES # Output the final image quantization_and_output: format_output: NO ... No newline at end of file
config/obs_config_Calibration.yaml→config/obs_config_Calibration_FLAT.yaml +17 −14 Original line number Diff line number Diff line Loading @@ -3,39 +3,42 @@ # # Configuration file for CSST simulation # For single exposure type: # SCI-WIDE # FLAT # CSST-Sim Group, 2024/01/08 # ############################################### # Observation type obs_type: "DARK" obs_type: "FLAT" obs_type_code: "128" obs_id: "00000001" # Define list of chips run_chips: [8] run_chips: [17] # Define observation sequence call_sequence: # Accumulate fluxes from objects led_calib_model: #"LED": ['LED1','LED2','LED3','LED4','LED5','LED6','LED7','LED8','LED9','LED10','LED11','LED12','LED13','LED14'] or null #'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '545', 'LED6': '590', 'LED7': '670', #'LED8': '760', 'LED9': '940', 'LED10': '940', 'LED11': '1050', 'LED12': '1050','LED13': '340', 'LED14': '365' LED_TYPE: ['LED5'] #'LED1': '275', 'LED2': '310', 'LED3': '430', 'LED4': '505', 'LED5': '525', 'LED6': '590', 'LED7': '670', #'LED8': '760', 'LED9': '880', 'LED10': '940', 'LED11': '1050', 'LED12': '1550','LED13': '340', 'LED14': '365' LED_TYPE: ['LED13'] LED_TIME: [1.] # if open shutter effect, led time must be >=2.6s shutter_effect: NO # flat_level: set the total skybackground value (e-) in the exptime,if none,set null, or delete the key # flat_level_filt: the vale of "flat_level" is in the filter "flat_level_filt", can set NUV, u, g, r, i, z, y, if # none,set null,or delete the key sky_background: exptime: 150. # [s] shutter_effect: YES flat_fielding: YES enable_straylight_model: YES flat_level: 20000 flat_level_filt: g # sky_background: # exptime: 150. # [s] # shutter_effect: YES # flat_fielding: YES # enable_straylight_model: YES # flat_level: 20000 # flat_level_filt: g # Apply PRNU to accumulated photons PRNU_effect: {} Loading