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

Conversation

EmmaRenauld
Copy link
Contributor

Quick description

Unit tests for the file gradients_utils.

As discussed, not sure about the random sphere thing... Went back to Caruyer's code, and it says on the half-sphere! Anyone understand why?

Type of change

Check the relevant options.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Unit test

Provide data, screenshots, command line to test (if relevant)

...

Checklist

  • My code follows the style guidelines of this project (run autopep8)
  • I added relevant citations to scripts, modules and functions docstrings and descriptions
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I moved all functions from the script file (except the argparser and main) to scilpy modules
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@pep8speaks
Copy link

pep8speaks commented Feb 15, 2024

Hello @EmmaRenauld, Thank you for updating !

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2024-02-20 13:39:03 UTC

Copy link

codecov bot commented Feb 15, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (9565115) 65.95% compared to head (2181190) 65.97%.
Report is 96 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #903      +/-   ##
==========================================
+ Coverage   65.95%   65.97%   +0.01%     
==========================================
  Files         384      386       +2     
  Lines       21352    21573     +221     
  Branches     3495     3540      +45     
==========================================
+ Hits        14083    14233     +150     
- Misses       5661     5706      +45     
- Partials     1608     1634      +26     
Components Coverage Δ
Scripts 67.28% <50.00%> (∅)
Library 63.61% <54.54%> (∅)

Copy link
Contributor

@karanphil karanphil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I added a few comments that should be addressed before merging.

@@ -3,10 +3,14 @@
import numpy as np


def random_uniform_on_sphere(nb_vectors):
def random_uniform_on_half_sphere(nb_vectors):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this produces points on the half sphere, but rather the whole sphere. I believe the previous name was right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll change back!

Here is the plot from running it a few times with 10 points.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not super well distributed, but not a half sphere

scilpy/gradients/utils.py Outdated Show resolved Hide resolved
scilpy/gradients/utils.py Outdated Show resolved Hide resolved
scilpy/gradients/utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@karanphil karanphil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTG after the two typos are corrected and the name of the function is changed!

scilpy/gradients/utils.py Outdated Show resolved Hide resolved
Philips gradient table
dwis: nibabel
dwis
ref_gradients_table: nd.array
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref_gradient_table, no s

scilpy/gradients/utils.py Outdated Show resolved Hide resolved
Copy link
Contributor

@arnaudbore arnaudbore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GTG

@arnaudbore arnaudbore merged commit f9e9dbe into scilus:master Feb 20, 2024
1 check passed
@EmmaRenauld EmmaRenauld deleted the test_gradients_utils branch February 21, 2024 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants