use of org.knime.core.node.config.ConfigRO in project knime-core by knime.
the class HistogramColumn method loadHistogramsPrivate.
private static Map<Integer, HistogramNumericModel> loadHistogramsPrivate(final File histogramsGz, final Map<Integer, Map<Integer, Set<RowKey>>> numericKeys, final BinNumberSelectionStrategy strategy, final double[] means) throws IOException, InvalidSettingsException {
final FileInputStream is = new FileInputStream(histogramsGz);
final GZIPInputStream inData = new GZIPInputStream(is);
final ConfigRO config = NodeSettings.loadFromXML(inData);
Map<Integer, HistogramNumericModel> histograms = new HashMap<Integer, HistogramNumericModel>();
// .getConfig(HISTOGRAMS);
ConfigRO hs = config;
int[] numColumnIndices = config.getIntArray(NUMERIC_COLUMNS);
for (int colIdx : numColumnIndices) {
Config h = hs.getConfig(HISTOGRAM + colIdx);
double min = h.getDouble(MIN), max = h.getDouble(MAX), width = h.getDouble(WIDTH);
int maxCount = h.getInt(MAX_COUNT);
int rowCount = h.getInt(ROW_COUNT);
String colName = h.getString(COL_NAME);
double[] binMins = h.getDoubleArray(BIN_MINS), binMaxes = h.getDoubleArray(BIN_MAXES);
int[] binCounts = h.getIntArray(BIN_COUNTS);
double mean = means[colIdx];
HistogramNumericModel histogramData = new HistogramNumericModel(min, max, binMins.length, colIdx, colName, min, max, mean);
for (int i = binMins.length; i-- > 0; ) {
histogramData.getBins().set(i, histogramData.new NumericBin(binMins[i], binMaxes[i]));
histogramData.getBins().get(i).setCount(binCounts[i]);
}
histogramData.setMaxCount(maxCount);
histogramData.setRowCount(rowCount);
assert Math.abs(histogramData.m_width - width) < 1e-9 : "histogram data width: " + histogramData.m_width + " width: " + width;
histograms.put(colIdx, histogramData);
numericKeys.put(colIdx, new HashMap<Integer, Set<RowKey>>());
}
return histograms;
}
Aggregations