NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
command_implementations.hpp File Reference
#include "../datamanagement/memorymanager.hpp"
#include "../ParserLib/muParser.h"
#include "../settings.hpp"
#include "../commandlineparser.hpp"
#include "define.hpp"
#include <string>
#include <vector>
Include dependency graph for command_implementations.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool integrate (CommandLineParser &cmdParser)
 Calculate the integral of a function or a data set in a single dimension. More...
 
bool integrate2d (CommandLineParser &cmdParser)
 Calculate the integral of a function in two dimensions. More...
 
bool differentiate (CommandLineParser &cmdParser)
 Calculate the numerical differential of the passed expression or data set. More...
 
bool findExtrema (CommandLineParser &cmdParser)
 This function is a wrapper to the actual extrema localisation function localizeExtremum() further below. More...
 
bool findZeroes (CommandLineParser &cmdParser)
 This function is a wrapper to the actual zeros localisation function localizeZero() further below. More...
 
void taylor (CommandLineParser &cmdParser)
 This function approximates the passed expression using Taylor's method. More...
 
bool fitDataSet (std::string &sCmd, mu::Parser &_parser, MemoryManager &_data, FunctionDefinitionManager &_functions, const Settings &_option)
 
bool fastFourierTransform (CommandLineParser &cmdParser)
 This function calculates the fast fourier transform of the passed data set. More...
 
bool fastWaveletTransform (CommandLineParser &cmdParser)
 This function calculates the fast wavelet transform of the passed data set. More...
 
bool evalPoints (CommandLineParser &cmdParser)
 This function samples a defined expression in an array of discrete values. More...
 
bool createDatagrid (CommandLineParser &cmdParser)
 This function calculates a datagrid from passed functions or (x-y-z) data values. More...
 
bool writeAudioFile (CommandLineParser &cmdParser)
 This function creates a WAVE file from the selected data set. More...
 
bool readAudioFile (CommandLineParser &cmdParser)
 Reads either the audio file meta information or the whole audio file to memory. More...
 
bool seekInAudioFile (CommandLineParser &cmdParser)
 Seek a position in an audiofile and extract a length of samples from it. More...
 
bool regularizeDataSet (CommandLineParser &cmdParser)
 This function regularizes the samples of a defined x-y-data array such that DeltaX is equal for every x. More...
 
bool analyzePulse (CommandLineParser &cmdParser)
 This function performs a pulse analysis on the selected data set. More...
 
bool shortTimeFourierAnalysis (CommandLineParser &cmdParser)
 This function performs the short-time fourier analysis on the passed data set. More...
 
void boneDetection (CommandLineParser &cmdParser)
 This function is the implementation of the detect command. More...
 
bool calculateSplines (CommandLineParser &cmdParser)
 This function approximates the passed data set using cubic splines. More...
 
void rotateTable (CommandLineParser &cmdParser)
 This function rotates a table, an image or a datagrid around a specified angle. More...
 
void particleSwarmOptimizer (CommandLineParser &cmdParser)
 This function implements a particle swarm optimizer in up to four dimensions (depending on the number of intervals defined). The optimizer has an adaptive velocity part, reducing the overall position variation of the particles over time. More...
 
void urlExecute (CommandLineParser &cmdParser)
 This function implements the url command providing an interface to http(s) and (s)ftp URLs. More...
 

Function Documentation

◆ analyzePulse()

bool analyzePulse ( CommandLineParser cmdParser)

This function performs a pulse analysis on the selected data set.

Parameters
cmdParserCommandLineParser&
Returns
bool

The function calculates the maximal amplitude, its position, the FWHM, the width near the maximal amplitude (which is different from the FWHM) and the energy in the pulse.

Definition at line 3915 of file command_implementations.cpp.

References _lang, extractRange(), Language::get(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), make_hline(), VectorIndex::OPEN_END, NumeReKernel::print(), NumeReKernel::printPreFmt(), CommandLineParser::setReturnValue(), SyntaxError::TABLE_DOESNT_EXIST, NumeReKernel::toggleTableStatus(), toString(), and toUpperCase().

Referenced by cmd_pulse().

Here is the call graph for this function:

◆ boneDetection()

◆ calculateSplines()

