Commit 13fa5306 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

pep8 reformat, replace the return of failed position retrivel to None

parent 291df315
Pipeline #7471 passed with stage
in 0 seconds
...@@ -78,6 +78,8 @@ class MockObject(object): ...@@ -78,6 +78,8 @@ class MockObject(object):
(self.posImg.x, self.posImg.y), flush=True) (self.posImg.x, self.posImg.y), flush=True)
self.posImg, self.fd_shear = fdmodel.get_distorted( self.posImg, self.fd_shear = fdmodel.get_distorted(
chip=chip, pos_img=self.posImg) chip=chip, pos_img=self.posImg)
if self.posImg is None:
return None, None, None, None, None
if verbose: if verbose:
print("After field distortion:\n") print("After field distortion:\n")
print("x = %.2f, y = %.2f\n" % print("x = %.2f, y = %.2f\n" %
......
...@@ -62,7 +62,8 @@ class FieldDistortion(object): ...@@ -62,7 +62,8 @@ class FieldDistortion(object):
the distored position. the distored position.
""" """
if not self.isContainObj_FD(chip=chip, pos_img=pos_img): if not self.isContainObj_FD(chip=chip, pos_img=pos_img):
return galsim.PositionD(-1, -1), None # return galsim.PositionD(-1, -1), None
return None, None
if not img_rot: if not img_rot:
img_rot = np.radians(self.img_rot) img_rot = np.radians(self.img_rot)
else: else:
......
...@@ -16,7 +16,8 @@ def _is_obj_valid(self, obj): ...@@ -16,7 +16,8 @@ def _is_obj_valid(self, obj):
# Currently there's no parameter checks for 'calib' type # Currently there's no parameter checks for 'calib' type
return True return True
pos_keys = ['ra', 'dec'] pos_keys = ['ra', 'dec']
shape_keys = ['hlr_bulge', 'hlr_disk', 'e1_disk', 'e2_disk', 'e1_bulge', 'e2_bulge'] shape_keys = ['hlr_bulge', 'hlr_disk',
'e1_disk', 'e2_disk', 'e1_bulge', 'e2_bulge']
if any(obj.param[key] == -999. for key in pos_keys): if any(obj.param[key] == -999. for key in pos_keys):
msg = 'One or more positional information (ra, dec) is missing' msg = 'One or more positional information (ra, dec) is missing'
self.chip_output.Log_error(msg) self.chip_output.Log_error(msg)
...@@ -76,7 +77,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -76,7 +77,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
temp_filter = self.all_filters[ifilt] temp_filter = self.all_filters[ifilt]
temp_filter.update_limit_saturation_mags( temp_filter.update_limit_saturation_mags(
exptime=pointing.exp_time, exptime=pointing.exp_time,
full_depth_exptime=pointing.get_full_depth_exptime(temp_filter.filter_type), full_depth_exptime=pointing.get_full_depth_exptime(
temp_filter.filter_type),
chip=chip) chip=chip)
if temp_filter.filter_type.lower() == self.overall_config["obs_setting"]["cut_in_band"].lower(): if temp_filter.filter_type.lower() == self.overall_config["obs_setting"]["cut_in_band"].lower():
cut_filter = temp_filter cut_filter = temp_filter
...@@ -175,7 +177,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param): ...@@ -175,7 +177,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
# [TODO] For now, only consider objects which their centers (after field distortion) are projected within the focal plane # [TODO] For now, only consider objects which their centers (after field distortion) are projected within the focal plane
# Otherwise they will be considered missed objects # Otherwise they will be considered missed objects
# if pos_img.x == -1 or pos_img.y == -1 or (not chip.isContainObj(x_image=pos_img.x, y_image=pos_img.y, margin=0.)): # if pos_img.x == -1 or pos_img.y == -1 or (not chip.isContainObj(x_image=pos_img.x, y_image=pos_img.y, margin=0.)):
if pos_img.x == -1 or pos_img.y == -1: # if pos_img.x == -1 or pos_img.y == -1:
if pos_img is None:
self.chip_output.Log_info('obj_ra = %.6f, obj_dec = %.6f, obj_ra_orig = %.6f, obj_dec_orig = %.6f' % ( self.chip_output.Log_info('obj_ra = %.6f, obj_dec = %.6f, obj_ra_orig = %.6f, obj_dec_orig = %.6f' % (
obj.ra, obj.dec, obj.ra_orig, obj.dec_orig)) obj.ra, obj.dec, obj.ra_orig, obj.dec_orig))
self.chip_output.Log_error("Object missed: %s" % (obj.id)) self.chip_output.Log_error("Object missed: %s" % (obj.id))
......
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