BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Parameter.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file Fit/Param/Parameter.h
6 //! @brief Defines class Parameter.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_FIT_PARAM_PARAMETER_H
16 #define BORNAGAIN_FIT_PARAM_PARAMETER_H
17 
18 #include "Fit/Param/AttLimits.h"
19 #include <string>
20 
21 namespace mumufit {
22 
23 //! A fittable parameter with value, error, step, and limits.
24 //! @ingroup fitting
25 
26 class Parameter {
27 public:
28  Parameter();
29 
30  //! Fit parameter constructor.
31  //! @param name: unique name of fit parameters
32  //! @param value: starting value of fit parameter
33  //! @param limits: fit parameter limits
34  //! @param step: initial step of fit parameter during the minimization,
35  //! will be calculated automatically, if zero.
36  Parameter(const std::string& name, double value,
37  const AttLimits& limits = AttLimits::limitless(), double step = 0.0);
38 
39  std::string name() const;
40 
41  double startValue() const;
42 
43  AttLimits limits() const;
44 
45  double value() const;
46  void setValue(double value);
47 
48  double step() const;
49 
50  double error() const;
51  void setError(double value);
52 
53 private:
54  std::string m_name; //!< unique fit parameter name
55  double m_start_value; //!< starting value of fit parameters
56  double m_value; //!< current value of fit parameters
57  double m_step; //!< approximate initial step for the minimizer
58  double m_error; //!< error of fit parameter calculated by the minimizer
60 };
61 
62 } // namespace mumufit
63 
64 #endif // BORNAGAIN_FIT_PARAM_PARAMETER_H
Defines and implements class AttLimits.
Attributes and limits of a fit parameter, and coupling between these properties.
Definition: AttLimits.h:25
static AttLimits limitless()
Definition: AttLimits.cpp:26
A fittable parameter with value, error, step, and limits.
Definition: Parameter.h:26
void setValue(double value)
Definition: Parameter.cpp:64
double startValue() const
Definition: Parameter.cpp:49
double m_value
current value of fit parameters
Definition: Parameter.h:56
std::string m_name
unique fit parameter name
Definition: Parameter.h:54
AttLimits m_limits
Definition: Parameter.h:59
double step() const
Definition: Parameter.cpp:69
std::string name() const
Definition: Parameter.cpp:44
AttLimits limits() const
Definition: Parameter.cpp:54
double value() const
Definition: Parameter.cpp:59
double error() const
Definition: Parameter.cpp:74
void setError(double value)
Definition: Parameter.cpp:79
double m_start_value
starting value of fit parameters
Definition: Parameter.h:55
double m_step
approximate initial step for the minimizer
Definition: Parameter.h:57
double m_error
error of fit parameter calculated by the minimizer
Definition: Parameter.h:58
The multi-library, multi-algorithm fit wrapper library.