BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Public Member Functions | |
Chi2Metric () | |
Chi2Metric * | clone () const override |
double | computeFromArrays (std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override |
double | computeFromArrays (std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > weight_factors) const override |
virtual double | compute (const SimDataPair &data_pair, bool use_weights) const |
void | setNorm (std::function< double(double)> norm) |
auto | norm () const |
virtual void | transferToCPP () |
Private Attributes | |
std::function< double(double)> | m_norm |
Implementation of the standard metric derived from maximum likelihood with Gaussian uncertainties.
With default L2 norm corresponds to the formula
Definition at line 73 of file ObjectiveMetric.h.
Chi2Metric::Chi2Metric | ( | ) |
Definition at line 82 of file ObjectiveMetric.cpp.
|
overridevirtual |
Implements ObjectiveMetric.
Reimplemented in RQ4Metric, RelativeDifferenceMetric, and PoissonLikeMetric.
Definition at line 84 of file ObjectiveMetric.cpp.
References anonymous_namespace{ObjectiveMetric.cpp}::copyMetric().
|
overridevirtual |
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 89 of file ObjectiveMetric.cpp.
References anonymous_namespace{ObjectiveMetric.cpp}::checkIntegrity(), and ObjectiveMetric::norm().
Referenced by RQ4Metric::compute().
|
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. |
Implements ObjectiveMetric.
Reimplemented in RelativeDifferenceMetric, and PoissonLikeMetric.
Definition at line 104 of file ObjectiveMetric.cpp.
References anonymous_namespace{ObjectiveMetric.cpp}::checkIntegrity(), anonymous_namespace{ObjectiveMetric.cpp}::double_max, and ObjectiveMetric::norm().
|
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 61 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().
|
inherited |
Definition at line 75 of file ObjectiveMetric.cpp.
References ObjectiveMetric::m_norm, and ObjectiveMetric::norm().
|
inlineinherited |
Returns a copy of the normalization function used.
Definition at line 63 of file ObjectiveMetric.h.
References ObjectiveMetric::m_norm.
Referenced by computeFromArrays(), LogMetric::computeFromArrays(), PoissonLikeMetric::computeFromArrays(), RelativeDifferenceMetric::computeFromArrays(), and ObjectiveMetric::setNorm().
|
inlinevirtualinherited |
Used for Python overriding of clone (see swig/tweaks.py)
Definition at line 34 of file ICloneable.h.
|
privateinherited |
Definition at line 66 of file ObjectiveMetric.h.
Referenced by ObjectiveMetric::norm(), and ObjectiveMetric::setNorm().