Dev/interpolation documentation (#255)
All checks were successful
Build on RHEL8 / build (push) Successful in 3m5s
Build on RHEL9 / build (push) Successful in 3m21s

- added transform_eta_values for easier debugging more control for the
user
- updated Documentation
This commit is contained in:
2025-12-16 13:06:28 +01:00
committed by GitHub
parent 80a2b02345
commit fb95e518b4
14 changed files with 240 additions and 120 deletions

View File

@@ -48,6 +48,19 @@ void register_interpolate(py::class_<aare::Interpolator> &interpolator,
docstring.c_str(), py::arg("cluster_vector"));
}
template <typename Type>
void register_transform_eta_values(
py::class_<aare::Interpolator> &interpolator) {
interpolator.def(
"transform_eta_values",
[](Interpolator &self, const Eta2<Type> &eta) {
auto uniform_coord = self.transform_eta_values(eta);
return py::make_tuple(uniform_coord.x, uniform_coord.y);
},
R"(eta.x eta.y transformed to uniform coordinates based on CDF ietax, ietay)",
py::arg("Eta"));
}
void define_interpolation_bindings(py::module &m) {
PYBIND11_NUMPY_DTYPE(aare::Photon, x, y, energy);
@@ -140,6 +153,10 @@ void define_interpolation_bindings(py::module &m) {
REGISTER_INTERPOLATOR_ETA2(float, 2, 2, uint16_t);
REGISTER_INTERPOLATOR_ETA2(double, 2, 2, uint16_t);
register_transform_eta_values<int>(interpolator);
register_transform_eta_values<float>(interpolator);
register_transform_eta_values<double>(interpolator);
// TODO! Evaluate without converting to double
m.def(
"hej",

View File

@@ -10,13 +10,13 @@
#include "bind_ClusterFinderMT.hpp"
#include "bind_ClusterVector.hpp"
#include "bind_Eta.hpp"
#include "bind_Interpolator.hpp"
#include "bind_calibration.hpp"
// TODO! migrate the other names
#include "ctb_raw_file.hpp"
#include "file.hpp"
#include "fit.hpp"
#include "interpolation.hpp"
#include "jungfrau_data_file.hpp"
#include "pedestal.hpp"
#include "pixel_map.hpp"

View File

@@ -51,6 +51,11 @@ def test_Interpolator():
cluster = _aare.Cluster3x3i(1,1, np.ones(9, dtype=np.int32))
clustervector.push_back(cluster)
[u,v] = interpolator.transform_eta_values(_aare.Etai())
assert u == 0
assert v == 0
interpolated_photons = interpolator.interpolate(clustervector)
assert interpolated_photons.size == 1