From dbc59ea1bbf7ce4caabb04d237c7ccb41b3716a2 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 14:59:24 +0200
Subject: [PATCH 01/19] improve class comment

---
 Device/Data/CumulativeValue.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Device/Data/CumulativeValue.h b/Device/Data/CumulativeValue.h
index 4900b0edac9..528a7e9693d 100644
--- a/Device/Data/CumulativeValue.h
+++ b/Device/Data/CumulativeValue.h
@@ -20,7 +20,7 @@
 #ifndef BORNAGAIN_DEVICE_DATA_CUMULATIVEVALUE_H
 #define BORNAGAIN_DEVICE_DATA_CUMULATIVEVALUE_H
 
-//! The cumulative value with average and rms on-the-flight calculations.
+//! The cumulative value, with on-the-flight calculation of average and root mean square.
 //! @ingroup tools
 
 class CumulativeValue {
-- 
GitLab


From e7fb593fe8eea602e1bd2b28d5d1bee55c249285 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 15:08:01 +0200
Subject: [PATCH 02/19] rm include

---
 Sample/SoftParticle/FormFactorSphereLogNormalRadius.h | 1 -
 auto/Wrap/doxygenDevice.i                             | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h
index ab35018c438..3dad5806cdc 100644
--- a/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h
+++ b/Sample/SoftParticle/FormFactorSphereLogNormalRadius.h
@@ -15,7 +15,6 @@
 #ifndef BORNAGAIN_SAMPLE_SOFTPARTICLE_FORMFACTORSPHERELOGNORMALRADIUS_H
 #define BORNAGAIN_SAMPLE_SOFTPARTICLE_FORMFACTORSPHERELOGNORMALRADIUS_H
 
-#include "Base/Types/SafePointerVector.h"
 #include "Sample/Scattering/IBornFF.h"
 #include <memory>
 
diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i
index 69a0f490ff1..101f8116a42 100644
--- a/auto/Wrap/doxygenDevice.i
+++ b/auto/Wrap/doxygenDevice.i
@@ -189,7 +189,7 @@ Sets convolution mode.
 // File: classCumulativeValue.xml
 %feature("docstring") CumulativeValue "
 
-The cumulative value with average and rms on-the-flight calculations.
+The cumulative value, with on-the-flight calculation of average and root mean square.
 
 C++ includes: CumulativeValue.h
 ";
-- 
GitLab


From 99ea25be6a656e35eeda49371cede1633b5be258 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 15:17:43 +0200
Subject: [PATCH 03/19] braceless one-liners

---
 Device/Data/LLData.h | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/Device/Data/LLData.h b/Device/Data/LLData.h
index 888a2cffd97..6f9c8875a76 100644
--- a/Device/Data/LLData.h
+++ b/Device/Data/LLData.h
@@ -95,9 +95,8 @@ inline LLData<T>::LLData(size_t rank, const int* dimensions) : m_rank(0), m_dims
 template <class T> LLData<T>::LLData(const LLData<T>& right) : m_rank(0), m_dims(0), m_data_array(0)
 {
     allocate(right.rank(), right.dimensions());
-    for (size_t i = 0; i < getTotalSize(); ++i) {
+    for (size_t i = 0; i < getTotalSize(); ++i)
         m_data_array[i] = right[i];
-    }
 }
 
 template <class T> LLData<T>::~LLData()
@@ -139,9 +138,8 @@ template <class T> LLData<T>& LLData<T>::operator+=(const LLData<T>& right)
     if (!HaveSameDimensions(*this, right))
         throw std::runtime_error(
             "Operation += on LLData requires both operands to have the same dimensions");
-    for (size_t i = 0; i < getTotalSize(); ++i) {
+    for (size_t i = 0; i < getTotalSize(); ++i)
         m_data_array[i] += right[i];
-    }
     return *this;
 }
 
@@ -150,9 +148,8 @@ template <class T> LLData<T>& LLData<T>::operator-=(const LLData& right)
     if (!HaveSameDimensions(*this, right))
         throw std::runtime_error(
             "Operation -= on LLData requires both operands to have the same dimensions");
-    for (size_t i = 0; i < getTotalSize(); ++i) {
+    for (size_t i = 0; i < getTotalSize(); ++i)
         m_data_array[i] -= right[i];
-    }
     return *this;
 }
 
@@ -161,9 +158,8 @@ template <class T> LLData<T>& LLData<T>::operator*=(const LLData& right)
     if (!HaveSameDimensions(*this, right))
         throw std::runtime_error(
             "Operation *= on LLData requires both operands to have the same dimensions");
-    for (size_t i = 0; i < getTotalSize(); ++i) {
+    for (size_t i = 0; i < getTotalSize(); ++i)
         m_data_array[i] *= right[i];
-    }
     return *this;
 }
 
@@ -212,9 +208,9 @@ template <class T> T LLData<T>::getTotalSum() const
 template <class T> void LLData<T>::allocate(size_t rank, const int* dimensions)
 {
     clear();
-    if (!checkDimensions(rank, dimensions)) {
+    if (!checkDimensions(rank, dimensions))
         throw std::runtime_error("LLData<T>::allocate error: dimensions must be > 0");
-    }
+
     m_rank = rank;
     if (m_rank) {
         m_dims = new int[m_rank];
-- 
GitLab


From 3115bcecc1163b368b0dbda5baf8c19dfbcd399f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 15:33:24 +0200
Subject: [PATCH 04/19] rm OutputData<>::atCoordinate

was only used in test
---
 Device/Data/LLData.h                     | 12 -----------
 Tests/UnitTests/Core/Data/LLDataTest.cpp | 26 +++---------------------
 auto/Wrap/doxygenDevice.i                |  6 ------
 3 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/Device/Data/LLData.h b/Device/Data/LLData.h
index 6f9c8875a76..e6fe5bc0db6 100644
--- a/Device/Data/LLData.h
+++ b/Device/Data/LLData.h
@@ -41,8 +41,6 @@ public:
     // accessors
     T& operator[](size_t i);
     const T& operator[](size_t i) const;
-    T& atCoordinate(int* coordinate);
-    const T& atCoordinate(int* coordinate) const;
 
     // arithmetic operations
     LLData<T>& operator+=(const LLData<T>& right);
@@ -123,16 +121,6 @@ template <class T> inline const T& LLData<T>::operator[](size_t i) const
     return m_data_array[i];
 }
 
-template <class T> inline T& LLData<T>::atCoordinate(int* coordinate)
-{
-    return m_data_array[convertCoordinate(coordinate)];
-}
-
-template <class T> inline const T& LLData<T>::atCoordinate(int* coordinate) const
-{
-    return m_data_array[convertCoordinate(coordinate)];
-}
-
 template <class T> LLData<T>& LLData<T>::operator+=(const LLData<T>& right)
 {
     if (!HaveSameDimensions(*this, right))
diff --git a/Tests/UnitTests/Core/Data/LLDataTest.cpp b/Tests/UnitTests/Core/Data/LLDataTest.cpp
index 6939f7b8538..6f5012df2a5 100644
--- a/Tests/UnitTests/Core/Data/LLDataTest.cpp
+++ b/Tests/UnitTests/Core/Data/LLDataTest.cpp
@@ -357,41 +357,21 @@ TEST_F(LLDataTest, HaveSameDimensions)
 
 TEST_F(LLDataTest, Accessors)
 {
-    for (size_t i = 0; i < fl_data_1d->getTotalSize(); ++i) {
+    for (size_t i = 0; i < fl_data_1d->getTotalSize(); ++i)
         (*fl_data_1d)[i] = 0.5f * i;
-    }
     EXPECT_FLOAT_EQ((*fl_data_1d)[2], 1.0f);
 
-    int* coordinate = new int[1];
-    coordinate[0] = 2;
-    EXPECT_FLOAT_EQ(fl_data_1d->atCoordinate(coordinate), 1.0f);
     EXPECT_FLOAT_EQ(fl_data_1d->getTotalSum(), 22.5f);
 
-    for (size_t i = 0; i < db_data_3d->getTotalSize(); ++i) {
+    for (size_t i = 0; i < db_data_3d->getTotalSize(); ++i)
         (*db_data_3d)[i] = 0.2 * i;
-    }
 
     EXPECT_DOUBLE_EQ((*db_data_3d)[2], 0.4);
-    int* coordinate3d = new int[3];
-    coordinate3d[0] = 0;
-    coordinate3d[1] = 0;
-    coordinate3d[2] = 2;
 
-    EXPECT_DOUBLE_EQ(db_data_3d->atCoordinate(coordinate3d), 0.4);
     EXPECT_DOUBLE_EQ(db_data_3d->getTotalSum(), 899700.0);
 
-    for (size_t i = 0; i < matrix_data_2d->getTotalSize(); ++i) {
+    for (size_t i = 0; i < matrix_data_2d->getTotalSize(); ++i)
         (*matrix_data_2d)[i] = static_cast<double>(i) * Eigen::Matrix2d::Identity();
-    }
 
     EXPECT_EQ((*matrix_data_2d)[2], 2 * Eigen::Matrix2d::Identity());
-    int* coordinate2d = new int[2];
-    coordinate2d[0] = 0;
-    coordinate2d[1] = 2;
-
-    EXPECT_EQ(matrix_data_2d->atCoordinate(coordinate2d), 2 * Eigen::Matrix2d::Identity());
-
-    delete[] coordinate;
-    delete[] coordinate3d;
-    delete[] coordinate2d;
 }
diff --git a/auto/Wrap/doxygenDevice.i b/auto/Wrap/doxygenDevice.i
index 101f8116a42..d6b0bd66cbe 100644
--- a/auto/Wrap/doxygenDevice.i
+++ b/auto/Wrap/doxygenDevice.i
@@ -1542,12 +1542,6 @@ C++ includes: LLData.h
 %feature("docstring")  LLData::meanValues "LLData<double> LLData< T >::meanValues() const
 ";
 
-%feature("docstring")  LLData::atCoordinate "T & LLData< T >::atCoordinate(int *coordinate)
-";
-
-%feature("docstring")  LLData::atCoordinate "const T & LLData< T >::atCoordinate(int *coordinate) const
-";
-
 %feature("docstring")  LLData::setAll "void LLData< T >::setAll(const T &value)
 ";
 
-- 
GitLab


From 46c18c91b0a32f4bc0d7c0bc03ee1d6b10a2dd07 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 15:34:47 +0200
Subject: [PATCH 05/19] rm LLData<>::convertCoordinate

---
 Device/Data/LLData.h | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/Device/Data/LLData.h b/Device/Data/LLData.h
index e6fe5bc0db6..2de4772cc2a 100644
--- a/Device/Data/LLData.h
+++ b/Device/Data/LLData.h
@@ -62,7 +62,6 @@ private:
     void allocate(size_t rank, const int* dimensions);
     void clear();
     bool checkDimensions(size_t rank, const int* dimensions) const;
-    size_t convertCoordinate(int* coordinate) const;
     void swapContents(LLData<T>& other);
     T getZeroElement() const;
 
@@ -228,17 +227,6 @@ template <class T> inline bool LLData<T>::checkDimensions(size_t rank, const int
                        [](const int& dim) -> bool { return dim > 0; });
 }
 
-template <class T> inline size_t LLData<T>::convertCoordinate(int* coordinate) const
-{
-    size_t offset = 1;
-    size_t result = 0;
-    for (size_t i = m_rank; i > 0; --i) {
-        result += offset * coordinate[i - 1];
-        offset *= m_dims[i - 1];
-    }
-    return result;
-}
-
 template <class T> void LLData<T>::swapContents(LLData<T>& other)
 {
     std::swap(this->m_rank, other.m_rank);
-- 
GitLab


From 7fb43854c352cf3e1b95752f4d83bd18dd05abae Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 16:00:19 +0200
Subject: [PATCH 06/19] - {}

---
 Device/Data/OutputData.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Device/Data/OutputData.h b/Device/Data/OutputData.h
index 94e67df8458..7924913a22f 100644
--- a/Device/Data/OutputData.h
+++ b/Device/Data/OutputData.h
@@ -544,9 +544,8 @@ template <class T> void OutputData<T>::allocate()
     delete m_ll_data;
     size_t rank = m_value_axes.size();
     int* dims = new int[rank];
-    for (size_t i = 0; i < rank; ++i) {
+    for (size_t i = 0; i < rank; ++i)
         dims[i] = (int)axis(i).size();
-    }
     m_ll_data = new LLData<T>(rank, dims);
     T default_value = {};
     m_ll_data->setAll(default_value);
-- 
GitLab


From 795f83f923faaa424bc16c4825c30031172c7df2 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 16:13:27 +0200
Subject: [PATCH 07/19] SimDataPair c'tors: arguments -> &&

---
 Core/Fitting/SimDataPair.cpp | 7 ++++---
 Core/Fitting/SimDataPair.h   | 6 +++---
 auto/Wrap/doxygenCore.i      | 4 ++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/Core/Fitting/SimDataPair.cpp b/Core/Fitting/SimDataPair.cpp
index ab70d32228b..c135e793758 100644
--- a/Core/Fitting/SimDataPair.cpp
+++ b/Core/Fitting/SimDataPair.cpp
@@ -35,8 +35,9 @@ std::unique_ptr<OutputData<double>> initUserWeights(const OutputData<double>& sh
 }
 } // namespace
 
+
 SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                         std::unique_ptr<OutputData<double>> uncertainties, double user_weight)
+                         std::unique_ptr<OutputData<double>>&& uncertainties, double user_weight)
     : m_simulation_builder(builder)
     , m_raw_data(data.clone())
     , m_raw_uncertainties(std::move(uncertainties))
@@ -46,8 +47,8 @@ SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>&
 }
 
 SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                         std::unique_ptr<OutputData<double>> uncertainties,
-                         std::unique_ptr<OutputData<double>> user_weights)
+                         std::unique_ptr<OutputData<double>>&& uncertainties,
+                         std::unique_ptr<OutputData<double>>&& user_weights)
     : m_simulation_builder(builder)
     , m_raw_data(data.clone())
     , m_raw_uncertainties(std::move(uncertainties))
diff --git a/Core/Fitting/SimDataPair.h b/Core/Fitting/SimDataPair.h
index ee8b6dcf1be..3bff6a9c0b9 100644
--- a/Core/Fitting/SimDataPair.h
+++ b/Core/Fitting/SimDataPair.h
@@ -30,11 +30,11 @@ template <class T> class OutputData;
 class SimDataPair {
 public:
     SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                std::unique_ptr<OutputData<double>> uncertainties, double user_weight = 1.0);
+                std::unique_ptr<OutputData<double>>&& uncertainties, double user_weight = 1.0);
 
     SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                std::unique_ptr<OutputData<double>> uncertainties,
-                std::unique_ptr<OutputData<double>> user_weights);
+                std::unique_ptr<OutputData<double>>&& uncertainties,
+                std::unique_ptr<OutputData<double>>&& user_weights);
 
     SimDataPair(SimDataPair&& other);
 
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 53973c2d342..c0a18f6d886 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -1876,10 +1876,10 @@ Holds pair of simulation/experimental data to fit.
 C++ includes: SimDataPair.h
 ";
 
-%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> uncertainties, double user_weight=1.0)
+%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> &&uncertainties, double user_weight=1.0)
 ";
 
-%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> uncertainties, std::unique_ptr< OutputData< double >> user_weights)
+%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> &&uncertainties, std::unique_ptr< OutputData< double >> &&user_weights)
 ";
 
 %feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(SimDataPair &&other)
-- 
GitLab


From 2752cd487e209caabc564b6af7a85e817d54cf27 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 16:30:29 +0200
Subject: [PATCH 08/19] merge local fct

---
 Core/Fitting/SimDataPair.cpp | 41 ++++++++++++++++--------------------
 Core/Fitting/SimDataPair.h   |  1 -
 2 files changed, 18 insertions(+), 24 deletions(-)

