Running
import pysiaf.utils.rotations
pysiaf.utils.rotations.unit_vector_from_cartesian(x=0.0, y=0.0)
incorrectly throws the following error
"UnboundLocalError: local variable 'unit_vector' referenced before assignment"
The problematic line is 778 in pysiaf/utils/rotations.py which seems to be checking for valid values but in turn ignores the valid value of zero.
if np.array([x_rad]).all() and np.array([y_rad]).all():
unit_vector = np.array([x_rad, y_rad, np.sqrt(1-(x_rad**2+y_rad**2))])
Instead should be replaced with something like
if z is None:
unit_vector = np.array([x_rad, y_rad, np.sqrt(1-(x_rad**2+y_rad**2))])
Running
incorrectly throws the following error
"UnboundLocalError: local variable 'unit_vector' referenced before assignment"
The problematic line is 778 in pysiaf/utils/rotations.py which seems to be checking for valid values but in turn ignores the valid value of zero.
Instead should be replaced with something like