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

Update thalamus #18

Merged
merged 8 commits into from
Oct 10, 2023
Merged

Update thalamus #18

merged 8 commits into from
Oct 10, 2023

Conversation

asoplata
Copy link
Contributor

This is a very small pull request for passing a "radius" argument down all the way to scipy's gaussian_filter in atlas_direction_vectors/algorithms/utils.py, and then using it and changing some parameters used for the thalamus' direction-vectors calculation. Most of the single-line changes are just from running the isort and black commands as suggested in the README. Thanks!

Austin E. Soplata added 3 commits April 28, 2023 12:59
Changes to be committed:
	modified:   atlas_direction_vectors/algorithms/simple_blur_gradient.py
	modified:   atlas_direction_vectors/algorithms/utils.py
Changes to be committed:
	modified:   atlas_direction_vectors/thalamus.py
@asoplata asoplata requested a review from mgeplf April 28, 2023 11:27
@mgeplf
Copy link
Collaborator

mgeplf commented Apr 28, 2023

Looks fine to me; I'm not able to comment on the scientific validity.
Has @PolinaL had a chance to look it?

@asoplata
Copy link
Contributor Author

Ugh, unfortunately my understanding of how to build the direction-vectors/orientations was the opposite of correct in a key assumption, so further changes are needed. I'll add those changes soon, but there's a silent external dependency here as well, where I don't want to push the direction-vectors before I've confirmed that their use in atlas-placement-hints is correct as well. This should be done by the end of May.

@mgeplf
Copy link
Collaborator

mgeplf commented May 17, 2023

This should be done by the end of May.

Sure, no problem. If there is somewhere, documentation wise, that could have helped prevent an error, let me know.

@asoplata
Copy link
Contributor Author

Here is the new (very small) change needed to fix the thalamus direction-vectors generation. I tried running tox -epy to test, but it gave me a fail (or error) at tests/test_isocortex.py, but I didn't change that file, so I assume something was off with my testing environment. As far as I know, the thalamus code is now ready to be merged.

@mgeplf
Copy link
Collaborator

mgeplf commented Jun 27, 2023

I tried running tox -epy to test, but it gave me a fail (or error) at tests/test_isocortex.py

I believe that it's in tests/test_thalamus.py that it's failing:
https://github.com/BlueBrain/atlas-direction-vectors/actions/runs/5378418348/jobs/9758189874?pr=18#step:5:40

When I ran it, the error messages that are here:
assert not [<warnings.WarningMessage object at 0x7fdc05a16590>, <warnings.WarningMessage object at 0x7fdc05a16f20>]
resolve to:

UserWarning('Such vectors are likely to produce problematic placement hints. Consider interpolating (NaN, NaN, NaN) vectors by valid ones. See ``atlas-direction-vectors direction-vectors interpolate --help``.')

@asoplata
Copy link
Contributor Author

That's weird, I don't get a NaN warning when running the actual main code (not the test). Investigating

@mgeplf
Copy link
Collaborator

mgeplf commented Jun 28, 2023

(not the test).

We may be using a simplified dataset, I can't remember.

mgeplf and others added 2 commits July 11, 2023 14:11
This makes a small change to the target of the "RT-complement" part of
the thalamus direction-vectors calculation. This change prevents
thalamic NaN direction-vectors from being created in the test case. It
should be noted that, when applied to the "real data" Atlas annotation
instead of the test case, neither of these landscapes produced any NaN
direction vectors, despite the previous landscape producing NaNs in the
test case. The new landscape, when applied to Atlas data, seems to
produce direction-vectors which are satisfactory (if interested, ask me
for details).

In order to pass the tests, I also had to reduce the tolerance on one of
the norm tests, since in the test case, it was producing norms that
further off from 1 than 1e-6. If such norms are produced in the actual
data, I'm not sure what the effects will be on placement-hints, but my
run of placement-hints using real data from these new direction-vectors
seemd to be fine. Also, I will point out that when running the test case
for the pre-2023 values of the direction vectors (including `sigma=ratio
* 18.0` etc.), the vast majority of the test case voxels were not
changed from their initialized values (i.e., they were not within
range of the gaussian blur being applied at all). This may have led to
most voxels passing this norm test as a false positive, since most
voxels in the older test case were not actually modified at all, if
being affected by the gaussian blur (meant to point them to RT, which
they mostly were not in this case) is what likely has the capacity to
change the norm from 1. In other words: the test whose tolerance I
changed was being passed in the most recent test case, but I suspect
that this is because the direction-vector algorithm was not changing the
vast majority of voxels in the test case, when it should have been.
@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2023

Codecov Report

All modified lines are covered by tests ✅

❗ No coverage uploaded for pull request base (main@95214ce). Click here to learn what that means.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #18   +/-   ##
=======================================
  Coverage        ?   90.88%           
=======================================
  Files           ?       16           
  Lines           ?      472           
  Branches        ?        0           
=======================================
  Hits            ?      429           
  Misses          ?       43           
  Partials        ?        0           
Flag Coverage Δ
pytest 90.88% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@asoplata
Copy link
Contributor Author

asoplata commented Sep 8, 2023

Whoops lol I forgot to mention that I tested this using 3.9 and it should now successfully pass test_thalamus. Judging from the test failures, though, it seems the tests are failing due to a config / environment issue, not the actual tests themselves

@mgeplf
Copy link
Collaborator

mgeplf commented Sep 8, 2023

Judging from the test failures, though, it seems the tests are failing due to a config / environment issue, not the actual tests themselves

Ok, I will try and have a look. Prod me in a couple days if I have forgotten.

Copy link
Collaborator

@mgeplf mgeplf left a comment

Choose a reason for hiding this comment

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

The scientist who knows best created the PR, so I have to trust it's correct.

@mgeplf mgeplf merged commit 6a0ffff into BlueBrain:main Oct 10, 2023
5 checks passed
@asoplata asoplata deleted the update_thalamus branch October 11, 2023 07:54
@asoplata
Copy link
Contributor Author

Thanks Mike! (my first successful PR to a BBP repo)
giphy

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.

3 participants