diff --git a/Base/Axis/Scale.cpp b/Base/Axis/Scale.cpp index f0f1f12d24e0ce12fce69e768a293afd1138aa6f..ba84a232d9c12f323c22ecace02688e722bf9918 100644 --- a/Base/Axis/Scale.cpp +++ b/Base/Axis/Scale.cpp @@ -224,7 +224,18 @@ Scale Scale::plottableScale() const return *this; } -Scale Scale::plottableScale(const std::string /*label*/) const -{ - 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 + "'"); + ASSERT(entry->first == label); + const trafo_t& trafo = entry->second; + std::vector<Bin1D> outvector; + for (const Bin1D b : m_bins) { + double bmi = trafo(b.lowerBound()); + double bma = trafo(b.upperBound()); + outvector.emplace_back(Bin1D::FromTo(bmi, bma)); + } + return {label, outvector}; } diff --git a/Device/Detector/FlatDetector.cpp b/Device/Detector/FlatDetector.cpp index f598748cdf2a78c04235e17b15cea4ab337e99d5..84a459061f978074023fd64e4fd939ddfc94ac07 100644 --- a/Device/Detector/FlatDetector.cpp +++ b/Device/Detector/FlatDetector.cpp @@ -59,10 +59,10 @@ FlatDetector::FlatDetector(size_t nxbins, size_t nybins, double width, double he m_u_unit = u_direction.unit_or_throw(); m_v_unit = m_u_unit.cross(m_normal_to_detector).unit_or_throw(); - trafo_map_t x_trafos = {{"phi_f (deg)", [&](double u) -> double { - return atan(u / m_distance) * (180 / pi);}}}; - trafo_map_t y_trafos = {{"alpha_f (deg)", [&](double v) -> double { - return atan(v / m_distance) * (180 / pi);}}}; + trafo_map_t x_trafos = { + {"phi_f (deg)", [&](double u) -> double { return atan(u / m_distance) * (180 / pi); }}}; + trafo_map_t y_trafos = { + {"alpha_f (deg)", [&](double v) -> double { return atan(v / m_distance) * (180 / pi); }}}; Scale x = m_frame->xAxis(); Scale y = m_frame->yAxis(); x.setTrafos(x_trafos);