Hi Bill and All,
I made this small program to test the Histogram function. what it does
is to generate 10000 random numbers and get the histogram. I was
expecting to have more or less the same number of points per bin but I
am having only a half of the points in the first and last "interval".
May be I am either making a wrong interpretation of the results or I am
giving the wrong input to the program.
Thanks again,
Ricardo Mantilla
University of Colorado at Boulder
import visad.*;
import visad.java2d.DisplayImplJ2D;
import java.rmi.RemoteException;
import java.awt.Font;
public class testHisto extends java.lang.Object {
/** Creates new testHisto */
public testHisto() throws RemoteException, VisADException{
RealType numLinks = RealType.Generic;
RealType distanceToOut = RealType.Generic;
FunctionType func_distanceToOut_numLinks = new
FunctionType(distanceToOut, numLinks);
Linear1DSet distanceToOut_set = new Linear1DSet(0, 1, 10000);
float[][] NumL_vals = new float[1][10000];
for (int i=0;i<10000;i++) NumL_vals[0][i]=(float) Math.random();
FlatField vals_ff = new FlatField( func_distanceToOut_numLinks,
distanceToOut_set);
vals_ff.setSamples( NumL_vals );
Linear1DSet bins = new Linear1DSet(0, 1, 11);
FlatField hist = visad.math.Histogram.makeHistogram(vals_ff, bins);
float[][] otra=bins.getSamples();
double[][] algo=hist.getValues();
for (int i=0;i<algo[0].length;i++)
System.out.println(otra[0][i]+" "+algo[0][i]);
}
/**
* @param args the command line arguments
*/
public static void main (String args[]){
try{
new testHisto();
} catch (VisADException v){
System.err.println(v);
} catch (RemoteException r){
System.err.println(r);
}
}
}