bool calculateSplines ( CommandLineParser cmdParser)

This function approximates the passed data set using cubic splines.

Parameters
cmdParserCommandLineParser&
Returns
bool

The calculated spline polynomials are defined as new custom functions.

Definition at line 4253 of file command_implementations.cpp.

References _lang, NumeReKernel::bSupressAnswer, FunctionDefinitionManager::defineFunc(), extractRange(), Language::get(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), NumeReKernel::getDefinitions(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), NumeReKernel::getSettings(), FunctionDefinitionManager::isDefined(), NumeReKernel::issueWarning(), NumeReKernel::print(), Settings::systemPrints(), SyntaxError::TABLE_DOESNT_EXIST, SyntaxError::TOO_FEW_DATAPOINTS, and toString().

Referenced by cmd_spline().

Here is the call graph for this function:

◆ createDatagrid()

bool createDatagrid ( CommandLineParser cmdParser)

This function calculates a datagrid from passed functions or (x-y-z) data values.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 3312 of file command_implementations.cpp.

References _defVars, date::abs(), CommandLineParser::clearReturnValue(), Indices::col, mu::ParserBase::Eval(), expandVectorToDatagrid(), CommandLineParser::exprContainsDataObjects(), VectorIndex::front(), MemoryManager::getColElements(), MemoryManager::getCols(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), CommandLineParser::getExprAsMathExpression(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), getSamplesForDatagrid(), CommandLineParser::getTargetTable(), CommandLineParser::hasParam(), intCast(), IntervalSet::intervals, VectorIndex::INVALID, SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, DataAccessParser::isCluster(), VectorIndex::isOpenEnd(), isValidIndexSet(), CommandLineParser::parseIntervals(), Indices::row, mu::ParserBase::SetExpr(), MemoryManager::setHeadLineElement(), VectorIndex::setRange(), CommandLineParser::setReturnValue(), IntervalSet::size(), VectorIndex::size(), VectorIndex::subidx(), SyntaxError::TABLE_DOESNT_EXIST, VectorIndex::to_string(), SyntaxError::TOO_FEW_DATAPOINTS, toString(), DefaultVariables::vValue, and MemoryManager::writeToTable().

Referenced by cmd_datagrid().

Here is the call graph for this function:

◆ differentiate()

bool differentiate ( CommandLineParser cmdParser)

Calculate the numerical differential of the passed expression or data set.

Parameters
cmdParserCommandLineParser
Returns
bool

Definition at line 754 of file command_implementations.cpp.

