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

Multiscale filtering functionality #16

Merged
merged 28 commits into from
Jul 3, 2024
Merged

Multiscale filtering functionality #16

merged 28 commits into from
Jul 3, 2024

Conversation

dmitry-ganyushin
Copy link
Contributor

Added multiscale filtering functionality according to 2021 paper and the code in the bm3d_streak_removal package.

@KedoKudo KedoKudo self-requested a review June 28, 2024 13:24
@KedoKudo KedoKudo self-assigned this Jun 28, 2024
Copy link
Contributor

@KedoKudo KedoKudo left a 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.

src/bm3dornl/utils.py Show resolved Hide resolved
src/bm3dornl/utils.py Outdated Show resolved Hide resolved
src/bm3dornl/utils.py Outdated Show resolved Hide resolved
src/bm3dornl/utils.py Outdated Show resolved Hide resolved
src/bm3dornl/utils.py Outdated Show resolved Hide resolved
@@ -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")
Copy link
Contributor

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.

Copy link
Contributor Author

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

Copy link
Contributor

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.

@@ -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")
Copy link
Contributor

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.

@@ -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")
Copy link
Contributor

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.

Comment on lines +771 to +772
2,
30,
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added function parameters

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

@KedoKudo KedoKudo left a 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)]
Copy link
Contributor

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?

Comment on lines +771 to +772
2,
30,
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor

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")
Copy link
Contributor

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.

@@ -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")
Copy link
Contributor

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.

@KedoKudo KedoKudo merged commit 306a6c9 into next Jul 3, 2024
3 checks passed
@KedoKudo KedoKudo deleted the bin branch July 12, 2024 14:50
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.

2 participants