NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
Go to the source code of this file.
Classes | |
struct | Ranges |
This structure defines the available ranges for the histograms. More... | |
struct | HistogramParameters |
This structure gathers all necessary parameters for the histograms. More... | |
Enumerations | |
enum | HistBinMethod { STURGES , SCOTT , FREEDMAN_DIACONIS } |
This enumeration defines the available bin determination methods for 1D and 2D histograms. More... | |
Functions | |
static std::string | getParameterValue (const std::string &sCmd, const std::string &sVersion1, const std::string &sVersion2, const std::string &sDefaultVal) |
This static function returns the value of the selected command line option (passable in two representations) as a std::string. More... | |
static void | getIntervalDef (const std::string &sCmd, const std::string &sIdentifier, double &dMin, double &dMax) |
This static function decodes a selected range definition (e.g. x=0:1) into doubles. More... | |
static void | prepareIntervalsForHist (const std::string &sCmd, double &dMin, double &dMax, double dDataMin, double dDataMax) |
This static function replaces invalid ranges boundaries with the passed minimal and maximal data values. More... | |
static std::vector< std::vector< double > > | calculateHist1dData (MemoryManager &_data, const Indices &_idx, const HistogramParameters &_histParams, mglData &_histData, mglData &_mAxisVals, int &nMax, std::vector< std::string > &vLegends, bool bGrid, bool isXLog) |
This static function calculates the data for a 1D histogram. The data is returned as a vector<vector<double>> instance. The data for the plotting is filled in this function as well. More... | |
static std::string | prepareTicksForHist1d (const HistogramParameters &_histParams, const mglData &_mAxisVals, std::string &sCommonExponent, bool bGrid) |
This static function calculates the custom ticks (one for every bin) and formats them accordingly. More... | |
static void | createOutputForHist1D (MemoryManager &_data, const Indices &_idx, const std::vector< std::vector< double > > &vHistMatrix, const HistogramParameters &_histParams, const mglData &_mAxisVals, bool bGrid, bool bFormat, bool bSilent) |
This static function creates the terminal and file output for a 1D histogram. More... | |
static mglGraph * | prepareGraphForHist (double dAspect, PlotData &_pData, bool bSilent) |
This static function prepares a mglGraph instance for histogram plotting. It's usable in 1D and 2D case. More... | |
static void | createPlotForHist1D (HistogramParameters &_histParams, mglData &_mAxisVals, mglData &_histData, const std::vector< std::string > &vLegends, int nMax, bool bSilent, bool bGrid) |
This static function creates the plot for a 1D histogram. More... | |
static void | createHist1D (const std::string &sCmd, const std::string &sTargettable, Indices &_idx, Indices &_tIdx, HistogramParameters &_histParams, bool bWriteToCache, bool bSilent, bool bGrid) |
This static function is the driver code for creating a 1D histogram. More... | |
static void | calculateDataForCenterPlot (MemoryManager &_data, const Indices &_idx, const HistogramParameters &_histParams, mglData _hist2DData[3]) |
This static function calculates the data for the center plot part of the 2D histogram. More... | |
static mglData | calculateXYHist (MemoryManager &_data, const Indices &_idx, const HistogramParameters &_histParams, mglData *_mAxisVals, double dBinMin, double dMin, double dMax, double dIntLength, int nMax, bool isLogScale, bool isHbar, bool bSum) |
This static function calculates the data for the both bar plot on top and at right of the center plot. Has to be called for each plot indepently. More... | |
static void | createOutputForHist2D (MemoryManager &_data, const Indices &_idx, const std::string &sTargettable, const Indices &_tIdx, const HistogramParameters &_histParams, mglData _mAxisVals[2], mglData &_barHistData, mglData &_hBarHistData, bool bSum, bool bWriteToCache, bool shallFormat, bool isSilent) |
This static function creates the textual output for terminal or file and writes the data also to a table, if desired. More... | |
static void | createPlotsForHist2D (const std::string &sCmd, HistogramParameters &_histParams, mglData _mAxisVals[2], mglData &_barHistData, mglData &_hBarHistData, mglData _hist2DData[3], bool isScatterPlot, bool bSum, bool bSilent) |
This static function creates the three plots for the 2D histogram. More... | |
static void | createHist2D (const std::string &sCmd, const std::string &sTargettable, Indices &_idx, Indices &_tIdx, HistogramParameters &_histParams, bool bSum, bool bWriteToCache, bool bSilent) |
This static function is the driver function for creating a 2D histogram. More... | |
void | plugin_histogram (std::string &sCmd) |
This function is the interface to both the 1D and the 2D histogram generation. More... | |
Variables | |
const std::string | PI_HIST = "1.1.2" |
mglGraph | _fontData |
enum HistBinMethod |
This enumeration defines the available bin determination methods for 1D and 2D histograms.
Enumerator | |
---|---|
STURGES | |
SCOTT | |
FREEDMAN_DIACONIS |
Definition at line 35 of file plugin_histogram.cpp.
|
static |
This static function calculates the data for the center plot part of the 2D histogram.
_data | MemoryManager& |
_idx | const Indices& |
_histParams | const HistogramParameters& |
_hist2DData[3] | mglData |
Definition at line 1010 of file plugin_histogram.cpp.
References Indices::col, MemoryManager::getElement(), MemoryManager::isValidElement(), HistogramParameters::ranges, Indices::row, VectorIndex::size(), HistogramParameters::sTable, Ranges::x, and Ranges::y.
Referenced by createHist2D().
|
static |
This static function calculates the data for a 1D histogram. The data is returned as a vector<vector<double>> instance. The data for the plotting is filled in this function as well.
_data | MemoryManager& |
_idx | const Indices& |
_histParams | const HistogramParameters& |
_histData | mglData& |
_mAxisVals | mglData& |
nMax | int& |
vLegends | std::vector<std::string>& |
bGrid | bool |
isXLog | bool |
Definition at line 212 of file plugin_histogram.cpp.
References HistogramParameters::binWidth, Indices::col, date::floor(), MemoryManager::getElement(), MemoryManager::getTopHeadLineElement(), if(), HistogramParameters::nBin, HistogramParameters::ranges, replaceToTeX(), Indices::row, VectorIndex::size(), HistogramParameters::sTable, Ranges::x, Ranges::y, and Ranges::z.
Referenced by createHist1D().
|
static |
This static function calculates the data for the both bar plot on top and at right of the center plot. Has to be called for each plot indepently.
_data | MemoryManager& |
_idx | const Indices& |
_histParams | const HistogramParameters& |
_mAxisVals | mglData* |
dBinMin | double |
dMin | double |
dMax | double |
dIntLength | double |
nMax | int |
isLogScale | bool |
isHbar | bool |
bSum | bool |
Definition at line 1089 of file plugin_histogram.cpp.
References Indices::col, MemoryManager::getElement(), MemoryManager::isValidElement(), HistogramParameters::nBin, HistogramParameters::ranges, Indices::row, VectorIndex::size(), HistogramParameters::sTable, and Ranges::z.
Referenced by createHist2D().
|
static |
This static function is the driver code for creating a 1D histogram.
sCmd | const std::string& |
sTargettable | const std::string& |
_idx | Indices& |
_tIdx | Indices& |
_histParams | HistogramParameters& |
bWriteToCache | bool |
bSilent | bool |
bGrid | bool |
Definition at line 839 of file plugin_histogram.cpp.
References date::abs(), HistogramParameters::binWidth, calculateHist1dData(), Indices::col, createOutputForHist1D(), createPlotForHist1D(), findParameter(), FREEDMAN_DIACONIS, VectorIndex::front(), MemoryManager::getElement(), MemoryManager::getHeadLineElement(), NumeReKernel::getInstance(), PlotData::getLogscale(), NumeReKernel::getMemoryManager(), NumeReKernel::getPlottingData(), SyntaxError::invalid_position, MemoryManager::isValidElement(), MemoryManager::max(), MemoryManager::min(), HistogramParameters::nBin, HistogramParameters::nMethod, MemoryManager::pct(), prepareIntervalsForHist(), HistogramParameters::ranges, mu::real(), mu::rint(), Indices::row, SCOTT, MemoryManager::setHeadLineElement(), VectorIndex::size(), HistogramParameters::sTable, MemoryManager::std(), STURGES, VectorIndex::subidx(), SyntaxError::TOO_LARGE_BINWIDTH, MemoryManager::writeToTable(), Ranges::x, XRANGE, Ranges::y, and Ranges::z.
Referenced by plugin_histogram().
|
static |
This static function is the driver function for creating a 2D histogram.
sCmd | const std::string& |
sTargettable | const std::string& |
_idx | Indices& |
_tIdx | Indices& |
_histParams | HistogramParameters& |
bSum | bool |
bWriteToCache | bool |
bSilent | bool |
Definition at line 1503 of file plugin_histogram.cpp.
References date::abs(), HistogramParameters::binWidth, calculateDataForCenterPlot(), calculateXYHist(), Indices::col, createOutputForHist2D(), createPlotsForHist2D(), findParameter(), FREEDMAN_DIACONIS, MemoryManager::getElement(), NumeReKernel::getInstance(), PlotData::getLogscale(), NumeReKernel::getMemoryManager(), NumeReKernel::getOutput(), NumeReKernel::getPlottingData(), NumeReKernel::getSettings(), SyntaxError::invalid_position, MemoryManager::isValidElement(), MemoryManager::max(), MemoryManager::min(), HistogramParameters::nBin, HistogramParameters::nMethod, MemoryManager::pct(), prepareIntervalsForHist(), HistogramParameters::ranges, mu::real(), Output::reset(), mu::rint(), Indices::row, SCOTT, VectorIndex::size(), HistogramParameters::sTable, MemoryManager::std(), STURGES, VectorIndex::subidx(), Settings::systemPrints(), SyntaxError::TOO_FEW_COLS, SyntaxError::TOO_LARGE_BINWIDTH, SyntaxError::WRONG_PLOT_INTERVAL_FOR_LOGSCALE, Ranges::x, XRANGE, Ranges::y, YRANGE, and Ranges::z.
Referenced by plugin_histogram().
|
static |
This static function creates the terminal and file output for a 1D histogram.
_data | MemoryManager& |
_idx | const Indices& |
vHistMatrix | const std::vector<std::vector<double>>& |
_histParams | const HistogramParameters& |
_mAxisVals | const mglData& |
bGrid | bool |
bFormat | bool |
bSilent | bool |
Definition at line 462 of file plugin_histogram.cpp.
References _lang, HistogramParameters::binWidth, Indices::col, condenseText(), Settings::createCompactTables(), Output::format(), VectorIndex::front(), Output::generateFileName(), Language::get(), NumeRe::FileAdapter::getDataFileName(), NumeReKernel::getInstance(), NumeReKernel::getOutput(), NumeReKernel::getSettings(), MemoryManager::getTopHeadLineElement(), Output::isFile(), VectorIndex::last(), make_hline(), PI_HIST, NumeReKernel::print(), HistogramParameters::ranges, HistogramParameters::sBinLabel, HistogramParameters::sCountLabel, Output::setCommentLine(), Output::setCompact(), Output::setFileName(), Output::setPluginName(), Output::setPrefix(), Output::setStatus(), HistogramParameters::sSavePath, HistogramParameters::sTable, Settings::systemPrints(), NumeReKernel::toggleTableStatus(), toString(), toSystemCodePage(), toUpperCase(), Ranges::x, and Ranges::z.
Referenced by createHist1D().
|
static |
This static function creates the textual output for terminal or file and writes the data also to a table, if desired.
_data | MemoryManager& |
_idx | const Indices& |
sTargettable | const std::string& |
_tIdx | const Indices& |
_histParams | const HistogramParameters& |
_mAxisVals[2] | mglData |
_barHistData | mglData& |
_hBarHistData | mglData& |
bSum | bool |
bWriteToCache | bool |
shallFormat | bool |
isSilent | bool |
Definition at line 1172 of file plugin_histogram.cpp.
References _lang, HistogramParameters::binWidth, Indices::col, Settings::createCompactTables(), Output::format(), VectorIndex::front(), Output::generateFileName(), Language::get(), NumeRe::FileAdapter::getDataFileName(), NumeReKernel::getInstance(), NumeReKernel::getOutput(), NumeReKernel::getSettings(), Output::isFile(), VectorIndex::last(), make_hline(), HistogramParameters::nBin, PI_HIST, NumeReKernel::print(), HistogramParameters::ranges, Indices::row, Output::setCommentLine(), Output::setCompact(), Output::setFileName(), MemoryManager::setHeadLineElement(), Output::setPluginName(), Output::setPrefix(), Output::setStatus(), VectorIndex::size(), HistogramParameters::sSavePath, HistogramParameters::sTable, NumeReKernel::toggleTableStatus(), toString(), toSystemCodePage(), toUpperCase(), MemoryManager::writeToTable(), Ranges::x, and Ranges::y.
Referenced by createHist2D().
|
static |
This static function creates the plot for a 1D histogram.
_histParams | HistogramParameters& |
_mAxisVals | mglData& |
_histData | mglData& |
vLegends | const std::vector<std::string>& |
nMax | int |
bSilent | bool |
bGrid | bool |
Definition at line 633 of file plugin_histogram.cpp.
References _lang, AXIS_NONE, NumeRe::WindowManager::createWindow(), Language::get(), PlotData::getColors(), Output::getFileName(), PlotData::getFineGridStyle(), PlotData::getGridStyle(), NumeReKernel::getInstance(), PlotData::getLogscale(), NumeReKernel::getOutput(), NumeReKernel::getPlottingData(), NumeReKernel::getSettings(), PlotData::getSettings(), PlotData::getTimeAxis(), NumeReKernel::getWindowManager(), PlotData::INT_AXIS, PlotData::INT_GRID, PlotData::INT_LEGENDPOSITION, Output::isFile(), LineBreak(), PlotData::LOG_BOX, PlotData::LOG_OPENIMAGE, PlotData::LOG_SILENTMODE, HistogramParameters::nBin, prepareGraphForHist(), prepareTicksForHist1d(), NumeReKernel::printPreFmt(), HistogramParameters::ranges, Output::reset(), HistogramParameters::sBinLabel, HistogramParameters::sCountLabel, GraphHelper::setAspect(), TimeAxis::sTimeFormat, Settings::systemPrints(), toSystemCodePage(), TimeAxis::use, FileSystem::ValidFileName(), Ranges::x, XRANGE, YRANGE, and Ranges::z.
Referenced by createHist1D().
|
static |
This static function creates the three plots for the 2D histogram.
sCmd | const std::string& |
_histParams | HistogramParameters& |
_mAxisVals[2] | mglData |
_barHistData | mglData& |
_hBarHistData | mglData& |
_hist2DData[3] | mglData |
isScatterPlot | bool |
bSum | bool |
bSilent | bool |
Definition at line 1284 of file plugin_histogram.cpp.
References _lang, HistogramParameters::binWidth, NumeRe::WindowManager::createWindow(), Language::get(), PlotData::getColors(), PlotData::getColorScheme(), Output::getFileName(), PlotData::getFineGridStyle(), PlotData::getGridStyle(), NumeReKernel::getInstance(), PlotData::getLogscale(), NumeReKernel::getOutput(), NumeReKernel::getPlottingData(), NumeReKernel::getSettings(), PlotData::getSettings(), PlotData::getTimeAxis(), NumeReKernel::getWindowManager(), PlotData::INT_GRID, SyntaxError::invalid_position, Output::isFile(), LineBreak(), PlotData::LOG_OPENIMAGE, PlotData::LOG_SILENTMODE, prepareGraphForHist(), NumeReKernel::printPreFmt(), HistogramParameters::ranges, HistogramParameters::sAxisLabels, HistogramParameters::sCountLabel, GraphHelper::setAspect(), TimeAxis::sTimeFormat, Settings::systemPrints(), toSystemCodePage(), TimeAxis::use, FileSystem::ValidFileName(), SyntaxError::WRONG_PLOT_INTERVAL_FOR_LOGSCALE, Ranges::x, XRANGE, Ranges::y, YRANGE, and ZRANGE.
Referenced by createHist2D().
|
static |
This static function decodes a selected range definition (e.g. x=0:1) into doubles.
sCmd | const std::string& |
sIdentifier | const std::string& |
dMin | double& |
dMax | double& |
Definition at line 123 of file plugin_histogram.cpp.
References findParameter(), getArgAtPos(), and StrToDb().
Referenced by plugin_histogram().
|
static |
This static function returns the value of the selected command line option (passable in two representations) as a std::string.
sCmd | const std::string& |
sVersion1 | const std::string& |
sVersion2 | const std::string& |
sDefaultVal | const std::string& |
Definition at line 86 of file plugin_histogram.cpp.
References findParameter(), getArgAtPos(), and StripSpaces().
Referenced by plugin_histogram().
void plugin_histogram | ( | std::string & | sCmd | ) |
This function is the interface to both the 1D and the 2D histogram generation.
sCmd | std::string& |
Definition at line 1653 of file plugin_histogram.cpp.
References MemoryManager::addTable(), HistogramParameters::binWidth, Indices::col, createHist1D(), createHist2D(), DataAccessParser::evalIndices(), evaluateTargetOptionInCommand(), findCommand(), findParameter(), FREEDMAN_DIACONIS, getArgAtPos(), MemoryManager::getCols(), DataAccessParser::getDataObject(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), getIntervalDef(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), NumeReKernel::getOutput(), getParameterValue(), intCast(), VectorIndex::INVALID, SyntaxError::invalid_position, MemoryManager::isEmpty(), MemoryManager::isTable(), MemoryManager::isValid(), isValidIndexSet(), MemoryManager::matchTableAsParameter(), HistogramParameters::nBin, HistogramParameters::nMethod, SyntaxError::NO_CACHED_DATA, SyntaxError::NO_DATA_AVAILABLE, VectorIndex::OPEN_END, HistogramParameters::ranges, Indices::row, HistogramParameters::sAxisLabels, HistogramParameters::sBinLabel, SCOTT, HistogramParameters::sCountLabel, Output::setStatus(), VectorIndex::size(), HistogramParameters::sSavePath, HistogramParameters::sTable, StripSpaces(), StrToDb(), STURGES, SyntaxError::TABLE_DOESNT_EXIST, Ranges::x, Ranges::y, and Ranges::z.
Referenced by cmd_hist().
|
static |
This static function prepares a mglGraph instance for histogram plotting. It's usable in 1D and 2D case.
dAspect | double |
_pData | PlotData& |
bSilent | bool |
Definition at line 578 of file plugin_histogram.cpp.
References _fontData, PlotData::FLOAT_BARS, PlotData::FLOAT_TEXTSIZE, PlotData::getLogscale(), PlotData::getSettings(), PlotData::INT_HIGHRESLEVEL, PlotData::LOG_SILENTMODE, XRANGE, YRANGE, and ZRANGE.
Referenced by createPlotForHist1D(), and createPlotsForHist2D().
|
static |
This static function replaces invalid ranges boundaries with the passed minimal and maximal data values.
sCmd | const std::string& |
dMin | double& |
dMax | double& |
dDataMin | double |
dDataMax | double |
Definition at line 158 of file plugin_histogram.cpp.
References SyntaxError::INVALID_INTERVAL, SyntaxError::invalid_position, and mu::isnan().
Referenced by createHist1D(), and createHist2D().
|
static |
This static function calculates the custom ticks (one for every bin) and formats them accordingly.
_histParams | const HistogramParameters& |
_mAxisVals | const mglData& |
sCommonExponent | std::string& |
bGrid | bool |
Definition at line 338 of file plugin_histogram.cpp.
References HistogramParameters::binWidth, HistogramParameters::nBin, HistogramParameters::ranges, StrToDb(), toString(), Ranges::x, and Ranges::z.
Referenced by createPlotForHist1D().
|
extern |
Definition at line 40 of file kernel.cpp.
Referenced by prepareGraphForHist(), and NumeReKernel::StartUp().
const std::string PI_HIST = "1.1.2" |
Definition at line 27 of file plugin_histogram.cpp.
Referenced by createOutputForHist1D(), and createOutputForHist2D().