Commit 9a4dead8 authored by Wei Chengliang's avatar Wei Chengliang
Browse files

update codestyle-PEP8

parent 99502553
Pipeline #7109 failed with stage
in 0 seconds
...@@ -27,7 +27,7 @@ def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -27,7 +27,7 @@ def add_LED_Flat(self, chip, filt, tel, pointing, catalog, obs_param):
self.updateHeaderInfo(header_flag='ext', keys=['LEDT01', 'LEDT02', 'LEDT03', 'LEDT04', 'LEDT05', 'LEDT06', self.updateHeaderInfo(header_flag='ext', keys=['LEDT01', 'LEDT02', 'LEDT03', 'LEDT04', 'LEDT05', 'LEDT06',
'LEDT07', 'LEDT08', 'LEDT09', 'LEDT10', 'LEDT11', 'LEDT12', 'LEDT13', 'LEDT14'], values=letts) 'LEDT07', 'LEDT08', 'LEDT09', 'LEDT10', 'LEDT11', 'LEDT12', 'LEDT13', 'LEDT14'], values=letts)
if obs_param["shutter_effect"] == True: if obs_param["shutter_effect"] is True:
pf_map = pf_map * chip.shutter_img pf_map = pf_map * chip.shutter_img
pf_map = np.array(pf_map, dtype='float32') pf_map = np.array(pf_map, dtype='float32')
self.updateHeaderInfo(header_flag='ext', keys=[ self.updateHeaderInfo(header_flag='ext', keys=[
......
...@@ -48,7 +48,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -48,7 +48,7 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
self.chip_output.Log_error("unrecognized PSF model type!!", flush=True) self.chip_output.Log_error("unrecognized PSF model type!!", flush=True)
# Apply field distortion model # Apply field distortion model
if obs_param["field_dist"] == True: if obs_param["field_dist"] is True:
fd_model = FieldDistortion(chip=chip, img_rot=pointing.img_pa.deg) fd_model = FieldDistortion(chip=chip, img_rot=pointing.img_pa.deg)
else: else:
fd_model = None fd_model = None
...@@ -253,10 +253,10 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -253,10 +253,10 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
# Apply flat fielding (with shutter effects) # Apply flat fielding (with shutter effects)
flat_normal = np.ones_like(chip.img.array) flat_normal = np.ones_like(chip.img.array)
if obs_param["flat_fielding"] == True: if obs_param["flat_fielding"] is True:
flat_normal = flat_normal * chip.flat_img.array / \ flat_normal = flat_normal * chip.flat_img.array / \
np.mean(chip.flat_img.array) np.mean(chip.flat_img.array)
if obs_param["shutter_effect"] == True: if obs_param["shutter_effect"] is True:
flat_normal = flat_normal * chip.shutter_img flat_normal = flat_normal * chip.shutter_img
flat_normal = np.array(flat_normal, dtype='float32') flat_normal = np.array(flat_normal, dtype='float32')
self.updateHeaderInfo(header_flag='ext', keys=[ self.updateHeaderInfo(header_flag='ext', keys=[
......
...@@ -5,7 +5,7 @@ from observation_sim.instruments.chip import effects ...@@ -5,7 +5,7 @@ from observation_sim.instruments.chip import effects
def apply_PRNU(self, chip, filt, tel, pointing, catalog, obs_param): def apply_PRNU(self, chip, filt, tel, pointing, catalog, obs_param):
chip.img *= chip.prnu_img chip.img *= chip.prnu_img
if self.overall_config["output_setting"]["prnu_output"] == True: if self.overall_config["output_setting"]["prnu_output"] is True:
chip.prnu_img.write("%s/FlatImg_PRNU_%s.fits" % chip.prnu_img.write("%s/FlatImg_PRNU_%s.fits" %
(self.chip_output.subdir, str(chip.chipID).rjust(2, '0'))) (self.chip_output.subdir, str(chip.chipID).rjust(2, '0')))
return chip, filt, tel, pointing return chip, filt, tel, pointing
...@@ -19,7 +19,7 @@ def add_poisson_and_dark(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -19,7 +19,7 @@ def add_poisson_and_dark(self, chip, filt, tel, pointing, catalog, obs_param):
else: else:
exptime = pointing.exp_time exptime = pointing.exp_time
if obs_param["add_dark"] == True: if obs_param["add_dark"] is True:
chip.img, _ = chip_utils.add_poisson(img=chip.img, chip.img, _ = chip_utils.add_poisson(img=chip.img,
chip=chip, chip=chip,
exptime=pointing.exp_time, exptime=pointing.exp_time,
...@@ -46,7 +46,7 @@ def add_detector_defects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -46,7 +46,7 @@ def add_detector_defects(self, chip, filt, tel, pointing, catalog, obs_param):
fraction=badfraction, fraction=badfraction,
seed=self.overall_config["random_seeds"]["seed_defective"]+chip.chipID, biaslevel=0) seed=self.overall_config["random_seeds"]["seed_defective"]+chip.chipID, biaslevel=0)
# Apply Bad columns # Apply Bad columns
if obs_param["bad_columns"] == True: if obs_param["bad_columns"] is True:
chip.img = effects.BadColumns(chip.img, chip.img = effects.BadColumns(chip.img,
seed=self.overall_config["random_seeds"]["seed_badcolumns"], seed=self.overall_config["random_seeds"]["seed_badcolumns"],
chipid=chip.chipID) chipid=chip.chipID)
...@@ -73,7 +73,7 @@ def add_blooming(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -73,7 +73,7 @@ def add_blooming(self, chip, filt, tel, pointing, catalog, obs_param):
def add_bias(self, chip, filt, tel, pointing, catalog, obs_param): def add_bias(self, chip, filt, tel, pointing, catalog, obs_param):
self.chip_output.Log_info( self.chip_output.Log_info(
" Adding Bias level and 16-channel non-uniformity") " Adding Bias level and 16-channel non-uniformity")
if obs_param["bias_16channel"] == True: if obs_param["bias_16channel"] is True:
chip.img = effects.AddBiasNonUniform16(chip.img, chip.img = effects.AddBiasNonUniform16(chip.img,
bias_level=float( bias_level=float(
chip.bias_level), chip.bias_level),
......
...@@ -16,10 +16,10 @@ def add_sky_background_sci(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -16,10 +16,10 @@ def add_sky_background_sci(self, chip, filt, tel, pointing, catalog, obs_param):
exptime = pointing.exp_time exptime = pointing.exp_time
flat_normal = np.ones_like(chip.img.array) flat_normal = np.ones_like(chip.img.array)
if obs_param["flat_fielding"] == True: if obs_param["flat_fielding"] is True:
flat_normal = flat_normal * chip.flat_img.array / \ flat_normal = flat_normal * chip.flat_img.array / \
np.mean(chip.flat_img.array) np.mean(chip.flat_img.array)
if obs_param["shutter_effect"] == True: if obs_param["shutter_effect"] is True:
flat_normal = flat_normal * chip.shutter_img flat_normal = flat_normal * chip.shutter_img
flat_normal = np.array(flat_normal, dtype='float32') flat_normal = np.array(flat_normal, dtype='float32')
self.updateHeaderInfo(header_flag='ext', keys=[ self.updateHeaderInfo(header_flag='ext', keys=[
...@@ -81,14 +81,14 @@ def add_sky_flat_calibration(self, chip, filt, tel, pointing, catalog, obs_param ...@@ -81,14 +81,14 @@ def add_sky_flat_calibration(self, chip, filt, tel, pointing, catalog, obs_param
norm_scaler = skyback_level/exptime / filter_param.param[sky_level_filt][5] norm_scaler = skyback_level/exptime / filter_param.param[sky_level_filt][5]
flat_normal = np.ones_like(chip.img.array) flat_normal = np.ones_like(chip.img.array)
if obs_param["flat_fielding"] == True: if obs_param["flat_fielding"] is True:
flat_normal = flat_normal * chip.flat_img.array / \ flat_normal = flat_normal * chip.flat_img.array / \
np.mean(chip.flat_img.array) np.mean(chip.flat_img.array)
if obs_param["shutter_effect"] == True: if obs_param["shutter_effect"] is True:
flat_normal = flat_normal * chip.shutter_img flat_normal = flat_normal * chip.shutter_img
flat_normal = np.array(flat_normal, dtype='float32') flat_normal = np.array(flat_normal, dtype='float32')
# output 16-bit shutter effect image with pixel value <=65535 # output 16-bit shutter effect image with pixel value <=65535
if self.overall_config["output_setting"]["shutter_output"] == True: if self.overall_config["output_setting"]["shutter_output"] is True:
shutt_gsimg = galsim.ImageUS(chip.shutter_img*6E4) shutt_gsimg = galsim.ImageUS(chip.shutter_img*6E4)
shutt_gsimg.write("%s/ShutterEffect_%s_1.fits" % shutt_gsimg.write("%s/ShutterEffect_%s_1.fits" %
(self.chip_output.subdir, str(chip.chipID).rjust(2, '0'))) (self.chip_output.subdir, str(chip.chipID).rjust(2, '0')))
...@@ -103,11 +103,11 @@ def add_sky_flat_calibration(self, chip, filt, tel, pointing, catalog, obs_param ...@@ -103,11 +103,11 @@ def add_sky_flat_calibration(self, chip, filt, tel, pointing, catalog, obs_param
filter_param.param[chip.filter_type][5] / tel.pupil_area * exptime filter_param.param[chip.filter_type][5] / tel.pupil_area * exptime
elif chip.survey_type == "spectroscopic": elif chip.survey_type == "spectroscopic":
# flat_normal = np.ones_like(chip.img.array) # flat_normal = np.ones_like(chip.img.array)
if obs_param["flat_fielding"] == True: if obs_param["flat_fielding"] is True:
flat_normal = flat_normal * chip.flat_img.array / \ flat_normal = flat_normal * chip.flat_img.array / \
np.mean(chip.flat_img.array) np.mean(chip.flat_img.array)
if obs_param["shutter_effect"] == True: if obs_param["shutter_effect"] is True:
flat_normal = flat_normal * chip.shutter_img flat_normal = flat_normal * chip.shutter_img
flat_normal = np.array(flat_normal, dtype='float32') flat_normal = np.array(flat_normal, dtype='float32')
......
...@@ -25,7 +25,7 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -25,7 +25,7 @@ def add_prescan_overscan(self, chip, filt, tel, pointing, catalog, obs_param):
def add_crosstalk(self, chip, filt, tel, pointing, catalog, obs_param): def add_crosstalk(self, chip, filt, tel, pointing, catalog, obs_param):
crosstalk=np.zeros([16, 16]) crosstalk = np.zeros([16, 16])
crosstalk[0, :] = np.array([1., 1e-4, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) crosstalk[0, :] = np.array([1., 1e-4, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
crosstalk[1, :] = np.array([1e-4, 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) crosstalk[1, :] = np.array([1e-4, 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
crosstalk[2, :] = np.array([0., 0., 1., 1e-4, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]) crosstalk[2, :] = np.array([0., 0., 1., 1e-4, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.])
......
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