sigma2D method

double sigma2D (List<Float64List> matrix, int posneg, double ymax)

Implementation

static double sigma2D(
    List<Float64List> matrix, int posneg, double ymax) {
  int nrowsNoise = 16, ncolsNoise = 16;
  int noisRowMax, noisRowMin;
  int noisColMax, noisColMin;

  int sizef1 = matrix.length;
  int size = matrix[0].length;
  if (sizef1 <= nrowsNoise) nrowsNoise = 4;
  if (size <= ncolsNoise) ncolsNoise = 4;
  noisRowMax = sizef1 - 1;
  noisRowMin = noisRowMax - nrowsNoise;
  noisColMax = ncolsNoise;
  noisColMin = 0;
  Float64List noisreg = Array2D.getSubmatrixAs1D(
      matrix, noisRowMin, noisRowMax, noisColMin, noisColMax);
  for (int i = 0; i < noisreg.length; i++) {
    if (posneg == SIGMA_POS_ONLY && noisreg[i] < 0) {
      noisreg[i] = 0.0;
    } else if (posneg == SIGMA_NEG_ONLY && noisreg[i] > 0) {
      noisreg[i] = 0.0;
    }
  }

  double sigma = Sigma.sigma(noisreg, null, null);
  if (sigma < 1.0e-10) sigma = ymax / 1000.0;
  return sigma;
}