diff --git a/Base/Axis/Scale.cpp b/Base/Axis/Scale.cpp index 5570346b858fd9c3b77c0fdf694533e2b032c5cc..25c19a96138f24c75ebd87e4ee0794f68e256c6d 100644 --- a/Base/Axis/Scale.cpp +++ b/Base/Axis/Scale.cpp @@ -21,9 +21,24 @@ #include <stdexcept> using std::numbers::pi; -Scale::Scale(const Coordinate& coord, std::vector<Bin1D> bins, trafo_map_t trafos) - : m_coord(coord) - , m_bins(std::move(bins)) +namespace { + +trafo_map_t::const_iterator find(std::string label, const trafo_map_t& trafos) +{ + for (trafo_map_t::const_iterator e = trafos.cbegin(); e != trafos.cend(); ++e) + if (e->first == label) { + std::cerr << "DEBUG FOUND " << label << std::endl; + return e; + } + std::cerr << "DEBUG NOT FOUND " << label << std::endl; + return trafos.cend(); +} + +} // namespace + + +Scale::Scale(std::vector<Bin1D> bins, trafo_map_t trafos) + : m_bins(std::move(bins)) , m_trafos(std::move(trafos)) { if (size() == 0) @@ -45,6 +60,16 @@ Scale::Scale(const Coordinate& coord, std::vector<Bin1D> bins, trafo_map_t trafo } } +Scale::Scale(const Coordinate& coord, std::vector<Bin1D> bins) + : Scale(bins, {{coord.label(), [](double x) { return x; }}}) +{ +} + +Scale* Scale::clone() const +{ + return new Scale(m_bins, m_trafos); +} + void Scale::setTrafos(trafo_map_t trafos) { m_trafos = std::move(trafos); @@ -60,7 +85,12 @@ std::string Scale::availableLabels() const std::string Scale::axisLabel() const { - return m_coord.label(); + return m_trafos.cbegin()->first; +} + +std::string Scale::unit() const +{ + return Coordinate(axisLabel()).unit(); } size_t Scale::size() const @@ -172,7 +202,7 @@ Scale Scale::clipped(double lower, double upper) const if (auto bc = b.clipped_or_nil(lower, upper)) if (is_scan || bc.value().binSize() > 0) out_bins.emplace_back(bc.value()); - return {m_coord, out_bins, m_trafos}; + return {out_bins, m_trafos}; } Scale Scale::clipped(std::pair<double, double> bounds) const @@ -182,7 +212,7 @@ Scale Scale::clipped(std::pair<double, double> bounds) const bool Scale::operator==(const Scale& other) const { - return m_coord == other.m_coord && m_bins == other.m_bins; + return axisLabel() == other.axisLabel() && m_bins == other.m_bins; } std::ostream& operator<<(std::ostream& ostr, const Scale& ax) @@ -213,34 +243,21 @@ std::ostream& operator<<(std::ostream& ostr, const Scale& ax) return ostr; } -std::string Scale::unit() const +Scale Scale::plottableScale(std::string label) const { - return m_coord.unit(); -} - -Scale Scale::plottableScale() const -{ - std::string u = unit(); - if (u == "rad") { - std::string outname = m_coord.label(); - std::vector<Bin1D> outvector; - for (const Bin1D b : m_bins) { - double bmi = b.lowerBound() * 180 / pi; - double bma = b.upperBound() * 180 / pi; - outvector.emplace_back(Bin1D::FromTo(bmi, bma)); - } - return {outname, outvector}; + ASSERT(!m_trafos.empty()); + trafo_map_t::const_iterator entry; + if (label.empty()) { + std::cerr << "DEBUG A" << std::endl; + entry = m_trafos.cbegin(); + label = entry->first; + } else { + std::cerr << "DEBUG B" << std::endl; + entry = find(label, m_trafos); + if (entry == m_trafos.cend()) + throw std::runtime_error("Scale::plottableScale called with unknown label '" + label + + "';" + " available labels are: " + availableLabels()); } - return *this; -} - -Scale Scale::plottableScale(const std::string label) const -{ - auto entry = m_trafos.find(label); - if (entry == m_trafos.end()) - throw std::runtime_error("Scale::plottableScale called with unknown label '" + label + "';" - + " available labels are: " + availableLabels()); - ASSERT(entry->first == label); const trafo_t& trafo = entry->second; std::vector<Bin1D> outvector; for (const Bin1D b : m_bins) { diff --git a/Base/Axis/Scale.h b/Base/Axis/Scale.h index ebf95a6d664e3af69855e9e4cfe0f80106b431d3..34919c46028e52c6f30ab342abe61ed52424bdcd 100644 --- a/Base/Axis/Scale.h +++ b/Base/Axis/Scale.h @@ -18,20 +18,20 @@ #include "Base/Axis/Bin.h" #include "Base/Axis/Coordinate.h" #include <functional> -#include <map> #include <string> #include <utility> #include <vector> using trafo_t = std::function<double(double)>; -using trafo_map_t = std::map<std::string, std::function<double(double)>>; +using trafo_map_t = std::vector<std::pair<std::string, std::function<double(double)>>>; //! Abstract base class for one-dimensional axes. class Scale { public: - Scale(const Coordinate& coord, std::vector<Bin1D> bins, trafo_map_t trafos = {}); - Scale* clone() const { return new Scale(*this); } + Scale(std::vector<Bin1D> bins, trafo_map_t trafos); + Scale(const Coordinate& coord, std::vector<Bin1D> bins); + Scale* clone() const; void setTrafos(trafo_map_t trafos); @@ -86,11 +86,9 @@ public: std::string unit() const; - Scale plottableScale() const; - Scale plottableScale(const std::string label) const; + Scale plottableScale(std::string label = "") const; protected: - Coordinate m_coord; std::vector<Bin1D> m_bins; trafo_map_t m_trafos; }; diff --git a/Device/Detector/FlatDetector.cpp b/Device/Detector/FlatDetector.cpp index 2196ad7df880dad795e97f642dd41a862911188a..f0f5023134723854ac68701c1b65a5e8fd10ddc1 100644 --- a/Device/Detector/FlatDetector.cpp +++ b/Device/Detector/FlatDetector.cpp @@ -73,12 +73,6 @@ FlatDetector::FlatDetector(size_t nxbins, size_t nybins, double width, double he }; trafo_map_t x_trafos = { - {"nxbins", [=](double u) -> double { return nxbins / width * u; }}, - {"phi_f (deg)", - [=](double u) -> double { - const R3 p = pos_in_det(u, 0); - return atan2(-p.y(), p.x()) * (180 / pi); - }}, {"q_y (1/nm)", [=](double u) -> double { const R3 p = pos_in_det(u, 0); @@ -86,14 +80,15 @@ FlatDetector::FlatDetector(size_t nxbins, size_t nybins, double width, double he const R3 q = kf - ki; return -q.y(); }}, + {"u (mm)", [](double u) -> double { return u; }}, + {"nxbins", [=](double u) -> double { return nxbins / width * u; }}, + {"phi_f (deg)", + [=](double u) -> double { + const R3 p = pos_in_det(u, 0); + return atan2(-p.y(), p.x()) * (180 / pi); + }}, }; trafo_map_t y_trafos = { - {"nybins", [=](double v) -> double { return nybins / height * v; }}, - {"alpha_f (deg)", - [=](double v) -> double { - const R3 p = pos_in_det(0, v); - return atan2(p.z(), p.x()) * (180 / pi); - }}, {"q_z (1/nm)", [=](double v) -> double { const R3 p = pos_in_det(0, v); @@ -101,6 +96,13 @@ FlatDetector::FlatDetector(size_t nxbins, size_t nybins, double width, double he const R3 q = kf - ki; return q.z(); }}, + {"v (mm)", [](double v) -> double { return v; }}, + {"nybins", [=](double v) -> double { return nybins / height * v; }}, + {"alpha_f (deg)", + [=](double v) -> double { + const R3 p = pos_in_det(0, v); + return atan2(p.z(), p.x()) * (180 / pi); + }}, }; Scale x = m_frame->xAxis(); Scale y = m_frame->yAxis(); diff --git a/auto/Examples/scatter2d/AxesInDifferentUnits.py b/auto/Examples/scatter2d/AxesInDifferentUnits.py index 430642c2756a41b61b2195f4ae5d9156f6bc4bac..ad94a9afe215cbd62741ee58626a7dd5c136d4c7 100755 --- a/auto/Examples/scatter2d/AxesInDifferentUnits.py +++ b/auto/Examples/scatter2d/AxesInDifferentUnits.py @@ -75,8 +75,8 @@ if __name__ == '__main__': rcParams['image.aspect'] = 'auto' plt.figure(figsize=(10, 10)) - transformed_plot(1, result.plottableField(), - "Default: real-space detector coordinates") + transformed_plot(1, result.plottableField(("u (mm)", "v (mm)")), + "Real-space detector coordinates") transformed_plot(2, result.plottableField(("nxbins", "nybins")), "Bin indices") transformed_plot(3, result.plottableField(("phi_f (deg)", "alpha_f (deg)")), diff --git a/auto/Examples/scatter2d/DodecahedraSAS.py b/auto/Examples/scatter2d/DodecahedraSAS.py index f5a7179ddce8106ecd11da646c7e8b5cee23073d..6986c062b13b0b9ae9002d0a2260ee35cf1a283d 100755 --- a/auto/Examples/scatter2d/DodecahedraSAS.py +++ b/auto/Examples/scatter2d/DodecahedraSAS.py @@ -47,4 +47,4 @@ if __name__ == '__main__': sample = get_sample() simulation = get_simulation(sample) result = simulation.simulate() - bp.plot_simulation_result(result) + bp.plot_simulation_result(result.plottableField(("u (mm)", "v (mm)"))) diff --git a/auto/MiniExamples/scatter2d/AxesInDifferentUnits.py b/auto/MiniExamples/scatter2d/AxesInDifferentUnits.py index 661c6a7d21fab2dcef89b6410e49a622c4abaed7..4f3b5dc7655e1c9b669febad6040635be1dab1df 100755 --- a/auto/MiniExamples/scatter2d/AxesInDifferentUnits.py +++ b/auto/MiniExamples/scatter2d/AxesInDifferentUnits.py @@ -75,8 +75,8 @@ if __name__ == '__main__': rcParams['image.aspect'] = 'auto' plt.figure(figsize=(10, 10)) - transformed_plot(1, result.plottableField(), - "Default: real-space detector coordinates") + transformed_plot(1, result.plottableField(("u (mm)", "v (mm)")), + "Real-space detector coordinates") transformed_plot(2, result.plottableField(("nxbins", "nybins")), "Bin indices") transformed_plot(3, result.plottableField(("phi_f (deg)", "alpha_f (deg)")), diff --git a/auto/MiniExamples/scatter2d/DodecahedraSAS.py b/auto/MiniExamples/scatter2d/DodecahedraSAS.py index cc237d065b401817249874de8ce1b49917d1aa12..5a02afa623189c79aec40a7511fdbdc8e44ebf96 100755 --- a/auto/MiniExamples/scatter2d/DodecahedraSAS.py +++ b/auto/MiniExamples/scatter2d/DodecahedraSAS.py @@ -47,4 +47,4 @@ if __name__ == '__main__': sample = get_sample() simulation = get_simulation(sample) result = simulation.simulate() - bp.plot_simulation_result(result) + bp.plot_simulation_result(result.plottableField(("u (mm)", "v (mm)"))) diff --git a/auto/Wrap/libBornAgainBase.py b/auto/Wrap/libBornAgainBase.py index 2a4a7f7f75f1c0a02516170b56989a18d6258eb0..6e3c1fa6f3d06757b0a70e8e1faa50a0e65763fa 100644 --- a/auto/Wrap/libBornAgainBase.py +++ b/auto/Wrap/libBornAgainBase.py @@ -1855,7 +1855,10 @@ class Scale(object): __repr__ = _swig_repr def __init__(self, *args): - r"""__init__(Scale self, Coordinate const & coord, std::vector< Bin1D,std::allocator< Bin1D > > bins, trafo_map_t trafos={}) -> Scale""" + r""" + __init__(Scale self, std::vector< Bin1D,std::allocator< Bin1D > > bins, trafo_map_t trafos) -> Scale + __init__(Scale self, Coordinate const & coord, std::vector< Bin1D,std::allocator< Bin1D > > bins) -> Scale + """ _libBornAgainBase.Scale_swiginit(self, _libBornAgainBase.new_Scale(*args)) def clone(self): @@ -1950,10 +1953,7 @@ class Scale(object): return _libBornAgainBase.Scale_unit(self) def plottableScale(self, *args): - r""" - plottableScale(Scale self) -> Scale - plottableScale(Scale self, std::string const label) -> Scale - """ + r"""plottableScale(Scale self, std::string label="") -> Scale""" return _libBornAgainBase.Scale_plottableScale(self, *args) __swig_destroy__ = _libBornAgainBase.delete_Scale diff --git a/auto/Wrap/libBornAgainBase_wrap.cpp b/auto/Wrap/libBornAgainBase_wrap.cpp index 96ffa3621694ea805e62a91945ed4c007a730b0a..d0683017207d43964dd44952b59ad7679fd6986b 100644 --- a/auto/Wrap/libBornAgainBase_wrap.cpp +++ b/auto/Wrap/libBornAgainBase_wrap.cpp @@ -3424,15 +3424,15 @@ namespace Swig { #define SWIGTYPE_p_std__invalid_argument swig_types[35] #define SWIGTYPE_p_std__lessT_std__string_t swig_types[36] #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[37] -#define SWIGTYPE_p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t swig_types[38] -#define SWIGTYPE_p_std__optionalT_Bin1D_t swig_types[39] -#define SWIGTYPE_p_std__pairT_double_double_t swig_types[40] -#define SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t swig_types[41] -#define SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t swig_types[42] -#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[43] -#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[44] -#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[45] -#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[46] +#define SWIGTYPE_p_std__optionalT_Bin1D_t swig_types[38] +#define SWIGTYPE_p_std__pairT_double_double_t swig_types[39] +#define SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t swig_types[40] +#define SWIGTYPE_p_std__vectorT_Scale_const_p_std__allocatorT_Scale_const_p_t_t swig_types[41] +#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[42] +#define SWIGTYPE_p_std__vectorT_int_std__allocatorT_int_t_t swig_types[43] +#define SWIGTYPE_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t swig_types[44] +#define SWIGTYPE_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t swig_types[45] +#define SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t swig_types[46] #define SWIGTYPE_p_std__vectorT_std__string_std__allocatorT_std__string_t_t swig_types[47] #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[48] #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[49] @@ -25782,55 +25782,44 @@ SWIGINTERN PyObject *Bin1D_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject SWIGINTERN PyObject *_wrap_new_Scale__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; - Coordinate *arg1 = 0 ; - SwigValueWrapper< std::vector< Bin1D,std::allocator< Bin1D > > > arg2 ; - SwigValueWrapper< std::map< std::string,std::function< double (double) >,std::less< std::string >,std::allocator< std::pair< std::string const,std::function< double (double) > > > > > arg3 ; - void *argp1 = 0 ; + SwigValueWrapper< std::vector< Bin1D,std::allocator< Bin1D > > > arg1 ; + SwigValueWrapper< std::vector< std::pair< std::string,std::function< double (double) > >,std::allocator< std::pair< std::string,std::function< double (double) > > > > > arg2 ; + void *argp1 ; int res1 = 0 ; void *argp2 ; int res2 = 0 ; - void *argp3 ; - int res3 = 0 ; Scale *result = 0 ; - if ((nobjs < 3) || (nobjs > 3)) SWIG_fail; - res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_Coordinate, 0 | 0); - if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Scale" "', argument " "1"" of type '" "Coordinate const &""'"); - } - if (!argp1) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Scale" "', argument " "1"" of type '" "Coordinate const &""'"); - } - arg1 = reinterpret_cast< Coordinate * >(argp1); + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, 0 | 0); - if (!SWIG_IsOK(res2)) { - SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Scale" "', argument " "2"" of type '" "std::vector< Bin1D,std::allocator< Bin1D > >""'"); + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, 0 | 0); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_Scale" "', argument " "1"" of type '" "std::vector< Bin1D,std::allocator< Bin1D > >""'"); } - if (!argp2) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Scale" "', argument " "2"" of type '" "std::vector< Bin1D,std::allocator< Bin1D > >""'"); + if (!argp1) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Scale" "', argument " "1"" of type '" "std::vector< Bin1D,std::allocator< Bin1D > >""'"); } else { - std::vector< Bin1D,std::allocator< Bin1D > > * temp = reinterpret_cast< std::vector< Bin1D,std::allocator< Bin1D > > * >(argp2); - arg2 = *temp; - if (SWIG_IsNewObj(res2)) delete temp; + std::vector< Bin1D,std::allocator< Bin1D > > * temp = reinterpret_cast< std::vector< Bin1D,std::allocator< Bin1D > > * >(argp1); + arg1 = *temp; + if (SWIG_IsNewObj(res1)) delete temp; } } { - res3 = SWIG_ConvertPtr(swig_obj[2], &argp3, SWIGTYPE_p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t, 0 | 0); - if (!SWIG_IsOK(res3)) { - SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_Scale" "', argument " "3"" of type '" "trafo_map_t""'"); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t, 0 | 0); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_Scale" "', argument " "2"" of type '" "trafo_map_t""'"); } - if (!argp3) { - SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Scale" "', argument " "3"" of type '" "trafo_map_t""'"); + if (!argp2) { + SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_Scale" "', argument " "2"" of type '" "trafo_map_t""'"); } else { - trafo_map_t * temp = reinterpret_cast< trafo_map_t * >(argp3); - arg3 = *temp; - if (SWIG_IsNewObj(res3)) delete temp; + trafo_map_t * temp = reinterpret_cast< trafo_map_t * >(argp2); + arg2 = *temp; + if (SWIG_IsNewObj(res2)) delete temp; } } { try { - result = (Scale *)new Scale((Coordinate const &)*arg1,arg2,arg3); + result = (Scale *)new Scale(arg1,arg2); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -25898,25 +25887,25 @@ fail: SWIGINTERN PyObject *_wrap_new_Scale(PyObject *self, PyObject *args) { Py_ssize_t argc; - PyObject *argv[4] = { + PyObject *argv[3] = { 0 }; - if (!(argc = SWIG_Python_UnpackTuple(args, "new_Scale", 0, 3, argv))) SWIG_fail; + if (!(argc = SWIG_Python_UnpackTuple(args, "new_Scale", 0, 2, argv))) SWIG_fail; --argc; if (argc == 2) { int _v = 0; - int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_Coordinate, SWIG_POINTER_NO_NULL | 0); + int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); if (_v) { - int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, SWIG_POINTER_NO_NULL | 0); + int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_new_Scale__SWIG_1(self, argc, argv); + return _wrap_new_Scale__SWIG_0(self, argc, argv); } } } - if (argc == 3) { + if (argc == 2) { int _v = 0; int res = SWIG_ConvertPtr(argv[0], 0, SWIGTYPE_p_Coordinate, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); @@ -25924,11 +25913,7 @@ SWIGINTERN PyObject *_wrap_new_Scale(PyObject *self, PyObject *args) { int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, SWIG_POINTER_NO_NULL | 0); _v = SWIG_CheckState(res); if (_v) { - int res = SWIG_ConvertPtr(argv[2], 0, SWIGTYPE_p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t, SWIG_POINTER_NO_NULL | 0); - _v = SWIG_CheckState(res); - if (_v) { - return _wrap_new_Scale__SWIG_0(self, argc, argv); - } + return _wrap_new_Scale__SWIG_1(self, argc, argv); } } } @@ -25936,7 +25921,7 @@ SWIGINTERN PyObject *_wrap_new_Scale(PyObject *self, PyObject *args) { fail: SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_Scale'.\n" " Possible C/C++ prototypes are:\n" - " Scale::Scale(Coordinate const &,std::vector< Bin1D,std::allocator< Bin1D > >,trafo_map_t)\n" + " Scale::Scale(std::vector< Bin1D,std::allocator< Bin1D > >,trafo_map_t)\n" " Scale::Scale(Coordinate const &,std::vector< Bin1D,std::allocator< Bin1D > >)\n"); return 0; } @@ -25978,7 +25963,7 @@ fail: SWIGINTERN PyObject *_wrap_Scale_setTrafos(PyObject *self, PyObject *args) { PyObject *resultobj = 0; Scale *arg1 = (Scale *) 0 ; - SwigValueWrapper< std::map< std::string,std::function< double (double) >,std::less< std::string >,std::allocator< std::pair< std::string const,std::function< double (double) > > > > > arg2 ; + SwigValueWrapper< std::vector< std::pair< std::string,std::function< double (double) > >,std::allocator< std::pair< std::string,std::function< double (double) > > > > > arg2 ; void *argp1 = 0 ; int res1 = 0 ; void *argp2 ; @@ -25992,7 +25977,7 @@ SWIGINTERN PyObject *_wrap_Scale_setTrafos(PyObject *self, PyObject *args) { } arg1 = reinterpret_cast< Scale * >(argp1); { - res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t, 0 | 0); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2, SWIGTYPE_p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t, 0 | 0); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Scale_setTrafos" "', argument " "2"" of type '" "trafo_map_t""'"); } @@ -26832,19 +26817,29 @@ fail: SWIGINTERN PyObject *_wrap_Scale_plottableScale__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; Scale *arg1 = (Scale *) 0 ; + std::string arg2 ; void *argp1 = 0 ; int res1 = 0 ; SwigValueWrapper< Scale > result; - if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; + if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Scale, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Scale_plottableScale" "', argument " "1"" of type '" "Scale const *""'"); } arg1 = reinterpret_cast< Scale * >(argp1); + { + std::string *ptr = (std::string *)0; + int res = SWIG_AsPtr_std_string(swig_obj[1], &ptr); + if (!SWIG_IsOK(res) || !ptr) { + SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Scale_plottableScale" "', argument " "2"" of type '" "std::string""'"); + } + arg2 = *ptr; + if (SWIG_IsNewObj(res)) delete ptr; + } { try { - result = ((Scale const *)arg1)->plottableScale(); + result = ((Scale const *)arg1)->plottableScale(arg2); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -26863,29 +26858,19 @@ fail: SWIGINTERN PyObject *_wrap_Scale_plottableScale__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) { PyObject *resultobj = 0; Scale *arg1 = (Scale *) 0 ; - std::string arg2 ; void *argp1 = 0 ; int res1 = 0 ; SwigValueWrapper< Scale > result; - if ((nobjs < 2) || (nobjs > 2)) SWIG_fail; + if ((nobjs < 1) || (nobjs > 1)) SWIG_fail; res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_Scale, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Scale_plottableScale" "', argument " "1"" of type '" "Scale const *""'"); } arg1 = reinterpret_cast< Scale * >(argp1); - { - std::string *ptr = (std::string *)0; - int res = SWIG_AsPtr_std_string(swig_obj[1], &ptr); - if (!SWIG_IsOK(res) || !ptr) { - SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Scale_plottableScale" "', argument " "2"" of type '" "std::string const""'"); - } - arg2 = *ptr; - if (SWIG_IsNewObj(res)) delete ptr; - } { try { - result = ((Scale const *)arg1)->plottableScale(arg2); + result = ((Scale const *)arg1)->plottableScale(); } catch (const std::exception& ex) { // message shown in the Python interpreter const std::string msg { @@ -26915,7 +26900,7 @@ SWIGINTERN PyObject *_wrap_Scale_plottableScale(PyObject *self, PyObject *args) int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_Scale, 0); _v = SWIG_CheckState(res); if (_v) { - return _wrap_Scale_plottableScale__SWIG_0(self, argc, argv); + return _wrap_Scale_plottableScale__SWIG_1(self, argc, argv); } } if (argc == 2) { @@ -26927,7 +26912,7 @@ SWIGINTERN PyObject *_wrap_Scale_plottableScale(PyObject *self, PyObject *args) int res = SWIG_AsPtr_std_string(argv[1], (std::string**)(0)); _v = SWIG_CheckState(res); if (_v) { - return _wrap_Scale_plottableScale__SWIG_1(self, argc, argv); + return _wrap_Scale_plottableScale__SWIG_0(self, argc, argv); } } } @@ -26935,8 +26920,8 @@ SWIGINTERN PyObject *_wrap_Scale_plottableScale(PyObject *self, PyObject *args) fail: SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'Scale_plottableScale'.\n" " Possible C/C++ prototypes are:\n" - " Scale::plottableScale() const\n" - " Scale::plottableScale(std::string const) const\n"); + " Scale::plottableScale(std::string) const\n" + " Scale::plottableScale() const\n"); return 0; } @@ -30534,7 +30519,10 @@ static PyMethodDef SwigMethods[] = { { "Bin1D_clipped_or_nil", _wrap_Bin1D_clipped_or_nil, METH_VARARGS, "Bin1D_clipped_or_nil(Bin1D self, double lower, double upper) -> std::optional< Bin1D >"}, { "delete_Bin1D", _wrap_delete_Bin1D, METH_O, "delete_Bin1D(Bin1D self)"}, { "Bin1D_swigregister", Bin1D_swigregister, METH_O, NULL}, - { "new_Scale", _wrap_new_Scale, METH_VARARGS, "Scale(Coordinate const & coord, std::vector< Bin1D,std::allocator< Bin1D > > bins, trafo_map_t trafos={})"}, + { "new_Scale", _wrap_new_Scale, METH_VARARGS, "\n" + "Scale(std::vector< Bin1D,std::allocator< Bin1D > > bins, trafo_map_t trafos)\n" + "new_Scale(Coordinate const & coord, std::vector< Bin1D,std::allocator< Bin1D > > bins) -> Scale\n" + ""}, { "Scale_clone", _wrap_Scale_clone, METH_O, "Scale_clone(Scale self) -> Scale"}, { "Scale_setTrafos", _wrap_Scale_setTrafos, METH_VARARGS, "Scale_setTrafos(Scale self, trafo_map_t trafos)"}, { "Scale_axisLabel", _wrap_Scale_axisLabel, METH_O, "Scale_axisLabel(Scale self) -> std::string"}, @@ -30560,10 +30548,7 @@ static PyMethodDef SwigMethods[] = { ""}, { "Scale___eq__", _wrap_Scale___eq__, METH_VARARGS, "Scale___eq__(Scale self, Scale other) -> bool"}, { "Scale_unit", _wrap_Scale_unit, METH_O, "Scale_unit(Scale self) -> std::string"}, - { "Scale_plottableScale", _wrap_Scale_plottableScale, METH_VARARGS, "\n" - "Scale_plottableScale(Scale self) -> Scale\n" - "Scale_plottableScale(Scale self, std::string const label) -> Scale\n" - ""}, + { "Scale_plottableScale", _wrap_Scale_plottableScale, METH_VARARGS, "Scale_plottableScale(Scale self, std::string label=\"\") -> Scale"}, { "delete_Scale", _wrap_delete_Scale, METH_O, "delete_Scale(Scale self)"}, { "Scale_swigregister", Scale_swigregister, METH_O, NULL}, { "Scale_swiginit", Scale_swiginit, METH_VARARGS, NULL}, @@ -30694,7 +30679,6 @@ static swig_type_info _swigt__p_std__functionT_double_fdoubleF_t = {"_p_std__fun static swig_type_info _swigt__p_std__invalid_argument = {"_p_std__invalid_argument", "std::invalid_argument *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__lessT_std__string_t = {"_p_std__lessT_std__string_t", "std::less< std::string > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t = {"_p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t", "std::map< std::string,double,std::less< std::string >,std::allocator< std::pair< std::string const,double > > > *|std::map< std::string,double > *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t = {"_p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t", "trafo_map_t *|std::map< std::string,std::function< double (double) >,std::less< std::string >,std::allocator< std::pair< std::string const,std::function< double (double) > > > > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__optionalT_Bin1D_t = {"_p_std__optionalT_Bin1D_t", "std::optional< Bin1D > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__pairT_double_double_t = {"_p_std__pairT_double_double_t", "std::pair< double,double > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t = {"_p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t", "std::vector< Bin1D,std::allocator< Bin1D > > *", 0, 0, (void*)0, 0}; @@ -30703,6 +30687,7 @@ static swig_type_info _swigt__p_std__vectorT_double_std__allocatorT_double_t_t = static swig_type_info _swigt__p_std__vectorT_int_std__allocatorT_int_t_t = {"_p_std__vectorT_int_std__allocatorT_int_t_t", "std::vector< int,std::allocator< int > > *|std::vector< int > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t = {"_p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t", "std::vector< std::complex< double >,std::allocator< std::complex< double > > > *|std::vector< std::complex< double > > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t = {"_p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t", "std::vector< std::pair< double,double >,std::allocator< std::pair< double,double > > > *|std::vector< std::pair< double,double > > *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t = {"_p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t", "trafo_map_t *|std::vector< std::pair< std::string,std::function< double (double) > >,std::allocator< std::pair< std::string,std::function< double (double) > > > > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t = {"_p_std__vectorT_std__string_std__allocatorT_std__string_t_t", "std::vector< std::string,std::allocator< std::string > > *|std::vector< std::string > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t = {"_p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t", "std::vector< std::vector< double,std::allocator< double > > > *|std::vector< std::vector< double,std::allocator< double > >,std::allocator< std::vector< double,std::allocator< double > > > > *|std::vector< std::vector< double > > *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t = {"_p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t", "std::vector< std::vector< int,std::allocator< int > > > *|std::vector< std::vector< int,std::allocator< int > >,std::allocator< std::vector< int,std::allocator< int > > > > *|std::vector< std::vector< int > > *", 0, 0, (void*)0, 0}; @@ -30754,7 +30739,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_std__invalid_argument, &_swigt__p_std__lessT_std__string_t, &_swigt__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t, - &_swigt__p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t, &_swigt__p_std__optionalT_Bin1D_t, &_swigt__p_std__pairT_double_double_t, &_swigt__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, @@ -30763,6 +30747,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, &_swigt__p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t, &_swigt__p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t, + &_swigt__p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t, &_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, &_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, &_swigt__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t, @@ -30814,7 +30799,6 @@ static swig_cast_info _swigc__p_std__functionT_double_fdoubleF_t[] = { {&_swigt static swig_cast_info _swigc__p_std__invalid_argument[] = { {&_swigt__p_std__invalid_argument, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__lessT_std__string_t[] = { {&_swigt__p_std__lessT_std__string_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t[] = { {&_swigt__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t[] = { {&_swigt__p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__optionalT_Bin1D_t[] = { {&_swigt__p_std__optionalT_Bin1D_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__pairT_double_double_t[] = { {&_swigt__p_std__pairT_double_double_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t[] = { {&_swigt__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, 0, 0, 0},{0, 0, 0, 0}}; @@ -30823,6 +30807,7 @@ static swig_cast_info _swigc__p_std__vectorT_double_std__allocatorT_double_t_t[] static swig_cast_info _swigc__p_std__vectorT_int_std__allocatorT_int_t_t[] = { {&_swigt__p_std__vectorT_int_std__allocatorT_int_t_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t[] = { {&_swigt__p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t[] = { {&_swigt__p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t[] = { {&_swigt__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t[] = { {&_swigt__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t, 0, 0, 0},{0, 0, 0, 0}}; @@ -30874,7 +30859,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_std__invalid_argument, _swigc__p_std__lessT_std__string_t, _swigc__p_std__mapT_std__string_double_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_double_t_t_t, - _swigc__p_std__mapT_std__string_std__functionT_double_fdoubleF_t_std__lessT_std__string_t_std__allocatorT_std__pairT_std__string_const_std__functionT_double_fdoubleF_t_t_t_t, _swigc__p_std__optionalT_Bin1D_t, _swigc__p_std__pairT_double_double_t, _swigc__p_std__vectorT_Bin1D_std__allocatorT_Bin1D_t_t, @@ -30883,6 +30867,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_std__vectorT_int_std__allocatorT_int_t_t, _swigc__p_std__vectorT_std__complexT_double_t_std__allocatorT_std__complexT_double_t_t_t, _swigc__p_std__vectorT_std__pairT_double_double_t_std__allocatorT_std__pairT_double_double_t_t_t, + _swigc__p_std__vectorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_std__allocatorT_std__pairT_std__string_std__functionT_double_fdoubleF_t_t_t_t, _swigc__p_std__vectorT_std__string_std__allocatorT_std__string_t_t, _swigc__p_std__vectorT_std__vectorT_double_std__allocatorT_double_t_t_std__allocatorT_std__vectorT_double_std__allocatorT_double_t_t_t_t, _swigc__p_std__vectorT_std__vectorT_int_std__allocatorT_int_t_t_std__allocatorT_std__vectorT_int_std__allocatorT_int_t_t_t_t, diff --git a/rawEx/scatter2d/AxesInDifferentUnits.py b/rawEx/scatter2d/AxesInDifferentUnits.py index 25492f5ccf92fd1c214c1fe8037c8aee8a604d6a..24c8b5ff2678effb8af5ce6f3d644b9771e04755 100755 --- a/rawEx/scatter2d/AxesInDifferentUnits.py +++ b/rawEx/scatter2d/AxesInDifferentUnits.py @@ -75,8 +75,8 @@ if __name__ == '__main__': rcParams['image.aspect'] = 'auto' plt.figure(figsize=(10, 10)) - transformed_plot(1, result.plottableField(), - "Default: real-space detector coordinates") + transformed_plot(1, result.plottableField(("u (mm)", "v (mm)")), + "Real-space detector coordinates") transformed_plot(2, result.plottableField(("nxbins", "nybins")), "Bin indices") transformed_plot(3, result.plottableField(("phi_f (deg)", "alpha_f (deg)")), diff --git a/rawEx/scatter2d/DodecahedraSAS.py b/rawEx/scatter2d/DodecahedraSAS.py index 20e90e062f1c8052ddc149eb3341db458952544c..b127abd91f787a80c50520882a50efdab5bda071 100755 --- a/rawEx/scatter2d/DodecahedraSAS.py +++ b/rawEx/scatter2d/DodecahedraSAS.py @@ -47,4 +47,4 @@ if __name__ == '__main__': sample = get_sample() simulation = get_simulation(sample) result = simulation.simulate() - bp.plot_simulation_result(result) + bp.plot_simulation_result(result.plottableField(("u (mm)", "v (mm)")))