Skip to content

Commit 31ddc9b

Browse files
Fix zoom issues and factorial error
- Zoom issue due to interp2d deprecation - Factorial error from not forcing integer
1 parent 2240486 commit 31ddc9b

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

aotools/functions/zernike.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ def zernikeRadialFunc(n, m, r):
9191
R += numpy.array(r**(n - 2 * i) * (((-1)**(i)) *
9292
math.factorial(n - i)) /
9393
(math.factorial(i) *
94-
math.factorial(0.5 * (n + m) - i) *
95-
math.factorial(0.5 * (n - m) - i)),
94+
math.factorial(int(0.5 * (n + m) - i)) *
95+
math.factorial(int(0.5 * (n - m) - i))),
9696
dtype='float')
9797
return R
9898

aotools/interpolation.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,20 @@ def zoom(array, newSize, order=3):
3535
#If array is complex must do 2 interpolations
3636
if array.dtype==numpy.complex64 or array.dtype==numpy.complex128:
3737

38-
realInterpObj = interp2d( numpy.arange(array.shape[0]),
39-
numpy.arange(array.shape[1]), array.real, copy=False,
40-
kind=INTERP_KIND[order])
41-
imagInterpObj = interp2d( numpy.arange(array.shape[0]),
42-
numpy.arange(array.shape[1]), array.imag, copy=False,
43-
kind=INTERP_KIND[order])
38+
realInterpObj = RectBivariateSpline( numpy.arange(array.shape[0]),
39+
numpy.arange(array.shape[1]), array.real, kx=order, ky=order)
40+
imagInterpObj = RectBivariateSpline( numpy.arange(array.shape[0]),
41+
numpy.arange(array.shape[1]), array.imag,
42+
kx=order, ky=order)
4443
return (realInterpObj(coordsY,coordsX)
4544
+ 1j*imagInterpObj(coordsY,coordsX))
4645

4746

4847

4948
else:
5049

51-
interpObj = interp2d( numpy.arange(array.shape[0]),
52-
numpy.arange(array.shape[1]), array, copy=False,
53-
kind=INTERP_KIND[order])
50+
interpObj = RectBivariateSpline( numpy.arange(array.shape[0]),
51+
numpy.arange(array.shape[1]), array, kx=order, ky=order)
5452

5553
#return numpy.flipud(numpy.rot90(interpObj(coordsY,coordsX)))
5654
return interpObj(coordsY,coordsX)

0 commit comments

Comments
 (0)