BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Implementation of relative difference metric. More...
Public Member Functions | |
RelativeDifferenceMetric () | |
RelativeDifferenceMetric * | clone () const override |
virtual double | compute (const SimDataPair &data_pair, bool use_weights) const |
Computes metric value from SimDataPair object. More... | |
double | computeFromArrays (std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override |
Computes metric value from data arrays. More... | |
double | computeFromArrays (std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override |
Computes metric value from data arrays. More... | |
double | computeFromArrays (std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > weight_factors) const override |
Computes metric value from data arrays. More... | |
double | computeFromArrays (std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > weight_factors) const override |
Computes metric value from data arrays. More... | |
auto | norm () const |
Returns a copy of the normalization function used. More... | |
void | setNorm (std::function< double(double)> norm) |
virtual void | transferToCPP () |
Used for Python overriding of clone (see swig/tweaks.py) More... | |
Private Attributes | |
std::function< double(double)> | m_norm |
Implementation of relative difference metric.
With default L2 norm and weighting off corresponds to the formula
where is the simulated intensity,
- experimental data. If weighting is on, falls back to the standard
metric.
Definition at line 168 of file ObjectiveMetric.h.
RelativeDifferenceMetric::RelativeDifferenceMetric | ( | ) |
Definition at line 195 of file ObjectiveMetric.cpp.
|
overridevirtual |
Reimplemented from Chi2Metric.
Definition at line 197 of file ObjectiveMetric.cpp.
|
virtualinherited |
Computes metric value from SimDataPair object.
Calls computeFromArrays internally.
data_pair | SimDataPair object. Can optionally contain data uncertainties |
use_weights | boolean, defines if data uncertainties should be taken into account |
Reimplemented in RQ4Metric.
Definition at line 60 of file ObjectiveMetric.cpp.
References ObjectiveMetric::computeFromArrays(), SimDataPair::containsUncertainties(), SimDataPair::experimental_array(), SimDataPair::simulation_array(), SimDataPair::uncertainties_array(), and SimDataPair::user_weights_array().
Referenced by RQ4Metric::compute().
|
overridevirtualinherited |
Computes metric value from data arrays.
Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size.
sim_data | array with simulated intensities. |
exp_data | array with intensity values obtained from an experiment. |
uncertainties | array with experimental data uncertainties. |
weight_factors | user-defined weighting factors. Used linearly, no matter which norm is chosen. |
Implements ObjectiveMetric.
Definition at line 88 of file ObjectiveMetric.cpp.
Referenced by RQ4Metric::compute().
|
override |
Computes metric value from data arrays.
Negative values in exp_data are ignored as well as non-positive weight_factors and uncertainties. All arrays involved in the computation must be of the same size.
sim_data | array with simulated intensities. |
exp_data | array with intensity values obtained from an experiment. |
uncertainties | array with experimental data uncertainties. |
weight_factors | user-defined weighting factors. Used linearly, no matter which norm is chosen. |
Definition at line 90 of file ObjectiveMetric.cpp.
|
override |
Computes metric value from data arrays.
Negative values in exp_data are ignored as well as non-positive weight_factors. All arrays involved in the computation must be of the same size.
sim_data | array with simulated intensities. |
exp_data | array with intensity values obtained from an experiment. |
weight_factors | user-defined weighting factors. Used linearly, no matter which norm is chosen. |
Definition at line 101 of file ObjectiveMetric.cpp.
|
overridevirtual |
Computes metric value from data arrays.
Negative values in exp_data are ignored as well as non-positive weight_factors. All arrays involved in the computation must be of the same size.
sim_data | array with simulated intensities. |
exp_data | array with intensity values obtained from an experiment. |
weight_factors | user-defined weighting factors. Used linearly, no matter which norm is chosen. |
Reimplemented from Chi2Metric.
Definition at line 202 of file ObjectiveMetric.cpp.
References ObjectiveMetric::norm().
|
inlineinherited |
Returns a copy of the normalization function used.
Definition at line 67 of file ObjectiveMetric.h.
References ObjectiveMetric::m_norm.
Referenced by PoissonLikeMetric::computeFromArrays(), LogMetric::computeFromArrays(), Chi2Metric::computeFromArrays(), computeFromArrays(), and ObjectiveMetric::setNorm().
|
inherited |
Definition at line 74 of file ObjectiveMetric.cpp.
References ObjectiveMetric::m_norm, and ObjectiveMetric::norm().
|
inlinevirtualinherited |
Used for Python overriding of clone (see swig/tweaks.py)
Definition at line 34 of file ICloneable.h.
|
privateinherited |
Definition at line 70 of file ObjectiveMetric.h.
Referenced by ObjectiveMetric::norm(), and ObjectiveMetric::setNorm().