Class Histogram2

    • Field Detail

      • xProjection

        protected final Histogram xProjection
      • yProjection

        protected final Histogram yProjection
    • 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 sets
        nBinsX - number of horizontal bins
        minX - minimum of horizontal range
        maxX - maximum of horizontal range
        nBinsY - number of vertical bins
        minY - minimum of vertical range
        maxY - maximum of vertical range
        boundsType - How the min and max value should be interpreted
    • Method Detail

      • fill

        public int fill​(double x,
                        double y)
        Description copied from interface: Histogram2D
        Increment 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:
        fill in interface Histogram2D
        Parameters:
        x - new value to be added
        y - 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: Histogram2D
        Increment 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:
        fill in interface Histogram2D
        Parameters:
        x - new value to be added
        y - new value to be added
        w - weight
        Returns:
        corresponding bin number which has its content incremented by 1
      • findFirstBinAbove

        public int findFirstBinAbove​(double x,
                                     double y)
        Specified by:
        findFirstBinAbove in interface Histogram2D
        Parameters:
        x - spatial real-valued coordinate in X
        y - 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: DataSet
        Gets the x value of the data point with the index i
        Specified by:
        get in interface DataSet
        Parameters:
        dimIndex - the dimension index (ie. '0' equals 'X', '1' equals 'Y')
        binIndex - data point index
        Returns:
        the x value
      • getIndex

        public int getIndex​(int dimIndex,
                            double... value)
        Description copied from interface: DataSet
        Gets 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:
        getIndex in interface DataSet
        Overrides:
        getIndex in class AbstractDataSet<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
      • 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)
      • get

        public double get​(int dimIndex,
                          int... indices)
        Specified by:
        get in interface GridDataSet
        Parameters:
        dimIndex - dimension to retrieve
        indices - indices to retrieve, missing indices are treated as zero
        Returns:
        the value for the given indices
      • getShape

        public int[] getShape()
        Specified by:
        getShape in interface GridDataSet
        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: GridDataSet
        Returns the Grid Value along the specified Grid dimension
        Specified by:
        getGrid in interface GridDataSet
        Parameters:
        dimIndex - Dimension Index, smaller than getShape().size
        index - Index along the specified dimension, smaller than getShape(dimIndex)
        Returns:
        the value for the specified index on the grid along the specified dimension
      • set

        public DataSet set​(DataSet other,
                           boolean copy)
        Specified by:
        set in interface DataSet
        Parameters:
        other - Other DataSet to copy into this DataSet
        copy - true: perform a deep copy (default), false: reuse the other dataset's internal data structures (if applicable)
        Returns:
        itself (fluent design) -- N.B. existing update listener are preserved
      • getGridIndex

        public int getGridIndex​(int dimIndex,
                                double x)
        Specified by:
        getGridIndex in interface GridDataSet
        Parameters:
        dimIndex - Dimension index, smaller than getShape().size
        x - value along the specified axis to get the next index for
        Returns:
        index which corresponds to the given value