Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes colatitude computation in utilities.angle_function (#329)
Browse files Browse the repository at this point in the history
Adds missing parenthesis and adjusts the tests
fabiodimarco authored Nov 25, 2023

Verified

This commit was signed with the committer’s verified signature. The key has expired.
ronoaldo Ronoaldo Pereira
1 parent b26d1fd commit e78867f
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
@@ -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
2 changes: 1 addition & 1 deletion pyroomacoustics/utilities.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e78867f

Please sign in to comment.