Package com.compomics.util.math
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 Summary
Constructors Constructor Description HistogramUtils()
Empty default constructor -
Method Summary
Modifier and Type Method Description static double
getMedianValue(HashMap<Double,Integer> histogram)
Returns the median of a histogram.static double
getMedianValue(HashMap<Double,Integer> histogram, int nValues)
Returns the median of a histogram.static HashMap<Double,Integer>
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
-