Package de.gsi.dataset.spi
Class Histogram2
- java.lang.Object
-
- de.gsi.dataset.spi.AbstractStylable<D>
-
- de.gsi.dataset.spi.AbstractDataSet<AbstractHistogram>
-
- de.gsi.dataset.spi.AbstractHistogram
-
- de.gsi.dataset.spi.Histogram2
-
- All Implemented Interfaces:
DataSet,DataSetMetaData,EventSource,GridDataSet,Histogram,Histogram2D,java.io.Serializable
public class Histogram2 extends AbstractHistogram implements Histogram2D
- Author:
- rstein
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.gsi.dataset.spi.AbstractHistogram
AbstractHistogram.HistogramOuterBounds
-
Nested classes/interfaces inherited from interface de.gsi.dataset.Histogram
Histogram.Boundary
-
-
Field Summary
Fields Modifier and Type Field Description protected HistogramxProjectionprotected HistogramyProjection-
Fields inherited from class de.gsi.dataset.spi.AbstractHistogram
axisBins, data
-
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 Histogram2(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]
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intfill(double x, double y)Increment bin with abscissa X, Y, and Z by 1.intfill(double x, double y, double w)Increment bin with abscissa X by with a weight w.intfindFirstBinAbove(double x, double y)doubleget(int dimIndex, int binIndex)Gets the x value of the data point with the index idoubleget(int dimIndex, int... indices)java.util.List<java.lang.String>getErrorList()doublegetGrid(int dimIndex, int index)Returns the Grid Value along the specified Grid dimensionintgetGridIndex(int dimIndex, double x)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()Histogram1DgetProjectionX()Histogram1DgetProjectionY()int[]getShape()protected doublegetSum(int dimIndex, int bin)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, addBinContent, fillEquidistantAxisBinning, findBin, findBin, findBin, findNextLargerIndex, getBinCenter, getBinContent, getBinCount, getBinLimits, getBoundsType, getDataCount, getValue, isEquiDistant, recomputeLimits, swap
-
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, getValues, hashCode, lock, 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, getDimension, getName, getStyle, getStyle, getValue, getValues, lock, recomputeLimits, set, setStyle
-
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.GridDataSet
getGridValues, getNGrid, getShape
-
Methods inherited from interface de.gsi.dataset.Histogram2D
findBin, getZ
-
-
-
-
Constructor Detail
-
Histogram2
public Histogram2(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
-
fill
public int fill(double x, double y)Description copied from interface:Histogram2DIncrement 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- Specified by:
fillin interfaceHistogram2D- Parameters:
x- new value to be addedy- new value to be added- Returns:
- corresponding bin number which has its content incremented by 1
-
fill
public int fill(double x, double y, double w)Description copied from interface:Histogram2DIncrement 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- Specified by:
fillin interfaceHistogram2D- Parameters:
x- new value to be addedy- new value to be addedw- weight- Returns:
- corresponding bin number which has its content incremented by 1
-
findFirstBinAbove
public int findFirstBinAbove(double x, double y)- Specified by:
findFirstBinAbovein interfaceHistogram2D- Parameters:
x- spatial real-valued coordinate in Xy- spatial real-valued coordinate in Y- Returns:
- bin index that is above the spatial x and y coordinates
-
get
public double get(int dimIndex, int binIndex)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>
-
getProjectionX
public Histogram1D getProjectionX()
- Returns:
- 1D histogram with projection in X
-
getProjectionY
public Histogram1D getProjectionY()
- Returns:
- 1D histogram with projection in Y
-
getSum
protected double getSum(int dimIndex, int bin)
-
getWarningList
public java.util.List<java.lang.String> getWarningList()
- Specified by:
getWarningListin interfaceDataSetMetaData- Overrides:
getWarningListin classAbstractDataSet<AbstractHistogram>
-
get
public double get(int dimIndex, int... indices)- Specified by:
getin interfaceGridDataSet- Parameters:
dimIndex- dimension to retrieveindices- indices to retrieve, missing indices are treated as zero- Returns:
- the value for the given indices
-
reset
public void reset()
Description copied from interface:Histogramreset histogram content- Specified by:
resetin interfaceHistogram- Overrides:
resetin classAbstractHistogram
-
getShape
public int[] getShape()
- Specified by:
getShapein interfaceGridDataSet- Returns:
- the shape of the grid of the data, e.g { 3, 4 } for a 3 x 4 matrix.
-
getGrid
public double getGrid(int dimIndex, int index)Description copied from interface:GridDataSetReturns the Grid Value along the specified Grid dimension- Specified by:
getGridin interfaceGridDataSet- Parameters:
dimIndex- Dimension Index, smaller than getShape().sizeindex- Index along the specified dimension, smaller than getShape(dimIndex)- Returns:
- the value for the specified index on the grid along the specified dimension
-
getGridIndex
public int getGridIndex(int dimIndex, double x)- Specified by:
getGridIndexin interfaceGridDataSet- Parameters:
dimIndex- Dimension index, smaller than getShape().sizex- value along the specified axis to get the next index for- Returns:
- index which corresponds to the given value
-
-