gov.nist.microanalysis.Utility
Class Histogram

java.lang.Object
  extended by gov.nist.microanalysis.Utility.Histogram

public class Histogram
extends java.lang.Object

A class for creating histograms of series of numbers. It is possible to override, bin(), minValue() and maxValue() to implement non-equally spaced bins. Alternatively, the user may implement a linearization function to take the users non-linear parameter into a linear parameter.

Copyright: Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain

Company: National Institute of Standards and Technology

Version:
1.0
Author:
Nicholas W. M. Ritchie

Constructor Summary
Histogram(double min, double max, int nBins)
          Histogram - Creates a histogram representing the specified range with bins for over-range and under-range.
 
Method Summary
 void add(double val)
          add - Add the specified value to the histogram.
 void add(double[] vals)
          add - Add the specified array of values to the histogram.
 int bin(double val)
          bin - Returns the bin into which the val fits.
 int binCount()
          binCount - Returns the number of bins (not counting over-range and under-range bins)
 java.lang.String binName(int bin, java.lang.String format)
          binName - Returns a string that describes the specified bin.
 int counts(int bin)
          counts - Returns the number of counts in the specified bin.
 double maxValue(int bin)
          maxValue - Returns the upper limit for values stored in this bin.
 double minValue(int bin)
          minValue - Returns the minimum value stored in the specified bin
 int overrange()
          overrange - Returns the number of events that fell into the overrange bin (larger than the max argument of the constructor.)
 int underrange()
          underrange -Returns the number of events that fell into the underrange bin (less than the min argument of the constructor.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Histogram

public Histogram(double min,
                 double max,
                 int nBins)
Histogram - Creates a histogram representing the specified range with bins for over-range and under-range.

Parameters:
min - double
max - double
nBins - int - The number of bins (excluding over- and under-range)
Method Detail

bin

public int bin(double val)
bin - Returns the bin into which the val fits.

Parameters:
val - double
Returns:
int

minValue

public double minValue(int bin)
minValue - Returns the minimum value stored in the specified bin

Parameters:
bin - int
Returns:
double

maxValue

public double maxValue(int bin)
maxValue - Returns the upper limit for values stored in this bin. Actually this value is excluded from the bin and included in the next larger bin.

Parameters:
bin - int
Returns:
double

add

public void add(double val)
add - Add the specified value to the histogram.

Parameters:
val - double

add

public void add(double[] vals)
add - Add the specified array of values to the histogram.

Parameters:
vals - double[]

binCount

public int binCount()
binCount - Returns the number of bins (not counting over-range and under-range bins)

Returns:
int

binName

public java.lang.String binName(int bin,
                                java.lang.String format)
binName - Returns a string that describes the specified bin. The String format is used to format numbers using MessageFormat.format(...)

Parameters:
bin - int
format - String
Returns:
String

counts

public int counts(int bin)
counts - Returns the number of counts in the specified bin.

Parameters:
bin - int - 0 to binCount()
Returns:
int

overrange

public int overrange()
overrange - Returns the number of events that fell into the overrange bin (larger than the max argument of the constructor.)

Returns:
int

underrange

public int underrange()
underrange -Returns the number of events that fell into the underrange bin (less than the min argument of the constructor.)

Returns:
int