From e9bf5d6cfcb9f006e152c8a8c064be913d6f4c82 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Tue, 11 Jul 2023 14:19:38 +0200 Subject: [PATCH] express newX fct by X --- Base/Axis/MakeScale.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Base/Axis/MakeScale.cpp b/Base/Axis/MakeScale.cpp index c99f750ee47..da46a79afa6 100644 --- a/Base/Axis/MakeScale.cpp +++ b/Base/Axis/MakeScale.cpp @@ -55,6 +55,7 @@ Scale* newGenericScale(const std::string& name, const std::vector<double>& limit return new Scale(name, limits2bins(limits)); } + Scale ListScan(const std::string& name, const std::vector<double>& points) { return Scale(name, centers2bins(points)); @@ -62,7 +63,7 @@ Scale ListScan(const std::string& name, const std::vector<double>& points) Scale* newListScan(const std::string& name, const std::vector<double>& points) { - return new Scale(name, centers2bins(points)); + return new Scale(ListScan(name, points)); } @@ -73,7 +74,7 @@ Scale EquiDivision(const std::string& name, size_t nbins, double start, double e Scale* newEquiDivision(const std::string& name, size_t nbins, double start, double end) { - return new Scale(name, bounds2division(nbins, start, end)); + return new Scale(EquiDivision(name, nbins, start, end)); } std::shared_ptr<Scale> sharedEquiDivision(const std::string& name, size_t nbins, double start, @@ -92,17 +93,14 @@ std::unique_ptr<Scale> uniqueEquiDivision(const std::string& name, size_t nbins, Scale EquiScan(const std::string& name, size_t nbins, double start, double end) { if (nbins < 2) - throw std::runtime_error("Cannot create scan axis with less than two points"); + throw std::runtime_error("Cannot scan axis with less than two points"); const double delta = (end - start) / (nbins - 1); return EquiDivision(name, nbins, start - delta / 2, end + delta / 2); } Scale* newEquiScan(const std::string& name, size_t nbins, double start, double end) { - if (nbins < 2) - throw std::runtime_error("Cannot create scan axis with less than two points"); - const double delta = (end - start) / (nbins - 1); - return newEquiDivision(name, nbins, start - delta / 2, end + delta / 2); + return new Scale(EquiScan(name, nbins, start, end)); } std::shared_ptr<Scale> sharedEquiScan(const std::string& name, size_t nbins, double start, -- GitLab