Commit 25dafa5a authored by Zhang Xin's avatar Zhang Xin
Browse files

modify PSF interp for DiretImgSLS

parent 3e9d0f8e
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -305,7 +305,19 @@ class PSFInterp(PSFModel):
            if bandpass.blue_limit < bandwave and bandwave < bandpass.red_limit:
                return twave
        return -1
    def _findWave_sencondary(self, bandpass):
        w_dist = np.zeros(self.nwave)
        for twave in range(self.nwave):
            bandwave = self.PSF_data[twave][0]['wavelength']
            d1 = bandwave - bandpass.blue_limit
            d2 = bandwave - bandpass.red_limit
            if d1 * d2 <= 0:
                w_dist[twave] = 0
            else:
                w_dist[twave] = np.min([abs(d1), abs(d2)])
        
        minTwawe = np.where(w_dist == np.min(w_dist))
        return minTwawe[0][0]

    def get_PSF(self, chip, pos_img, bandpass, galsimGSObject=True, findNeighMode='treeFind', folding_threshold=5.e-3, pointing_pa=0.0):
        """
@@ -325,8 +337,7 @@ class PSFInterp(PSFModel):
        assert self.iccd == int(chip.getChipLabel(chipID=chip.chipID)), 'ERROR: self.iccd != chip.chipID'
        twave = self._findWave(bandpass)
        if twave == -1:
            print("!!!PSF bandpass does not match.")
            exit()
            twave = self._findWave_sencondary(bandpass)
        PSFMat = self.psfMat[twave]
        cen_col= self.cen_col[twave]
        cen_row= self.cen_row[twave]