Package de.gsi.dataset.spi
Class Histogram
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<AbstractHistogram>
-
- de.gsi.dataset.spi.AbstractHistogram
-
- de.gsi.dataset.spi.Histogram
-
- All Implemented Interfaces:
DataSet,DataSet2D,DataSetMetaData,EventSource,Histogram,Histogram1D,java.io.Serializable
public class Histogram extends AbstractHistogram implements Histogram1D, DataSet2D
Class implements simple one dimensional binned histogram backed internally by double arrays- Author:
- rstein
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.gsi.dataset.spi.AbstractHistogram
AbstractHistogram.HistogramOuterBounds
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisHorizontal-
Fields inherited from class de.gsi.dataset.spi.AbstractHistogram
axisBins, data, nAxisBins
-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet
axisListener, dimension
-
Fields inherited from interface de.gsi.dataset.DataSetMetaData
TAG_GAIN_RANGE, TAG_OVERSHOOT, TAG_UNDERSHOOT
-
-
Constructor Summary
Constructors Constructor Description Histogram(java.lang.String name, double[] xBins)Creates histogram with name and range [minX, maxX]Histogram(java.lang.String name, double[] xBins, boolean horizontal)Creates histogram with name and range [minX, maxX]Histogram(java.lang.String name, int nBins, double minX, double maxX, boolean horizontal, AbstractHistogram.HistogramOuterBounds boundsType)Creates histogram with name and range [minX, maxX]Histogram(java.lang.String name, int nBins, double minX, double maxX, AbstractHistogram.HistogramOuterBounds boundsType)Creates histogram with name and range [minX, maxX]
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinContent(int bin, double w)Increment bin content by a weight w.intfill(double x, double w)Increment bin with abscissa X by with a weight w.voidfillN(double[] x, double[] w, int stepSize)Fill this histogram with an array x and weights w.intfindBin(int dimIndex, double x)doubleget(int dimIndex, int index)Gets the x value of the data point with the index ijava.util.List<java.lang.String>getErrorList()intgetIndex(int dimIndex, double... value)Gets the index of the data point closest to the given 'value' coordinate.java.util.List<java.lang.String>getInfoList()doublegetValue(int dimIndex, double x)java.util.List<java.lang.String>getWarningList()voidreset()reset histogram contentDataSetset(DataSet other, boolean copy)-
Methods inherited from class de.gsi.dataset.spi.AbstractHistogram
addBinContent, findBin, findBin, findNextLargerIndex, getBinCenter, getBinContent, getDataCount, isEquiDistant
-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
addDataLabel, addDataStyle, autoNotification, binarySearch, binarySearch, clearMetaInfo, copyAxisDescription, copyDataLabelsAndStyles, copyMetaData, equalDataLabels, equalEditConstraints, equalErrorValues, equalMetaData, equals, equals, equalValues, fireInvalidated, getAxisDescriptions, getDataLabel, getDataLabelMap, getDataStyleMap, getDimension, getEditConstraints, getMetaInfo, getName, getStyle, getThis, getValue, getValues, hashCode, lock, recomputeLimits, removeDataLabel, removeStyle, setEditConstraints, setName, toString, updateEventListener
-
Methods inherited from class de.gsi.dataset.spi.AbstractStylable
getStyle, setStyle
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.gsi.dataset.DataSet
getAxisDescription, getAxisDescriptions, getDataCount, getDataLabel, getName, getStyle, getStyle, getValue, getValues, lock, recomputeLimits, set, setStyle
-
Methods inherited from interface de.gsi.dataset.DataSet2D
getDimension, getValue, getX, getXIndex, getXValues, getY, getYIndex, getYValues
-
Methods inherited from interface de.gsi.dataset.DataSetMetaData
getMetaInfo
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, autoNotification, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener, updateEventListener
-
Methods inherited from interface de.gsi.dataset.Histogram
addBinContent, findBin, findBin, getBinCenter, getBinContent, isEquiDistant
-
Methods inherited from interface de.gsi.dataset.Histogram1D
fill
-
-
-
-
Constructor Detail
-
Histogram
public Histogram(java.lang.String name, double[] xBins)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsxBins- the initial bin array (defines [minX, maxX] and nBins)
-
Histogram
public Histogram(java.lang.String name, double[] xBins, boolean horizontal)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsxBins- the initial bin array (defines [minX, maxX] and nBins)horizontal- whether binning is performed in X
-
Histogram
public Histogram(java.lang.String name, int nBins, double minX, double maxX, AbstractHistogram.HistogramOuterBounds boundsType)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsnBins- number of binsminX- minimum of rangemaxX- maximum of rangeboundsType- How the min and max value should be interpreted
-
Histogram
public Histogram(java.lang.String name, int nBins, double minX, double maxX, boolean horizontal, AbstractHistogram.HistogramOuterBounds boundsType)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsnBins- number of binsminX- minimum of rangemaxX- maximum of rangehorizontal- whether binning is performed in XboundsType- How the min and max value should be interpreted
-
-
Method Detail
-
addBinContent
public void addBinContent(int bin, double w)Description copied from interface:HistogramIncrement bin content by a weight w. More...- Specified by:
addBinContentin interfaceHistogram- Overrides:
addBinContentin classAbstractHistogram- Parameters:
bin- global bin IDw- weight
-
fill
public int fill(double x, double w)Description copied from interface:Histogram1DIncrement bin with abscissa X by with a weight w. if x is less than the low-edge of the first bin, the Underflow bin is incremented if x is equal to or greater than the upper edge of last bin, the Overflow bin is incremented The function returns the corresponding bin number which has its content incremented by 1- Specified by:
fillin interfaceHistogram1D- Parameters:
x- new value to be addedw- weight- Returns:
- corresponding bin number which has its content incremented by 1
-
fillN
public void fillN(double[] x, double[] w, int stepSize)Description copied from interface:Histogram1DFill this histogram with an array x and weights w.- Specified by:
fillNin interfaceHistogram1D- Parameters:
x- x coordinates to be added.w- weights to be added.stepSize- step size through arrays x and w
-
findBin
public int findBin(int dimIndex, double x)- Specified by:
findBinin interfaceHistogram- Overrides:
findBinin classAbstractHistogram- Parameters:
dimIndex- the dimension indexx- spatial real-valued coordinate for dimension dimIndex- Returns:
- bin index corresponding to spatial x and y coordinates
-
get
public double get(int dimIndex, int index)Description copied from interface:DataSetGets the x value of the data point with the index i
-
getErrorList
public java.util.List<java.lang.String> getErrorList()
- Specified by:
getErrorListin interfaceDataSetMetaData- Overrides:
getErrorListin classAbstractDataSet<AbstractHistogram>
-
getIndex
public int getIndex(int dimIndex, double... value)Description copied from interface:DataSetGets the index of the data point closest to the given 'value' coordinate. The index returned may be less then zero or larger the the number of data points in the data set, if the x coordinate lies outside the range of the data set.- Specified by:
getIndexin interfaceDataSet- Overrides:
getIndexin classAbstractDataSet<AbstractHistogram>- Parameters:
dimIndex- the dimension index (ie. '0' equals 'X', '1' equals 'Y')value- the data point coordinates to search for- Returns:
- the index of the data point
-
getInfoList
public java.util.List<java.lang.String> getInfoList()
- Specified by:
getInfoListin interfaceDataSetMetaData- Overrides:
getInfoListin classAbstractDataSet<AbstractHistogram>
-
getValue
public double getValue(int dimIndex, double x)
-
getWarningList
public java.util.List<java.lang.String> getWarningList()
- Specified by:
getWarningListin interfaceDataSetMetaData- Overrides:
getWarningListin classAbstractDataSet<AbstractHistogram>
-
reset
public void reset()
Description copied from interface:Histogramreset histogram content- Specified by:
resetin interfaceHistogram- Overrides:
resetin classAbstractHistogram
-
-