diff --git a/aotools/functions/zernike.py b/aotools/functions/zernike.py index 17c9d28..49bf79c 100644 --- a/aotools/functions/zernike.py +++ b/aotools/functions/zernike.py @@ -91,6 +91,7 @@ def zernikeRadialFunc(n, m, r): R += numpy.array(r**(n - 2 * i) * (((-1)**(i)) * math.factorial(n - i)) / (math.factorial(i) * + math.factorial((n + m)//2 - i) * math.factorial((n - m)//2 - i)), dtype='float') diff --git a/aotools/interpolation.py b/aotools/interpolation.py index 02dc25f..b345289 100644 --- a/aotools/interpolation.py +++ b/aotools/interpolation.py @@ -35,12 +35,11 @@ def zoom(array, newSize, order=3): #If array is complex must do 2 interpolations if array.dtype==numpy.complex64 or array.dtype==numpy.complex128: - realInterpObj = interp2d( numpy.arange(array.shape[0]), - numpy.arange(array.shape[1]), array.real, copy=False, - kind=INTERP_KIND[order]) - imagInterpObj = interp2d( numpy.arange(array.shape[0]), - numpy.arange(array.shape[1]), array.imag, copy=False, - kind=INTERP_KIND[order]) + realInterpObj = RectBivariateSpline( numpy.arange(array.shape[0]), + numpy.arange(array.shape[1]), array.real, kx=order, ky=order) + imagInterpObj = RectBivariateSpline( numpy.arange(array.shape[0]), + numpy.arange(array.shape[1]), array.imag, + kx=order, ky=order) return (realInterpObj(coordsY,coordsX) + 1j*imagInterpObj(coordsY,coordsX)) @@ -48,9 +47,8 @@ def zoom(array, newSize, order=3): else: - interpObj = interp2d( numpy.arange(array.shape[0]), - numpy.arange(array.shape[1]), array, copy=False, - kind=INTERP_KIND[order]) + interpObj = RectBivariateSpline( numpy.arange(array.shape[0]), + numpy.arange(array.shape[1]), array, kx=order, ky=order) #return numpy.flipud(numpy.rot90(interpObj(coordsY,coordsX))) return interpObj(coordsY,coordsX)