diff --git a/Core/Fitting/SimDataPair.cpp b/Core/Fitting/SimDataPair.cpp
index c135e793758..61ce1760249 100644
--- a/Core/Fitting/SimDataPair.cpp
+++ b/Core/Fitting/SimDataPair.cpp
@@ -81,7 +81,24 @@ void SimDataPair::runSimulation(const mumufit::Parameters& params)
     m_simulation->runSimulation();
     m_sim_data = m_simulation->result();
 
-    initResultArrays();
+    if (m_exp_data.size() != 0 && m_uncertainties.size() != 0 && m_user_weights.size() != 0)
+        return;
+
+    if (!m_simulation || m_sim_data.size() == 0)
+        throwInitializationException("initResultArrays");
+
+    m_exp_data = m_simulation->convertData(*m_raw_data, true);
+
+    if (containsUncertainties()) {
+        m_uncertainties = m_simulation->convertData(*m_raw_uncertainties, true);
+    } else {
+        const IUnitConverter& converter = m_sim_data.converter();
+        std::unique_ptr<OutputData<double>> dummy_array =
+            UnitConverterUtils::createOutputData(converter, converter.defaultUnits());
+        m_uncertainties = SimulationResult(*dummy_array, converter);
+    }
+
+    m_user_weights = m_simulation->convertData(*m_raw_user_weights, true);
 }
 
 bool SimDataPair::containsUncertainties() const
@@ -177,28 +194,6 @@ std::vector<double> SimDataPair::user_weights_array() const
     return m_user_weights.data()->getRawDataVector();
 }
 
-void SimDataPair::initResultArrays()
-{
-    if (m_exp_data.size() != 0 && m_uncertainties.size() != 0 && m_user_weights.size() != 0)
-        return;
-
-    if (!m_simulation || m_sim_data.size() == 0)
-        throwInitializationException("initResultArrays");
-
-    m_exp_data = m_simulation->convertData(*m_raw_data, true);
-
-    if (containsUncertainties()) {
-        m_uncertainties = m_simulation->convertData(*m_raw_uncertainties, true);
-    } else {
-        const IUnitConverter& converter = m_sim_data.converter();
-        std::unique_ptr<OutputData<double>> dummy_array =
-            UnitConverterUtils::createOutputData(converter, converter.defaultUnits());
-        m_uncertainties = SimulationResult(*dummy_array, converter);
-    }
-
-    m_user_weights = m_simulation->convertData(*m_raw_user_weights, true);
-}
-
 void SimDataPair::validate() const
 {
     if (!m_simulation_builder)
diff --git a/Core/Fitting/SimDataPair.h b/Core/Fitting/SimDataPair.h
index 3bff6a9c0b9..69f03dc9845 100644
--- a/Core/Fitting/SimDataPair.h
+++ b/Core/Fitting/SimDataPair.h
@@ -83,7 +83,6 @@ public:
     std::vector<double> user_weights_array() const;
 
 private:
-    void initResultArrays();
     void validate() const;
 
     //! ISimulation builder from the user to construct simulation for given set of parameters.
-- 
GitLab


From 8cf10612fac298c1ec38edf42a6eaaef4173de5c Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 16:55:21 +0200
Subject: [PATCH 09/19] SimDataPair: better names for c'tor args

---
 Core/Fitting/SimDataPair.cpp | 16 ++++++++--------
 Core/Fitting/SimDataPair.h   |  8 ++++----
 auto/Wrap/doxygenCore.i      |  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Core/Fitting/SimDataPair.cpp b/Core/Fitting/SimDataPair.cpp
index 61ce1760249..865fbc5c01d 100644
--- a/Core/Fitting/SimDataPair.cpp
+++ b/Core/Fitting/SimDataPair.cpp
@@ -36,22 +36,22 @@ std::unique_ptr<OutputData<double>> initUserWeights(const OutputData<double>& sh
 } // namespace
 
 
-SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                         std::unique_ptr<OutputData<double>>&& uncertainties, double user_weight)
+SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data,
+                         std::unique_ptr<OutputData<double>>&& raw_stdv, double user_weight)
     : m_simulation_builder(builder)
-    , m_raw_data(data.clone())
-    , m_raw_uncertainties(std::move(uncertainties))
+    , m_raw_data(raw_data.clone())
+    , m_raw_uncertainties(std::move(raw_stdv))
 {
     m_raw_user_weights = initUserWeights(*m_raw_data, user_weight);
     validate();
 }
 
-SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                         std::unique_ptr<OutputData<double>>&& uncertainties,
+SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data,
+                         std::unique_ptr<OutputData<double>>&& raw_stdv,
                          std::unique_ptr<OutputData<double>>&& user_weights)
     : m_simulation_builder(builder)
-    , m_raw_data(data.clone())
-    , m_raw_uncertainties(std::move(uncertainties))
+    , m_raw_data(raw_data.clone())
+    , m_raw_uncertainties(std::move(raw_stdv))
     , m_raw_user_weights(std::move(user_weights))
 {
     if (!m_raw_user_weights)
diff --git a/Core/Fitting/SimDataPair.h b/Core/Fitting/SimDataPair.h
index 69f03dc9845..59f76fd3c8e 100644
--- a/Core/Fitting/SimDataPair.h
+++ b/Core/Fitting/SimDataPair.h
@@ -29,11 +29,11 @@ template <class T> class OutputData;
 
 class SimDataPair {
 public:
-    SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                std::unique_ptr<OutputData<double>>&& uncertainties, double user_weight = 1.0);
+    SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data,
+                std::unique_ptr<OutputData<double>>&& raw_stdv, double user_weight = 1.0);
 
-    SimDataPair(simulation_builder_t builder, const OutputData<double>& data,
-                std::unique_ptr<OutputData<double>>&& uncertainties,
+    SimDataPair(simulation_builder_t builder, const OutputData<double>& raw_data,
+                std::unique_ptr<OutputData<double>>&& raw_stdv,
                 std::unique_ptr<OutputData<double>>&& user_weights);
 
     SimDataPair(SimDataPair&& other);
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index c0a18f6d886..bb50ed75718 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -1876,10 +1876,10 @@ Holds pair of simulation/experimental data to fit.
 C++ includes: SimDataPair.h
 ";
 
-%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> &&uncertainties, double user_weight=1.0)
+%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &raw_data, std::unique_ptr< OutputData< double >> &&raw_stdv, double user_weight=1.0)
 ";
 
-%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> &&uncertainties, std::unique_ptr< OutputData< double >> &&user_weights)
+%feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(simulation_builder_t builder, const OutputData< double > &raw_data, std::unique_ptr< OutputData< double >> &&raw_stdv, std::unique_ptr< OutputData< double >> &&user_weights)
 ";
 
 %feature("docstring")  SimDataPair::SimDataPair "SimDataPair::SimDataPair(SimDataPair &&other)
-- 
GitLab


From 506962767bf73c06248989ff6f81e020ca282437 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 20:03:59 +0200
Subject: [PATCH 10/19] better argument names

---
 Core/Fitting/FitObjective.cpp | 6 +++---
 Core/Fitting/FitObjective.h   | 2 +-
 auto/Wrap/doxygenCore.i       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Core/Fitting/FitObjective.cpp b/Core/Fitting/FitObjective.cpp
index 16b667afdf6..96e911855e7 100644
--- a/Core/Fitting/FitObjective.cpp
+++ b/Core/Fitting/FitObjective.cpp
@@ -68,14 +68,14 @@ FitObjective::~FitObjective() = default;
 //! Constructs simulation/data pair for later fit.
 //! @param builder: simulation builder capable of producing simulations
 //! @param data: experimental data array
-//! @param uncertainties: data uncertainties array
+//! @param stdv: data uncertainties array
 //! @param weight: weight of dataset in metric calculations
 void FitObjective::addSimulationAndData(simulation_builder_t builder,
                                         const OutputData<double>& data,
-                                        std::unique_ptr<OutputData<double>> uncertainties,
+                                        std::unique_ptr<OutputData<double>>&& stdv,
                                         double weight)
 {
-    m_fit_objects.emplace_back(builder, data, std::move(uncertainties), weight);
+    m_fit_objects.emplace_back(builder, data, std::move(stdv), weight);
 }
 
 double FitObjective::evaluate(const mumufit::Parameters& params)
diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h
index 143edb0b024..c53e70ffd4b 100644
--- a/Core/Fitting/FitObjective.h
+++ b/Core/Fitting/FitObjective.h
@@ -39,7 +39,7 @@ public:
 
 #ifndef SWIG
     void addSimulationAndData(simulation_builder_t builder, const OutputData<double>& data,
-                              std::unique_ptr<OutputData<double>> uncertainties,
+                              std::unique_ptr<OutputData<double>>&& stdv,
                               double weight = 1.0);
 #endif
     //! Constructs simulation/data pair for later fit.
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index bb50ed75718..40beb55fa81 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -469,7 +469,7 @@ C++ includes: FitObjective.h
 %feature("docstring")  FitObjective::~FitObjective "FitObjective::~FitObjective()
 ";
 
-%feature("docstring")  FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> uncertainties, double weight=1.0)
+%feature("docstring")  FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(simulation_builder_t builder, const OutputData< double > &data, std::unique_ptr< OutputData< double >> &&stdv, double weight=1.0)
 
 Constructs simulation/data pair for later fit.
 
-- 
GitLab


From eda673cb54f7f9c718f45d8cdc080aa3f5a11162 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 20:50:27 +0200
Subject: [PATCH 11/19] 'stdv' ctd

---
 Core/Fitting/FitObjective.h         | 6 +++---
 auto/Wrap/doxygenCore.i             | 6 +++---
 auto/Wrap/libBornAgainCore.py       | 8 ++++----
 auto/Wrap/libBornAgainCore_wrap.cpp | 8 ++++----
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h
index c53e70ffd4b..fd1cbb55c20 100644
--- a/Core/Fitting/FitObjective.h
+++ b/Core/Fitting/FitObjective.h
@@ -56,14 +56,14 @@ public:
     //! Constructs simulation/data pair for later fit.
     //! @param callback: simulation builder capable of producing simulations
     //! @param data: experimental data array
-    //! @param uncertainties: data uncertainties array
+    //! @param stdv: data uncertainties array
     //! @param weight: weight of dataset in metric calculations
     template <class T>
-    void addSimulationAndData(PyBuilderCallback& callback, const T& data, const T& uncertainties,
+    void addSimulationAndData(PyBuilderCallback& callback, const T& data, const T& stdv,
                               double weight = 1.0)
     {
         addSimulationAndData(simulationBuilder(callback), *ArrayUtils::createData(data),
-                             ArrayUtils::createData(uncertainties), weight);
+                             ArrayUtils::createData(stdv), weight);
     }
 
     virtual double evaluate(const mumufit::Parameters& params);
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 40beb55fa81..484bafcfe67 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -482,7 +482,7 @@ simulation builder capable of producing simulations
 data: 
 experimental data array
 
-uncertainties: 
+stdv: 
 data uncertainties array
 
 weight: 
@@ -506,7 +506,7 @@ weight:
 weight of dataset in metric calculations 
 ";
 
-%feature("docstring")  FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &uncertainties, double weight=1.0)
+%feature("docstring")  FitObjective::addSimulationAndData "void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &stdv, double weight=1.0)
 
 Constructs simulation/data pair for later fit.
 
@@ -519,7 +519,7 @@ simulation builder capable of producing simulations
 data: 
 experimental data array
 
