Package de.gsi.dataset.spi
Class AbstractHistogram
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<AbstractHistogram>
-
- de.gsi.dataset.spi.AbstractHistogram
-
- All Implemented Interfaces:
DataSet,DataSetMetaData,EventSource,Histogram,java.io.Serializable
- Direct Known Subclasses:
Histogram,Histogram2
public abstract class AbstractHistogram extends AbstractDataSet<AbstractHistogram> implements Histogram
- Author:
- rstein
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractHistogram.HistogramOuterBoundsDefines how the lower and upper bound of equidistant Histograms should be treated
-
Field Summary
Fields Modifier and Type Field Description protected double[][]axisBinsprotected double[]dataprotected int[]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 AbstractHistogram(java.lang.String name, double[] xBins)Creates a non equidistant histogram with name and range [minX, maxX]AbstractHistogram(java.lang.String name, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY, AbstractHistogram.HistogramOuterBounds boundsType)Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]AbstractHistogram(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)Increment bin content by 1.voidaddBinContent(int bin, double w)Increment bin content by a weight w.intfindBin(double x, double y)intfindBin(double x, double y, double z)intfindBin(int dimIndex, double x)protected intfindNextLargerIndex(double[] bin, double value)doublegetBinCenter(int dimIndex, int binIndex)doublegetBinContent(int bin)Return content of bin number bin.intgetDataCount()Get the number of data points in the data set.booleanisEquiDistant()voidreset()reset histogram content-
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, getErrorList, getIndex, getInfoList, getMetaInfo, getName, getStyle, getThis, getValue, getValues, getWarningList, 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
get, getAxisDescription, getAxisDescriptions, getDataLabel, getDimension, getIndex, getName, getStyle, getStyle, getValue, getValues, lock, recomputeLimits, set, set, setStyle
-
Methods inherited from interface de.gsi.dataset.DataSetMetaData
getErrorList, getInfoList, getMetaInfo, getWarningList
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, autoNotification, invokeListener, invokeListener, invokeListener, isAutoNotification, removeListener, updateEventListener
-
-
-
-
Constructor Detail
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, double[] xBins)Creates a non equidistant histogram with name and range [minX, maxX]NOTE: since chartfx's default ErrorDataSetRenderer cannot access the bin boundaries, it is currently unable to correctly render non equidistant Histograms.
- Parameters:
name- of the data setsxBins- the bin boundary array (defines [minX, maxX] and nBins)
-
AbstractHistogram
public AbstractHistogram(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/max value should be interpreted
-
AbstractHistogram
public AbstractHistogram(java.lang.String name, int nBinsX, double minX, double maxX, int nBinsY, double minY, double maxY, AbstractHistogram.HistogramOuterBounds boundsType)Creates 2D histogram with name and ranges [minX, maxX] and [minY, maxY]- Parameters:
name- of the data setsnBinsX- number of horizontal binsminX- minimum of horizontal rangemaxX- maximum of horizontal rangenBinsY- number of vertical binsminY- minimum of vertical rangemaxY- maximum of vertical rangeboundsType- How the min and max value should be interpreted
-
-
Method Detail
-
addBinContent
public void addBinContent(int bin)
Description copied from interface:HistogramIncrement bin content by 1. More...- Specified by:
addBinContentin interfaceHistogram- Parameters:
bin- global bin ID
-
addBinContent
public void addBinContent(int bin, double w)Description copied from interface:HistogramIncrement bin content by a weight w. More...- Specified by:
addBinContentin interfaceHistogram- Parameters:
bin- global bin IDw- weight
-
findBin
public int findBin(double x, double y)
-
findBin
public int findBin(double x, double y, double z)
-
findBin
public int findBin(int dimIndex, double x)
-
findNextLargerIndex
protected int findNextLargerIndex(double[] bin, double value)
-
getBinCenter
public double getBinCenter(int dimIndex, int binIndex)- Specified by:
getBinCenterin interfaceHistogram- Parameters:
dimIndex- the dimension indexbinIndex- index- Returns:
- bin centre for axis with dimIndex
-
getBinContent
public double getBinContent(int bin)
Description copied from interface:HistogramReturn content of bin number bin. Convention for numbering bins For all histogram types: nbins, xlow, xup bin = 0; underflow bin bin = 1; first bin with low-edge xlow INCLUDED bin = nbins; last bin with upper-edge xup EXCLUDED bin = nbins+1; overflow bin- Specified by:
getBinContentin interfaceHistogram- Parameters:
bin- the index- Returns:
- numeric bin content
-
getDataCount
public int getDataCount()
Description copied from interface:DataSetGet the number of data points in the data set.- Specified by:
getDataCountin interfaceDataSet- Returns:
- the number of data points
-
isEquiDistant
public boolean isEquiDistant()
- Specified by:
isEquiDistantin interfaceHistogram- Returns:
- true if bin sizes are equal
-
-