From f3d322d3fcd7662333c24078e20d3b4a2dead83e Mon Sep 17 00:00:00 2001
From: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date: Wed, 10 Jul 2024 18:33:39 +0200
Subject: [PATCH] InstrumentItems: rm parameterization that was declared
 obsolete in v21

---
 Device/Detector/OffspecDetector.cpp   |   9 ---
 Device/Detector/OffspecDetector.h     |   1 -
 GUI/Model/Sim/InstrumentItems.cpp     |  28 --------
 auto/Wrap/libBornAgainDevice.py       |   5 +-
 auto/Wrap/libBornAgainDevice_wrap.cpp | 100 ++------------------------
 5 files changed, 5 insertions(+), 138 deletions(-)

diff --git a/Device/Detector/OffspecDetector.cpp b/Device/Detector/OffspecDetector.cpp
index 1f1574e754f..9d2852f2ac0 100644
--- a/Device/Detector/OffspecDetector.cpp
+++ b/Device/Detector/OffspecDetector.cpp
@@ -38,15 +38,6 @@ void OffspecDetector::setAnalyzer(const R3 Bloch_vector, double mean_transmissio
     m_pol_analyzer = PolFilter(Bloch_vector, mean_transmission);
 }
 
-void OffspecDetector::setAnalyzer(const R3 direction, double efficiency, double mean_transmission)
-{
-    std::cout
-        << "Function setAnalyzer(direction, efficiency, transmission) is obsolete since "
-           "BornAgain v21,\n"
-           "and will eventually be removed. Use setAnalyzer(Bloch_vector, transmission) instead.\n";
-    setAnalyzer(direction * efficiency, mean_transmission);
-}
-
 const Scale& OffspecDetector::axis(size_t index) const
 {
     ASSERT(index < 2);
diff --git a/Device/Detector/OffspecDetector.h b/Device/Detector/OffspecDetector.h
index d6d55f8dc29..315d45465f0 100644
--- a/Device/Detector/OffspecDetector.h
+++ b/Device/Detector/OffspecDetector.h
@@ -44,7 +44,6 @@ public:
 
     //! Sets the polarization analyzer characteristics of the detector
     void setAnalyzer(R3 Bloch_vector = {}, double mean_transmission = 0.5);
-    void setAnalyzer(R3 direction, double efficiency, double transmission); // OBSOLETE since v21
 
     //! One axis of the complete detector.
     //! Any region of interest is not taken into account.
diff --git a/GUI/Model/Sim/InstrumentItems.cpp b/GUI/Model/Sim/InstrumentItems.cpp
index c22d23af0b5..714fb72d75e 100644
--- a/GUI/Model/Sim/InstrumentItems.cpp
+++ b/GUI/Model/Sim/InstrumentItems.cpp
@@ -54,8 +54,6 @@ namespace Tag {
 
 const QString AlphaAxis("AlphaAxis");
 const QString AnalyzerBlochVector("AnalyzerBlochVector");
-const QString AnalyzerDirection("AnalyzerDirection");   // OBSOLETE since v21
-const QString AnalyzerEfficiency("AnalyzerEfficiency"); // OBSOLETE since v21
 const QString Background("Background");
 const QString BaseData("BaseData");
 const QString Beam("Beam");
@@ -68,11 +66,9 @@ const QString ExpandInfoGroupbox("ExpandInfoGroupbox");
 const QString ExpandPolarizerAnalyzerGroupbox("ExpandPolarizerAnalyzerGroupbox");
 const QString Id("Id");
 const QString Name("Name");
-const QString Polarization("Polarization"); // OBSOLETE since v21
 const QString PolarizerBlochVector("PolarizerBlochVector");
 const QString Scan("Scan");
 const QString ScanParameters("ScanParameters");
-const QString WithPolarizerAnalyzer("WithPolarizerAnalyzer"); // OBSOLETE since v21
 const QString WithPolarizer("WithPolarizer");
 const QString WithAnalyzer("WithAnalyzer");
 const QString ZAxis("ZAxis");
@@ -194,8 +190,6 @@ void InstrumentItem::writeTo(QXmlStreamWriter* w) const
 
 void InstrumentItem::readFrom(QXmlStreamReader* r)
 {
-    const uint version = XML::readUInt(r, XML::Attrib::version);
-
     while (r->readNextStartElement()) {
         QString tag = r->name().toString();
 
@@ -214,22 +208,11 @@ void InstrumentItem::readFrom(QXmlStreamReader* r)
             setDescription(XML::readString(r, XML::Attrib::value));
             XML::gotoEndElementOfTag(r, tag);
 
-            // with polarizer or analyzer? (OBSOLETE since v21 (version == 2))
-        } else if (version == 1 && tag == Tag::WithPolarizerAnalyzer) {
-            m_with_polarizer = XML::readBool(r, XML::Attrib::value);
-            m_with_analyzer = m_with_polarizer;
-            XML::gotoEndElementOfTag(r, tag);
-
             // with polarizer?
         } else if (tag == Tag::WithPolarizer) {
             m_with_polarizer = XML::readBool(r, XML::Attrib::value);
             XML::gotoEndElementOfTag(r, tag);
 
-            // polarization (alternate tag OBSOLETE since v21 (version == 2))
-        } else if (tag == Tag::PolarizerBlochVector || (version == 1 && tag == Tag::Polarization)) {
-            m_polarizer_bloch_vector.readFrom(r);
-            XML::gotoEndElementOfTag(r, tag);
-
             // with analyzer?
         } else if (tag == Tag::WithAnalyzer) {
             m_with_analyzer = XML::readBool(r, XML::Attrib::value);
@@ -240,17 +223,6 @@ void InstrumentItem::readFrom(QXmlStreamReader* r)
             m_analyzer_bloch_vector.readFrom(r);
             XML::gotoEndElementOfTag(r, tag);
 
-            // analyzer direction OBSOLETE since v21 (version == 2)
-        } else if (version == 1 && tag == Tag::AnalyzerDirection) {
-            m_analyzer_bloch_vector.readFrom(r);
-            XML::gotoEndElementOfTag(r, tag);
-
-            // analyzer efficiency OBSOLETE since v21 (version == 2)
-        } else if (version == 1 && tag == Tag::AnalyzerEfficiency) {
-            DoubleProperty analyzerEfficiency;
-            analyzerEfficiency.readFrom2(r, tag);
-            m_analyzer_bloch_vector.setR3(m_analyzer_bloch_vector.r3() * analyzerEfficiency.dVal());
-
             // background
         } else if (tag == Tag::Background) {
             m_background.readFrom(r);
diff --git a/auto/Wrap/libBornAgainDevice.py b/auto/Wrap/libBornAgainDevice.py
index 03bcf4d22e4..b252292adb8 100644
--- a/auto/Wrap/libBornAgainDevice.py
+++ b/auto/Wrap/libBornAgainDevice.py
@@ -2762,10 +2762,7 @@ class OffspecDetector(libBornAgainParam.INode):
         return _libBornAgainDevice.OffspecDetector_className(self)
 
     def setAnalyzer(self, *args):
-        r"""
-        setAnalyzer(OffspecDetector self, R3 Bloch_vector={}, double mean_transmission=0.5)
-        setAnalyzer(OffspecDetector self, R3 direction, double efficiency, double transmission)
-        """
+        r"""setAnalyzer(OffspecDetector self, R3 Bloch_vector={}, double mean_transmission=0.5)"""
         return _libBornAgainDevice.OffspecDetector_setAnalyzer(self, *args)
 
     def axis(self, index):
diff --git a/auto/Wrap/libBornAgainDevice_wrap.cpp b/auto/Wrap/libBornAgainDevice_wrap.cpp
index bb57693530d..78eba8a08ac 100644
--- a/auto/Wrap/libBornAgainDevice_wrap.cpp
+++ b/auto/Wrap/libBornAgainDevice_wrap.cpp
@@ -37706,76 +37706,13 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_OffspecDetector_setAnalyzer__SWIG_3(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
-  PyObject *resultobj = 0;
-  OffspecDetector *arg1 = (OffspecDetector *) 0 ;
-  R3 arg2 ;
-  double arg3 ;
-  double arg4 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 ;
-  int res2 = 0 ;
-  double val3 ;
-  int ecode3 = 0 ;
-  double val4 ;
-  int ecode4 = 0 ;
-  
-  (void)self;
-  if ((nobjs < 4) || (nobjs > 4)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_OffspecDetector, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "OffspecDetector_setAnalyzer" "', argument " "1"" of type '" "OffspecDetector *""'"); 
-  }
-  arg1 = reinterpret_cast< OffspecDetector * >(argp1);
-  {
-    res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_Vec3T_double_t,  0  | 0);
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "OffspecDetector_setAnalyzer" "', argument " "2"" of type '" "R3""'"); 
-    }  
-    if (!argp2) {
-      SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "OffspecDetector_setAnalyzer" "', argument " "2"" of type '" "R3""'");
-    } else {
-      R3 * temp = reinterpret_cast< R3 * >(argp2);
-      arg2 = *temp;
-      if (SWIG_IsNewObj(res2)) delete temp;
-    }
-  }
-  ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
-  if (!SWIG_IsOK(ecode3)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "OffspecDetector_setAnalyzer" "', argument " "3"" of type '" "double""'");
-  } 
-  arg3 = static_cast< double >(val3);
-  ecode4 = SWIG_AsVal_double(swig_obj[3], &val4);
-  if (!SWIG_IsOK(ecode4)) {
-    SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "OffspecDetector_setAnalyzer" "', argument " "4"" of type '" "double""'");
-  } 
-  arg4 = static_cast< double >(val4);
-  {
-    try {
-      (arg1)->setAnalyzer(arg2,arg3,arg4);
-    } catch (const std::exception& ex) {
-      // message shown in the Python interpreter
-      const std::string msg {
-        "BornAgain C++ Exception: " + std::string(ex.what())
-      };
-      SWIG_exception(SWIG_RuntimeError, msg.c_str());
-    }
-  }
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
 SWIGINTERN PyObject *_wrap_OffspecDetector_setAnalyzer(PyObject *self, PyObject *args) {
   Py_ssize_t argc;
-  PyObject *argv[5] = {
+  PyObject *argv[4] = {
     0
   };
   
-  if (!(argc = SWIG_Python_UnpackTuple(args, "OffspecDetector_setAnalyzer", 0, 4, argv))) SWIG_fail;
+  if (!(argc = SWIG_Python_UnpackTuple(args, "OffspecDetector_setAnalyzer", 0, 3, argv))) SWIG_fail;
   --argc;
   if (argc == 1) {
     int _v = 0;
@@ -37818,39 +37755,13 @@ SWIGINTERN PyObject *_wrap_OffspecDetector_setAnalyzer(PyObject *self, PyObject
       }
     }
   }
-  if (argc == 4) {
-    int _v = 0;
-    void *vptr = 0;
-    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_OffspecDetector, 0);
-    _v = SWIG_CheckState(res);
-    if (_v) {
-      int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_Vec3T_double_t, SWIG_POINTER_NO_NULL | 0);
-      _v = SWIG_CheckState(res);
-      if (_v) {
-        {
-          int res = SWIG_AsVal_double(argv[2], NULL);
-          _v = SWIG_CheckState(res);
-        }
-        if (_v) {
-          {
-            int res = SWIG_AsVal_double(argv[3], NULL);
-            _v = SWIG_CheckState(res);
-          }
-          if (_v) {
-            return _wrap_OffspecDetector_setAnalyzer__SWIG_3(self, argc, argv);
-          }
-        }
-      }
-    }
-  }
   
 fail:
   SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'OffspecDetector_setAnalyzer'.\n"
     "  Possible C/C++ prototypes are:\n"
     "    OffspecDetector::setAnalyzer(R3,double)\n"
     "    OffspecDetector::setAnalyzer(R3)\n"
