Class Histogram

    • Field Detail

      • isHorizontal

        protected final boolean isHorizontal
    • Constructor Detail

      • Histogram

        public Histogram​(java.lang.String name,
                         double[] xBins)
        Creates histogram with name and range [minX, maxX]
        Parameters:
        name - of the data sets
        xBins - 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 sets
        xBins - 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 sets
        nBins - number of bins
        minX - minimum of range
        maxX - maximum of range
        boundsType - 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 sets
        nBins - number of bins
        minX - minimum of range
        maxX - maximum of range
        horizontal - whether binning is performed in X
        boundsType - How the min and max value should be interpreted
    • Method Detail

      • addBinContent

        public void addBinContent​(int bin,
                                  double w)
        Description copied from interface: Histogram
        Increment bin content by a weight w. More...
        Specified by:
        addBinContent in interface Histogram
        Overrides:
        addBinContent in class AbstractHistogram
        Parameters:
        bin - global bin ID
        w - weight
      • fill

        public int fill​(double x,
                        double w)
        Description copied from interface: Histogram1D
        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 The function returns the corresponding bin number which has its content incremented by 1
        Specified by:
        fill in interface Histogram1D
        Parameters:
        x - new value to be added
        w - 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: Histogram1D
        Fill this histogram with an array x and weights w.
        Specified by:
        fillN in interface Histogram1D
        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:
        findBin in interface Histogram
        Overrides:
        findBin in class AbstractHistogram
        Parameters:
        dimIndex - the dimension index
        x - 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: 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')
        index - 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
      • getValue

        public double getValue​(int dimIndex,
                               double x)
      • 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