Package com.compomics.util.math
Class HistogramUtils
java.lang.Object
com.compomics.util.math.HistogramUtils
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublegetMedianValue(HashMap<Double, Integer> histogram) Returns the median of a histogram.static doublegetMedianValue(HashMap<Double, Integer> histogram, int nValues) Returns the median of a histogram.mergeHistograms(Collection<HashMap<Double, Integer>> histograms) Merges histograms in a single histogram by adding the values in each bin.
-
Constructor Details
-
HistogramUtils
public HistogramUtils()Empty default constructor
-
-
Method Details
-
getMedianValue
Returns the median of a histogram.- Parameters:
histogram- the histogram- Returns:
- the median
-
getMedianValue
Returns the median of a histogram.- Parameters:
histogram- the histogramnValues- 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
-