-
Notifications
You must be signed in to change notification settings - Fork 1
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
Multiscale filtering functionality #16
Conversation
Code refactoring
# Conflicts: # src/bm3dornl/denoiser.py # src/bm3dornl/utils.py # tests/unit/bm3dornl/test_denoiser.py # tests/unit/bm3dornl/test_utils.py
for more information, see https://pre-commit.ci
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.
Please adjust the code based on the comments.
Also, please update the example notebook as the binning and debinning here will change the output from that notebook.
tests/unit/bm3dornl/test_utils.py
Outdated
@@ -66,6 +66,7 @@ def test_horizontal_binning(): | |||
expected_width = (expected_width + 1) // 2 # Calculate the next expected width | |||
|
|||
|
|||
@pytest.mark.skip(reason="Changed function signature") |
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.
if the unit test no longer being used, remove it.
otherwise please update it to use the latest signature.
we should only skip the tests if it is still relevant and we intend to fix it at a later date due to time constraints.
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.
Was intended to fix later
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.
please fix it in this PR.
tests/unit/bm3dornl/test_utils.py
Outdated
@@ -74,6 +75,7 @@ def test_horizontal_binning_k_zero(): | |||
), "Binning with k=0 should return only the original image" | |||
|
|||
|
|||
@pytest.mark.skip(reason="Changed function signature") |
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.
same as the one above.
tests/unit/bm3dornl/test_utils.py
Outdated
@@ -84,6 +86,7 @@ def test_horizontal_binning_large_k(): | |||
@pytest.mark.parametrize( | |||
"original_width, target_width", [(32, 64), (64, 128), (128, 256)] | |||
) | |||
@pytest.mark.skip(reason="Changed function signature") |
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.
same as the one above.
2, | ||
30, |
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.
hard-coded magic numbers should be avoided, or at least provide some comments on the reasoning.
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.
Added function parameters
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.
can you explain a bit on the decision on selecting 2
and 30
here? This is to help the future developer so that they don't have to guess why these number are chosen.
tests/scripts/denoise-gpu.py
Outdated
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.
Please convert this to notebook and move the notebook to the notebook folder.
pytest
will not pick this up.
Fixed test script
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
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.
Given the status of the PR, I don't think we will be able to close it this iteration, but this is ok.
I'd rather have a proper PR without leaving lots of small traps for our future selves.
Please fix the unit tests properly instead of skipping it, strike the iron while it's hot.
binned_sinos_orig = [np.copy(sino_orig)] | ||
|
||
# Contains upscaled denoised sinograms | ||
binned_sinos = [np.zeros(0)] |
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.
why creating an np.zeros(0) here? Are we trying to do np.empty
or something else?
2, | ||
30, |
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.
can you explain a bit on the decision on selecting 2
and 30
here? This is to help the future developer so that they don't have to guess why these number are chosen.
tests/scripts/denoise-gpu.py
Outdated
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.
As I mentioned before, please don't put file that pytest
cannot run here. If this is some example code showing on it works, convert it into a notebook instead.
tests/scripts/denoise-orig.py
Outdated
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.
Same as the previous one
@@ -9,6 +9,7 @@ def setup_sinogram(): | |||
return np.random.rand(256, 256) | |||
|
|||
|
|||
@pytest.mark.skip(reason="Change function signature") |
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.
blindly skipping a unit test is not a good idea. If this no longer applies, either fixes it or remove it.
tests/unit/bm3dornl/test_utils.py
Outdated
@@ -66,6 +66,7 @@ def test_horizontal_binning(): | |||
expected_width = (expected_width + 1) // 2 # Calculate the next expected width | |||
|
|||
|
|||
@pytest.mark.skip(reason="Changed function signature") |
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.
please fix it in this PR.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Added multiscale filtering functionality according to 2021 paper and the code in the bm3d_streak_removal package.