Package de.gsi.dataset.spi
Class Histogram
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<D>
-
- de.gsi.dataset.spi.AbstractDataSet3D<AbstractHistogram>
-
- de.gsi.dataset.spi.AbstractHistogram
-
- de.gsi.dataset.spi.Histogram
-
- All Implemented Interfaces:
DataSet,DataSet3D,DataSetMetaData,EventSource,Histogram,Histogram1D
public class Histogram extends AbstractHistogram implements Histogram1D
Class implements simple one dimensional binned histogram backed internally by double arrays- Author:
- rstein
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisHorizontal-
Fields inherited from class de.gsi.dataset.spi.AbstractHistogram
dataLabels, dataStyles
-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet3D
zRange
-
Fields inherited from class de.gsi.dataset.spi.AbstractDataSet
editConstraints, lock, metaInfoMap, name, updateListeners, xRange, yRange
-
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)Creates histogram with name and range [minX, maxX]Histogram(java.lang.String name, int nBins, double minX, double maxX, boolean horizontal)Creates histogram with name and range [minX, maxX]
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected HistogramcomputeLimits()recompute data set limitsintfill(double x)Increment bin with abscissa X, Y, and Z by 1.intfill(double x, double w)Increment bin with abscissa X by with a weight w.intfill(java.lang.String name)Increment bin with name with by 1.intfill(java.lang.String name, double w)Increment bin with name with a weight w.voidfillN(double[] x, double[] w, int stepSize)Fill this histogram with an array x and weights w.intgetDataCount()Get the number of data points in the data setjava.util.List<java.lang.String>getErrorList()java.util.List<java.lang.String>getInfoList()java.util.List<java.lang.String>getWarningList()doublegetX(int i)Gets the x value of the data point with the index iintgetXDataCount()Returns number of X coordinates.doublegetY(int i)Gets the y value of the data point with the index iintgetYDataCount()Returns number of Y coordinates.DataRangegetYRange()doublegetZ(int xIndex, int yIndex)Returns Z coordinate for the specified data point.-
Methods inherited from class de.gsi.dataset.spi.AbstractHistogram
addBinContent, addBinContent, addDataLabel, addDataStyle, findBin, findBin, findBin, findBinX, findBinY, findBinZ, findNextLargerIndex, getBinCenterX, getBinCenterY, getBinCenterZ, getBinContent, getDataLabel, getDataLabelMap, getDataStyleMap, getDimension, getMaximum, getMinimum, getNBinsX, getNBinsY, getNBinsZ, getStyle, getValueRange, isEquiDistant, removeDataLabel, removeStyle, reset, set
-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet3D
getXIndex, getYIndex, getZRange
-
Methods inherited from class de.gsi.dataset.spi.AbstractDataSet
binarySearchX, binarySearchY, fireInvalidated, getDataCount, getDefaultDataLabel, getEditConstraints, getMetaInfo, getName, getThis, getUndefValue, getXMax, getXMin, getXRange, getYMax, getYMin, isAutoNotification, lock, minNeigbourSearchX, setAutoNotifaction, setEditConstraints, setName, toString, unlock, updateEventListener
-
Methods inherited from class de.gsi.dataset.spi.AbstractStylable
getStyle, setStyle
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface de.gsi.dataset.DataSet
getDataCount, getDataLabel, getName, getStyle, getStyle, getUndefValue, getValue, getXIndex, getXMax, getXMin, getXValues, getYIndex, getYMax, getYMin, getYValues, isAutoNotification, lock, setAutoNotifaction, setStyle, unlock
-
Methods inherited from interface de.gsi.dataset.DataSetMetaData
getMetaInfo
-
Methods inherited from interface de.gsi.dataset.event.EventSource
addListener, invokeListener, invokeListener, removeListener, updateEventListener
-
Methods inherited from interface de.gsi.dataset.Histogram
addBinContent, addBinContent, findBin, findBin, findBin, getBinCenterX, getBinCenterY, getBinCenterZ, getBinContent, getDimension, getMaximum, getMinimum, getNBinsX, getNBinsY, getNBinsZ, isEquiDistant, reset
-
-
-
-
Constructor Detail
-
Histogram
public Histogram(java.lang.String name, int nBins, double minX, double maxX, boolean horizontal)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 X
-
Histogram
public Histogram(java.lang.String name, int nBins, double minX, double maxX)Creates histogram with name and range [minX, maxX]- Parameters:
name- of the data setsnBins- number of binsminX- minimum of rangemaxX- maximum of range
-
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, 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)
-
-
Method Detail
-
getDataCount
public int getDataCount()
Get the number of data points in the data set- Specified by:
getDataCountin interfaceDataSet- Overrides:
getDataCountin classAbstractDataSet3D<AbstractHistogram>- Returns:
- the number of data points
-
getXDataCount
public int getXDataCount()
Description copied from interface:DataSet3DReturns number of X coordinates.- Specified by:
getXDataCountin interfaceDataSet3D- Returns:
- the number of y axis bins
-
getYDataCount
public int getYDataCount()
Description copied from interface:DataSet3DReturns number of Y coordinates.- Specified by:
getYDataCountin interfaceDataSet3D- Returns:
- the number of y axis bins
-
getX
public double getX(int i)
Description copied from interface:DataSetGets the x value of the data point with the index i
-
getY
public double getY(int i)
Description copied from interface:DataSetGets the y value of the data point with the index i
-
getYRange
public DataRange getYRange()
- Overrides:
getYRangein classAbstractDataSet<AbstractHistogram>- Returns:
- vertical range of data set
-
fill
public int fill(double x)
Description copied from interface:Histogram1DIncrement bin with abscissa X, Y, and Z by 1. 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 added- Returns:
- corresponding bin number which has its content incremented by 1
-
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
-
fill
public int fill(java.lang.String name)
Description copied from interface:Histogram1DIncrement bin with name with by 1. 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- Specified by:
fillin interfaceHistogram1D- Parameters:
name- name to be added- Returns:
- corresponding bin number which has its content incremented by w
-
fill
public int fill(java.lang.String name, double w)Description copied from interface:Histogram1DIncrement bin with name 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- Specified by:
fillin interfaceHistogram1D- Parameters:
name- name to be addedw- weight for given name- Returns:
- corresponding bin number which has its content incremented by w
-
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
-
getZ
public double getZ(int xIndex, int yIndex)Description copied from interface:DataSet3DReturns Z coordinate for the specified data point.
-
getInfoList
public java.util.List<java.lang.String> getInfoList()
- Specified by:
getInfoListin interfaceDataSetMetaData- Overrides:
getInfoListin classAbstractDataSet<AbstractHistogram>
-
computeLimits
protected Histogram computeLimits()
Description copied from class:AbstractDataSet3Drecompute data set limits- Overrides:
computeLimitsin classAbstractDataSet3D<AbstractHistogram>- Returns:
- itself (fluent design)
-
getWarningList
public java.util.List<java.lang.String> getWarningList()
- Specified by:
getWarningListin interfaceDataSetMetaData- Overrides:
getWarningListin classAbstractDataSet<AbstractHistogram>
-
getErrorList
public java.util.List<java.lang.String> getErrorList()
- Specified by:
getErrorListin interfaceDataSetMetaData- Overrides:
getErrorListin classAbstractDataSet<AbstractHistogram>
-
-