code: def check_p_values(p_values):
      """Basic checks on the p_values array: values should be within [0,1]
  
      Assures also that p_values are at least in 1d array.  None of the
      checks is performed if p_values is None.
  
      Parameters
      ----------
      p_values : array of shape (n)
          The sample p-values
  
      Returns
      -------
      p_values : array of shape (n)
          The sample p-values
      """
      if p_values is None:
          return None
      # Take all elements unfolded and assure having at least 1d
      p_values = np.atleast_1d(np.ravel(p_values))
      if np.any(np.isnan(p_values)):
          raise ValueError(
              "%d values are NaN" % (sum(np.isnan(p_values)))
          )
      if p_values.min() < 0:
          raise ValueError(f"Negative p-values. Min={p_values.min():g}")
      if p_values.max() > 1:
          raise ValueError(
              f"P-values greater than 1! Max={p_values.max():g}"
          )
      return p_values
  
file_path: nipy/nipy/algorithms/statistics/empirical_pvalue.py
imports: import numpy
  import scipy.stats
  from numpy.linalg import pinv
label_desc: Use image node_id 1 for calling a global function with example usage: check_p_values(p_values) and returns: p_values, None