class_docstr: Class derived from the generic permutation_test class.
  Inherits the calibrate method
class_docstr_tok: ["Class","derived","from","the","generic","permutation_test","class",".","Inherits","the","calibrate","method"]
docstr: Initialize permutation_test_onesample instance,
  compute statistic values in each voxel and under permutation
  In:  data                data array
       G                   weighted graph (each vertex corresponds to a voxel)
       axis    <int>       Subject axis in data
       vardata             variance (same shape as data)
                   optional (if None, mfx statistics cannot be used)
       stat_id <char>      choice of test statistic
                           (see onesample.stats for a list of possible stats)
       base    <float>     mean signal under H0
       niter   <int>       number of iterations of EM algorithm
       ndraws  <int>       Number of generated random t values
  Out:
       self.Tvalues        voxelwise test statistic values
       self.random_Tvalues sorted statistic values in random voxels and under random
                           sign permutation
docstr_tok: ["Initialize","permutation_test_onesample","instance",",","compute","statistic","values","in","each","voxel","and","under","permutation","In",":","data","data","array","G","weighted","graph","(","each","vertex","corresponds","to","a","voxel",")","axis","<","int",">","Subject","axis","in","data","vardata","variance","(","same","shape","as","data",")","optional","(","if","None",",","mfx","statistics","can","not","be","used",")","stat_id","<","char",">","choice","of","test","statistic","(","see","onesample.stats","for","a","list","of","possible","stats",")","base","<","float",">","mean","signal","under","H0","niter","<","int",">","number","of","iterations","of","EM","algorithm","ndraws","<","int",">","Number","of","generated","random","t","values","Out",":","self.Tvalues","voxelwise","test","statistic","values","self.random_Tvalues","sorted","statistic","values","in","random","voxels","and","under","random","sign","permutation"]
code: def __init__(
      self,
      data,
      G,
      axis=0,
      vardata=None,
      stat_id=DEF_STAT_ONESAMPLE,
      base=0.0,
      niter=DEF_NITER,
      ndraws=DEF_NDRAWS,
  ):
      """
      Initialize permutation_test_onesample instance,
      compute statistic values in each voxel and under permutation
      In:  data                data array
           G                   weighted graph (each vertex corresponds to a voxel)
           axis    <int>       Subject axis in data
           vardata             variance (same shape as data)
                       optional (if None, mfx statistics cannot be used)
           stat_id <char>      choice of test statistic
                               (see onesample.stats for a list of possible stats)
           base    <float>     mean signal under H0
           niter   <int>       number of iterations of EM algorithm
           ndraws  <int>       Number of generated random t values
      Out:
           self.Tvalues        voxelwise test statistic values
           self.random_Tvalues sorted statistic values in random voxels and under random
                               sign permutation
      """
      # Create data fields
      n, p = data.shape[axis], data.shape[1 - axis]
      self.data = data
      self.stat_id = stat_id
      self.XYZ = None
      self.G = G
      self.axis = axis
      self.vardata = vardata
      self.niter = niter
      self.base = base
      self.ndraws = ndraws
      self.Tvalues = onesample_stat(
          data, vardata, stat_id, base, axis, Magics=None, niter=niter
      ).squeeze()
      self.nsamples = 1
      # Compute statistic values in random voxels and under random permutations
      # Use a self.verbose flag for this output?
      # print "Computing average null distribution of test statistic..."
      self.random_Tvalues = np.zeros(ndraws, float)
      # Random voxel selection
      I = np.random.randint(0, p, size=ndraws)
      if axis == 0:
          rand_data = data[:, I]
          if vardata is None:
              rand_vardata = None
          else:
              rand_vardata = vardata[:, I]
      else:
          rand_data = data[I]
          if vardata is None:
              rand_vardata = None
          else:
              rand_vardata = vardata[I]
      # Random sign permutation
      rand_sign = (
          np.random.binomial(1, 0.5, size=n * ndraws) * 2 - 1
      ).reshape(n, ndraws)
      if axis == 1:
          rand_sign = rand_sign.transpose()
      rand_data *= rand_sign
      self.random_Tvalues = onesample_stat(
          rand_data, rand_vardata, stat_id, base, axis
      ).squeeze()
      self.random_Tvalues.sort()
  
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 1 to create a new permutation_test_onesample_graph object from inherited base classes: permutation_test with example: obj = permutation_test_onesample_graph(data, G, axis, vardata, stat_id, base, niter, ndraws)