Class HistogramUtils

java.lang.Object
com.compomics.util.math.HistogramUtils

public class HistogramUtils
extends Object
Simple functions to manipulate histograms. A histogram is here represented as a HashMap where the keys are the bin values and the values the occurrence of the bin values
Author:
Marc Vaudel
  • Constructor Details

  • Method Details

    • getMedianValue

      public static double getMedianValue​(HashMap<Double,​Integer> histogram)
      Returns the median of a histogram.
      Parameters:
      histogram - the histogram
      Returns:
      the median
    • getMedianValue

      public static double getMedianValue​(HashMap<Double,​Integer> histogram, int nValues)
      Returns the median of a histogram.
      Parameters:
      histogram - the histogram
      nValues - the number of values in the histogram
      Returns:
      the median
    • mergeHistograms

      public static HashMap<Double,​Integer> mergeHistograms​(Collection<HashMap<Double,​Integer>> histograms)
      Merges histograms in a single histogram by adding the values in each bin.
      Parameters:
      histograms - the histograms to merge
      Returns:
      the merged histogram