Skip to content

Commit

Permalink
getting closer
Browse files Browse the repository at this point in the history
  • Loading branch information
lastephey committed Jun 20, 2018
1 parent 003fabc commit 0cb9335
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions py/specter/psf/psf.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _xypix(self, ispec, wavelength):
"""
raise NotImplementedError

def xypix(self, ispec, wavelength, xmin=0, xmax=None, ymin=0, ymax=None, iwave_cache=None):
def xypix(self, ispec, wavelength, xmin=0, xmax=None, ymin=0, ymax=None, iwave=None):
"""
Evaluate PSF for spectrum[ispec] at given wavelength
Expand All @@ -242,11 +242,11 @@ def xypix(self, ispec, wavelength, xmin=0, xmax=None, ymin=0, ymax=None, iwave_c
if key in self._cache:
xx, yy, ccdpix = self._cache[key]
else:
xx, yy, ccdpix = self._xypix(ispec, wavelength, iwave_cache)
xx, yy, ccdpix = self._xypix(ispec, wavelength, iwave)
self._cache[key] = (xx, yy, ccdpix)
except AttributeError:
self._cache = CacheDict(2500)
xx, yy, ccdpix = self._xypix(ispec, wavelength, iwave_cache)
xx, yy, ccdpix = self._xypix(ispec, wavelength, iwave)

xlo, xhi = xx.start, xx.stop
ylo, yhi = yy.start, yy.stop
Expand Down Expand Up @@ -647,18 +647,18 @@ def projection_matrix(self, spec_range, wavelengths, xyrange, iwave_cache=None):
#- Generate A
A = np.zeros( (ny*nx, nspec*nflux) )
tmp = np.zeros((ny, nx))
for ispec in range(specmin, specmax):
for ispec in range(specmin, specmax-1):
for iw, w in enumerate(wavelengths):
#- Are use using a pre-cached wavelength?
if iwave_cache is not None:
iwave = iwave_cache + iw
iwave = iwave_cache[iw]
else:
iwave = None

#- Get subimage and index slices
xslice, yslice, pix = self.xypix(ispec, w,
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
iwave_cache = iwave
iwave = iwave
)

#- If there is overlap with pix_range, put into sub-region of A
Expand Down

0 comments on commit 0cb9335

Please sign in to comment.