public static boolean isNormal(GeoTimeSerie gts,int buckets,double pcterror,boolean bessel){
  if (0 == gts.values) {
    return true;
  }
  if (TYPE.DOUBLE != gts.type && TYPE.LONG != gts.type) {
    return false;
  }
  double[] musigma=musigma(gts,bessel);
  double mu=musigma[0];
  double sigma=musigma[1];
  if (0.0D == sigma) {
    return false;
  }
  double[] bounds=SAXUtils.getBounds(buckets);
  int[] counts=new int[bounds.length + 1];
  for (int i=0; i < gts.values; i++) {
    double v=((double)GTSHelper.valueAtIndex(gts,i) - mu) / sigma;
    int insertion=Arrays.binarySearch(bounds,v);
    if (insertion >= 0) {
      counts[insertion]++;
    }
 else {
      counts[-(1 + insertion)]++;
    }
  }
  double mean=gts.values / counts.length;
  for (int i=0; i < counts.length; i++) {
    if (Math.abs(1.0D - (counts[i] / mean)) > pcterror) {
      return false;
    }
  }
  return true;
}

public static boolean isNormal ( GeoTimeSerie gts , int buckets , double pcterror , boolean bessel ) { if ( 0 == gts . values ) { return true ; } if ( TYPE . DOUBLE != gts . type && TYPE . LONG != gts . type ) { return false ; } double [ ] musigma = musigma ( gts , bessel ) ; double mu = musigma [ 0 ] ; double sigma = musigma [ 1 ] ; if ( 0.0D == sigma ) { return false ; } double [ ] bounds = SAXUtils . getBounds ( buckets ) ; int [ ] counts = new int [ bounds . length + 1 ] ; for ( int i = 0 ; i < gts . values ; i ++ ) { double v = ( ( double ) GTSHelper . valueAtIndex ( gts , i ) - mu ) / sigma ; int insertion = Arrays . binarySearch ( bounds , v ) ; if ( insertion >= 0 ) { counts [ insertion ] ++ ; } else { counts [ - ( 1 + insertion ) ] ++ ; } } double mean = gts . values / counts . length ; for ( int i = 0 ; i < counts . length ; i ++ ) { if ( Math . abs ( 1.0D - ( counts [ i ] / mean ) ) > pcterror ) { return false ; } } return true ; }
determine if a gts ' values are normally distributed . works for numerical gts only
