public class Histogram extends Object
Constructor and Description |
---|
Histogram(double[] data) |
Histogram(double[] data,
int nbins)
A simple constructor
|
Histogram(double[] data,
int nbins,
double min,
double max)
Constructor which sets name, number of bins, and range.
|
Modifier and Type | Method and Description |
---|---|
void |
changeSettings(int nbins) |
int |
entries()
Get number of entries in the histogram.
|
void |
fill(double x)
Enter data into the histogram.
|
double |
getBandWidth() |
double[] |
getDataArray() |
boolean |
getDebug()
Get debug flag.
|
double[] |
getHistArray()
This method gives you the bin contents in the form of an array.
|
double[] |
getSampleArray() |
double |
max()
Get upper end of histogram range
|
double |
mean() |
double |
min()
Get lower end of histogram range
|
String |
name()
Get the name of the histogram.
|
int |
numberOfBins()
Get the number of bins in the histogram.
|
double |
overflow()
Get the height of the overflow bin.
|
void |
setBandWidth() |
void |
setDebug(boolean flag)
Set debug flag.
|
void |
setHistogram(double[] data,
int nbins,
double min,
double max)
Settings to Histogram
|
double[] |
setSampleArray() |
void |
show()
Print the histogram data to the console.
|
double |
stdDev() |
double |
underflow()
Get the height of the underflow bin.
|
double |
variance() |
void |
writeToFile(String fileName)
Save the histogram data to a file.
|
public Histogram(double[] data)
public Histogram(double[] data, int nbins)
data
- datanbins
- nbinspublic Histogram(double[] data, int nbins, double min, double max)
data
- samplesnbins
- the number of bins the histogram should have. The range specified by min and max will be divided up into this
many bins.min
- the minimum of the range covered by the histogram binsmax
- the maximum value of the range covered by the histogram binspublic void setHistogram(double[] data, int nbins, double min, double max)
data
- datanbins
- nbinsmin
- minmax
- maxpublic void changeSettings(int nbins)
public void fill(double x)
x
- is the value to add in to the histogrampublic void setBandWidth()
public double getBandWidth()
public void writeToFile(String fileName) throws IOException
fileName
- name of the file to write the histogram to. Note this must be valid for your operating system, e.g. a unix
filename might not work under windowsIOException
- if file cannot be opened or written to.public void show()
public double[] setSampleArray()
public int entries()
public String name()
public int numberOfBins()
public double min()
public double mean()
public double variance()
public double stdDev()
public double max()
public double overflow()
public double underflow()
public double[] getHistArray()
public double[] getSampleArray()
public double[] getDataArray()
public void setDebug(boolean flag)
flag
- debug flag (true or false)public boolean getDebug()
Copyright © 2000–2016 DFKI GmbH. All rights reserved.