16#include <boost/lexical_cast.hpp>
21Kernel::Logger
g_log(
"FitParameter");
33 std::stringstream constraint;
34 size_t foundMinPercentage, foundMaxPercentage;
40 if (foundMinPercentage != std::string::npos)
46 if (foundMaxPercentage != std::string::npos)
53 constraint << min <<
" < " <<
m_name <<
" < " << max;
55 constraint << min <<
" < " <<
m_name;
57 constraint <<
m_name <<
" < " << max;
60 return constraint.str();
78 std::string toReplace =
"centre";
79 size_t len = toReplace.size();
80 found = equationStr.find(toReplace);
81 std::stringstream readDouble;
83 std::string extractedValueStr = readDouble.str();
84 if (found != std::string::npos)
85 equationStr.replace(found, len, extractedValueStr);
89 while (equationStr.find(toReplace) != std::string::npos) {
90 found = equationStr.find(toReplace);
91 equationStr.replace(found, len, extractedValueStr);
96 p.SetExpr(equationStr);
99 }
catch (mu::Parser::exception_type &e) {
100 g_log.
error() <<
"Cannot evaluate fitting parameter formula."
101 <<
" Formula which cannot be passed is " <<
m_formula
102 <<
". Muparser error message is: " << e.GetMsg() <<
'\n';
172 if (values.size() < 3) {
173 g_log.
warning() <<
"Expecting a comma separated list of at each three entries"
174 <<
" (any of which may be empty strings) to set information about a "
176 <<
" instead of: " << str <<
'\n';
181 f.
setValue(boost::lexical_cast<double>(values[0]));
182 }
catch (boost::bad_lexical_cast &) {
185 if (!values.at(0).empty()) {
186 g_log.
warning() <<
"Could not read " << values[0] <<
" as double for "
187 <<
" fitting parameter: " << values[1] <<
":" << values[2] <<
'\n';
198 while (values.size() < 10)
199 values.emplace_back(
"");
209 if (values.size() > 10) {
210 std::stringstream lookupTableStream(values[10]);
212 lookupTableStream >> lookupTable;
Store information about a fitting parameter such as its value if it is constrained or tied.
void setName(const std::string &name)
set name
void setFormulaUnit(const std::string &formulaUnit)
set formula unit
std::string m_tie
tie of parameter
void setResultUnit(const std::string &resultUnit)
set result formula unit
void setLookUpTable(const Kernel::Interpolation &lookupTable)
set look up table
void setFormula(const std::string &formula)
set formula
void setTie(const std::string &tie)
set tie
Kernel::Interpolation m_lookUpTable
look up table
std::string m_constraintPenaltyFactor
the penalty factor
std::string m_constraintMin
constraint min boundary
void setConstraintMax(const std::string &constraintMax)
set constraint max
void setFunction(const std::string &function)
set function
void setConstraintMin(const std::string &constraintMin)
set constraint min
std::string m_formulaUnit
the unit that the formula expects
void setConstraintPenaltyFactor(const std::string &constraintPenaltyFactor)
set the constraint penalty
std::string m_name
name of parameter
void setValue(double value)
set parameter value
std::string m_formula
the formula
std::string getConstraint() const
get constraint
std::string m_function
name of fitting function
void printSelf(std::ostream &os) const
Prints object to stream.
std::string m_resultUnit
the result unit
double m_value
value of parameter
std::string m_constraintMax
constraint max boundary
double getValue() const
get paramter value
Provide interpolation over a series of points.
bool containData() const
return false if no data has been added
double value(const double &at) const
get interpolated value at location at
void error(const std::string &msg)
Logs at error level.
void warning(const std::string &msg)
Logs at warning level.
@ TOK_IGNORE_FINAL_EMPTY_TOKEN
ignore an empty token at the end of the string.
@ TOK_TRIM
remove leading and trailing whitespace from tokens
const TokenVec & asVector()
Returns a vector of tokenized strings.
MANTID_GEOMETRY_DLL std::istream & operator>>(std::istream &stream, SymmetryOperation &operation)
Reads identifier from stream and tries to parse as a symbol.
Mantid::Kernel::Logger g_log("Goniometer")
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.