question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

🐛Bug

After un update of my python package I now get error on the following test

FAIL: test_with_zero_intensity (tests.transforms.augmentation.test_random_spike.TestRandomSpike) FAIL: test_with_zero_spike (tests.transforms.augmentation.test_random_spike.TestRandomSpike) FAIL: test_no_movement (tests.transforms.augmentation.test_random_motion.TestRandomMotion)

To reproduce

numpy 1.19.1 pypi_0 pypi numpy-base 1.17.2 py37hde5b4d6_0
numpydoc 1.1.0 py_0

# Your code here
array=np.random.uniform(0,40,100)
transformed = np.fft.fftn(array)
fshift = np.fft.fftshift(transformed)
f_ishift = np.fft.ifftshift(fshift)
img_back = np.fft.ifftn(f_ishift)
np.max(array-np.abs(img_back))


# Your errors here
 1.4210854715202004e-14

Expected behavior

it is related to fft and fft inverse that now to not get the exact same number

Solution will be to replace assert_array_equal with des np.all_close

but may be it is due to something wrong in my python package …

TorchIO version 0.17.34

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
fepegarcommented, Sep 17, 2020

I think you are right. What’s the point of using 0 intensity or 0 spikes anyway? I will just switch to assert_array_almost_equal in the tests.

1reaction
GFabiencommented, Sep 17, 2020

I agree that assert_array_almost_equal should be used for these type of tests. However, I think a more efficient solution for us would be to leave the input as it was for the cases tested in those tests. What do you and @GFabien think?

Actually I’m not sure about that. In one hand, it’s more effective and output will truly equal input if we leave the input untouched when transforms are supposed to have no effect. On the other hand, it shows that the transform somehow behaves properly by not altering the input (or almost) when it is supposed to have no effect. What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed DMV Test 3 Times - Green Light Driving School
If you have failed the knowledge test three times, you must successfully complete an 8-hour Driver's Manual Course before you can take the...
Read more >
What happens if you fail your driving test 3 times? - Jerry
Depending on your state, failing your driving test 3 times usually results in a reapplication process or a waiting period before you can...
Read more >
What happens if you fail the written test 3 times in a driver's ...
Nothing happens. You can take it as many times as it takes you to pass. When you finally do pass, congratulations, you have...
Read more >
3 Critical Steps If You Fail Your Driver's License Test
A lot of factors can be the reason behind someone failing their driver's license test. Go through our guide carefully to be ready...
Read more >
Can I fail my driver's three times in Pennsylvania?
I have failed twice already and I am almost certain that I am ... You have at most three times to attempt the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found