-    "    OffspecDetector::setAnalyzer()\n"
-    "    OffspecDetector::setAnalyzer(R3,double,double)\n");
+    "    OffspecDetector::setAnalyzer()\n");
   return 0;
 }
 
@@ -44151,10 +44062,7 @@ static PyMethodDef SwigMethods[] = {
 	 { "delete_OffspecDetector", _wrap_delete_OffspecDetector, METH_O, "delete_OffspecDetector(OffspecDetector self)"},
 	 { "OffspecDetector_clone", _wrap_OffspecDetector_clone, METH_O, "OffspecDetector_clone(OffspecDetector self) -> OffspecDetector"},
 	 { "OffspecDetector_className", _wrap_OffspecDetector_className, METH_O, "OffspecDetector_className(OffspecDetector self) -> std::string"},
-	 { "OffspecDetector_setAnalyzer", _wrap_OffspecDetector_setAnalyzer, METH_VARARGS, "\n"
-		"OffspecDetector_setAnalyzer(OffspecDetector self, R3 Bloch_vector={}, double mean_transmission=0.5)\n"
-		"OffspecDetector_setAnalyzer(OffspecDetector self, R3 direction, double efficiency, double transmission)\n"
-		""},
+	 { "OffspecDetector_setAnalyzer", _wrap_OffspecDetector_setAnalyzer, METH_VARARGS, "OffspecDetector_setAnalyzer(OffspecDetector self, R3 Bloch_vector={}, double mean_transmission=0.5)"},
 	 { "OffspecDetector_axis", _wrap_OffspecDetector_axis, METH_VARARGS, "OffspecDetector_axis(OffspecDetector self, size_t index) -> Scale"},
 	 { "OffspecDetector_axisBinIndex", _wrap_OffspecDetector_axisBinIndex, METH_VARARGS, "OffspecDetector_axisBinIndex(OffspecDetector self, size_t index, size_t k_axis) -> size_t"},
 	 { "OffspecDetector_totalSize", _wrap_OffspecDetector_totalSize, METH_O, "OffspecDetector_totalSize(OffspecDetector self) -> size_t"},
-- 
GitLab