-
Notifications
You must be signed in to change notification settings - Fork 5
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
auto generate sampling angles #163
Conversation
…rgotten string an f-string
Minimum allowed coverage is Generated by 🐒 cobertura-action against 47a0007 |
Error in the test persists :/ |
Wait, it wasn't just introduced with the poles? You are sure you are running a clean install of this branch? |
I will double check. |
Complete fresh install, still happens. No clue. When it tested the branch before holiday here, the tests worked fine. I could try to go back to that commit. |
Could you also try commit 79efbec and the current main branch? |
Exactly, just tried 79efbec and it also fails. I am 100% sure it worked before. Will also try main. |
Argg, there the tests work |
Alright, so something got triggered in with the changing of the angles. Can you see if those two rotations actually have the same CC score after the volume split, or if we are now somehow catching an artifact of the volume splitting? |
Also, are you using the |
I also get an error on the same test, but with a different angle ======================================================================
FAIL: test_tm_job_split_volume (test_tmjob.TestTMJob.test_tm_job_split_volume)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/sander/github_files/pytom-template-matching-gpu/tests/test_tmjob.py", line 301, in test_tm_job_split_volume
self.assertAlmostEqual(angle_diff, 0, places=1, msg='angle diff should not change')
AssertionError: 192.0 != 0 within 1 places (192.0 difference) : angle diff should not change
----------------------------------------------------------------------
Ran 35 tests in 18.498s
FAILED (failures=1) |
Is it the same location? |
Am using the pip version, will give conda forge a try as well |
Using the following code: test_diff = np.abs(
angle[ok_region, ok_region, ok_region] -
read_mrc(TEST_ANGLES)[ok_region, ok_region, ok_region])
print(np.argwhere(test_diff > 0.5)) I get [[40 20 9]] |
So also a single location, but different position |
Installed the conda forge cupy (its the same version as via pip, i.e. 13.1). I get the same error and same location as I had before (but different from yours clearly): [[30 14 26]] For full clarity, these are my installed package versions:
|
So I found a single split in which it does not happen, could you check if this is also a working split for you? (might tell us what is wonky in the algorithm)
|
For me its this:
|
It becomes weirder... |
Alright, it the diff seems to be in generated in the actual running of the template matching. I made sure that every output in the angles and scores matrices is written to once so it is not a race condition in the merging of the data |
Good that the merging is not causing problems. To sum up:
My hunch is: at this location the template has two orientations that correlate almost identically. As the splitting changes the volumes very slightly, it occurs sometimes that it changes the correlation there slightly. Could it then just be dependent on the random number generation? |
@McHaillet with the refactored volume spitting code in #170 I can't get my test environment to error out for |
That sounds promising!! Will test! |
Defaults pass, but I tried with different splits as well and then issue is still there: Current branch:
Though overhang was too small perhaps, but with overhang=template.shape similar inconsistency:
Also, thinking about it, the benchmark in the test against which the splitting is tested, still appends the full volume to a fast FFT shape. So there is also still that difference... To sum up, the FFT shape aware splitting is in general a good addition, and at this point we did a lot to fix this tiny inconsistency. I would we say we relax the test for volume splitting to tolerate a small difference. |
I commented out the angle diff test (and added a comment why), is that a suitable solution for you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented out the angle diff test (and added a comment why), is that a suitable solution for you?
That is fine for me!
LGTM! Feel free to merge :)
Will close #92 by auto generating
theta
andphi
withhealpix
and samplingpsi
linearly. It will use the input angle as amaximum
angle differenceTodo:
test all touched code with ruff(decided to leave this for another PR)format all touched files with black(decided to leave this for another PR)Other fixes:
The test of bad angles in the angle file was missing newlines, so it did raise the expected type
ValueError
, just the wrongValueError
The coverage has increased to 81%