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
Loading
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ class MockObject(object):
                      (self.posImg.x, self.posImg.y), flush=True)
            self.posImg, self.fd_shear = fdmodel.get_distorted(
                chip=chip, pos_img=self.posImg)
            if self.posImg is None:
                return None, None, None, None, None
            if verbose:
                print("After field distortion:\n")
                print("x = %.2f, y = %.2f\n" %
+2 −1
Original line number Diff line number Diff line
@@ -62,7 +62,8 @@ class FieldDistortion(object):
                                the distored position.
        """
        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:
            img_rot = np.radians(self.img_rot)
        else:
+6 −3
Original line number Diff line number Diff line
@@ -16,7 +16,8 @@ def _is_obj_valid(self, obj):
        # Currently there's no parameter checks for 'calib' type
        return True
    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):
        msg = 'One or more positional information (ra, dec) is missing'
        self.chip_output.Log_error(msg)
@@ -76,7 +77,8 @@ def add_objects(self, chip, filt, tel, pointing, catalog, obs_param):
        temp_filter = self.all_filters[ifilt]
        temp_filter.update_limit_saturation_mags(
            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)
        if temp_filter.filter_type.lower() == self.overall_config["obs_setting"]["cut_in_band"].lower():
            cut_filter = temp_filter
@@ -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
        # 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:
        # 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' % (
                obj.ra, obj.dec, obj.ra_orig, obj.dec_orig))
            self.chip_output.Log_error("Object missed: %s" % (obj.id))