Skip to content

Commit

Permalink
add theta, rho handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Van Gorkom committed May 17, 2017
1 parent e2f0bb0 commit a9099d3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions poppy/zernike.py
Original file line number Diff line number Diff line change
Expand Up @@ -722,9 +722,16 @@ def arbitrary_basis(aperture, nterms=15, rho=None, theta=None):
padded_shape = (shape[0] + padding[0] * 2, shape[1] + padding[1] * 2)
npix = padded_shape[0]

# pad theta and rho arrays
if theta is not None:
theta = np.pad(theta,padding,mode='constant',constant_values=0.)
if rho is not None:
rho = np.pad(rho,padding,mode='constant',constant_values=1.)

# precompute zernikes on oversized array
Z = np.zeros((nterms + 1,) + padded_shape)
Z[1:] = zernike_basis(nterms=nterms, npix=npix, rho=rho, theta=theta, outside=0.0)
return Z
# slice down to original aperture array size
Z = Z[:,padding[0]:padded_shape[0]-padding[0],
padding[1]:padded_shape[1]-padding[1]]
Expand Down

0 comments on commit a9099d3

Please sign in to comment.