bindings for xy

This commit is contained in:
Erik Fröjdh
2026-10-04 09:54:55 +02:00
parent 6f5e6b4702
commit f2db33365e
7 changed files with 90 additions and 4 deletions
+16
View File
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: MPL-2.0
#include <pybind11/operators.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
@@ -74,6 +75,21 @@ void define_defs_bindings(py::module &m) {
self.ymin == other.ymin && self.ymax == other.ymax;
});
py::class_<xy>(m, "xy")
.def(py::init<uint32_t, uint32_t>(), py::arg("row"), py::arg("col"))
.def_readwrite("row", &xy::row)
.def_readwrite("col", &xy::col)
.def("__repr__",
[](const xy &self) {
return fmt::format("xy(row={}, col={})", self.row, self.col);
})
.def("__iter__",
[](const xy &self) {
return py::iter(py::make_tuple(self.row, self.col));
})
.def(py::self == py::self)
.def(py::self != py::self);
py::enum_<DetectorType>(m, "DetectorType")
.value("Jungfrau", DetectorType::Jungfrau)
.value("Eiger", DetectorType::Eiger)
+8 -1
View File
@@ -318,7 +318,14 @@ void define_raw_file_io_bindings(py::module &m) {
Cols for the given ROI.
)")
.def_property_readonly("bitdepth", &RawFile::bitdepth)
.def_property_readonly("geometry", &RawFile::geometry)
.def_property_readonly("geometry", &RawFile::geometry, R"(
Number of modules along each axis of the detector.
Returns
-------
xy
Module rows and columns.
)")
.def_property_readonly("detector_type", &RawFile::detector_type)
.def_property_readonly("master", &RawFile::master)
.def_property_readonly("n_modules", &RawFile::n_modules)
+16 -2
View File
@@ -67,9 +67,23 @@ void define_raw_master_file_bindings(py::module &m) {
.def_property_readonly("total_frames_expected",
&RawMasterFile::total_frames_expected)
.def_property_readonly("detector_layout",
&RawMasterFile::detector_layout)
&RawMasterFile::detector_layout, R"(
Number of modules along each axis of the detector
Returns
----------
xy
Module rows and columns
)")
.def_property_readonly("udp_interfaces_per_module",
&RawMasterFile::udp_interfaces_per_module)
&RawMasterFile::udp_interfaces_per_module, R"(
Number of UDP interfaces along each axis of a module
Returns
----------
xy
UDP interface rows and columns
)")
.def_property_readonly("analog_samples", &RawMasterFile::analog_samples,
R"(
Number of analog samples