20Kernel::Logger
g_log(
"ParamFunction");
30 if (std::isnan(
value)) {
32 std::stringstream errmsg;
33 errmsg <<
"Trying to set a NaN value (" <<
value <<
") to parameter " << this->
parameterName(i);
34 throw std::invalid_argument(errmsg.str());
35 }
else if (std::isinf(
value)) {
37 std::stringstream errmsg;
38 errmsg <<
"Trying to set an infinity value (" <<
value <<
") to parameter " << this->
parameterName(i);
39 throw std::invalid_argument(errmsg.str());
77 std::ostringstream msg;
78 msg <<
"ParamFunction tries to set value to non-exist parameter (" <<
name <<
") "
79 <<
"of function " << this->
name();
80 msg <<
"\nAllowed parameters: ";
84 throw std::invalid_argument(msg.str());
97 std::ostringstream msg;
98 msg <<
"ParamFunction tries to set description to non-exist parameter (" <<
name <<
"). ";
99 msg <<
"\nAllowed parameters: ";
102 throw std::invalid_argument(msg.str());
115 std::ostringstream msg;
116 msg <<
"ParamFunction tries to get value of non-existing parameter (" <<
name <<
") "
117 <<
"to function " << this->
name();
118 msg <<
"\nAllowed parameters: ";
121 throw std::invalid_argument(msg.str());
126 if (!std::isfinite(parvalue)) {
127 g_log.
warning() <<
"Parameter " <<
name <<
" has a NaN or infinity value " <<
'\n';
150 std::ostringstream msg;
151 msg <<
"ParamFunction " << this->
name() <<
" does not have parameter (" << name <<
").";
152 throw std::invalid_argument(msg.str());
193 std::ostringstream msg;
194 msg <<
"ParamFunction tries to get error of non-existing parameter (" <<
name <<
") "
195 <<
"to function " << this->
name();
196 msg <<
"\nAllowed parameters: ";
199 throw std::invalid_argument(msg.str());
222 std::ostringstream msg;
223 msg <<
"ParamFunction tries to set error of non-existing parameter (" <<
name <<
") "
224 <<
"to function " << this->
name();
225 msg <<
"\nAllowed parameters: ";
228 throw std::invalid_argument(msg.str());
242 std::ostringstream msg;
243 msg <<
"ParamFunction parameter (" <<
name <<
") already exists.";
244 throw std::invalid_argument(msg.str());
double value
The value of the point.
virtual void clearTies()
Remove all ties.
virtual void clearConstraints()
Remove all constraints.
ParameterStatus
Describe parameter status in relation to fitting: Active: Fit varies such parameter directly.
virtual std::string name() const =0
Returns the function's name.
void setParameterDescription(size_t, const std::string &description) override
Set i-th parameter description.
void clearAllParameters()
Nonvirtual member which removes all declared parameters.
bool hasParameter(const std::string &name) const override
Check if function has a parameter with this name.
std::string parameterDescription(size_t i) const override
Returns the description of parameter i.
std::vector< std::string > m_parameterDescriptions
parameter descriptions
std::vector< double > m_parameters
Keeps parameter values.
double getError(size_t i) const override
Get the fitting error for a parameter.
std::vector< std::string > m_parameterNames
Keeps parameter names.
ParameterStatus getParameterStatus(size_t i) const override
Get status of parameter.
void setParameter(size_t, const double &value, bool explicitlySet=true) override
Set i-th parameter.
virtual double * getParameterAddress(size_t i)
Get the address of the parameter. For use in UserFunction with mu::Parser.
size_t parameterIndex(const std::string &name) const override
Returns the index of parameter name.
bool isExplicitlySet(size_t i) const override
Checks if a parameter has been set explicitly.
std::vector< double > m_errors
Keeps parameter errors.
void setParameterStatus(size_t i, ParameterStatus status) override
Change status of parameter.
size_t getParameterIndex(const ParameterReference &ref) const override
Return parameter index from a parameter reference.
std::string parameterName(size_t i) const override
Returns the name of parameter i.
std::vector< ParameterStatus > m_parameterStatus
Keeps status for each parameter.
void declareParameter(const std::string &name, double initValue=0, const std::string &description="") override
Declare a new parameter.
std::vector< bool > m_explicitlySet
Flags of explicitly set parameters.
size_t nParams() const override
Total number of parameters.
void setError(size_t i, double err) override
Set the fitting error for a parameter.
void checkParameterIndex(size_t i) const
Check that a parameter index is in a valid range.
double getParameter(size_t i) const override
Get i-th parameter.
A reference to a parameter in a function.
std::size_t getLocalIndex() const
Return parameter index in the local function.
IFunction * getLocalFunction() const
Return pointer to the local function.
void warning(const std::string &msg)
Logs at warning level.
Kernel::Logger g_log("ExperimentInfo")
static logger object