Skip to content

Commit

Permalink
remove random unit vector; add 2 more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
navidcy committed Sep 5, 2023
1 parent 812a302 commit 3d3179a
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions tests/test_grid_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
import xarray as xr


def random_unit_vector():
"""Return a random unit vector on the unit sphere."""
z = 2 * np.random.rand(1)[0] - 1
z
θ = 2 * np.pi * np.random.rand(1)[0]
return [np.sqrt(1 - z**2) * np.cos(θ), np.sqrt(1 - z**2) * np.sin(θ), z]


@pytest.mark.parametrize(
("v1", "v2", "v3", "true_angle"),
[
([1, 0, 0], [0, 1, 0], [0, 0, 1], np.pi / 2),
([1, 0, 0], [1, 1, 0], [0, 1, 1], np.pi / 4),
([1, 0, 0], [1, 1, 1], [0, 0, 1], np.pi / 4),
([1, 1, 1], [1, 1, 0], [0, 1, 1], 2 * np.pi / 3)
],
)
def test_angle_between(v1, v2, v3, true_angle):
Expand Down

0 comments on commit 3d3179a

Please sign in to comment.