class_docstr: This generic permutation test class contains the calibration method
  which is common to the derived classes permutation_test_onesample and
  permutation_test_twosample (as well as other common methods)
class_docstr_tok: ["This","generic","permutation","test","class","contains","the","calibration","method","which","is","common","to","the","derived","classes","permutation_test_onesample","and","permutation_test_twosample","(","as","well","as","other","common","methods",")"]
docstr: Return the uniform height threshold matching a given
  permutation-based P-value.
docstr_tok: ["Return","the","uniform","height","threshold","matching","a","given","permutation-based","P-value","."]
code: def height_threshold(self, pval):
      """
      Return the uniform height threshold matching a given
      permutation-based P-value.
      """
      tvals = self.random_Tvalues
      ndraws = tvals.size
      idx = int(np.ceil(ndraws * (1 - pval)))
      if idx >= ndraws:
          return np.inf
      candidate = tvals[idx]
      if tvals[max(0, idx - 1)] < candidate:
          return candidate
      idx = np.searchsorted(tvals, candidate, "right")
      if idx >= ndraws:
          return np.inf
      return tvals[idx]
  
imports: import numpy
  import warnings
  from nipy.algorithms.graph import wgraph_from_3d_grid
  from nipy.algorithms.graph.field import Field, field_from_graph_and_data
  from ..utils import zscore
  from .onesample import stat
  from .onesample import stat_mfx
  from .twosample import stat
  from .twosample import stat_mfx
label_desc: Use image node_id 2 for calling the permutation_test obj's underlying member method code with example usage: obj.height_threshold(pval) and returns: tvals, np, candidate, np