code: def test_imm_wnc():
      # Test the basic imm_wnc
      n = 50
      dim = 1
      alpha = 0.5
      g0 = 1.0
      x = np.random.rand(n, dim)
      x[: int(0.3 * n)] *= 0.2
      x[: int(0.1 * n)] *= 0.3
  
      # instantiate
      migmm = MixedIMM(alpha, dim)
      migmm.set_priors(x)
      migmm.set_constant_densities(null_dens=g0)
      ncp = 0.5 * np.ones(n)
  
      # warming
      migmm.sample(x, null_class_proba=ncp, niter=100, init=True)
      g = np.reshape(np.linspace(0, 1, 101), (101, dim))
  
      # sampling
      like, pproba = migmm.sample(
          x, null_class_proba=ncp, niter=300, sampling_points=g
      )
  
      # the density should sum to 1
      ds = 0.01 * like.sum()
      assert ds < 1
      assert ds > 0.8
      assert np.sum(pproba > 0.5) > 1
      assert np.sum(pproba < 0.5) > 1
  
file_path: nipy/nipy/algorithms/clustering/tests/test_imm.py
imports: import numpy
  from numpy.testing import assert_array_equal
  from ..imm import IMM, MixedIMM, co_labelling
label_desc: Use image node_id 8 for calling a global function with example usage: test_imm_wnc() without return types