Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gradient_utils unit tests #903

Merged
merged 5 commits into from
Feb 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix pep8
EmmaRenauld committed Feb 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit fc714bcb8a535f44984c12e5556f329de885e521
6 changes: 3 additions & 3 deletions scilpy/gradients/tests/test_gradients_utils.py
Original file line number Diff line number Diff line change
@@ -28,9 +28,9 @@ def test_random_uniform_on_sphere():
def test_get_new_order_philips():
# Using N=4 vectors
philips_table = np.asarray([[1, 1, 1, 1],
[2, 2, 2, 2],
[3, 3, 3, 3],
[4, 4, 4, 4]])
[2, 2, 2, 2],
[3, 3, 3, 3],
[4, 4, 4, 4]])
dwi = np.ones((10, 10, 10, 4))
bvecs = np.asarray([[3, 3, 3],
[4, 4, 4],
3 changes: 2 additions & 1 deletion scilpy/gradients/utils.py
Original file line number Diff line number Diff line change
@@ -27,7 +27,8 @@ def random_uniform_on_half_sphere(nb_vectors):
r = 2 * np.sqrt(np.random.rand(nb_vectors))
theta = 2 * np.arcsin(r / 2)

# See here: https://www.bogotobogo.com/Algorithms/uniform_distribution_sphere.php
# See here:
# https://www.bogotobogo.com/Algorithms/uniform_distribution_sphere.php
# They seem to be using something like this instead:
# theta = np.arccos(2 * np.random.rand(nb_vectors) - 1.0)