Skip to content

Commit

Permalink
Update hexrd/xrdutil/phutil.py
Browse files Browse the repository at this point in the history
use `np.isclose` instead of `==`

Co-authored-by: Patrick Avery <[email protected]>
  • Loading branch information
saransh13 and psavery authored Nov 13, 2024
1 parent b7d867c commit f093910
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion hexrd/xrdutil/phutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ def calc_phi_x(bvec, eHat_l):
"""
bv = np.array(bvec)
bv[2] = 0.
if np.linalg.norm(bv) == 0.:
bv_norm = np.linalg.norm(bv)
if np.isclose(bv_norm, 0):
return 0.
else:
bv = bv/np.linalg.norm(bv)
Expand Down

0 comments on commit f093910

Please sign in to comment.