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

Speed up doctest of calibrate_denoiser by ~30 s #7209

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions skimage/restoration/j_invariant.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,14 @@ def denoise_invariant(image, denoise_function, *, stride=4,
Examples
--------
>>> import skimage
>>> from skimage.restoration import denoise_invariant, denoise_tv_chambolle
>>> from skimage.restoration import denoise_invariant, denoise_wavelet
>>> image = skimage.util.img_as_float(skimage.data.chelsea())
>>> noisy = skimage.util.random_noise(image, var=0.2 ** 2)
>>> denoised = denoise_invariant(noisy, denoise_function=denoise_tv_chambolle)

In this case, `denoise_wavelet` requires the optional dependency PyWavelets.

>>> import pytest; _ = pytest.importorskip("pywt")
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally, we could hide this line altogether.

@pllim does doctest-plus support something like that? I don't see an directive at a first glance.

Copy link

Choose a reason for hiding this comment

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

Maybe you want .. doctest-requires:: documented in https://github.com/scientific-python/pytest-doctestplus#doctest-dependencies ?

Copy link
Member Author

@lagru lagru Oct 17, 2023

Choose a reason for hiding this comment

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

That seems like a good option and in my book it's an argument in favor of using doctest-plus! Thanks for the quick reply. :)

>>> denoised = denoise_invariant(noisy, denoise_function=denoise_wavelet)
"""
image = img_as_float(image)

Expand Down