-uncertainties: 
+stdv: 
 data uncertainties array
 
 weight: 
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index 840b498dcbb..7bf66ef0e1d 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -2964,10 +2964,10 @@ class FitObjective(object):
     def addSimulationAndData_cpp(self, *args):
         r"""
         addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, double weight=1.0)
-        addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t uncertainties, double weight=1.0)
+        addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t stdv, double weight=1.0)
         addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, double weight=1.0)
-        addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t uncertainties, double weight=1.0)
-        void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &uncertainties, double weight=1.0)
+        addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t stdv, double weight=1.0)
+        void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &stdv, double weight=1.0)
 
         Constructs simulation/data pair for later fit.
 
@@ -2980,7 +2980,7 @@ class FitObjective(object):
         data: 
         experimental data array
 
-        uncertainties: 
+        stdv: 
         data uncertainties array
 
         weight: 
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index 0f598d034f2..0538a88b414 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -44337,10 +44337,10 @@ static PyMethodDef SwigMethods[] = {
 	 { "FitObjective_availableMetricOptions", _wrap_FitObjective_availableMetricOptions, METH_NOARGS, "FitObjective_availableMetricOptions() -> std::string"},
 	 { "FitObjective_addSimulationAndData_cpp", _wrap_FitObjective_addSimulationAndData_cpp, METH_VARARGS, "\n"
 		"FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, double weight=1.0)\n"
-		"FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t uncertainties, double weight=1.0)\n"
+		"FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble1d_t data, vdouble1d_t stdv, double weight=1.0)\n"
 		"FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, double weight=1.0)\n"
-		"FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t uncertainties, double weight=1.0)\n"
-		"void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &uncertainties, double weight=1.0)\n"
+		"FitObjective_addSimulationAndData_cpp(FitObjective self, PyBuilderCallback callback, vdouble2d_t data, vdouble2d_t stdv, double weight=1.0)\n"
+		"void FitObjective::addSimulationAndData(PyBuilderCallback &callback, const T &data, const T &stdv, double weight=1.0)\n"
 		"\n"
 		"Constructs simulation/data pair for later fit.\n"
 		"\n"
@@ -44353,7 +44353,7 @@ static PyMethodDef SwigMethods[] = {
 		"data: \n"
 		"experimental data array\n"
 		"\n"
-		"uncertainties: \n"
+		"stdv: \n"
 		"data uncertainties array\n"
 		"\n"
 		"weight: \n"
-- 
GitLab


From e721326b077987917576a8e5b1b3c8ca8ff33ffc Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:02:45 +0200
Subject: [PATCH 12/19] ctd

---
 Core/Fitting/ObjectiveMetric.cpp | 20 ++++++++++----------
 Core/Fitting/ObjectiveMetric.h   | 12 ++++++------
 auto/Wrap/doxygenCore.i          | 20 ++++++++++----------
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/Core/Fitting/ObjectiveMetric.cpp b/Core/Fitting/ObjectiveMetric.cpp
index fa5801c5490..45714c4a235 100644
--- a/Core/Fitting/ObjectiveMetric.cpp
+++ b/Core/Fitting/ObjectiveMetric.cpp
@@ -45,10 +45,10 @@ void checkIntegrity(const std::vector<double>& sim_data, const std::vector<doubl
 }
 
 void checkIntegrity(const std::vector<double>& sim_data, const std::vector<double>& exp_data,
-                    const std::vector<double>& uncertainties,
+                    const std::vector<double>& exp_stdv,
                     const std::vector<double>& weight_factors)
 {
-    if (sim_data.size() != uncertainties.size())
+    if (sim_data.size() != exp_stdv.size())
         throw std::runtime_error("Error in ObjectiveMetric: input arrays have different sizes");
 
     checkIntegrity(sim_data, exp_data, weight_factors);
@@ -86,16 +86,16 @@ Chi2Metric* Chi2Metric::clone() const
 }
 
 double Chi2Metric::computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data,
-                                     std::vector<double> uncertainties,
+                                     std::vector<double> exp_stdv,
                                      std::vector<double> weight_factors) const
 {
-    checkIntegrity(sim_data, exp_data, uncertainties, weight_factors);
+    checkIntegrity(sim_data, exp_data, exp_stdv, weight_factors);
 
     double result = 0.0;
     auto norm_fun = norm();
     for (size_t i = 0, sim_size = sim_data.size(); i < sim_size; ++i)
-        if (exp_data[i] >= 0.0 && weight_factors[i] > 0.0 && uncertainties[i] > 0.0)
-            result += norm_fun((exp_data[i] - sim_data[i]) / uncertainties[i]) * weight_factors[i];
+        if (exp_data[i] >= 0.0 && weight_factors[i] > 0.0 && exp_stdv[i] > 0.0)
+            result += norm_fun((exp_data[i] - sim_data[i]) / exp_stdv[i]) * weight_factors[i];
 
     return std::isfinite(result) ? result : double_max;
 }
@@ -152,20 +152,20 @@ LogMetric* LogMetric::clone() const
 }
 
 double LogMetric::computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data,
-                                    std::vector<double> uncertainties,
+                                    std::vector<double> exp_stdv,
                                     std::vector<double> weight_factors) const
 {
-    checkIntegrity(sim_data, exp_data, uncertainties, weight_factors);
+    checkIntegrity(sim_data, exp_data, exp_stdv, weight_factors);
 
     double result = 0.0;
     auto norm_fun = norm();
     for (size_t i = 0, sim_size = sim_data.size(); i < sim_size; ++i) {
-        if (weight_factors[i] <= 0.0 || exp_data[i] < 0.0 || uncertainties[i] <= 0.0)
+        if (weight_factors[i] <= 0.0 || exp_data[i] < 0.0 || exp_stdv[i] <= 0.0)
             continue;
         const double sim_val = std::max(double_min, sim_data[i]);
         const double exp_val = std::max(double_min, exp_data[i]);
         double value = std::log10(sim_val) - std::log10(exp_val);
-        value *= exp_val * ln10 / uncertainties[i];
+        value *= exp_val * ln10 / exp_stdv[i];
         result += norm_fun(value) * weight_factors[i];
     }
 
diff --git a/Core/Fitting/ObjectiveMetric.h b/Core/Fitting/ObjectiveMetric.h
index 37dc185ea9d..62bfb93a203 100644
--- a/Core/Fitting/ObjectiveMetric.h
+++ b/Core/Fitting/ObjectiveMetric.h
@@ -44,11 +44,11 @@ public:
     //! All arrays involved in the computation must be of the same size.
     //! @param sim_data: array with simulated intensities.
     //! @param exp_data: array with intensity values obtained from an experiment.
-    //! @param uncertainties: array with experimental data uncertainties.
+    //! @param exp_stdv: array with experimental data uncertainties.
     //! @param weight_factors: user-defined weighting factors. Used linearly, no matter which norm
     //! is chosen.
     virtual double computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data,
-                                     std::vector<double> uncertainties,
+                                     std::vector<double> exp_stdv,
                                      std::vector<double> weight_factors) const = 0;
 
     //! Computes metric value from data arrays. Negative values in exp_data
@@ -84,11 +84,11 @@ public:
     //! All arrays involved in the computation must be of the same size.
     //! @param sim_data: array with simulated intensities.
     //! @param exp_data: array with intensity values obtained from an experiment.
-    //! @param uncertainties: array with experimental data uncertainties.
+    //! @param exp_stdv: array with experimental data uncertainties.
     //! @param weight_factors: user-defined weighting factors. Used linearly, no matter which norm
     //! is chosen.
     double computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data,
-                             std::vector<double> uncertainties,
+                             std::vector<double> exp_stdv,
                              std::vector<double> weight_factors) const override;
 
     //! Computes metric value from data arrays. Negative values in exp_data
@@ -142,11 +142,11 @@ public:
     //! All arrays involved in the computation must be of the same size.
     //! @param sim_data: array with simulated intensities.
     //! @param exp_data: array with intensity values obtained from an experiment.
-    //! @param uncertainties: array with experimental data uncertainties.
+    //! @param exp_stdv: array with experimental data uncertainties.
     //! @param weight_factors: user-defined weighting factors. Used linearly, no matter which norm
     //! is chosen.
     double computeFromArrays(std::vector<double> sim_data, std::vector<double> exp_data,
-                             std::vector<double> uncertainties,
+                             std::vector<double> exp_stdv,
                              std::vector<double> weight_factors) const override;
 
     //! Computes metric value from data arrays. Negative values in exp_data
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 484bafcfe67..a38556ab3e7 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -127,7 +127,7 @@ C++ includes: ObjectiveMetric.h
 %feature("docstring")  Chi2Metric::clone "Chi2Metric * Chi2Metric::clone() const override
 ";
 
-%feature("docstring")  Chi2Metric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override
+%feature("docstring")  Chi2Metric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const 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.
 
@@ -140,7 +140,7 @@ array with simulated intensities.
 exp_data: 
 array with intensity values obtained from an experiment.
 
-uncertainties: 
+exp_stdv: 
 array with experimental data uncertainties.
 
 weight_factors: 
@@ -1294,7 +1294,7 @@ C++ includes: ObjectiveMetric.h
 %feature("docstring")  LogMetric::clone "LogMetric * LogMetric::clone() const override
 ";
 
-%feature("docstring")  LogMetric::computeFromArrays "double LogMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override
+%feature("docstring")  LogMetric::computeFromArrays "double LogMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const 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.
 
@@ -1307,7 +1307,7 @@ array with simulated intensities.
 exp_data: 
 array with intensity values obtained from an experiment.
 
-uncertainties: 
+exp_stdv: 
 array with experimental data uncertainties.
 
 weight_factors: 
@@ -1385,7 +1385,7 @@ use_weights:
 boolean, defines if data uncertainties should be taken into account 
 ";
 
-%feature("docstring")  ObjectiveMetric::computeFromArrays "virtual double ObjectiveMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const =0
+%feature("docstring")  ObjectiveMetric::computeFromArrays "virtual double ObjectiveMetric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const =0
 
 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.
 
@@ -1398,7 +1398,7 @@ array with simulated intensities.
 exp_data: 
 array with intensity values obtained from an experiment.
 
-uncertainties: 
+exp_stdv: 
 array with experimental data uncertainties.
 
 weight_factors: 
@@ -1554,7 +1554,7 @@ weight_factors:
 user-defined weighting factors. Used linearly, no matter which norm is chosen. 
 ";
 
-%feature("docstring")  PoissonLikeMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override
+%feature("docstring")  PoissonLikeMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const 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.
 
@@ -1567,7 +1567,7 @@ array with simulated intensities.
 exp_data: 
 array with intensity values obtained from an experiment.
 
-uncertainties: 
+exp_stdv: 
 array with experimental data uncertainties.
 
 weight_factors: 
@@ -1768,7 +1768,7 @@ weight_factors:
 user-defined weighting factors. Used linearly, no matter which norm is chosen. 
 ";
 
-%feature("docstring")  RelativeDifferenceMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > uncertainties, std::vector< double > weight_factors) const override
+%feature("docstring")  RelativeDifferenceMetric::computeFromArrays "double Chi2Metric::computeFromArrays(std::vector< double > sim_data, std::vector< double > exp_data, std::vector< double > exp_stdv, std::vector< double > weight_factors) const 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.
 
@@ -1781,7 +1781,7 @@ array with simulated intensities.
 exp_data: 
 array with intensity values obtained from an experiment.
 
-uncertainties: 
+exp_stdv: 
 array with experimental data uncertainties.
 
 weight_factors: 
-- 
GitLab


From 23d1a50f3af74d333492a61e2b39f807c4514fbd Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:13:25 +0200
Subject: [PATCH 13/19] disambiguate fct name -> SimDataPair::execSimulation

---
 Core/Fitting/FitObjective.cpp                    | 2 +-
 Core/Fitting/SimDataPair.cpp                     | 2 +-
 Core/Fitting/SimDataPair.h                       | 2 +-
 Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp | 8 ++++----
 auto/Wrap/doxygenCore.i                          | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/Core/Fitting/FitObjective.cpp b/Core/Fitting/FitObjective.cpp
index 96e911855e7..bb8afadd077 100644
--- a/Core/Fitting/FitObjective.cpp
+++ b/Core/Fitting/FitObjective.cpp
@@ -235,7 +235,7 @@ void FitObjective::run_simulations(const mumufit::Parameters& params)
                                  "No simulation/data defined.");
 
     for (auto& obj : m_fit_objects)
-        obj.runSimulation(params);
+        obj.execSimulation(params);
 }
 
 void FitObjective::setChiSquaredModule(const IChiSquaredModule& module)
diff --git a/Core/Fitting/SimDataPair.cpp b/Core/Fitting/SimDataPair.cpp
index 865fbc5c01d..b9063810423 100644
--- a/Core/Fitting/SimDataPair.cpp
+++ b/Core/Fitting/SimDataPair.cpp
@@ -75,7 +75,7 @@ SimDataPair::SimDataPair(SimDataPair&& other)
 
 SimDataPair::~SimDataPair() = default;
 
-void SimDataPair::runSimulation(const mumufit::Parameters& params)
+void SimDataPair::execSimulation(const mumufit::Parameters& params)
 {
     m_simulation = m_simulation_builder(params);
     m_simulation->runSimulation();
diff --git a/Core/Fitting/SimDataPair.h b/Core/Fitting/SimDataPair.h
index 59f76fd3c8e..5cb38313613 100644
--- a/Core/Fitting/SimDataPair.h
+++ b/Core/Fitting/SimDataPair.h
@@ -40,7 +40,7 @@ public:
 
     ~SimDataPair();
 
-    void runSimulation(const mumufit::Parameters& params);
+    void execSimulation(const mumufit::Parameters& params);
 
     bool containsUncertainties() const;
 
diff --git a/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp b/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp
index a7e7511fc34..4f6c1602b86 100644
--- a/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp
+++ b/Tests/UnitTests/Core/Fitting/SimDataPairTest.cpp
@@ -30,7 +30,7 @@ TEST_F(SimDataPairTest, standardPair)
     // calling builder once
     mumufit::Parameters params;
     EXPECT_EQ(helper.m_builder_calls, 0u);
-    obj.runSimulation(params);
+    obj.execSimulation(params);
     EXPECT_EQ(helper.m_builder_calls, 1u);
 
     // checking simulated and experimental data
@@ -48,7 +48,7 @@ TEST_F(SimDataPairTest, standardPair)
     EXPECT_DOUBLE_EQ(std::accumulate(array.begin(), array.end(), 0), expected_size * exp_value);
 
     // calling builder second time
-    obj.runSimulation(params);
+    obj.execSimulation(params);
     EXPECT_EQ(helper.m_builder_calls, 2u);
 
     // checking arrays
@@ -75,7 +75,7 @@ TEST_F(SimDataPairTest, moveTest)
     // calling builder once
     mumufit::Parameters params;
     EXPECT_EQ(helper.m_builder_calls, 0u);
-    obj.runSimulation(params);
+    obj.execSimulation(params);
     EXPECT_EQ(helper.m_builder_calls, 1u);
 
     // checking simulated and experimental data
@@ -97,7 +97,7 @@ TEST_F(SimDataPairTest, moveTest)
     EXPECT_EQ(moved.experimentalData().size(), expected_size);
 
     // calling clone's builder once
-    moved.runSimulation(params);
+    moved.execSimulation(params);
     EXPECT_EQ(helper.m_builder_calls, 2u);
 
     // checking simulated and experimental data
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index a38556ab3e7..e2fc18203a6 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -1888,7 +1888,7 @@ C++ includes: SimDataPair.h
 %feature("docstring")  SimDataPair::~SimDataPair "SimDataPair::~SimDataPair()
 ";
 
-%feature("docstring")  SimDataPair::runSimulation "void SimDataPair::runSimulation(const mumufit::Parameters &params)
+%feature("docstring")  SimDataPair::execSimulation "void SimDataPair::execSimulation(const mumufit::Parameters &params)
 ";
 
 %feature("docstring")  SimDataPair::containsUncertainties "bool SimDataPair::containsUncertainties() const
-- 
GitLab


From 1e62464dfe40127f1807537073a4d36dc42059e0 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:18:12 +0200
Subject: [PATCH 14/19] corr doxy syntax

---
 Core/Fitting/FitObjective.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h
index fd1cbb55c20..58beb000cfd 100644
--- a/Core/Fitting/FitObjective.h
+++ b/Core/Fitting/FitObjective.h
@@ -27,7 +27,7 @@ class ObjectiveMetric;
 class PyBuilderCallback;
 class PyObserverCallback;
 
-//! Holds vector of `SimDataPair`s (experimental data and simulation results) for use in fitting.
+//! Holds vector of SimDataPair%s (experimental data and simulation results) for use in fitting.
 //! @ingroup fitting_internal
 
 class FitObjective {
-- 
GitLab


From 5ceb5d499b7ec1f00a89299df6c4bdf1c1046ff8 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:31:52 +0200
Subject: [PATCH 15/19] fit example: standardise get_simulation

---
 Examples/fit52_Advanced/multiple_datasets.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/Examples/fit52_Advanced/multiple_datasets.py b/Examples/fit52_Advanced/multiple_datasets.py
index d4698f71099..932cfbf74f1 100755
--- a/Examples/fit52_Advanced/multiple_datasets.py
+++ b/Examples/fit52_Advanced/multiple_datasets.py
@@ -44,12 +44,9 @@ def get_simulation(params):
     """
     incident_angle = params["incident_angle"]
 
