code: def test_add_noise(rng):
      N = 50
      S0 = 100
  
      options = dict(
          func=f,
          t=np.linspace(0, 2 * np.pi, N),
          datashape=(10, 10, 10, len(bvals)),
          origin=(5, 5, 5),
          scale=(3, 3, 3),
          angles=np.linspace(0, 2 * np.pi, 16),
          radii=np.linspace(0.2, 2, 6),
          S0=S0,
          rng=rng,
      )
  
      vol = orbital_phantom(gtab, **options)
  
      for snr in [10, 20, 30, 50]:
          vol_noise = orbital_phantom(gtab, snr=snr, **options)
  
          sigma = S0 / snr
  
          assert_(np.abs(np.var(vol_noise - vol) - sigma**2) < 1)
  
file_path: dipy/dipy/sims/tests/test_phantom.py
imports: import numpy
  from numpy.testing import assert_, assert_array_almost_equal
  from dipy.data import get_fnames
  from dipy.reconst.dti import TensorModel
  from dipy.sims.phantom import orbital_phantom
  from dipy.core.gradients import gradient_table
  from dipy.io.gradients import read_bvals_bvecs
  from dipy.testing.decorators import set_random_number_generator
label_desc: Use image node_id 3 for calling a global function with example usage: test_add_noise(rng) without return types