Commit 8649bb95 authored by Fang Yuedong's avatar Fang Yuedong
Browse files

"updated to using the new field distortion model"

parent bd7943ce
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -189,16 +189,21 @@ class Catalog(CatalogBase):
            param['ra_orig'] = gals['ra'][igals]
            param['dec_orig'] = gals['dec'][igals]
            param['mag_use_normal'] = gals['mag_csst_%s'%(self.filt.filter_type)][igals]
            # param['mag_use_normal'] = 20.
            if self.filt.is_too_dim(mag=param['mag_use_normal'], margin=self.config["obs_setting"]["mag_lim_margin"]):
                continue

            param['z'] = gals['redshift'][igals]
            param['model_tag'] = 'None'
            param['g1'] = gals['shear'][igals][0]
            param['g2'] = gals['shear'][igals][1]
            # param['g1'] = gals['shear'][igals][0]
            # param['g2'] = gals['shear'][igals][1]
            param['g1'] = 0.
            param['g2'] = 0.
            param['kappa'] = gals['kappa'][igals]
            param['e1'] = gals['ellipticity_true'][igals][0]
            param['e2'] = gals['ellipticity_true'][igals][1]
            # param['e1'] = gals['ellipticity_true'][igals][0]
            # param['e2'] = gals['ellipticity_true'][igals][1]
            param['e1'] = 0.
            param['e2'] = 0.
            
            # For shape calculation
            
+2 −1
Original line number Diff line number Diff line
@@ -75,7 +75,8 @@ class Chip(FocalPlane):
                self.fdModel = None
            else:
                try:
                    with pkg_resources.files('ObservationSim.Instrument.data.field_distortion').joinpath("FieldDistModelGlobal_mainFP_v1.0.pickle") as field_distortion:
                    # with pkg_resources.files('ObservationSim.Instrument.data.field_distortion').joinpath("FieldDistModelGlobal_mainFP_v1.0.pickle") as field_distortion:
                    with pkg_resources.files('ObservationSim.Instrument.data.field_distortion').joinpath("FieldDistModel_v2.0.pickle") as field_distortion:
                        with open(field_distortion, "rb") as f:
                            self.fdModel = pickle.load(f)
                except AttributeError:
+0 −2
Original line number Diff line number Diff line
@@ -153,8 +153,6 @@ class MockObject(object):
        self.real_pos = self.getRealPos(chip.img, global_x=self.posImg.x, global_y=self.posImg.y,
                                        img_real_wcs=self.real_wcs)

        print(self.real_pos.x, self.real_pos.y)

        x, y = self.real_pos.x + 0.5, self.real_pos.y + 0.5
        x_nominal = int(np.floor(x + 0.5))
        y_nominal = int(np.floor(y + 0.5))
+0 −2
Original line number Diff line number Diff line
@@ -249,8 +249,6 @@ class Observation(object):
                # Get position of object on the focal plane
                pos_img, offset, local_wcs, real_wcs, fd_shear = obj.getPosImg_Offset_WCS(img=chip.img, fdmodel=self.fd_model, chip=chip, verbose=False, chip_wcs=chip_wcs, img_header=h_ext)

                print(pos_img.x, pos_img.y)

                # [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.)):
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@ class FieldDistortion(object):
        # g1k_fd = g_abs * np.cos(phi - 2*img_rot)
        # g2k_fd = -g_abs * np.sin(phi - 2*img_rot)
        # g1k_fd = g_abs * np.cos(0. - 2*img_rot)
        # g2k_fd = -g_abs * np.sin(0. - 2*img_rot)
        # g2k_fd = g_abs * np.sin(0. - 2*img_rot)

        fd_shear = galsim.Shear(g1=g1k_fd, g2=g2k_fd)
        return galsim.PositionD(x, y), fd_shear
Loading