Metric wrapper for back-compaptibility with old scripts.
Definition at line 32 of file FitObjective.cpp.
◆ ChiModuleWrapper()
Definition at line 321 of file FitObjective.cpp.
325 throw std::runtime_error(
"Error in ChiModuleWrapper: empty chi square module passed");
std::unique_ptr< IChiSquaredModule > m_module
References m_module.
◆ compute()
double ChiModuleWrapper::compute |
( |
const std::vector< SimDataPair > & |
fit_objects, |
|
|
size_t |
n_pars |
|
) |
| const |
|
overridevirtual |
Implements IMetricWrapper.
Definition at line 328 of file FitObjective.cpp.
332 for (
auto& obj : fit_objects) {
333 const auto sim_array = obj.simulation_array();
334 const auto exp_array = obj.experimental_array();
335 const auto weights = obj.user_weights_array();
336 const size_t n_elements = sim_array.size();
337 for (
size_t i = 0; i < n_elements; ++i) {
338 double value =
m_module->residual(sim_array[i], exp_array[i], weights[i]);
339 result += value * value;
341 n_points += n_elements;
344 int fnorm =
static_cast<int>(n_points) -
static_cast<int>(n_pars);
346 throw std::runtime_error(
"Error in ChiModuleWrapper: Normalization shall be positive");
348 return result / fnorm;
References m_module.
◆ m_module
The documentation for this class was generated from the following file: