Skip to content

Improve docstring for Wiener restoration function - #7523

Merged
lagru merged 6 commits into
scikit-image:mainfrom
mkcor:improve-wiener-docstring
Jul 16, 2025
Merged

lagru merged 6 commits into
scikit-image:mainfrom
mkcor:improve-wiener-docstring

Conversation

@mkcor

@mkcor mkcor commented Sep 1, 2024

Copy link
Copy Markdown
Member

Description

Following up on #7477 (comment).

Checklist

Release note

For maintainers and optionally contributors, please refer to the instructions on how to document this PR for the release notes.

...

@mkcor mkcor added the 📄 type: Documentation Updates, fixes and additions to documentation label Sep 1, 2024
between the data adequacy that improve frequency restoration
and the prior adequacy that reduce frequency restoration (to
avoid noise artifacts).
Regularization parameter. Denoted by :math:`\lambda`: in the Notes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It would be good to specify the range of this parameter, which seems to be [0, 1], and say which bound corresponds to data adequacy vs. prior adequacy. I would need to go deeper in the source code to check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I synced this with the Notes in 9ea68c3.

Comment thread skimage/restoration/deconvolution.py Outdated
response. The transfer function must be of shape
`(N1, N2, ..., ND)` if `is_real is True`,
`(N1, N2, ..., ND // 2 + 1)` otherwise (see `np.fft.rfftn`).
``(N1, N2, ..., ND)`` if `is_real is True`,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm actually not sure what these shapes are... What are N1, ..., ND? I can see that this notation was introduced in b8ce4d0 by @m-albert and @rfezzani: Can you please help me here?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's been a bit since I worked on this.

Before b8ce4d0, which generalized the function from 2D to ND, the docstring was:

The transfer function must be of shape `(M, N)` if
       `is_real is True`, `(M, N // 2 + 1)` otherwise (see
       `np.fft.rfftn`).

The new docstring adapted this to the n-dimensional case so that N1, ...., ND refers to the n-dimensional shape of the input image. So in 2D (N1, N2) would be equivalent to (M, N).

Sorry for stating the obvious though 😅

@mkcor mkcor Feb 20, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you so much, @m-albert! Your answer is definitely helpful. So I think I should replace ([P, ]M, N) ndarray line 18 with (N1, N2, ..., ND) ndarray and keep single backticks, based on my understanding of the numpydoc style guide.

Edit: Also, I believe it should be 'PSF' instead of 'transfer function' in this last sentence, because we just said that we speak of 'transfer function' in the complex case. Sorry, had to re-read the full parameter description!

Comment thread skimage/restoration/deconvolution.py Resolved
Comment thread skimage/restoration/deconvolution.py Outdated
response. The transfer function must be of shape
`(N1, N2, ..., ND)` if `is_real is True`,
`(N1, N2, ..., ND // 2 + 1)` otherwise (see `np.fft.rfftn`).
``(N1, N2, ..., ND)`` if `is_real is True`,

@mkcor mkcor Feb 20, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you so much, @m-albert! Your answer is definitely helpful. So I think I should replace ([P, ]M, N) ndarray line 18 with (N1, N2, ..., ND) ndarray and keep single backticks, based on my understanding of the numpydoc style guide.

Edit: Also, I believe it should be 'PSF' instead of 'transfer function' in this last sentence, because we just said that we speak of 'transfer function' in the complex case. Sorry, had to re-read the full parameter description!

Comment thread skimage/restoration/deconvolution.py Resolved
@mkcor
mkcor marked this pull request as ready for review February 20, 2025 22:25
@mkcor
mkcor requested review from m-albert and stefanv February 20, 2025 22:25
@mkcor
mkcor requested review from lagru and removed request for m-albert July 16, 2025 15:03

@lagru lagru left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @mkcor. Merging. :)

@lagru
lagru merged commit 06bc8aa into scikit-image:main Jul 16, 2025
@lagru lagru changed the title Improve docstring for Wiener restoration function. Improve docstring for Wiener restoration function Jul 16, 2025
@stefanv stefanv added this to the 0.26 milestone Jul 16, 2025
@mkcor
mkcor deleted the improve-wiener-docstring branch July 17, 2025 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📄 type: Documentation Updates, fixes and additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants