brandondube / prysm

physical optics: integrated modeling, phase retrieval, segmented systems, polynomials and fitting, sequential raytracing...
https://prysm.readthedocs.io/en/stable/
MIT License
262 stars 45 forks source link

possible bug in zernike_nm() #97

Closed laujason122 closed 1 year ago

laujason122 commented 1 year ago

Excepting the following lines of code: returns the following errors:

r = np.array([0,0.5,1])
t = np.array([0,0.5,1])
zernike_nm(1, 1, r, t, norm=True)

Returns the following error in [scipy\special_orthogonal.py:130]:

--> 130 if monic:
    131     evf = eval_func
    132     if evf:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
brandondube commented 1 year ago

What version of prysm are you using? The current commit on master does not crash from the same code, and zernike_nm has not been changed in several years. I don't think scipy is used in any way at all when computing Zernike polynomials, too

>>> from prysm.polynomials import zernike_nm
>>> import numpy as np
>>> r = np.array([0,0.5,1])
>>> t = np.array([0,0.5,1])
>>> zernike_nm(1, 1, r, t, norm=True)
array([0.        , 0.87758256, 1.08060461])
brandondube commented 1 year ago

inactive, not reproducible