BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
FTDecayFunctionItems.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/Models/FTDecayFunctionItems.cpp
6 //! @brief Implements FTDecayFunction1DItem classes
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 
16 #include "Base/Const/Units.h"
17 
18 // --------------------------------------------------------------------------------------------- //
19 
20 const QString FTDecayFunction1DItem::P_DECAY_LENGTH = QString::fromStdString("DecayLength");
21 
23 
25 {
27  ->setToolTip("Decay length (half-width of the distribution in nanometers)");
28 }
29 
30 // --------------------------------------------------------------------------------------------- //
31 
33  : FTDecayFunction1DItem("FTDecayFunction1DCauchy")
34 {
35  setToolTip("One-dimensional Cauchy decay function");
37 }
38 
39 std::unique_ptr<IFTDecayFunction1D> FTDecayFunction1DCauchyItem::createFTDecayFunction() const
40 {
41  return std::make_unique<FTDecayFunction1DCauchy>(getItemValue(P_DECAY_LENGTH).toDouble());
42 }
43 
44 // --------------------------------------------------------------------------------------------- //
45 
47  : FTDecayFunction1DItem("FTDecayFunction1DGauss")
48 {
49  setToolTip("One-dimensional Gauss decay function");
51 }
52 
53 std::unique_ptr<IFTDecayFunction1D> FTDecayFunction1DGaussItem::createFTDecayFunction() const
54 {
55  return std::make_unique<FTDecayFunction1DGauss>(getItemValue(P_DECAY_LENGTH).toDouble());
56 }
57 
58 // --------------------------------------------------------------------------------------------- //
59 
61  : FTDecayFunction1DItem("FTDecayFunction1DTriangle")
62 {
63  setToolTip("One-dimensional triangle decay function");
65 }
66 
67 std::unique_ptr<IFTDecayFunction1D> FTDecayFunction1DTriangleItem::createFTDecayFunction() const
68 {
69  return std::make_unique<FTDecayFunction1DTriangle>(getItemValue(P_DECAY_LENGTH).toDouble());
70 }
71 
72 // --------------------------------------------------------------------------------------------- //
73 
74 const QString FTDecayFunction1DVoigtItem::P_ETA = QString::fromStdString("Eta");
75 
77  : FTDecayFunction1DItem("FTDecayFunction1DVoigt")
78 {
79  setToolTip("One-dimensional pseudo-Voigt decay function");
81  addProperty(P_ETA, 0.5)
82  ->setLimits(RealLimits::limited(0.0, 1.0))
83  .setToolTip("Parameter [0,1] to balance between Cauchy (eta=0.0) and Gauss (eta=1.0)");
84 }
85 
86 std::unique_ptr<IFTDecayFunction1D> FTDecayFunction1DVoigtItem::createFTDecayFunction() const
87 {
88  return std::make_unique<FTDecayFunction1DVoigt>(getItemValue(P_DECAY_LENGTH).toDouble(),
89  getItemValue(P_ETA).toDouble());
90 }
91 
92 // --------------------------------------------------------------------------------------------- //
93 
94 const QString FTDecayFunction2DItem::P_DECAY_LENGTH_X = QString::fromStdString("DecayLengthX");
95 const QString FTDecayFunction2DItem::P_DECAY_LENGTH_Y = QString::fromStdString("DecayLengthY");
96 const QString FTDecayFunction2DItem::P_GAMMA = QString::fromStdString("Gamma");
97 const QString FTDecayFunction2DItem::P_DELTA = QString::fromStdString("Delta");
98 
100 
102 {
104  ->setToolTip("Decay length (half-width of the distribution in nanometers) "
105  "\nalong x-axis of the distribution");
107  ->setToolTip("Decay length (half-width of the distribution in nanometers) "
108  "\nalong y-axis of the distribution");
109 }
110 
112 {
113  addProperty(P_GAMMA, 0.0)
114  ->setToolTip(
115  "Distribution orientation with respect to the first lattice vector in degrees");
116  addProperty(P_DELTA, 90.0)->setVisible(false);
117 }
118 
119 // --------------------------------------------------------------------------------------------- //
120 
122  : FTDecayFunction2DItem("FTDecayFunction2DCauchy")
123 {
124  setToolTip("Two-dimensional Cauchy decay function");
127 }
128 
129 std::unique_ptr<IFTDecayFunction2D> FTDecayFunction2DCauchyItem::createFTDecayFunction() const
130 {
131  return std::make_unique<FTDecayFunction2DCauchy>(
133  Units::deg2rad(getItemValue(P_GAMMA).toDouble()));
134 }
135 
136 // --------------------------------------------------------------------------------------------- //
137 
139  : FTDecayFunction2DItem("FTDecayFunction2DGauss")
140 {
141  setToolTip("Two-dimensional Gauss decay function");
144 }
145 
146 std::unique_ptr<IFTDecayFunction2D> FTDecayFunction2DGaussItem::createFTDecayFunction() const
147 {
148  return std::make_unique<FTDecayFunction2DGauss>(
150  Units::deg2rad(getItemValue(P_GAMMA).toDouble()));
151 }
152 
153 // --------------------------------------------------------------------------------------------- //
154 
155 const QString FTDecayFunction2DVoigtItem::P_ETA = QString::fromStdString("Eta");
156 
158  : FTDecayFunction2DItem("FTDecayFunction2DVoigt")
159 {
160  setToolTip("Two-dimensional pseudo-Voigt decay function");
162  addProperty(P_ETA, 0.5)
163  ->setLimits(RealLimits::limited(0.0, 1.0))
164  .setToolTip("Parameter [0,1] to balance between Cauchy (eta=0.0) and Gauss (eta=1.0)");
166 }
167 
168 std::unique_ptr<IFTDecayFunction2D> FTDecayFunction2DVoigtItem::createFTDecayFunction() const
169 {
170  return std::make_unique<FTDecayFunction2DVoigt>(
172  getItemValue(P_ETA).toDouble(), Units::deg2rad(getItemValue(P_GAMMA).toDouble()));
173 }
Defines FTDecayFunction1DItem classes.
Defines some unit conversion factors and other constants in namespace Units.
std::unique_ptr< IFTDecayFunction1D > createFTDecayFunction() const
std::unique_ptr< IFTDecayFunction1D > createFTDecayFunction() const
static const QString P_DECAY_LENGTH
FTDecayFunction1DItem(const QString &name)
std::unique_ptr< IFTDecayFunction1D > createFTDecayFunction() const
std::unique_ptr< IFTDecayFunction1D > createFTDecayFunction() const
std::unique_ptr< IFTDecayFunction2D > createFTDecayFunction() const
std::unique_ptr< IFTDecayFunction2D > createFTDecayFunction() const
static const QString P_DECAY_LENGTH_X
static const QString P_DELTA
FTDecayFunction2DItem(const QString &name)
static const QString P_DECAY_LENGTH_Y
static const QString P_GAMMA
std::unique_ptr< IFTDecayFunction2D > createFTDecayFunction() const
static RealLimits limited(double left_bound_value, double right_bound_value)
Creates an object bounded from the left and right.
Definition: RealLimits.cpp:125
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag.
void setVisible(bool enabled)
Flags accessors.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
SessionItem & setToolTip(const QString &tooltip)
SessionItem & setLimits(const RealLimits &value)
QString const & name(EShape k)
Definition: particles.cpp:21
double deg2rad(double angle)
Definition: Units.h:59