From d7a92bed4276cb40481b3db990ab9524adf5beb1 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 09:58:53 +0100
Subject: [PATCH 01/12] rm unused fct

---
 Sim/Scan/ScanResolution.cpp | 6 ------
 Sim/Scan/ScanResolution.h   | 1 -
 2 files changed, 7 deletions(-)

diff --git a/Sim/Scan/ScanResolution.cpp b/Sim/Scan/ScanResolution.cpp
index 30cfd931490..69dc7d2aebf 100644
--- a/Sim/Scan/ScanResolution.cpp
+++ b/Sim/Scan/ScanResolution.cpp
@@ -40,12 +40,6 @@ std::vector<double> ScanResolution::stdDevs(double, size_t n_times) const
     return std::vector<double>(n_times, m_stddev);
 }
 
-std::vector<double> ScanResolution::stdDevs(const std::vector<double>& mean) const
-{
-    ASSERT(!mean.empty());
-    return std::vector<double>(mean.size(), m_stddev);
-}
-
 size_t ScanResolution::nSamples() const
 {
     return m_distr ? m_distr->nSamples() : 1L;
diff --git a/Sim/Scan/ScanResolution.h b/Sim/Scan/ScanResolution.h
index 49a92799b8f..87ef10643bf 100644
--- a/Sim/Scan/ScanResolution.h
+++ b/Sim/Scan/ScanResolution.h
@@ -39,7 +39,6 @@ public:
     std::vector<ParameterSample> resolutionSamples(double mean) const;
 
     std::vector<double> stdDevs(double mean, size_t n_times) const;
-    std::vector<double> stdDevs(const std::vector<double>& mean) const;
 
     //... For export:
     double delta() const
-- 
GitLab


From d921479f861de85bd53121297f479f63d0a87e98 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 10:11:38 +0100
Subject: [PATCH 02/12] simplify

---
 GUI/Model/FromCore/ItemizeSimulation.cpp | 4 ++--
 Sim/Scan/ScanResolution.cpp              | 5 -----
 Sim/Scan/ScanResolution.h                | 5 ++++-
 3 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp
index 54afb3b82f1..a73551fd0d1 100644
--- a/GUI/Model/FromCore/ItemizeSimulation.cpp
+++ b/GUI/Model/FromCore/ItemizeSimulation.cpp
@@ -453,13 +453,13 @@ SpecularInstrumentItem* createSpecularInstrumentItem(const SpecularSimulation& s
     if (const ScanResolution* resolution = alphaScan->wavelengthResolution())
         if (const IRangedDistribution* rdis = resolution->rdistribution()) {
             double mean = alphaScan->wavelength();
-            double std_dev = resolution->stdDevs(mean, 1).front();
+            double std_dev = resolution->stdDev();
             addRangedDistributionToItem(beam_item->wavelengthItem(), *rdis, mean, std_dev);
         }
 
     if (const ScanResolution* resolution = alphaScan->angleResolution())
         if (const IRangedDistribution* rdis = resolution->rdistribution()) {
-            double std_dev = resolution->stdDevs(0.0, 1).front();
+            double std_dev = resolution->stdDev();
             addRangedDistributionToItem(beam_item->inclinationAngleItem(), *rdis, 0, std_dev);
         }
 
diff --git a/Sim/Scan/ScanResolution.cpp b/Sim/Scan/ScanResolution.cpp
index 69dc7d2aebf..66fb477641e 100644
--- a/Sim/Scan/ScanResolution.cpp
+++ b/Sim/Scan/ScanResolution.cpp
@@ -35,11 +35,6 @@ std::vector<ParameterSample> ScanResolution::resolutionSamples(double mean) cons
     return rdistribution()->generateSamples(mean, m_stddev);
 }
 
-std::vector<double> ScanResolution::stdDevs(double, size_t n_times) const
-{
-    return std::vector<double>(n_times, m_stddev);
-}
-
 size_t ScanResolution::nSamples() const
 {
     return m_distr ? m_distr->nSamples() : 1L;
diff --git a/Sim/Scan/ScanResolution.h b/Sim/Scan/ScanResolution.h
index 87ef10643bf..a707bf5aa62 100644
--- a/Sim/Scan/ScanResolution.h
+++ b/Sim/Scan/ScanResolution.h
@@ -38,7 +38,10 @@ public:
 
     std::vector<ParameterSample> resolutionSamples(double mean) const;
 
-    std::vector<double> stdDevs(double mean, size_t n_times) const;
+    double stdDev() const
+    {
+        return m_stddev;
+    }
 
     //... For export:
     double delta() const
-- 
GitLab


From b11e8637976fb9573469395b21cb631a2e727be1 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 10:12:56 +0100
Subject: [PATCH 03/12] merge fcts

---
 Sim/Export/SimulationToPython.cpp | 4 ++--
 Sim/Scan/ScanResolution.h         | 6 ------
 2 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/Sim/Export/SimulationToPython.cpp b/Sim/Export/SimulationToPython.cpp
index 8bfc5fd8546..1f2a35694b1 100644
--- a/Sim/Export/SimulationToPython.cpp
+++ b/Sim/Export/SimulationToPython.cpp
@@ -97,12 +97,12 @@ std::string defineAlphaScan(const AlphaScan& scan)
     if (const auto* r = scan.angleResolution(); r && r->rdistribution()) {
         result << Py::Fmt2::printRangedDistribution(*r->rdistribution()) << "\n";
         result << indent() << "scan.setAbsoluteAngularResolution(distribution, "
-               << Py::Fmt::printDouble(r->delta()) << ")\n";
+               << Py::Fmt::printDouble(r->stdDev()) << ")\n";
     }
     if (const auto* r = scan.wavelengthResolution(); r && r->rdistribution()) {
         result << Py::Fmt2::printRangedDistribution(*r->rdistribution()) << "\n";
         result << indent() << "scan.setWavelengthResolution(distribution, "
-               << Py::Fmt::printDouble(r->delta()) << ")\n";
+               << Py::Fmt::printDouble(r->stdDev()) << ")\n";
     }
     return result.str();
 }
diff --git a/Sim/Scan/ScanResolution.h b/Sim/Scan/ScanResolution.h
index a707bf5aa62..237cdacaf61 100644
--- a/Sim/Scan/ScanResolution.h
+++ b/Sim/Scan/ScanResolution.h
@@ -43,12 +43,6 @@ public:
         return m_stddev;
     }
 
-    //... For export:
-    double delta() const
-    {
-        return m_stddev;
-    }
-
 protected:
     std::unique_ptr<IRangedDistribution> m_distr; //!< basic distribution function
     double m_stddev;                              //!< deltas for computing resolutions
-- 
GitLab


From 061197d26700670d0567eb8e7ebaa422f3549bb2 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 10:17:38 +0100
Subject: [PATCH 04/12] rm includes

---
 GUI/Model/ToCore/SimulationToCore.cpp | 1 -
 Tests/SimFactory/MakeSimulations.cpp  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/GUI/Model/ToCore/SimulationToCore.cpp b/GUI/Model/ToCore/SimulationToCore.cpp
index c5f26fc8c3f..dd1620c9906 100644
--- a/GUI/Model/ToCore/SimulationToCore.cpp
+++ b/GUI/Model/ToCore/SimulationToCore.cpp
@@ -33,7 +33,6 @@
 #include "Sample/Multilayer/MultiLayer.h"
 #include "Sim/Background/IBackground.h"
 #include "Sim/Scan/AlphaScan.h"
-#include "Sim/Scan/ScanResolution.h"
 #include "Sim/Simulation/includeSimulations.h"
 
 namespace {
diff --git a/Tests/SimFactory/MakeSimulations.cpp b/Tests/SimFactory/MakeSimulations.cpp
index 5dbd4bb0999..545f04c549d 100644
--- a/Tests/SimFactory/MakeSimulations.cpp
+++ b/Tests/SimFactory/MakeSimulations.cpp
@@ -31,7 +31,6 @@
 #include "Sim/Background/ConstantBackground.h"
 #include "Sim/Scan/AlphaScan.h"
 #include "Sim/Scan/QzScan.h"
-#include "Sim/Scan/ScanResolution.h"
 #include "Sim/Simulation/includeSimulations.h"
 #include <algorithm>
 #include <map>
-- 
GitLab


From d1939bfe7628b02dacee2c039c2423debb0a45b7 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 10:25:01 +0100
Subject: [PATCH 05/12] dont expose ScanResolution to Swig

---
 Wrap/Swig/libBornAgainSim.i        |   2 -
 auto/Wrap/libBornAgainSim.py       |  17 ---
 auto/Wrap/libBornAgainSim_wrap.cpp | 223 ++++++++---------------------
 3 files changed, 60 insertions(+), 182 deletions(-)

diff --git a/Wrap/Swig/libBornAgainSim.i b/Wrap/Swig/libBornAgainSim.i
index ea3585ad3da..65d7e1e1f13 100644
--- a/Wrap/Swig/libBornAgainSim.i
+++ b/Wrap/Swig/libBornAgainSim.i
@@ -70,7 +70,6 @@
 #include "Sim/Residual/VarianceFunctions.h"
 #include "Sim/Scan/AlphaScan.h"
 #include "Sim/Scan/QzScan.h"
-#include "Sim/Scan/ScanResolution.h"
 #include "Sim/Simulation/DepthprobeSimulation.h"
 #include "Sim/Simulation/ScatteringSimulation.h"
 #include "Sim/Simulation/OffspecSimulation.h"
@@ -97,7 +96,6 @@
 %include "Sim/Scan/ISpecularScan.h"
 %include "Sim/Scan/AlphaScan.h"
 %include "Sim/Scan/QzScan.h"
-%include "Sim/Scan/ScanResolution.h"
 
 %include "Sim/Simulation/ISimulation.h"
 %include "Sim/Simulation/ScatteringSimulation.h"
diff --git a/auto/Wrap/libBornAgainSim.py b/auto/Wrap/libBornAgainSim.py
index 0e33783cbe2..ecb9a91bb64 100644
--- a/auto/Wrap/libBornAgainSim.py
+++ b/auto/Wrap/libBornAgainSim.py
@@ -2619,23 +2619,6 @@ class QzScan(ISpecularScan):
 
 # Register QzScan in _libBornAgainSim:
 _libBornAgainSim.QzScan_swigregister(QzScan)
-class ScanResolution(libBornAgainBase.ICloneable):
-    r"""Proxy of C++ ScanResolution class."""
-
-    thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
-    __repr__ = _swig_repr
-
-    def __init__(self, distr, stddev):
-        r"""__init__(ScanResolution self, IRangedDistribution const & distr, double stddev) -> ScanResolution"""
-        _libBornAgainSim.ScanResolution_swiginit(self, _libBornAgainSim.new_ScanResolution(distr, stddev))
-    __swig_destroy__ = _libBornAgainSim.delete_ScanResolution
-
-    def clone(self):
-        r"""clone(ScanResolution self) -> ScanResolution"""
-        return _libBornAgainSim.ScanResolution_clone(self)
-
-# Register ScanResolution in _libBornAgainSim:
-_libBornAgainSim.ScanResolution_swigregister(ScanResolution)
 class ISimulation(libBornAgainParam.INode):
     r"""Proxy of C++ ISimulation class."""
 
diff --git a/auto/Wrap/libBornAgainSim_wrap.cpp b/auto/Wrap/libBornAgainSim_wrap.cpp
index 7f2022f9f6b..4aa4eddc5e5 100644
--- a/auto/Wrap/libBornAgainSim_wrap.cpp
+++ b/auto/Wrap/libBornAgainSim_wrap.cpp
@@ -3419,66 +3419,65 @@ namespace Swig {
 #define SWIGTYPE_p_QzScan swig_types[30]
 #define SWIGTYPE_p_RealLimits swig_types[31]
 #define SWIGTYPE_p_Rotation3DT_double_t swig_types[32]
-#define SWIGTYPE_p_ScanResolution swig_types[33]
-#define SWIGTYPE_p_ScatteringSimulation swig_types[34]
-#define SWIGTYPE_p_SimulationOptions swig_types[35]
-#define SWIGTYPE_p_SimulationResult swig_types[36]
-#define SWIGTYPE_p_SpecularSimulation swig_types[37]
-#define SWIGTYPE_p_VarianceConstantFunction swig_types[38]
-#define SWIGTYPE_p_VarianceSimFunction swig_types[39]
-#define SWIGTYPE_p_Vec3T_double_t swig_types[40]
-#define SWIGTYPE_p_Vec3T_int_t swig_types[41]
-#define SWIGTYPE_p_Vec3T_std__complexT_double_t_t swig_types[42]
-#define SWIGTYPE_p_allocator_type swig_types[43]
-#define SWIGTYPE_p_char swig_types[44]
-#define SWIGTYPE_p_difference_type swig_types[45]
-#define SWIGTYPE_p_first_type swig_types[46]
-#define SWIGTYPE_p_int swig_types[47]
-#define SWIGTYPE_p_key_type swig_types[48]
-#define SWIGTYPE_p_long_long swig_types[49]
-#define SWIGTYPE_p_mapped_type swig_types[50]
-#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[51]
-#define SWIGTYPE_p_mumufit__Parameters swig_types[52]
-#define SWIGTYPE_p_p_PyObject swig_types[53]
-#define SWIGTYPE_p_second_type swig_types[54]
-#define SWIGTYPE_p_short swig_types[55]
-#define SWIGTYPE_p_signed_char swig_types[56]
-#define SWIGTYPE_p_size_type swig_types[57]
-#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[58]
-#define SWIGTYPE_p_std__allocatorT_Vec3T_double_t_t swig_types[59]
-#define SWIGTYPE_p_std__allocatorT_double_t swig_types[60]
-#define SWIGTYPE_p_std__allocatorT_int_t swig_types[61]
-#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[62]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[63]
-#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[64]
-#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[65]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[66]
-#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[67]
-#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[68]
-#define SWIGTYPE_p_std__complexT_double_t swig_types[69]
-#define SWIGTYPE_p_std__invalid_argument swig_types[70]
-#define SWIGTYPE_p_std__lessT_std__string_t swig_types[71]
-#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[72]
-#define SWIGTYPE_p_std__pairT_double_double_t swig_types[73]
-#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[74]
-#define SWIGTYPE_p_std__vectorT_ParaMeta_std__allocatorT_ParaMeta_t_t swig_types[75]
-#define SWIGTYPE_p_std__vectorT_Vec3T_double_t_std__allocatorT_Vec3T_double_t_t_t swig_types[76]
-#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[77]
-#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[78]
-#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[79]
-#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[80]
-#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[81]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[82]
-#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[83]
-#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[84]
-#define SWIGTYPE_p_swig__SwigPyIterator swig_types[85]
-#define SWIGTYPE_p_unsigned_char swig_types[86]
-#define SWIGTYPE_p_unsigned_int swig_types[87]
-#define SWIGTYPE_p_unsigned_long_long swig_types[88]
-#define SWIGTYPE_p_unsigned_short swig_types[89]
-#define SWIGTYPE_p_value_type swig_types[90]
-static swig_type_info *swig_types[92];
-static swig_module_info swig_module = {swig_types, 91, 0, 0, 0, 0};
+#define SWIGTYPE_p_ScatteringSimulation swig_types[33]
+#define SWIGTYPE_p_SimulationOptions swig_types[34]
+#define SWIGTYPE_p_SimulationResult swig_types[35]
+#define SWIGTYPE_p_SpecularSimulation swig_types[36]
+#define SWIGTYPE_p_VarianceConstantFunction swig_types[37]
+#define SWIGTYPE_p_VarianceSimFunction swig_types[38]
+#define SWIGTYPE_p_Vec3T_double_t swig_types[39]
+#define SWIGTYPE_p_Vec3T_int_t swig_types[40]
+#define SWIGTYPE_p_Vec3T_std__complexT_double_t_t swig_types[41]
+#define SWIGTYPE_p_allocator_type swig_types[42]
+#define SWIGTYPE_p_char swig_types[43]
+#define SWIGTYPE_p_difference_type swig_types[44]
+#define SWIGTYPE_p_first_type swig_types[45]
+#define SWIGTYPE_p_int swig_types[46]
+#define SWIGTYPE_p_key_type swig_types[47]
+#define SWIGTYPE_p_long_long swig_types[48]
+#define SWIGTYPE_p_mapped_type swig_types[49]
+#define SWIGTYPE_p_mumufit__MinimizerResult swig_types[50]
+#define SWIGTYPE_p_mumufit__Parameters swig_types[51]
+#define SWIGTYPE_p_p_PyObject swig_types[52]
+#define SWIGTYPE_p_second_type swig_types[53]
+#define SWIGTYPE_p_short swig_types[54]
+#define SWIGTYPE_p_signed_char swig_types[55]
+#define SWIGTYPE_p_size_type swig_types[56]
+#define SWIGTYPE_p_std__allocatorT_INode_const_p_t swig_types[57]
+#define SWIGTYPE_p_std__allocatorT_Vec3T_double_t_t swig_types[58]
+#define SWIGTYPE_p_std__allocatorT_double_t swig_types[59]
+#define SWIGTYPE_p_std__allocatorT_int_t swig_types[60]
+#define SWIGTYPE_p_std__allocatorT_std__complexT_double_t_t swig_types[61]
+#define SWIGTYPE_p_std__allocatorT_std__pairT_double_double_t_t swig_types[62]
+#define SWIGTYPE_p_std__allocatorT_std__pairT_std__string_const_double_t_t swig_types[63]
+#define SWIGTYPE_p_std__allocatorT_std__string_t swig_types[64]
+#define SWIGTYPE_p_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t swig_types[65]
+#define SWIGTYPE_p_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t swig_types[66]
+#define SWIGTYPE_p_std__allocatorT_unsigned_long_t swig_types[67]
+#define SWIGTYPE_p_std__complexT_double_t swig_types[68]
+#define SWIGTYPE_p_std__invalid_argument swig_types[69]
+#define SWIGTYPE_p_std__lessT_std__string_t swig_types[70]
+#define SWIGTYPE_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t swig_types[71]
+#define SWIGTYPE_p_std__pairT_double_double_t swig_types[72]
+#define SWIGTYPE_p_std__vectorT_INode_const_p_std__allocatorT_INode_const_p_t_t swig_types[73]
+#define SWIGTYPE_p_std__vectorT_ParaMeta_std__allocatorT_ParaMeta_t_t swig_types[74]
+#define SWIGTYPE_p_std__vectorT_Vec3T_double_t_std__allocatorT_Vec3T_double_t_t_t swig_types[75]
+#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[76]
+#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[77]
+#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[78]
+#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[79]
+#define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[80]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t swig_types[81]
+#define SWIGTYPE_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t swig_types[82]
+#define SWIGTYPE_p_std__vectorT_unsigned_long_std__allocatorT_unsigned_long_t_t swig_types[83]
+#define SWIGTYPE_p_swig__SwigPyIterator swig_types[84]
+#define SWIGTYPE_p_unsigned_char swig_types[85]
+#define SWIGTYPE_p_unsigned_int swig_types[86]
+#define SWIGTYPE_p_unsigned_long_long swig_types[87]
+#define SWIGTYPE_p_unsigned_short swig_types[88]
+#define SWIGTYPE_p_value_type swig_types[89]
+static swig_type_info *swig_types[91];
+static swig_module_info swig_module = {swig_types, 90, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -7036,7 +7035,6 @@ SWIGINTERN void std_vector_Sl_std_pair_Sl_double_Sc_double_Sg__Sg__insert__SWIG_
 #include "Sim/Residual/VarianceFunctions.h"
 #include "Sim/Scan/AlphaScan.h"
 #include "Sim/Scan/QzScan.h"
-#include "Sim/Scan/ScanResolution.h"
 #include "Sim/Simulation/DepthprobeSimulation.h"
 #include "Sim/Simulation/ScatteringSimulation.h"
 #include "Sim/Simulation/OffspecSimulation.h"
@@ -32726,95 +32724,6 @@ SWIGINTERN PyObject *QzScan_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *a
   return SWIG_Python_InitShadowInstance(args);
 }
 
-SWIGINTERN PyObject *_wrap_new_ScanResolution(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  IRangedDistribution *arg1 = 0 ;
-  double arg2 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  double val2 ;
-  int ecode2 = 0 ;
-  PyObject *swig_obj[2] ;
-  ScanResolution *result = 0 ;
-  
-  if (!SWIG_Python_UnpackTuple(args, "new_ScanResolution", 2, 2, swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_IRangedDistribution,  0  | 0);
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ScanResolution" "', argument " "1"" of type '" "IRangedDistribution const &""'"); 
-  }
-  if (!argp1) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_ScanResolution" "', argument " "1"" of type '" "IRangedDistribution const &""'"); 
-  }
-  arg1 = reinterpret_cast< IRangedDistribution * >(argp1);
-  ecode2 = SWIG_AsVal_double(swig_obj[1], &val2);
-  if (!SWIG_IsOK(ecode2)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ScanResolution" "', argument " "2"" of type '" "double""'");
-  } 
-  arg2 = static_cast< double >(val2);
-  result = (ScanResolution *)new ScanResolution((IRangedDistribution const &)*arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ScanResolution, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_ScanResolution(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  ScanResolution *arg1 = (ScanResolution *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ScanResolution, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ScanResolution" "', argument " "1"" of type '" "ScanResolution *""'"); 
-  }
-  arg1 = reinterpret_cast< ScanResolution * >(argp1);
-  delete arg1;
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_ScanResolution_clone(PyObject *self, PyObject *args) {
-  PyObject *resultobj = 0;
-  ScanResolution *arg1 = (ScanResolution *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  ScanResolution *result = 0 ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_ScanResolution, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ScanResolution_clone" "', argument " "1"" of type '" "ScanResolution const *""'"); 
-  }
-  arg1 = reinterpret_cast< ScanResolution * >(argp1);
-  result = (ScanResolution *)((ScanResolution const *)arg1)->clone();
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ScanResolution, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *ScanResolution_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_ScanResolution, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *ScanResolution_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  return SWIG_Python_InitShadowInstance(args);
-}
-
 SWIGINTERN PyObject *_wrap_delete_ISimulation(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   ISimulation *arg1 = (ISimulation *) 0 ;
@@ -36731,11 +36640,6 @@ static PyMethodDef SwigMethods[] = {
 	 { "QzScan_setOffset", _wrap_QzScan_setOffset, METH_VARARGS, "QzScan_setOffset(QzScan self, double offset)"},
 	 { "QzScan_swigregister", QzScan_swigregister, METH_O, NULL},
 	 { "QzScan_swiginit", QzScan_swiginit, METH_VARARGS, NULL},
-	 { "new_ScanResolution", _wrap_new_ScanResolution, METH_VARARGS, "new_ScanResolution(IRangedDistribution const & distr, double stddev) -> ScanResolution"},
-	 { "delete_ScanResolution", _wrap_delete_ScanResolution, METH_O, "delete_ScanResolution(ScanResolution self)"},
-	 { "ScanResolution_clone", _wrap_ScanResolution_clone, METH_O, "ScanResolution_clone(ScanResolution self) -> ScanResolution"},
-	 { "ScanResolution_swigregister", ScanResolution_swigregister, METH_O, NULL},
-	 { "ScanResolution_swiginit", ScanResolution_swiginit, METH_VARARGS, NULL},
 	 { "delete_ISimulation", _wrap_delete_ISimulation, METH_O, "delete_ISimulation(ISimulation self)"},
 	 { "ISimulation_setBackground", _wrap_ISimulation_setBackground, METH_VARARGS, "ISimulation_setBackground(ISimulation self, IBackground bg)"},
 	 { "ISimulation_addParameterDistribution", _wrap_ISimulation_addParameterDistribution, METH_VARARGS, "\n"
@@ -36898,9 +36802,6 @@ static void *_p_PoissonBackgroundTo_p_ICloneable(void *x, int *SWIGUNUSEDPARM(ne
 static void *_p_QzScanTo_p_ICloneable(void *x, int *SWIGUNUSEDPARM(newmemory)) {
     return (void *)((ICloneable *) (ISpecularScan *) ((QzScan *) x));
 }
-static void *_p_ScanResolutionTo_p_ICloneable(void *x, int *SWIGUNUSEDPARM(newmemory)) {
-    return (void *)((ICloneable *)  ((ScanResolution *) x));
-}
 static void *_p_IntensityFunctionLogTo_p_IIntensityFunction(void *x, int *SWIGUNUSEDPARM(newmemory)) {
     return (void *)((IIntensityFunction *)  ((IntensityFunctionLog *) x));
 }
@@ -36991,7 +36892,6 @@ static swig_type_info _swigt__p_PyObserverCallback = {"_p_PyObserverCallback", "
 static swig_type_info _swigt__p_QzScan = {"_p_QzScan", "QzScan *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_RealLimits = {"_p_RealLimits", "RealLimits *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_Rotation3DT_double_t = {"_p_Rotation3DT_double_t", "RotMatrix *|Rotation3D< double > *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_ScanResolution = {"_p_ScanResolution", "ScanResolution *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ScatteringSimulation = {"_p_ScatteringSimulation", "ScatteringSimulation *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_SimulationOptions = {"_p_SimulationOptions", "SimulationOptions *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_SimulationResult = {"_p_SimulationResult", "SimulationResult *", 0, 0, (void*)0, 0};
@@ -37084,7 +36984,6 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_QzScan,
   &_swigt__p_RealLimits,
   &_swigt__p_Rotation3DT_double_t,
-  &_swigt__p_ScanResolution,
   &_swigt__p_ScatteringSimulation,
   &_swigt__p_SimulationOptions,
   &_swigt__p_SimulationResult,
@@ -37154,7 +37053,7 @@ static swig_cast_info _swigc__p_IAxis[] = {  {&_swigt__p_IAxis, 0, 0, 0},{0, 0,
 static swig_cast_info _swigc__p_IBackground[] = {  {&_swigt__p_IBackground, 0, 0, 0},  {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_IBackground, 0, 0},  {&_swigt__p_PoissonBackground, _p_PoissonBackgroundTo_p_IBackground, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IChiSquaredModule[] = {  {&_swigt__p_IChiSquaredModule, 0, 0, 0},  {&_swigt__p_ChiSquaredModule, _p_ChiSquaredModuleTo_p_IChiSquaredModule, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ISampleNode[] = {{&_swigt__p_ISampleNode, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_ICloneable[] = {  {&_swigt__p_ICloneable, 0, 0, 0},  {&_swigt__p_AlphaScan, _p_AlphaScanTo_p_ICloneable, 0, 0},  {&_swigt__p_ChiSquaredModule, _p_ChiSquaredModuleTo_p_ICloneable, 0, 0},  {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_ICloneable, 0, 0},  {&_swigt__p_IBackground, _p_IBackgroundTo_p_ICloneable, 0, 0},  {&_swigt__p_IChiSquaredModule, _p_IChiSquaredModuleTo_p_ICloneable, 0, 0},  {&_swigt__p_ISampleNode, _p_ISampleNodeTo_p_ICloneable, 0, 0},  {&_swigt__p_ISpecularScan, _p_ISpecularScanTo_p_ICloneable, 0, 0},  {&_swigt__p_PoissonBackground, _p_PoissonBackgroundTo_p_ICloneable, 0, 0},  {&_swigt__p_QzScan, _p_QzScanTo_p_ICloneable, 0, 0},  {&_swigt__p_ScanResolution, _p_ScanResolutionTo_p_ICloneable, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ICloneable[] = {  {&_swigt__p_ICloneable, 0, 0, 0},  {&_swigt__p_AlphaScan, _p_AlphaScanTo_p_ICloneable, 0, 0},  {&_swigt__p_ChiSquaredModule, _p_ChiSquaredModuleTo_p_ICloneable, 0, 0},  {&_swigt__p_ConstantBackground, _p_ConstantBackgroundTo_p_ICloneable, 0, 0},  {&_swigt__p_IBackground, _p_IBackgroundTo_p_ICloneable, 0, 0},  {&_swigt__p_IChiSquaredModule, _p_IChiSquaredModuleTo_p_ICloneable, 0, 0},  {&_swigt__p_ISampleNode, _p_ISampleNodeTo_p_ICloneable, 0, 0},  {&_swigt__p_ISpecularScan, _p_ISpecularScanTo_p_ICloneable, 0, 0},  {&_swigt__p_PoissonBackground, _p_PoissonBackgroundTo_p_ICloneable, 0, 0},  {&_swigt__p_QzScan, _p_QzScanTo_p_ICloneable, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IDetector[] = {  {&_swigt__p_IDetector, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IDistribution1D[] = {  {&_swigt__p_IDistribution1D, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_IFootprintFactor[] = {  {&_swigt__p_IFootprintFactor, 0, 0, 0},{0, 0, 0, 0}};
@@ -37177,7 +37076,6 @@ static swig_cast_info _swigc__p_PyObserverCallback[] = {  {&_swigt__p_PyObserver
 static swig_cast_info _swigc__p_QzScan[] = {  {&_swigt__p_QzScan, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_RealLimits[] = {  {&_swigt__p_RealLimits, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_Rotation3DT_double_t[] = {  {&_swigt__p_Rotation3DT_double_t, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_ScanResolution[] = {  {&_swigt__p_ScanResolution, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ScatteringSimulation[] = {  {&_swigt__p_ScatteringSimulation, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_SimulationOptions[] = {  {&_swigt__p_SimulationOptions, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_SimulationResult[] = {  {&_swigt__p_SimulationResult, 0, 0, 0},{0, 0, 0, 0}};
@@ -37270,7 +37168,6 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_QzScan,
   _swigc__p_RealLimits,
   _swigc__p_Rotation3DT_double_t,
-  _swigc__p_ScanResolution,
   _swigc__p_ScatteringSimulation,
   _swigc__p_SimulationOptions,
   _swigc__p_SimulationResult,
-- 
GitLab


From f7e8602a4c8fc20d0a7d3ec101b34584c3149732 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 10:46:35 +0100
Subject: [PATCH 06/12] no longer pass mean to sample generator

---
 Sim/Scan/AlphaScan.cpp | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/Sim/Scan/AlphaScan.cpp b/Sim/Scan/AlphaScan.cpp
index bcd791014a0..36f90222f9c 100644
--- a/Sim/Scan/AlphaScan.cpp
+++ b/Sim/Scan/AlphaScan.cpp
@@ -31,11 +31,11 @@ size_t nResolSamples(const ScanResolution* resol)
     return resol ? resol->nSamples() : 1L;
 }
 
-std::vector<ParameterSample> drawResolution(const ScanResolution* resol, double mean)
+std::vector<ParameterSample> drawResolution(const ScanResolution* resol)
 {
-    if (resol)
-        return resol->resolutionSamples(mean);
-    return {{mean, 1}};
+    if (!resol)
+        return {{0., 1}};
+    return resol->resolutionSamples(0.);
 }
 
 } // namespace
@@ -81,18 +81,16 @@ std::vector<SpecularElement> AlphaScan::generateElements() const
     result.reserve(nSteps());
 
     for (size_t i = 0; i < m_axis->size(); ++i) {
-        const std::vector<ParameterSample> lambdaDistrib =
-            drawResolution(m_lambda_distrib.get(), wavelength());
-        const std::vector<ParameterSample> alphaDistrib =
-            drawResolution(m_alpha_distrib.get(), m_axis->binCenters()[i]);
+        const std::vector<ParameterSample> lambdaDistrib = drawResolution(m_lambda_distrib.get());
+        const std::vector<ParameterSample> alphaDistrib = drawResolution(m_alpha_distrib.get());
         for (size_t j = 0; j < alphaDistrib.size(); ++j) {
-            const double alpha = alphaDistrib[j].value;
+            const double alpha = m_axis->binCenters()[i] + alphaDistrib[j].value;
             for (size_t k = 0; k < lambdaDistrib.size(); ++k) {
-                const double wavelength = lambdaDistrib[k].value;
-                const bool computable = wavelength >= 0 && alpha >= 0 && alpha <= M_PI_2;
+                const double lambda = wavelength() + lambdaDistrib[k].value;
+                const bool computable = lambda >= 0 && alpha >= 0 && alpha <= M_PI_2;
                 const double weight = alphaDistrib[j].weight * lambdaDistrib[k].weight;
                 const double footprint = m_footprint ? m_footprint->calculate(alpha) : 1;
-                result.emplace_back(SpecularElement::FromAlphaScan(i, weight, wavelength, -alpha,
+                result.emplace_back(SpecularElement::FromAlphaScan(i, weight, lambda, -alpha,
                                                                    footprint, polarizerMatrix(),
                                                                    analyzerMatrix(), computable));
             }
-- 
GitLab


From ba815cafe0cd52d2297c76ccbbffb65125614fbf Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 10:50:07 +0100
Subject: [PATCH 07/12] rm fct arg

---
 Sim/Scan/AlphaScan.cpp      | 2 +-
 Sim/Scan/QzScan.cpp         | 2 +-
 Sim/Scan/ScanResolution.cpp | 4 ++--
 Sim/Scan/ScanResolution.h   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Sim/Scan/AlphaScan.cpp b/Sim/Scan/AlphaScan.cpp
index 36f90222f9c..e4f70000f5a 100644
--- a/Sim/Scan/AlphaScan.cpp
+++ b/Sim/Scan/AlphaScan.cpp
@@ -35,7 +35,7 @@ std::vector<ParameterSample> drawResolution(const ScanResolution* resol)
 {
     if (!resol)
         return {{0., 1}};
-    return resol->resolutionSamples(0.);
+    return resol->resolutionSamples();
 }
 
 } // namespace
diff --git a/Sim/Scan/QzScan.cpp b/Sim/Scan/QzScan.cpp
index d2958d838e1..9127339eaa2 100644
--- a/Sim/Scan/QzScan.cpp
+++ b/Sim/Scan/QzScan.cpp
@@ -80,7 +80,7 @@ std::vector<SpecularElement> QzScan::generateElements() const
     for (size_t i = 0; i < m_axis->size(); ++i) {
         const double q0 = m_axis->binCenters()[i];
         if (m_resolution) {
-            const auto samples = m_resolution->resolutionSamples(0.);
+            const auto samples = m_resolution->resolutionSamples();
             for (size_t j = 0; j < samples.size(); ++j) {
                 double qz = q0;
                 ASSERT(m_resol_width.size() > 0);
diff --git a/Sim/Scan/ScanResolution.cpp b/Sim/Scan/ScanResolution.cpp
index 66fb477641e..fb1b71158b6 100644
--- a/Sim/Scan/ScanResolution.cpp
+++ b/Sim/Scan/ScanResolution.cpp
@@ -30,9 +30,9 @@ ScanResolution* ScanResolution::clone() const
     return new ScanResolution(*rdistribution(), m_stddev);
 }
 
-std::vector<ParameterSample> ScanResolution::resolutionSamples(double mean) const
+std::vector<ParameterSample> ScanResolution::resolutionSamples() const
 {
-    return rdistribution()->generateSamples(mean, m_stddev);
+    return rdistribution()->generateSamples(0., m_stddev);
 }
 
 size_t ScanResolution::nSamples() const
diff --git a/Sim/Scan/ScanResolution.h b/Sim/Scan/ScanResolution.h
index 237cdacaf61..a5b6fe0890c 100644
--- a/Sim/Scan/ScanResolution.h
+++ b/Sim/Scan/ScanResolution.h
@@ -36,7 +36,7 @@ public:
     }
     size_t nSamples() const;
 
-    std::vector<ParameterSample> resolutionSamples(double mean) const;
+    std::vector<ParameterSample> resolutionSamples() const;
 
     double stdDev() const
     {
-- 
GitLab


From 45897cd2777596e8badf19a477cbc5582120f86f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 11:14:25 +0100
Subject: [PATCH 08/12] rm 'Absolute' from setAngleResolution (missed before)

---
 .../fit/specular/RealLifeReflectometryFitting.py |  2 +-
 Examples/specular/BeamAngularDivergence.py       |  2 +-
 Examples/specular/BeamFullDivergence.py          |  2 +-
 GUI/Model/ToCore/SimulationToCore.cpp            |  2 +-
 Sim/Export/SimulationToPython.cpp                |  2 +-
 Sim/Scan/AlphaScan.cpp                           |  2 +-
 Sim/Scan/AlphaScan.h                             |  2 +-
 Tests/SimFactory/MakeSimulations.cpp             |  2 +-
 auto/Wrap/libBornAgainSim.py                     |  6 +++---
 auto/Wrap/libBornAgainSim_wrap.cpp               | 16 ++++++++--------
 10 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/Examples/fit/specular/RealLifeReflectometryFitting.py b/Examples/fit/specular/RealLifeReflectometryFitting.py
index c2f77907fbd..ddda1ba583a 100755
--- a/Examples/fit/specular/RealLifeReflectometryFitting.py
+++ b/Examples/fit/specular/RealLifeReflectometryFitting.py
@@ -97,7 +97,7 @@ def create_simulation(sample, arg_dict, bin_start, bin_end):
     footprint = ba.FootprintGauss(arg_dict["footprint_factor"])
 
     scan = ba.AlphaScan(wavelength, get_real_data_axis(bin_start, bin_end))
-    scan.setAbsoluteAngularResolution(alpha_distr, arg_dict["divergence"])
+    scan.setAngleResolution(alpha_distr, arg_dict["divergence"])
     scan.setFootprintFactor(footprint)
 
     simulation = ba.SpecularSimulation(scan, sample)
diff --git a/Examples/specular/BeamAngularDivergence.py b/Examples/specular/BeamAngularDivergence.py
index 9c132e36628..7852faa00ef 100755
--- a/Examples/specular/BeamAngularDivergence.py
+++ b/Examples/specular/BeamAngularDivergence.py
@@ -47,7 +47,7 @@ def get_simulation(sample, **kwargs):
 
     scan = ba.AlphaScan(wavelength, n, 2*deg/n, 2*deg)
     scan.setFootprintFactor(footprint)
-    scan.setAbsoluteAngularResolution(alpha_distr, d_ang)
+    scan.setAngleResolution(alpha_distr, d_ang)
 
     return ba.SpecularSimulation(scan, sample)
 
diff --git a/Examples/specular/BeamFullDivergence.py b/Examples/specular/BeamFullDivergence.py
index 74c8cdbfa37..897ccff6809 100755
--- a/Examples/specular/BeamFullDivergence.py
+++ b/Examples/specular/BeamFullDivergence.py
@@ -30,7 +30,7 @@ def get_simulation(sample):
     wavelength_distr = ba.RangedDistributionGaussian(n_points, n_sig)
 
     scan = ba.AlphaScan(wavelength, n, 2*deg/n, 2*deg)
-    scan.setAbsoluteAngularResolution(alpha_distr, d_ang)
+    scan.setAngleResolution(alpha_distr, d_ang)
     scan.setWavelengthResolution(wavelength_distr, d_wl)
 
     return ba.SpecularSimulation(scan, sample)
diff --git a/GUI/Model/ToCore/SimulationToCore.cpp b/GUI/Model/ToCore/SimulationToCore.cpp
index dd1620c9906..75061d5a687 100644
--- a/GUI/Model/ToCore/SimulationToCore.cpp
+++ b/GUI/Model/ToCore/SimulationToCore.cpp
@@ -132,7 +132,7 @@ SpecularSimulation* createSpecularSimulation(std::unique_ptr<MultiLayer> sample,
             const double scale = it->scaleFactor();
             if (std::unique_ptr<IRangedDistribution> distr =
                     distr_item->createIRangedDistribution(scale))
-                scan.setAbsoluteAngularResolution(*distr, distr_item->deviation(scale));
+                scan.setAngleResolution(*distr, distr_item->deviation(scale));
         }
     }
 
diff --git a/Sim/Export/SimulationToPython.cpp b/Sim/Export/SimulationToPython.cpp
index 1f2a35694b1..468387b2f5e 100644
--- a/Sim/Export/SimulationToPython.cpp
+++ b/Sim/Export/SimulationToPython.cpp
@@ -96,7 +96,7 @@ std::string defineAlphaScan(const AlphaScan& scan)
     }
     if (const auto* r = scan.angleResolution(); r && r->rdistribution()) {
         result << Py::Fmt2::printRangedDistribution(*r->rdistribution()) << "\n";
-        result << indent() << "scan.setAbsoluteAngularResolution(distribution, "
+        result << indent() << "scan.setAngleResolution(distribution, "
                << Py::Fmt::printDouble(r->stdDev()) << ")\n";
     }
     if (const auto* r = scan.wavelengthResolution(); r && r->rdistribution()) {
diff --git a/Sim/Scan/AlphaScan.cpp b/Sim/Scan/AlphaScan.cpp
index e4f70000f5a..b67bd63505b 100644
--- a/Sim/Scan/AlphaScan.cpp
+++ b/Sim/Scan/AlphaScan.cpp
@@ -109,7 +109,7 @@ void AlphaScan::setWavelengthResolution(const IRangedDistribution& distr, double
     m_lambda_distrib.reset(new ScanResolution(distr, std_dev));
 }
 
-void AlphaScan::setAbsoluteAngularResolution(const IRangedDistribution& distr, double std_dev)
+void AlphaScan::setAngleResolution(const IRangedDistribution& distr, double std_dev)
 {
     m_alpha_distrib.reset(new ScanResolution(distr, std_dev));
 }
diff --git a/Sim/Scan/AlphaScan.h b/Sim/Scan/AlphaScan.h
index d8c9767b840..276b113b499 100644
--- a/Sim/Scan/AlphaScan.h
+++ b/Sim/Scan/AlphaScan.h
@@ -41,7 +41,7 @@ public:
 
     void setWavelengthResolution(const IRangedDistribution& distr, double std_dev);
 
-    void setAbsoluteAngularResolution(const IRangedDistribution& distr, double std_dev);
+    void setAngleResolution(const IRangedDistribution& distr, double std_dev);
 
 #ifndef SWIG
     //! Generates simulation elements for specular simulations
diff --git a/Tests/SimFactory/MakeSimulations.cpp b/Tests/SimFactory/MakeSimulations.cpp
index 545f04c549d..f46697f116b 100644
--- a/Tests/SimFactory/MakeSimulations.cpp
+++ b/Tests/SimFactory/MakeSimulations.cpp
@@ -423,7 +423,7 @@ test::makeSimulation::SpecularDivergentBeam(const MultiLayer& sample)
     RangedDistributionGaussian alpha_distr(n_integration_points, /*sigma_factor = */ 2.0);
 
     scan.setWavelengthResolution(wl_distr, wl_stddev);
-    scan.setAbsoluteAngularResolution(alpha_distr, ang_stddev);
+    scan.setAngleResolution(alpha_distr, ang_stddev);
 
     return std::make_unique<SpecularSimulation>(scan, sample);
 }
diff --git a/auto/Wrap/libBornAgainSim.py b/auto/Wrap/libBornAgainSim.py
index ecb9a91bb64..43731f7d5c9 100644
--- a/auto/Wrap/libBornAgainSim.py
+++ b/auto/Wrap/libBornAgainSim.py
@@ -2572,9 +2572,9 @@ class AlphaScan(ISpecularScan):
         r"""setWavelengthResolution(AlphaScan self, IRangedDistribution const & distr, double std_dev)"""
         return _libBornAgainSim.AlphaScan_setWavelengthResolution(self, distr, std_dev)
 
-    def setAbsoluteAngularResolution(self, distr, std_dev):
-        r"""setAbsoluteAngularResolution(AlphaScan self, IRangedDistribution const & distr, double std_dev)"""
-        return _libBornAgainSim.AlphaScan_setAbsoluteAngularResolution(self, distr, std_dev)
+    def setAngleResolution(self, distr, std_dev):
+        r"""setAngleResolution(AlphaScan self, IRangedDistribution const & distr, double std_dev)"""
+        return _libBornAgainSim.AlphaScan_setAngleResolution(self, distr, std_dev)
 
 # Register AlphaScan in _libBornAgainSim:
 _libBornAgainSim.AlphaScan_swigregister(AlphaScan)
diff --git a/auto/Wrap/libBornAgainSim_wrap.cpp b/auto/Wrap/libBornAgainSim_wrap.cpp
index 4aa4eddc5e5..03efb029a96 100644
--- a/auto/Wrap/libBornAgainSim_wrap.cpp
+++ b/auto/Wrap/libBornAgainSim_wrap.cpp
@@ -32291,7 +32291,7 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_AlphaScan_setAbsoluteAngularResolution(PyObject *self, PyObject *args) {
+SWIGINTERN PyObject *_wrap_AlphaScan_setAngleResolution(PyObject *self, PyObject *args) {
   PyObject *resultobj = 0;
   AlphaScan *arg1 = (AlphaScan *) 0 ;
   IRangedDistribution *arg2 = 0 ;
@@ -32304,26 +32304,26 @@ SWIGINTERN PyObject *_wrap_AlphaScan_setAbsoluteAngularResolution(PyObject *self
   int ecode3 = 0 ;
   PyObject *swig_obj[3] ;
   
-  if (!SWIG_Python_UnpackTuple(args, "AlphaScan_setAbsoluteAngularResolution", 3, 3, swig_obj)) SWIG_fail;
+  if (!SWIG_Python_UnpackTuple(args, "AlphaScan_setAngleResolution", 3, 3, swig_obj)) SWIG_fail;
   res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_AlphaScan, 0 |  0 );
   if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AlphaScan_setAbsoluteAngularResolution" "', argument " "1"" of type '" "AlphaScan *""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "AlphaScan_setAngleResolution" "', argument " "1"" of type '" "AlphaScan *""'"); 
   }
   arg1 = reinterpret_cast< AlphaScan * >(argp1);
   res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_IRangedDistribution,  0  | 0);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AlphaScan_setAbsoluteAngularResolution" "', argument " "2"" of type '" "IRangedDistribution const &""'"); 
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "AlphaScan_setAngleResolution" "', argument " "2"" of type '" "IRangedDistribution const &""'"); 
   }
   if (!argp2) {
-    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "AlphaScan_setAbsoluteAngularResolution" "', argument " "2"" of type '" "IRangedDistribution const &""'"); 
+    SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "AlphaScan_setAngleResolution" "', argument " "2"" of type '" "IRangedDistribution const &""'"); 
   }
   arg2 = reinterpret_cast< IRangedDistribution * >(argp2);
   ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
   if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "AlphaScan_setAbsoluteAngularResolution" "', argument " "3"" of type '" "double""'");
+    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "AlphaScan_setAngleResolution" "', argument " "3"" of type '" "double""'");
   } 
   arg3 = static_cast< double >(val3);
-  (arg1)->setAbsoluteAngularResolution((IRangedDistribution const &)*arg2,arg3);
+  (arg1)->setAngleResolution((IRangedDistribution const &)*arg2,arg3);
   resultobj = SWIG_Py_Void();
   return resultobj;
 fail:
@@ -36623,7 +36623,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "AlphaScan_clone", _wrap_AlphaScan_clone, METH_O, "AlphaScan_clone(AlphaScan self) -> AlphaScan"},
 	 { "AlphaScan_setFootprintFactor", _wrap_AlphaScan_setFootprintFactor, METH_VARARGS, "AlphaScan_setFootprintFactor(AlphaScan self, IFootprintFactor const * f_factor)"},
 	 { "AlphaScan_setWavelengthResolution", _wrap_AlphaScan_setWavelengthResolution, METH_VARARGS, "AlphaScan_setWavelengthResolution(AlphaScan self, IRangedDistribution const & distr, double std_dev)"},
-	 { "AlphaScan_setAbsoluteAngularResolution", _wrap_AlphaScan_setAbsoluteAngularResolution, METH_VARARGS, "AlphaScan_setAbsoluteAngularResolution(AlphaScan self, IRangedDistribution const & distr, double std_dev)"},
+	 { "AlphaScan_setAngleResolution", _wrap_AlphaScan_setAngleResolution, METH_VARARGS, "AlphaScan_setAngleResolution(AlphaScan self, IRangedDistribution const & distr, double std_dev)"},
 	 { "AlphaScan_swigregister", AlphaScan_swigregister, METH_O, NULL},
 	 { "AlphaScan_swiginit", AlphaScan_swiginit, METH_VARARGS, NULL},
 	 { "new_QzScan", _wrap_new_QzScan, METH_VARARGS, "\n"
-- 
GitLab


From 19e7b1b6844d602c7b09d20117a89c6b5079947c Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 11:41:51 +0100
Subject: [PATCH 09/12] corr typo => improve err msgs

---
 Sim/Scan/AlphaScan.cpp | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/Sim/Scan/AlphaScan.cpp b/Sim/Scan/AlphaScan.cpp
index b67bd63505b..9011e4c7f2d 100644
--- a/Sim/Scan/AlphaScan.cpp
+++ b/Sim/Scan/AlphaScan.cpp
@@ -128,13 +128,12 @@ CoordSystem1D* AlphaScan::scanCoordSystem() const
 void AlphaScan::checkInitialization()
 {
     if (wavelength() <= 0.0)
-        throw std::runtime_error(
-            "Error in AlphaScan::checkInitialization: wavelength shell be positive");
+        throw std::runtime_error("AlphaScan called with invalid wavelength: is not > 0");
 
     const std::vector<double> axis_values = m_axis->binCenters();
     if (!std::is_sorted(axis_values.begin(), axis_values.end()))
-        throw std::runtime_error("Error in AlphaScan::checkInitialization: q-vector values "
-                                 "shall be sorted in ascending order.");
+        throw std::runtime_error("AlphaScan called with invalid alpha_i vector:"
+                                 " is not sorted in ascending order");
 
     // TODO: check for inclination angle limits after switching to pointwise resolution.
 }
-- 
GitLab


From 90ad5d1090dff04859f5d98468b9f4bf41c9cac3 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 11:46:35 +0100
Subject: [PATCH 10/12] rm unused const

---
 Tests/Unit/Base/SpinMatrixTest.cpp | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Tests/Unit/Base/SpinMatrixTest.cpp b/Tests/Unit/Base/SpinMatrixTest.cpp
index 8bf50d72450..3ae0c66c041 100644
--- a/Tests/Unit/Base/SpinMatrixTest.cpp
+++ b/Tests/Unit/Base/SpinMatrixTest.cpp
@@ -2,8 +2,6 @@
 #include "Base/Spin/Spinor.h"
 #include "Tests/GTestWrapper/google_test.h"
 
-const double epsilon = 1e-12;
-
 const complex_t A{1., 5.};
 const complex_t B{2., 6.};
 const complex_t C{3., 7.};
-- 
GitLab


From 7d8b9d52054c8ac413db2e1701d7a8971e7b7306 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 11:48:50 +0100
Subject: [PATCH 11/12] ignorable fct args

---
 GUI/Model/Descriptor/DistributionItems.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/GUI/Model/Descriptor/DistributionItems.cpp b/GUI/Model/Descriptor/DistributionItems.cpp
index b40fbaa52ac..2cf0f7cb402 100644
--- a/GUI/Model/Descriptor/DistributionItems.cpp
+++ b/GUI/Model/Descriptor/DistributionItems.cpp
@@ -296,7 +296,7 @@ std::unique_ptr<IDistribution1D> DistributionLorentzItem::createDistribution(dou
 }
 
 std::unique_ptr<IRangedDistribution>
-DistributionLorentzItem::createIRangedDistribution(double scale) const
+DistributionLorentzItem::createIRangedDistribution(double /*scale*/) const
 {
     return std::make_unique<RangedDistributionLorentz>(numberOfSamples(), m_sigmaFactor.value());
 }
@@ -384,7 +384,7 @@ std::unique_ptr<IDistribution1D> DistributionGaussianItem::createDistribution(do
 }
 
 std::unique_ptr<IRangedDistribution>
-DistributionGaussianItem::createIRangedDistribution(double scale) const
+DistributionGaussianItem::createIRangedDistribution(double /*scale*/) const
 {
     return std::make_unique<RangedDistributionGaussian>(m_numberOfSamples, m_sigmaFactor.value());
 }
@@ -555,7 +555,7 @@ std::unique_ptr<IDistribution1D> DistributionCosineItem::createDistribution(doub
 }
 
 std::unique_ptr<IRangedDistribution>
-DistributionCosineItem::createIRangedDistribution(double scale) const
+DistributionCosineItem::createIRangedDistribution(double /*scale*/) const
 {
     return std::make_unique<RangedDistributionCosine>(m_numberOfSamples, m_sigmaFactor.value());
 }
-- 
GitLab


From 929a160e553d95ea76cf53b6abf7127ffa434650 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Jan 2023 12:18:22 +0100
Subject: [PATCH 12/12] rm fct arg

---
 Param/Distrib/RangedDistributions.cpp | 6 +++---
 Param/Distrib/RangedDistributions.h   | 2 +-
 Sim/Scan/ScanResolution.cpp           | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Param/Distrib/RangedDistributions.cpp b/Param/Distrib/RangedDistributions.cpp
index 97b669f6956..eaac1fdd5f7 100644
--- a/Param/Distrib/RangedDistributions.cpp
+++ b/Param/Distrib/RangedDistributions.cpp
@@ -44,13 +44,13 @@ IRangedDistribution::IRangedDistribution(size_t n_samples, double sigma_factor)
 
 IRangedDistribution::~IRangedDistribution() = default;
 
-std::vector<ParameterSample> IRangedDistribution::generateSamples(double mean, double stddev) const
+std::vector<ParameterSample> IRangedDistribution::generateSamples(double stddev) const
 {
     if (stddev == 0) // it's a delta distribution
-        return {{mean, 1.0}};
+        return {{0., 1.0}};
     ASSERT(stddev > 0);
 
-    auto generator = distribution(mean, stddev);
+    auto generator = distribution(0., stddev);
     return generator->equidistantSamples(m_n_samples, m_sigma_factor);
 }
 
diff --git a/Param/Distrib/RangedDistributions.h b/Param/Distrib/RangedDistributions.h
index e47de972d5a..d6852bf6d54 100644
--- a/Param/Distrib/RangedDistributions.h
+++ b/Param/Distrib/RangedDistributions.h
@@ -41,7 +41,7 @@ public:
     IRangedDistribution* clone() const override = 0;
 
 #ifndef SWIG
-    std::vector<ParameterSample> generateSamples(double mean, double stddev) const;
+    std::vector<ParameterSample> generateSamples(double stddev) const;
 
     //! Public interface function to underlying IDistribution1D object
     IDistribution1D* distribution(double mean, double stddev) const;
diff --git a/Sim/Scan/ScanResolution.cpp b/Sim/Scan/ScanResolution.cpp
index fb1b71158b6..341b04d2907 100644
--- a/Sim/Scan/ScanResolution.cpp
+++ b/Sim/Scan/ScanResolution.cpp
@@ -32,7 +32,7 @@ ScanResolution* ScanResolution::clone() const
 
 std::vector<ParameterSample> ScanResolution::resolutionSamples() const
 {
-    return rdistribution()->generateSamples(0., m_stddev);
+    return rdistribution()->generateSamples(m_stddev);
 }
 
 size_t ScanResolution::nSamples() const
-- 
GitLab