Skip to content

Commit bc04269

Browse files
committed
correlate7f: increase size of work arrays; call python code in case of huge shifts
1 parent 4419fcf commit bc04269

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

tractor/psf.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ def lanczos_shift_image(img, dx, dy, inplace=False, force_python=False):
3131
Lx /= Lx.sum()
3232
Ly /= Ly.sum()
3333

34-
#print('mp_fourier:', mp_fourier)
3534
H,W = img.shape
36-
if mp_fourier is None or force_python or W <= 8 or H <= 8:
35+
#print('lanczos_shift_image: size', W, H)
36+
#print('mp_fourier:', mp_fourier)
37+
if (mp_fourier is None or force_python or W <= 8 or H <= 8
38+
or H > work_corr7f.shape[0] or W > work_corr7f.shape[1]):
3739
sx = correlate1d(img, Lx, axis=1, mode='constant')
3840
outimg = correlate1d(sx, Ly, axis=0, mode='constant')
3941
else:
@@ -50,10 +52,7 @@ def lanczos_shift_image(img, dx, dy, inplace=False, force_python=False):
5052
assert(np.all(np.isfinite(outimg)))
5153
return outimg
5254

53-
#work_corr7 = np.zeros((1024,1024), np.float64)
54-
#work_corr7 = np.require(work_corr7, requirements=['A'])
55-
56-
work_corr7f = np.zeros((1024,1024), np.float32)
55+
work_corr7f = np.zeros((4096, 4096), np.float32)
5756
work_corr7f = np.require(work_corr7f, requirements=['A'])
5857

5958
class HybridPSF(object):

0 commit comments

Comments
 (0)