code: def test_pproba():
      test = 5 * np.random.rand(10)
      order = np.argsort(-test)
      learn = np.random.rand(100)
      learn[:20] += 3
      #
      pval = _stat_to_proba(test)
      # check that pvals are between 0 and 1, and that its is monotonous
      assert (pval >= 0).all()
      assert (pval <= 1).all()
      assert_array_equal(pval[order], np.sort(pval))
      #
      pval = _stat_to_proba(test, learn)
      assert (pval >= 0).all()
      assert (pval <= 1).all()
      assert_array_equal(pval[order], np.sort(pval))
      #
      for method in ["gauss_mixture", "emp_null", "gam_gauss"]:
          pval = _stat_to_proba(test, learn, method=method)
          assert (pval >= 0).all()
          assert (pval <= 1).all()
  
file_path: nipy/nipy/labs/spatial_models/tests/test_bsa.py
imports: import numpy
  import scipy.stats
  from nipy.testing import assert_array_equal
  from ...utils.simul_multisubject_fmri_dataset import surrogate_2d_dataset
  from ..bayesian_structural_analysis import _stat_to_proba, compute_landmarks
  from ..discrete_domain import domain_from_binary_array
label_desc: Use image node_id 3 for calling a global function with example usage: test_pproba() without return types