code: def test_estimate_sigma():
      sigma = estimate_sigma(
          np.ones((7, 7, 7)), disable_background_masking=True
      )
      assert_equal(sigma, 0.0)
  
      sigma = estimate_sigma(
          np.ones((7, 7, 7, 3)), disable_background_masking=True
      )
      assert_equal(sigma, np.array([0.0, 0.0, 0.0]))
  
      sigma = estimate_sigma(
          5 * np.ones((7, 7, 7)), disable_background_masking=False
      )
      assert_equal(sigma, 0.0)
  
      sigma = estimate_sigma(
          5 * np.ones((7, 7, 7, 3)), disable_background_masking=False
      )
      assert_equal(sigma, np.array([0.0, 0.0, 0.0]))
  
      arr = np.zeros((3, 3, 3))
      arr[0, 0, 0] = 1
      sigma = estimate_sigma(arr, disable_background_masking=False, N=1)
      assert_array_almost_equal(
          sigma, (0.10286889997472792 / np.sqrt(0.42920367320510366))
      )
  
      arr = np.zeros((3, 3, 3, 3))
      arr[0, 0, 0] = 1
      sigma = estimate_sigma(arr, disable_background_masking=False, N=1)
      assert_array_almost_equal(
          sigma,
          np.array(
              [
                  0.10286889997472792 / np.sqrt(0.42920367320510366),
                  0.10286889997472792 / np.sqrt(0.42920367320510366),
                  0.10286889997472792 / np.sqrt(0.42920367320510366),
              ]
          ),
      )
  
      arr = np.zeros((3, 3, 3))
      arr[0, 0, 0] = 1
      sigma = estimate_sigma(arr, disable_background_masking=True, N=4)
      assert_array_almost_equal(
          sigma, 0.46291005 / np.sqrt(0.4834941393603609)
      )
  
      arr = np.zeros((3, 3, 3))
      arr[0, 0, 0] = 1
      sigma = estimate_sigma(arr, disable_background_masking=True, N=0)
      assert_array_almost_equal(sigma, 0.46291005 / np.sqrt(1))
      arr = np.zeros((3, 3, 3, 3))
  
      arr[0, 0, 0] = 1
      sigma = estimate_sigma(arr, disable_background_masking=True, N=12)
      assert_array_almost_equal(
          sigma,
          np.array(
              [
                  0.46291005 / np.sqrt(0.4946862482541263),
                  0.46291005 / np.sqrt(0.4946862482541263),
                  0.46291005 / np.sqrt(0.4946862482541263),
              ]
          ),
      )
  
file_path: dipy/dipy/denoise/tests/test_noise_estimate.py
imports: import numpy
  from numpy.testing import assert_almost_equal, assert_equal, assert_, assert_array_almost_equal, assert_warns
  from dipy.denoise.noise_estimate import _inv_nchi_cdf, piesno, estimate_sigma
  from dipy.denoise.noise_estimate import _piesno_3D
  from dipy.denoise.pca_noise_estimate import pca_noise_estimate
  import dipy.data
  import dipy.core.gradients
  from dipy.io.image import load_nifti_data
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 4 for calling a global function with example usage: test_estimate_sigma() without return types