From f571503d2d6b5cc6ee70b15030593b3b39d660ab Mon Sep 17 00:00:00 2001
From: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date: Tue, 26 Sep 2023 12:24:30 +0200
Subject: [PATCH] units always in round parentheses

---
 GUI/Model/Model/ParameterTreeUtil.cpp                    | 2 +-
 GUI/View/MaterialEditor/MaterialEditorModel.cpp          | 2 +-
 GUI/View/Numeric/NumWidgetUtil.cpp                       | 2 +-
 GUI/View/SampleDesigner/LayerEditorUtil.cpp              | 2 +-
 auto/Examples/fit/specular/Honeycomb_fit.py              | 8 ++++----
 auto/Examples/fit/specular/PolarizedSpinAsymmetry.py     | 4 ++--
 auto/Examples/fit/specular/Pt_layer_fit.py               | 2 +-
 auto/Examples/specular/PolarizedSpinAsymmetry.py         | 4 ++--
 auto/MiniExamples/fit/specular/Honeycomb_fit.py          | 8 ++++----
 auto/MiniExamples/fit/specular/PolarizedSpinAsymmetry.py | 4 ++--
 auto/MiniExamples/fit/specular/Pt_layer_fit.py           | 2 +-
 auto/MiniExamples/specular/PolarizedSpinAsymmetry.py     | 4 ++--
 rawEx/fit/specular/Honeycomb_fit.py                      | 4 ++--
 rawEx/fit/specular/Pt_layer_fit.py                       | 2 +-
 rawEx/specular/PolarizedSpinAsymmetry.py                 | 4 ++--
 15 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/GUI/Model/Model/ParameterTreeUtil.cpp b/GUI/Model/Model/ParameterTreeUtil.cpp
index 9c3e106882c..54671288089 100644
--- a/GUI/Model/Model/ParameterTreeUtil.cpp
+++ b/GUI/Model/Model/ParameterTreeUtil.cpp
@@ -43,7 +43,7 @@ QString labelWithUnit(const QString& label, variant<QString, Unit> unit)
                                                             : unitAsString(std::get<Unit>(unit));
 
     if (!s.isEmpty())
-        return label + " [" + s + "]";
+        return label + " (" + s + ")";
 
     return label;
 }
