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

modify PSF interp for DiretImgSLS

parent 3e9d0f8e
...@@ -305,7 +305,19 @@ class PSFInterp(PSFModel): ...@@ -305,7 +305,19 @@ class PSFInterp(PSFModel):
if bandpass.blue_limit < bandwave and bandwave < bandpass.red_limit: if bandpass.blue_limit < bandwave and bandwave < bandpass.red_limit:
return twave return twave
return -1 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): 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): ...@@ -325,8 +337,7 @@ class PSFInterp(PSFModel):
assert self.iccd == int(chip.getChipLabel(chipID=chip.chipID)), 'ERROR: self.iccd != chip.chipID' assert self.iccd == int(chip.getChipLabel(chipID=chip.chipID)), 'ERROR: self.iccd != chip.chipID'
twave = self._findWave(bandpass) twave = self._findWave(bandpass)
if twave == -1: if twave == -1:
print("!!!PSF bandpass does not match.") twave = self._findWave_sencondary(bandpass)
exit()
PSFMat = self.psfMat[twave] PSFMat = self.psfMat[twave]
cen_col= self.cen_col[twave] cen_col= self.cen_col[twave]
cen_row= self.cen_row[twave] cen_row= self.cen_row[twave]
......
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