References _lang, date::abs(), NumeRe::SavitzkyGolayDiffFilter::apply(), FunctionDefinitionManager::call(), Indices::col, MemoryManager::containsTablesOrClusters(), mu::Parser::Diff(), mu::ParserBase::Eval(), VectorIndex::front(), SyntaxError::FUNCTION_ERROR, Language::get(), CommandLineParser::getCommandLine(), getDataElements(), DataAccessParser::getDataObject(), NumeReKernel::getDefinitions(), MemoryManager::getElement(), CommandLineParser::getExprAsDataObject(), CommandLineParser::getExprAsMathExpression(), DataAccessParser::getIndices(), NumeReKernel::getInstance(), MemoryManager::getLines(), getMatchingParenthesis(), NumeReKernel::getMemoryManager(), getNextArgument(), CommandLineParser::getParameterList(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), getPointerToVariable(), NumeReKernel::getSettings(), CommandLineParser::hasParam(), intCast(), intPower(), SyntaxError::INVALID_INDEX, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), isNotEmptyExpression(), VectorIndex::isOpenEnd(), NumeReKernel::issueWarning(), MemoryManager::isValidElement(), isValidIndexSet(), min, SyntaxError::NO_DIFF_OPTIONS, SyntaxError::NO_DIFF_VAR, Indices::row, mu::ParserBase::SetExpr(), VectorIndex::setRange(), CommandLineParser::setReturnValue(), VectorIndex::size(), MemoryManager::sortElements(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, StripSpaces(), VectorIndex::to_string(), and MemoryManager::writeToTable().

Referenced by cmd_diff().

Here is the call graph for this function:

◆ evalPoints()

◆ fastFourierTransform()

◆ fastWaveletTransform()

◆ findExtrema()

bool findExtrema ( CommandLineParser cmdParser)

This function is a wrapper to the actual extrema localisation function localizeExtremum() further below.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 1398 of file command_implementations.cpp.

References date::abs(), FunctionDefinitionManager::call(), MemoryManager::containsTablesOrClusters(), mu::Parser::Diff(), mu::ParserBase::Eval(), CommandLineParser::exprContainsDataObjects(), SyntaxError::EXTREMA_VAR_NOT_FOUND, findCommand(), findExtremaInData(), findExtremaInMultiResult(), findParameter(), findVariableInExpression(), getAllIndices(), getArgAtPos(), CommandLineParser::getCommandLine(), getDataElements(), NumeReKernel::getDefinitions(), CommandLineParser::getExpr(), NumeReKernel::getInstance(), getIntervalForSearchFunctions(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterList(), NumeReKernel::getParser(), getPointerToVariable(), Settings::getPrecision(), NumeReKernel::getSettings(), NumeReKernel::getStringParser(), intCast(), SyntaxError::invalid_position, mu::isinf(), mu::isnan(), isNotEmptyExpression(), NumeRe::StringParser::isStringExpression(), localizeExtremum(), SyntaxError::NO_EXTREMA_OPTIONS, SyntaxError::NO_EXTREMA_VAR, mu::real(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, StripSpaces(), and toString().

Referenced by cmd_extrema().

Here is the call graph for this function:

◆ findZeroes()

bool findZeroes ( CommandLineParser cmdParser)

◆ fitDataSet()

bool fitDataSet ( std::string &  sCmd,
mu::Parser _parser,
MemoryManager _data,
FunctionDefinitionManager _functions,
const Settings _option 
)

Definition at line 73 of file fitting.cpp.

References _lang, applyFitAlgorithm(), FittingData::b1DChiMap, FittingData::bNoParams, FittingData::bSaveErrors, FittingData::bUseErrors, calculateChiMap(), calculateCovarianceData(), calculatePercentageAvgAndCreateParserVariables(), SyntaxError::CANNOT_BE_A_FITTING_PARAM, SyntaxError::CANNOT_OPEN_FITLOG, constructCovarianceMatrix(), MemoryManager::containsTablesOrClusters(), createTeXExport(), FunctionDefinitionManager::defineFunc(), FittingData::dPrecision, mu::ParserBase::Eval(), evaluateFittingParams(), findCommand(), SyntaxError::FITFUNC_NOT_CONTAINS, Language::get(), Fitcontroller::getCovarianceMatrix(), getDataForFit(), FunctionDefinitionManager::getDefinitionString(), getFitAnalysis(), Fitcontroller::getFitChi(), Fitcontroller::getFitFunction(), getFitOptionsTable(), getFittingParameters(), FunctionDefinitionManager::getFunctionIndex(), getParameterTable(), getTimeStamp(), mu::ParserBase::GetUsedVar(), Settings::getWindow(), IntervalSet::intervals, SyntaxError::invalid_position, FunctionDefinitionManager::isDefined(), NumeReKernel::issueWarning(), FittingData::ivl, LineBreak(), make_hline(), FittingData::nDim, FittingData::nFitVars, FittingData::nMaxIterations, SyntaxError::NO_DATA_FOR_FIT, SyntaxError::NO_PARAMS_FOR_FIT, SyntaxError::OVERFITTING_ERROR, NumeReKernel::print(), NumeReKernel::printPreFmt(), reduceLogFilesize(), removeObsoleteParentheses(), FittingData::restricted, FittingData::sChiMap, FittingData::sChiMap_Vars, mu::ParserBase::SetExpr(), FittingData::sFitFunction, FittingData::sParams, FittingData::sRestrictions, strfill(), StripSpaces(), Settings::systemPrints(), NumeReKernel::toggleTableStatus(), toSystemCodePage(), toUpperCase(), FileSystem::ValidFileName(), FittingData::vx, FittingData::vy, FittingData::vz, and FittingData::vz_w.

Referenced by cmd_fit().

Here is the call graph for this function:

◆ integrate()

bool integrate ( CommandLineParser cmdParser)

Calculate the integral of a function or a data set in a single dimension.

Parameters
cmdParserCommandLineParser&
Returns
bool

Definition at line 272 of file command_implementations.cpp.

References _defVars, _lang, date::abs(), mu::ParserBase::Eval(), Language::get(), NumeReKernel::GetAsyncCancelState(), CommandLineParser::getCommandLine(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), getMatchingParenthesis(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValue(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), NumeReKernel::getSettings(), CommandLineParser::hasParam(), intCast(), integrateSingleDimensionData(), integrationstep_simpson(), integrationstep_trapezoidal(), SyntaxError::INVALID_INTEGRATION_PRECISION, SyntaxError::INVALID_INTEGRATION_RANGES, SyntaxError::invalid_position, mu::isinf(), mu::isnan(), MemoryManager::isTable(), max, min, SyntaxError::NO_INTEGRATION_FUNCTION, SyntaxError::NO_INTEGRATION_RANGES, CommandLineParser::parseIntervals(), NumeReKernel::printPreFmt(), SyntaxError::PROCESS_ABORTED_BY_USER, mu::rint(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), SIMPSON, IntervalSet::size(), SyntaxError::STRINGS_MAY_NOT_BE_EVALUATED_WITH_CMD, Settings::systemPrints(), toString(), TRAPEZOIDAL, and DefaultVariables::vValue.

Referenced by cmd_integrate().

Here is the call graph for this function:

◆ integrate2d()

◆ particleSwarmOptimizer()

void particleSwarmOptimizer ( CommandLineParser cmdParser)

This function implements a particle swarm optimizer in up to four dimensions (depending on the number of intervals defined). The optimizer has an adaptive velocity part, reducing the overall position variation of the particles over time.

Parameters
cmdParserCommandLineParser&
Returns
void

Definition at line 4547 of file command_implementations.cpp.

References _defVars, mu::ParserBase::Eval(), CommandLineParser::getExprAsMathExpression(), NumeReKernel::getInstance(), CommandLineParser::getParameterValueAsNumericalValue(), NumeReKernel::getParser(), intCast(), IntervalSet::intervals, max, min, CommandLineParser::parseIntervals(), parser_Random(), mu::real(), mu::ParserBase::SetExpr(), CommandLineParser::setReturnValue(), IntervalSet::size(), and DefaultVariables::vValue.

Referenced by cmd_pso().

Here is the call graph for this function:

◆ readAudioFile()

bool readAudioFile ( CommandLineParser cmdParser)

◆ regularizeDataSet()

bool regularizeDataSet ( CommandLineParser cmdParser)

This function regularizes the samples of a defined x-y-data array such that DeltaX is equal for every x.

Parameters
CommandLineParser&cmdParser
Returns
bool

Definition at line 3851 of file command_implementations.cpp.

References extractRange(), MemoryManager::getCols(), CommandLineParser::getCommandLine(), DataAccessParser::getDataObject(), CommandLineParser::getExprAsDataObject(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), CommandLineParser::getParameterValueAsNumericalValue(), intCast(), VectorIndex::OPEN_END, mu::real(), MemoryManager::setHeadLineElement(), SyntaxError::TABLE_DOESNT_EXIST, and MemoryManager::writeToTable().

Referenced by cmd_regularize().

Here is the call graph for this function:

◆ rotateTable()

◆ seekInAudioFile()

◆ shortTimeFourierAnalysis()

◆ taylor()

◆ urlExecute()

void urlExecute ( CommandLineParser cmdParser)

This function implements the url command providing an interface to http(s) and (s)ftp URLs.

Parameters
cmdParserCommandLineParser&
Returns
void

Definition at line 4700 of file command_implementations.cpp.

References SyntaxError::CANNOT_OPEN_TARGET, url::get(), CommandLineParser::getCommandLine(), CommandLineParser::getFileParameterValue(), CommandLineParser::getFileParameterValueForSaving(), CommandLineParser::getParameterValueAsString(), CommandLineParser::hasParam(), CommandLineParser::parseExprAsString(), url::put(), replaceAll(), CommandLineParser::setReturnValue(), toString(), date::detail::trunc(), SyntaxError::URL_ERROR, and url::Error::what().

Referenced by cmd_url().

Here is the call graph for this function:

◆ writeAudioFile()