diff --git a/GUI/View/MaterialEditor/MaterialEditorModel.cpp b/GUI/View/MaterialEditor/MaterialEditorModel.cpp
index 34138a5ca9f..3714fa455d6 100644
--- a/GUI/View/MaterialEditor/MaterialEditorModel.cpp
+++ b/GUI/View/MaterialEditor/MaterialEditorModel.cpp
@@ -48,7 +48,7 @@ QVariant MaterialEditorModel::headerData(int section, Qt::Orientation /*orientat
     case PARAMETERS:
         return "Material parameters";
     case MAGNETIZATION:
-        return "Magnetization [A/m]";
+        return "Magnetization (A/m)";
     default:
         return {};
     }
diff --git a/GUI/View/Numeric/NumWidgetUtil.cpp b/GUI/View/Numeric/NumWidgetUtil.cpp
index 68110dd28ba..0be3617e5fe 100644
--- a/GUI/View/Numeric/NumWidgetUtil.cpp
+++ b/GUI/View/Numeric/NumWidgetUtil.cpp
@@ -44,7 +44,7 @@ QString GUI::Util::labelWithUnit(const QString& label, variant<QString, Unit> un
     const QString s = std::holds_alternative<QString>(unit) ? std::get<QString>(unit)
                                                             : unitAsString(std::get<Unit>(unit));
     if (!s.isEmpty())
-        return label + " [" + s + "]";
+        return label + " (" + s + ")";
 
     return label;
 }
diff --git a/GUI/View/SampleDesigner/LayerEditorUtil.cpp b/GUI/View/SampleDesigner/LayerEditorUtil.cpp
index 2667f1380b8..dfb442e5874 100644
--- a/GUI/View/SampleDesigner/LayerEditorUtil.cpp
+++ b/GUI/View/SampleDesigner/LayerEditorUtil.cpp
@@ -46,7 +46,7 @@ void updateLabelUnit(QLabel* label, const QString& unit)
         text.chop(1);
 
     if (!unit.isEmpty())
-        text += " [" + unit + "]";
+        text += " (" + unit + ")";
     if (hasColon)
         text += ":";
     label->setText(text);
diff --git a/auto/Examples/fit/specular/Honeycomb_fit.py b/auto/Examples/fit/specular/Honeycomb_fit.py
index ce43c300624..9a9a01df3d4 100755
--- a/auto/Examples/fit/specular/Honeycomb_fit.py
+++ b/auto/Examples/fit/specular/Honeycomb_fit.py
@@ -139,7 +139,7 @@ def plot(q, rs, exps, shifts, labels):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     plt.tight_layout()
@@ -159,7 +159,7 @@ def plot_sld_profile(P):
     plt.plot(z_150p, np.real(sld_150p)*1e6, label=r"150K $+$")
     plt.plot(z_150m, np.real(sld_150m)*1e6, label=r"150K $-$")
 
-    plt.xlabel(r"$z$ [A]")
+    plt.xlabel(r"$z (\AA)$")
     plt.ylabel(r"$\delta(z) \cdot 10^6$")
 
     plt.legend()
@@ -262,8 +262,8 @@ if __name__ == '__main__':
     result = scipy.optimize.differential_evolution(
         objective_function,
         bounds,
-        maxiter=5,
-        popsize=3,
+        maxiter=5, # for a serious DE fit, choose 500
+        popsize=3, # for a serious DE fit, choose 10
         tol=1e-2,
         mutation=(0.5, 1.5),
         seed=0,
diff --git a/auto/Examples/fit/specular/PolarizedSpinAsymmetry.py b/auto/Examples/fit/specular/PolarizedSpinAsymmetry.py
index 91f3571438b..d859c5ea1d5 100755
--- a/auto/Examples/fit/specular/PolarizedSpinAsymmetry.py
+++ b/auto/Examples/fit/specular/PolarizedSpinAsymmetry.py
@@ -131,7 +131,7 @@ def plotData(qs, rs, exps, labels, colors):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     plt.tight_layout()
@@ -164,7 +164,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
 
     plt.gca().set_ylim((-0.3, 0.5))
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("Q (1/nm)")
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
diff --git a/auto/Examples/fit/specular/Pt_layer_fit.py b/auto/Examples/fit/specular/Pt_layer_fit.py
index bd4f17520fe..1af4988e765 100755
--- a/auto/Examples/fit/specular/Pt_layer_fit.py
+++ b/auto/Examples/fit/specular/Pt_layer_fit.py
@@ -79,7 +79,7 @@ def plot(q, r, data, P):
 
     ax.set_yscale('log')
 
-    ax.set_xlabel("Q [nm$^{^-1}$]")
+    ax.set_xlabel("q (1/nm)")
     ax.set_ylabel("R")
 
     y = 0.5
diff --git a/auto/Examples/specular/PolarizedSpinAsymmetry.py b/auto/Examples/specular/PolarizedSpinAsymmetry.py
index 91f3571438b..d859c5ea1d5 100755
--- a/auto/Examples/specular/PolarizedSpinAsymmetry.py
+++ b/auto/Examples/specular/PolarizedSpinAsymmetry.py
@@ -131,7 +131,7 @@ def plotData(qs, rs, exps, labels, colors):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     plt.tight_layout()
@@ -164,7 +164,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
 
     plt.gca().set_ylim((-0.3, 0.5))
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("Q (1/nm)")
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
diff --git a/auto/MiniExamples/fit/specular/Honeycomb_fit.py b/auto/MiniExamples/fit/specular/Honeycomb_fit.py
index fa2a12e826b..b07ea2c3d00 100755
--- a/auto/MiniExamples/fit/specular/Honeycomb_fit.py
+++ b/auto/MiniExamples/fit/specular/Honeycomb_fit.py
@@ -139,7 +139,7 @@ def plot(q, rs, exps, shifts, labels):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     #plt.tight_layout()
@@ -159,7 +159,7 @@ def plot_sld_profile(P):
     plt.plot(z_150p, np.real(sld_150p)*1e6, label=r"150K $+$")
     plt.plot(z_150m, np.real(sld_150m)*1e6, label=r"150K $-$")
 
-    plt.xlabel(r"$z$ [A]")
+    plt.xlabel(r"$z (\AA)$")
     plt.ylabel(r"$\delta(z) \cdot 10^6$")
 
     plt.legend()
@@ -262,8 +262,8 @@ if __name__ == '__main__':
     result = scipy.optimize.differential_evolution(
         objective_function,
         bounds,
-        maxiter=2,
-        popsize=2,
+        maxiter=2, # for a serious DE fit, choose 500
+        popsize=2, # for a serious DE fit, choose 10
         tol=1e-2,
         mutation=(0.5, 1.5),
         seed=0,
diff --git a/auto/MiniExamples/fit/specular/PolarizedSpinAsymmetry.py b/auto/MiniExamples/fit/specular/PolarizedSpinAsymmetry.py
index 0123529d57f..3185a2719f2 100755
--- a/auto/MiniExamples/fit/specular/PolarizedSpinAsymmetry.py
+++ b/auto/MiniExamples/fit/specular/PolarizedSpinAsymmetry.py
@@ -131,7 +131,7 @@ def plotData(qs, rs, exps, labels, colors):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     plt.tight_layout()
@@ -164,7 +164,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
 
     plt.gca().set_ylim((-0.3, 0.5))
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("Q (1/nm)")
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
diff --git a/auto/MiniExamples/fit/specular/Pt_layer_fit.py b/auto/MiniExamples/fit/specular/Pt_layer_fit.py
index 3a32ac836a5..6370c896f52 100755
--- a/auto/MiniExamples/fit/specular/Pt_layer_fit.py
+++ b/auto/MiniExamples/fit/specular/Pt_layer_fit.py
@@ -79,7 +79,7 @@ def plot(q, r, data, P):
 
     ax.set_yscale('log')
 
-    ax.set_xlabel("Q [nm$^{^-1}$]")
+    ax.set_xlabel("q (1/nm)")
     ax.set_ylabel("R")
 
     y = 0.5
diff --git a/auto/MiniExamples/specular/PolarizedSpinAsymmetry.py b/auto/MiniExamples/specular/PolarizedSpinAsymmetry.py
index 0123529d57f..3185a2719f2 100755
--- a/auto/MiniExamples/specular/PolarizedSpinAsymmetry.py
+++ b/auto/MiniExamples/specular/PolarizedSpinAsymmetry.py
@@ -131,7 +131,7 @@ def plotData(qs, rs, exps, labels, colors):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     plt.tight_layout()
@@ -164,7 +164,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
 
     plt.gca().set_ylim((-0.3, 0.5))
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("Q (1/nm)")
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
diff --git a/rawEx/fit/specular/Honeycomb_fit.py b/rawEx/fit/specular/Honeycomb_fit.py
index 95b5c3ab50f..dcb28876ff2 100755
--- a/rawEx/fit/specular/Honeycomb_fit.py
+++ b/rawEx/fit/specular/Honeycomb_fit.py
@@ -139,7 +139,7 @@ def plot(q, rs, exps, shifts, labels):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     <%= sm ? "#" : "" %>plt.tight_layout()
@@ -159,7 +159,7 @@ def plot_sld_profile(P):
     plt.plot(z_150p, np.real(sld_150p)*1e6, label=r"150K $+$")
     plt.plot(z_150m, np.real(sld_150m)*1e6, label=r"150K $-$")
 
-    plt.xlabel(r"$z$ [A]")
+    plt.xlabel(r"$z (\AA)$")
     plt.ylabel(r"$\delta(z) \cdot 10^6$")
 
     plt.legend()
diff --git a/rawEx/fit/specular/Pt_layer_fit.py b/rawEx/fit/specular/Pt_layer_fit.py
index bae2abf7f92..cc9200f3154 100755
--- a/rawEx/fit/specular/Pt_layer_fit.py
+++ b/rawEx/fit/specular/Pt_layer_fit.py
@@ -79,7 +79,7 @@ def plot(q, r, data, P):
 
     ax.set_yscale('log')
 
-    ax.set_xlabel("Q [nm$^{^-1}$]")
+    ax.set_xlabel("q (1/nm)")
     ax.set_ylabel("R")
 
     y = 0.5
diff --git a/rawEx/specular/PolarizedSpinAsymmetry.py b/rawEx/specular/PolarizedSpinAsymmetry.py
index 9378c689fd1..cba1b8ac600 100755
--- a/rawEx/specular/PolarizedSpinAsymmetry.py
+++ b/rawEx/specular/PolarizedSpinAsymmetry.py
@@ -131,7 +131,7 @@ def plotData(qs, rs, exps, labels, colors):
     ax.set_yscale('log')
     plt.legend()
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("q (1/nm)")
     plt.ylabel("R")
 
     plt.tight_layout()
@@ -164,7 +164,7 @@ def plotSpinAsymmetry(data_pp, data_mm, q, r_pp, r_mm):
 
     plt.gca().set_ylim((-0.3, 0.5))
 
-    plt.xlabel("Q [nm${}^{-1}$]")
+    plt.xlabel("Q (1/nm)")
     plt.ylabel("Spin asymmetry")
 
     plt.tight_layout()
-- 
GitLab