import numpy as np from ObservationSim.MockObject import FlatLED import galsim def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param): if not hasattr(self, 'h_ext'): _, _ = self.prepare_headers(chip=chip, pointing=pointing) chip_wcs = galsim.FitsWCS(header = self.h_ext) pf_map = np.zeros_like(chip.img.array) if obs_param["LED_TYPE"] is not None: if len(obs_param["LED_TYPE"]) != 0: print("LED OPEN--------") led_obj = FlatLED(chip, filt) led_flat, ledstat, letts = led_obj.drawObj_LEDFlat(led_type_list=obs_param["LED_TYPE"], exp_t_list=obs_param["LED_TIME"]) pf_map = led_flat self.updateHeaderInfo(header_flag='ext', keys = ['LEDSTAT'], values = [ledstat]) self.updateHeaderInfo(header_flag='ext', keys = ['LEDT01','LEDT02','LEDT03','LEDT04','LEDT05','LEDT06','LEDT07','LEDT08','LEDT09','LEDT10','LEDT11','LEDT12','LEDT13','LEDT14'], values = letts) 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