code: def test_butterworth_cutoff(
      cutoff, order, high_pass, squared_butterworth
  ):
      wfilt = _get_nd_butterworth_filter(
          shape=(512, 512),
          factor=cutoff,
          order=order,
          high_pass=high_pass,
          real=False,
          squared_butterworth=squared_butterworth,
      )
      # select DC frequence on first axis to plot profile along a single axis
      wfilt_profile = np.abs(wfilt[0])
  
      # Empirical chosen to pass for order=6. Can use a smaller tolerance at
      # higher orders.
      tol = 0.3 / order
  
      # should have amplitude of ~1.0 in the center of the passband
      if high_pass:
          assert abs(wfilt_profile[wfilt_profile.size // 2] - 1.0) < tol
      else:
          assert abs(wfilt_profile[0] - 1.0) < tol
  
      # should be close to the expected amplitude at the cutoff frequency
      f_cutoff = int(cutoff * wfilt.shape[0])
      if squared_butterworth:
          # expect 0.5 at the cutoff
          assert abs(wfilt_profile[f_cutoff] - 0.5) < tol
      else:
          # expect 1/sqrt(2) at the cutoff
          assert abs(wfilt_profile[f_cutoff] - 1 / math.sqrt(2)) < tol
  
file_path: scikit-image/skimage/filters/tests/test_fft_based.py
imports: import math
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_equal
  import scipy.fft
  from skimage._shared.utils import _supported_float_type
  from skimage.data import astronaut, coins
  from skimage.filters import butterworth
  from skimage.filters._fft_based import _get_nd_butterworth_filter
label_desc: Use image node_id 3 for calling a global function with example usage: test_butterworth_cutoff(cutoff, order, high_pass, squared_butterworth) without return types