code: def test_wavelet_threshold():
      rstate = np.random.default_rng(1234)
  
      img = astro_gray
      sigma = 0.1
      noisy = img + sigma * rstate.standard_normal(img.shape)
      noisy = np.clip(noisy, 0, 1)
  
      # employ a single, user-specified threshold instead of BayesShrink sigmas
      denoised = _wavelet_threshold(
          noisy, wavelet="db1", method=None, threshold=sigma
      )
      psnr_noisy = peak_signal_noise_ratio(img, noisy)
      psnr_denoised = peak_signal_noise_ratio(img, denoised)
      assert psnr_denoised > psnr_noisy
  
      # either method or threshold must be defined
      with pytest.raises(ValueError):
          _wavelet_threshold(
              noisy, wavelet="db1", method=None, threshold=None
          )
  
      # warns if a threshold is provided in a case where it would be ignored
      with expected_warnings(["Thresholding method "]):
          _wavelet_threshold(
              noisy,
              wavelet="db1",
              method="BayesShrink",
              threshold=sigma,
          )
  
imports: import functools
  import itertools
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_warns
  from skimage import color, data, img_as_float, restoration
  from skimage._shared._warnings import expected_warnings
  from skimage._shared.utils import _supported_float_type, slice_at_axis
  from skimage.metrics import peak_signal_noise_ratio, structural_similarity
  from skimage.restoration._denoise import _wavelet_threshold
label_desc: Use image node_id 40 for calling a global function with example usage: test_wavelet_threshold() without return types