Skip to content

Commit

Permalink
Fixes colatitude computation
Browse files Browse the repository at this point in the history
Added missing parenthesis and adjusted the tests
  • Loading branch information
fabiodimarco committed Nov 16, 2023
1 parent df8af24 commit bd75374
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pyroomacoustics/tests/test_angle_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
pi = np.pi

# for 3-D coordinates
a1 = np.array([[0, 0, 1], [0, 0, 1], [0, 1, 1]])
a1 = np.array([[0, 0, 1], [0, 1, 0], [1, 0, 0]])
a2 = np.array([[0], [0], [1]])
a3 = np.array([0, 0, 1]).T

b1 = np.array([[0], [0], [0]])
b2 = np.array([1, -1, 1]).T
b2 = np.array([1, 0, 0]).T


a1_b1 = np.array([[0, 0, pi / 4], [0, 0, pi / 4]])
a1_b2 = np.array([[3 * pi / 4, 3 * pi / 4, pi / 2], [3 * pi / 4, pi / 2, pi / 2]])
a1_b1 = np.array([[0, pi / 2, 0], [0, pi / 2, pi / 2]])
a1_b2 = np.array([[pi, 3 * pi / 4, 0], [pi / 4, pi / 2, 0]])
a2_b1 = np.array([[0], [0]])
a2_b2 = np.array([[3 * pi / 4], [pi / 2]])
a2_b2 = np.array([[pi], [pi / 4]])
a3_b1 = np.array([[0], [0]])
a3_b2 = np.array([[3 * pi / 4], [pi / 2]])
a3_b2 = np.array([[pi], [pi / 4]])


# for 2-D coordinates
Expand Down
2 changes: 1 addition & 1 deletion pyroomacoustics/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def angle_function(s1, v2):
z_vals = s1[2]

colatitude = np.arctan2(
((x_vals - x2) ** 2 + (y_vals - y2) ** 2) ** 1 / 2, (z_vals - z2)
((x_vals - x2) ** 2 + (y_vals - y2) ** 2) ** (1 / 2), (z_vals - z2)
)

# colatitude calculation for 2-D coordinates
Expand Down

0 comments on commit bd75374

Please sign in to comment.