-    simulation = ba.GISASSimulation()
-    simulation.setDetectorParameters(50, -1.5*deg, 1.5*deg, 50, 0, 2*deg)
-    simulation.setBeamParameters(0.1*nm, incident_angle, 0)
-    simulation.beam().setIntensity(1e+08)
-    simulation.setSample(get_sample(params))
-    return simulation
+    beam = ba.Beam(1e8, 0.1*nm, ba.Direction(incident_angle, 0))
+    detector = ba.SphericalDetector(50, -1.5*deg, 1.5*deg, 50, 0, 2*deg)
+    return ba.GISASSimulation(beam, get_sample(params), detector)
 
 
 def simulation1(params):
-- 
GitLab


From 298f3b9e6e6f341e7a16a020f24108baa179feb3 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:34:08 +0200
Subject: [PATCH 16/19] FitObjective: class comment

---
 Core/Fitting/FitObjective.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h
index 58beb000cfd..524eacb7bd8 100644
--- a/Core/Fitting/FitObjective.h
+++ b/Core/Fitting/FitObjective.h
@@ -28,6 +28,9 @@ class PyBuilderCallback;
 class PyObserverCallback;
 
 //! Holds vector of SimDataPair%s (experimental data and simulation results) for use in fitting.
+//! Thereby supports simultaneous fitting of several data sets and model functions,
+//! as demonstrated in example fit52/multiple_datasets.
+
 //! @ingroup fitting_internal
 
 class FitObjective {
-- 
GitLab


From 0d7d835572d71d8dfb9841a2995a286b29e09d4f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:39:58 +0200
Subject: [PATCH 17/19] uniform fct names: execSimulations calls execSimulation

---
 Core/Fitting/FitObjective.cpp       |  6 +++---
 Core/Fitting/FitObjective.h         |  2 +-
 auto/Wrap/doxygenCore.i             |  4 ++--
 auto/Wrap/libBornAgainCore.py       | 10 +++++-----
 auto/Wrap/libBornAgainCore_wrap.cpp | 18 +++++++++---------
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/Core/Fitting/FitObjective.cpp b/Core/Fitting/FitObjective.cpp
index bb8afadd077..92b4286d0e8 100644
--- a/Core/Fitting/FitObjective.cpp
+++ b/Core/Fitting/FitObjective.cpp
@@ -80,7 +80,7 @@ void FitObjective::addSimulationAndData(simulation_builder_t builder,
 
 double FitObjective::evaluate(const mumufit::Parameters& params)
 {
-    run_simulations(params);
+    execSimulations(params);
     const double metric_value = m_metric_module->compute(m_fit_objects, params.size());
     m_fit_status->update(params, metric_value);
     return metric_value;
@@ -225,13 +225,13 @@ bool FitObjective::isFirstIteration() const
     return iterationInfo().iterationCount() == 1;
 }
 
-void FitObjective::run_simulations(const mumufit::Parameters& params)
+void FitObjective::execSimulations(const mumufit::Parameters& params)
 {
     if (m_fit_status->isInterrupted())
         throw std::runtime_error("Fitting was interrupted by the user.");
 
     if (m_fit_objects.empty())
-        throw std::runtime_error("FitObjective::run_simulations() -> Error. "
+        throw std::runtime_error("FitObjective::execSimulations() -> Error. "
                                  "No simulation/data defined.");
 
     for (auto& obj : m_fit_objects)
diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h
index 524eacb7bd8..1e54d375d7a 100644
--- a/Core/Fitting/FitObjective.h
+++ b/Core/Fitting/FitObjective.h
@@ -101,7 +101,7 @@ public:
 
     unsigned fitObjectCount() const;
 
-    void run_simulations(const mumufit::Parameters& params);
+    void execSimulations(const mumufit::Parameters& params);
 
     void setChiSquaredModule(const IChiSquaredModule& module);
 
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index e2fc18203a6..1638b8b9f7b 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -458,7 +458,7 @@ C++ includes: DWBASingleComputation.h
 // File: classFitObjective.xml
 %feature("docstring") FitObjective "
 
-Holds vector of   SimDataPairs (experimental data and simulation results) for use in fitting.
+Holds vector of  SimDataPairs (experimental data and simulation results) for use in fitting. Thereby supports simultaneous fitting of several data sets and model functions, as demonstrated in example fit52/multiple_datasets.
 
 C++ includes: FitObjective.h
 ";
@@ -604,7 +604,7 @@ Should be explicitely called on last iteration to notify all observers.
 %feature("docstring")  FitObjective::fitObjectCount "unsigned FitObjective::fitObjectCount() const
 ";
 
-%feature("docstring")  FitObjective::run_simulations "void FitObjective::run_simulations(const mumufit::Parameters &params)
+%feature("docstring")  FitObjective::execSimulations "void FitObjective::execSimulations(const mumufit::Parameters &params)
 ";
 
 %feature("docstring")  FitObjective::setChiSquaredModule "void FitObjective::setChiSquaredModule(const IChiSquaredModule &module)
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index 7bf66ef0e1d..6752f0d7019 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -2723,7 +2723,7 @@ class FitObjective(object):
     r"""
 
 
-    Holds vector of   SimDataPairs (experimental data and simulation results) for use in fitting.
+    Holds vector of  SimDataPairs (experimental data and simulation results) for use in fitting. Thereby supports simultaneous fitting of several data sets and model functions, as demonstrated in example fit52/multiple_datasets.
 
     C++ includes: FitObjective.h
 
@@ -2911,13 +2911,13 @@ class FitObjective(object):
         """
         return _libBornAgainCore.FitObjective_fitObjectCount(self)
 
-    def run_simulations(self, params):
+    def execSimulations(self, params):
         r"""
-        run_simulations(FitObjective self, mumufit::Parameters const & params)
-        void FitObjective::run_simulations(const mumufit::Parameters &params)
+        execSimulations(FitObjective self, mumufit::Parameters const & params)
+        void FitObjective::execSimulations(const mumufit::Parameters &params)
 
         """
-        return _libBornAgainCore.FitObjective_run_simulations(self, params)
+        return _libBornAgainCore.FitObjective_execSimulations(self, params)
 
     def setChiSquaredModule(self, module):
         r"""
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index 0538a88b414..fadf7924af7 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -35768,7 +35768,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_FitObjective_run_simulations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_FitObjective_execSimulations(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   FitObjective *arg1 = (FitObjective *) 0 ;
   mumufit::Parameters *arg2 = 0 ;
@@ -35778,21 +35778,21 @@ SWIGINTERN PyObject *_wrap_FitObjective_run_simulations(PyObject *SWIGUNUSEDPARM
   int res2 = 0 ;
   PyObject *swig_obj[2] ;
   
-  if (!SWIG_Python_UnpackTuple(args, "FitObjective_run_simulations", 2, 2, swig_obj)) SWIG_fail;
+  if (!SWIG_Python_UnpackTuple(args, "FitObjective_execSimulations", 2, 2, swig_obj)) SWIG_fail;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_FitObjective, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitObjective_run_simulations" "', argument " "1"" of type '" "FitObjective *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "FitObjective_execSimulations" "', argument " "1"" of type '" "FitObjective *""'"); 
   }
   arg1 = reinterpret_cast< FitObjective * >(argp1);
   res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_mumufit__Parameters,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FitObjective_run_simulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "FitObjective_execSimulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FitObjective_run_simulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "FitObjective_execSimulations" "', argument " "2"" of type '" "mumufit::Parameters const &""'"); 
   }
   arg2 = reinterpret_cast< mumufit::Parameters * >(argp2);
-  (arg1)->run_simulations((mumufit::Parameters const &)*arg2);
+  (arg1)->execSimulations((mumufit::Parameters const &)*arg2);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -44304,9 +44304,9 @@ static PyMethodDef SwigMethods[] = {
 		"unsigned FitObjective::fitObjectCount() const\n"
 		"\n"
 		""},
-	 { "FitObjective_run_simulations", _wrap_FitObjective_run_simulations, METH_VARARGS, "\n"
-		"FitObjective_run_simulations(FitObjective self, mumufit::Parameters const & params)\n"
-		"void FitObjective::run_simulations(const mumufit::Parameters &params)\n"
+	 { "FitObjective_execSimulations", _wrap_FitObjective_execSimulations, METH_VARARGS, "\n"
+		"FitObjective_execSimulations(FitObjective self, mumufit::Parameters const & params)\n"
+		"void FitObjective::execSimulations(const mumufit::Parameters &params)\n"
 		"\n"
 		""},
 	 { "FitObjective_setChiSquaredModule", _wrap_FitObjective_setChiSquaredModule, METH_VARARGS, "\n"
-- 
GitLab


From e4450a35ead9dcc796e566ec29119e0d09b0eb40 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 21:50:52 +0200
Subject: [PATCH 18/19] typo in comments

---
 Core/Fitting/FitObjective.h                   | 2 +-
 Core/Fitting/FitStatus.h                      | 2 +-
 auto/Wrap/doxygenCore.i                       | 4 ++--
 auto/Wrap/libBornAgainCore.py                 | 2 +-
 auto/Wrap/libBornAgainCore_wrap.cpp           | 2 +-
 mvvm/model/mvvm/model/sessionitem.cpp         | 2 +-
 mvvm/model/mvvm/model/sessionmodel.cpp        | 2 +-
 mvvm/tests/testmodel/threadsafestack.test.cpp | 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Core/Fitting/FitObjective.h b/Core/Fitting/FitObjective.h
index 1e54d375d7a..c0be95b08d2 100644
--- a/Core/Fitting/FitObjective.h
+++ b/Core/Fitting/FitObjective.h
@@ -96,7 +96,7 @@ public:
 
     mumufit::MinimizerResult minimizerResult() const;
 
-    //! Should be explicitely called on last iteration to notify all observers.
+    //! Should be explicitly called on last iteration to notify all observers.
     void finalize(const mumufit::MinimizerResult& result);
 
     unsigned fitObjectCount() const;
diff --git a/Core/Fitting/FitStatus.h b/Core/Fitting/FitStatus.h
index 27aa2cda6ce..4468b8d112e 100644
--- a/Core/Fitting/FitStatus.h
+++ b/Core/Fitting/FitStatus.h
@@ -54,7 +54,7 @@ public:
 
     mumufit::MinimizerResult minimizerResult() const;
 
-    //! Should be explicitely called on last iteration to notify all observers.
+    //! Should be explicitly called on last iteration to notify all observers.
     void finalize(const mumufit::MinimizerResult& result);
 
 private:
diff --git a/auto/Wrap/doxygenCore.i b/auto/Wrap/doxygenCore.i
index 1638b8b9f7b..50ccdc2bc1a 100644
--- a/auto/Wrap/doxygenCore.i
+++ b/auto/Wrap/doxygenCore.i
@@ -598,7 +598,7 @@ Initializes observer callback to be called on every_nth fit iteration.
 
 %feature("docstring")  FitObjective::finalize "void FitObjective::finalize(const mumufit::MinimizerResult &result)
 
-Should be explicitely called on last iteration to notify all observers. 
+Should be explicitly called on last iteration to notify all observers. 
 ";
 
 %feature("docstring")  FitObjective::fitObjectCount "unsigned FitObjective::fitObjectCount() const
@@ -756,7 +756,7 @@ C++ includes: FitStatus.h
 
 %feature("docstring")  FitStatus::finalize "void FitStatus::finalize(const mumufit::MinimizerResult &result)
 
-Should be explicitely called on last iteration to notify all observers. 
+Should be explicitly called on last iteration to notify all observers. 
 ";
 
 
diff --git a/auto/Wrap/libBornAgainCore.py b/auto/Wrap/libBornAgainCore.py
index 6752f0d7019..1df514b3094 100644
--- a/auto/Wrap/libBornAgainCore.py
+++ b/auto/Wrap/libBornAgainCore.py
@@ -2898,7 +2898,7 @@ class FitObjective(object):
         finalize_cpp(FitObjective self, mumufit::MinimizerResult const & result)
         void FitObjective::finalize(const mumufit::MinimizerResult &result)
 
-        Should be explicitely called on last iteration to notify all observers. 
+        Should be explicitly called on last iteration to notify all observers. 
 
         """
         return _libBornAgainCore.FitObjective_finalize_cpp(self, result)
diff --git a/auto/Wrap/libBornAgainCore_wrap.cpp b/auto/Wrap/libBornAgainCore_wrap.cpp
index fadf7924af7..0a41cb1676e 100644
--- a/auto/Wrap/libBornAgainCore_wrap.cpp
+++ b/auto/Wrap/libBornAgainCore_wrap.cpp
@@ -44296,7 +44296,7 @@ static PyMethodDef SwigMethods[] = {
 		"FitObjective_finalize_cpp(FitObjective self, mumufit::MinimizerResult const & result)\n"
 		"void FitObjective::finalize(const mumufit::MinimizerResult &result)\n"
 		"\n"
-		"Should be explicitely called on last iteration to notify all observers. \n"
+		"Should be explicitly called on last iteration to notify all observers. \n"
 		"\n"
 		""},
 	 { "FitObjective_fitObjectCount", _wrap_FitObjective_fitObjectCount, METH_O, "\n"
diff --git a/mvvm/model/mvvm/model/sessionitem.cpp b/mvvm/model/mvvm/model/sessionitem.cpp
index 24de2f4d76f..65c4fd39ca9 100644
--- a/mvvm/model/mvvm/model/sessionitem.cpp
+++ b/mvvm/model/mvvm/model/sessionitem.cpp
@@ -331,7 +331,7 @@ SessionItem* SessionItem::setEditorType(const std::string& editor_type)
 bool SessionItem::set_data_internal(const Variant& value, int role, bool direct)
 {
     // If model is present, and undo stack is enabled, will forward request to the model
-    // (unless user explicitely asks for direct processing via direct=true flag).
+    // (unless user explicitly asks for direct processing via direct=true flag).
     const bool act_through_model = !direct && model() && model()->undoStack();
     return act_through_model ? model()->setData(this, value, role)
                              : p_impl->do_setData(value, role);
diff --git a/mvvm/model/mvvm/model/sessionmodel.cpp b/mvvm/model/mvvm/model/sessionmodel.cpp
index f8257d65c1f..a822c930ec8 100644
--- a/mvvm/model/mvvm/model/sessionmodel.cpp
+++ b/mvvm/model/mvvm/model/sessionmodel.cpp
@@ -72,7 +72,7 @@ SessionModel::SessionModel(std::string model_type, std::shared_ptr<ItemPool> poo
 
 SessionModel::~SessionModel()
 {
-    // Explicitely call root item's destructor. It uses p_impl pointer during own descruction
+    // Explicitly call root item's destructor. It uses p_impl pointer during own descruction
     // and we have to keep pimpl pointer intact. Without line below will crash on MacOS because
     // of pecularities of MacOS libc++. See explanations here:
     // http://ibob.github.io/blog/2019/11/07/dont-use-unique_ptr-for-pimpl/
diff --git a/mvvm/tests/testmodel/threadsafestack.test.cpp b/mvvm/tests/testmodel/threadsafestack.test.cpp
index 08ecdbf24af..79c014d771f 100644
--- a/mvvm/tests/testmodel/threadsafestack.test.cpp
+++ b/mvvm/tests/testmodel/threadsafestack.test.cpp
@@ -126,7 +126,7 @@ TEST_F(ThreadSafeStackTest, concurentPushAndPop)
     }
 }
 
-//! Explicitely terminate waiting (concurrent mode).
+//! Explicitly terminate waiting (concurrent mode).
 
 TEST_F(ThreadSafeStackTest, concurentStopWaiting)
 {
-- 
GitLab


From 18a8ed0dad732fa071bfb40c00fabed732999796 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 19 Apr 2021 22:33:17 +0200
Subject: [PATCH 19/19] ASSERT instead of throw in non-exposed class

---
 Device/Detector/SimpleUnitConverters.cpp | 25 ++++++------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/Device/Detector/SimpleUnitConverters.cpp b/Device/Detector/SimpleUnitConverters.cpp
index 78602cc11bb..6ec4b5f46bd 100644
--- a/Device/Detector/SimpleUnitConverters.cpp
+++ b/Device/Detector/SimpleUnitConverters.cpp
@@ -125,10 +125,7 @@ void UnitConverterSimple::addDetectorAxis(const IDetector& detector, size_t i_ax
 SphericalConverter::SphericalConverter(const SphericalDetector& detector, const Beam& beam)
     : UnitConverterSimple(beam)
 {
-    if (detector.dimension() != 2)
-        throw std::runtime_error("Error in SphericalConverter constructor: "
-                                 "detector has wrong dimension: "
-                                 + std::to_string(static_cast<int>(detector.dimension())));
+    ASSERT(detector.dimension() == 2);
     addDetectorAxis(detector, 0);
     addDetectorAxis(detector, 1);
 }
@@ -209,10 +206,7 @@ std::vector<std::map<Axes::Units, std::string>> SphericalConverter::createNameMa
 RectangularConverter::RectangularConverter(const RectangularDetector& detector, const Beam& beam)
     : UnitConverterSimple(beam)
 {
-    if (detector.dimension() != 2)
-        throw std::runtime_error("Error in RectangularConverter constructor: "
-                                 "detector has wrong dimension: "
-                                 + std::to_string(static_cast<int>(detector.dimension())));
+    ASSERT(detector.dimension() == 2);
     addDetectorAxis(detector, 0);
     addDetectorAxis(detector, 1);
     m_detector_pixel.reset(detector.regionOfInterestPixel());
@@ -307,9 +301,7 @@ double RectangularConverter::axisAngle(size_t i_axis, kvector_t k_f) const
         return k_f.phi();
     if (i_axis == 1)
         return M_PI_2 - k_f.theta();
-    throw std::runtime_error("Error in RectangularConverter::axisAngle: "
-                             "incorrect axis index: "
-                             + std::to_string(static_cast<int>(i_axis)));
+    ASSERT(0);
 }
 
 //  ************************************************************************************************
@@ -320,10 +312,7 @@ OffSpecularConverter::OffSpecularConverter(const IDetector2D& detector, const Be
                                            const IAxis& alpha_axis)
     : UnitConverterSimple(beam)
 {
-    if (detector.dimension() != 2)
-        throw std::runtime_error("Error in OffSpecularConverter constructor: "
-                                 "detector has wrong dimension: "
-                                 + std::to_string(static_cast<int>(detector.dimension())));
+    ASSERT(detector.dimension() == 2);
     addAxisData(axisName(0), alpha_axis.lowerBound(), alpha_axis.upperBound(), defaultUnits(),
                 alpha_axis.size());
     addDetectorYAxis(detector);
@@ -391,10 +380,8 @@ void OffSpecularConverter::addDetectorYAxis(const IDetector2D& detector)
         const double alpha_f_min = P_new_axis->lowerBound();
         const double alpha_f_max = P_new_axis->upperBound();
         addAxisData(axis_name, alpha_f_min, alpha_f_max, defaultUnits(), P_new_axis->size());
-    } else {
-        throw std::runtime_error("Error in OffSpecularConverter::addDetectorYAxis: "
-                                 "wrong detector type");
-    }
+    } else
+        ASSERT(0);
 }
 
 //  ************************************************************************************************
-- 
GitLab