Class HistogramCalculator
java.lang.Object
com.illumon.iris.db.plot.datasets.histogram.HistogramCalculator
public class HistogramCalculator extends Object
Utility for calculating histogram plot information:
bin locations and data frequencies within these bins.
-
Constructor Summary
Constructors Constructor Description HistogramCalculator()
-
Method Summary
Modifier and Type Method Description static Table
calc(Table table, String histogramColumn, double rangeMin, double rangeMax, int nbins, PlotInfo plotInfo, String... byColumns)
Splits the specified range intonbins
equally sized bins.static Table
calc(Table table, String histogramColumn, double rangeMin, double rangeMax, int nbins, PlotInfo plotInfo, List<String> byColumns)
Splits the specified range intonbins
equally sized bins.static Table
calc(Table table, String column, int nbins, PlotInfo plotInfo, String... byColumns)
Finds the minimum and maximum of the data in thecolumn
of thetable
and splits this range intonbins
equally sized bins.static Table
calc(Table table, String column, int nbins, PlotInfo plotInfo, List<String> byColumns)
Finds the minimum and maximum of the data in thecolumn
of thetable
and splits this range intonbins
equally sized bins.static Table
collapse(Table table, Collection<String> byCols)
Collapses results of #calc(...) down to a single series.
-
Constructor Details
-
HistogramCalculator
public HistogramCalculator()
-
-
Method Details
-
calc
public static Table calc(Table table, String column, int nbins, PlotInfo plotInfo, String... byColumns)Finds the minimum and maximum of the data in thecolumn
of thetable
and splits this range intonbins
equally sized bins. Calculates the number of data values in each bin.Data which is not normal as defined in
DoubleFpPrimitives.isNormal(double)
is filtered out of the data set.- Parameters:
table
- tablecolumn
- column intable
nbins
- number of binsplotInfo
- plot informationbyColumns
- other columns needed to calculate histogram, these columns will be included while grouping- Returns:
- table holding the calculated bins and their counts
- Throws:
com.fishlib.base.verify.RequirementFailure
-table
andcolumn
must not be nullRuntimeException
-column
must be numericcom.fishlib.base.verify.RequirementFailure
-table
andcolumn
must not be nullRuntimeException
-column
must be numeric
-
calc
public static Table calc(Table table, String column, int nbins, PlotInfo plotInfo, List<String> byColumns)Finds the minimum and maximum of the data in thecolumn
of thetable
and splits this range intonbins
equally sized bins. Calculates the number of data values in each bin.Data which is not normal as defined in
DoubleFpPrimitives.isNormal(double)
is filtered out of the data set.- Parameters:
table
- tablecolumn
- column intable
nbins
- number of binsplotInfo
- plot informationbyColumns
- other columns needed to calculate histogram, these columns will be included while grouping- Returns:
- table holding the calculated bins and their counts
- Throws:
com.fishlib.base.verify.RequirementFailure
-table
andcolumn
must not be nullRuntimeException
-column
must be numeric
-
calc
public static Table calc(Table table, String histogramColumn, double rangeMin, double rangeMax, int nbins, PlotInfo plotInfo, String... byColumns)Splits the specified range intonbins
equally sized bins. Calculates the number of data values in each bin.Data which is not normal as defined in
DoubleFpPrimitives.isNormal(double)
is filtered out of the data set.- Parameters:
table
- tablehistogramColumn
- histogramColumn intable
rangeMin
- range minimumrangeMax
- range maximumnbins
- number of binsplotInfo
- plot informationbyColumns
- other columns needed to calculate histogram, these columns will be included while grouping- Returns:
- table holding the calculated bins and their counts
- Throws:
com.fishlib.base.verify.RequirementFailure
-table
andhistogramColumn
must not be nullRuntimeException
-histogramColumn
must be numeric
-
calc
public static Table calc(Table table, String histogramColumn, double rangeMin, double rangeMax, int nbins, PlotInfo plotInfo, List<String> byColumns)Splits the specified range intonbins
equally sized bins. Calculates the number of data values in each bin.Data which is not normal as defined in
DoubleFpPrimitives.isNormal(double)
is filtered out of the data set.- Parameters:
table
- tablehistogramColumn
- histogramColumn intable
rangeMin
- range minimumrangeMax
- range maximumnbins
- number of binsplotInfo
- plot informationbyColumns
- other columns needed to calculate histogram, these columns will be included while grouping- Returns:
- table holding the calculated bins and their counts
- Throws:
com.fishlib.base.verify.RequirementFailure
-table
andhistogramColumn
must not be nullRuntimeException
-histogramColumn
must be numeric
-
collapse
Collapses results of #calc(...) down to a single series. In the case that we're not pre-filtered by our byCols, then we will potentially end up having duplicated series for a given Range. We should, instead, collapse that down to a single row-per-Range- Parameters:
table
- the result of a previous call to #calc(...)byCols
- the columns which will become array-values because we're no longer grouped by them- Returns:
- the collapsed results where there is a single row per Range/bin
-