Dev/stuff from pyctbgui (#273)
Build on RHEL8 / build (push) Successful in 2m23s
Build on RHEL9 / build (push) Successful in 2m35s
Run tests using data on local RHEL8 / build (push) Failing after 3m19s

Matterhorn10 Transform 
some other Transformations from pyctbGUI 
added method get_reading_mode for easier error handling in decoders 


## TODO: 

- proper error handling for all other decoders 
- proper documentation for all other decoders 
- refactoring all other decoders to store hard coded values in a Struct
ChipSpecification
This commit is contained in:
2026-02-19 16:12:44 +01:00
committed by GitHub
parent 5dbc746462
commit 2139e5843c
19 changed files with 411 additions and 51 deletions
+25
View File
@@ -0,0 +1,25 @@
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "aare/defs.hpp"
namespace py = pybind11;
using namespace aare;
void define_defs_bindings(py::module &m) {
auto matterhorn10 = py::class_<Matterhorn10>(m, "Matterhorn10");
matterhorn10.attr("nRows") = Matterhorn10::nRows;
matterhorn10.attr("nCols") = Matterhorn10::nCols;
auto matterhorn02 = py::class_<Matterhorn02>(m, "Matterhorn02");
matterhorn02.attr("nRows") = Matterhorn02::nRows;
matterhorn02.attr("nCols") = Matterhorn02::nCols;
matterhorn02.attr("nHalfCols") = Matterhorn02::nHalfCols;
auto moench04 = py::class_<Moench04>(m, "Moench04");
moench04.attr("nRows") = Moench04::nRows;
moench04.attr("nCols") = Moench04::nCols;
moench04.attr("nPixelsPerSuperColumn") = Moench04::nPixelsPerSuperColumn;
moench04.attr("superColumnWidth") = Moench04::superColumnWidth;
moench04.attr("adcNumbers") = Moench04::adcNumbers;
}
@@ -33,15 +33,35 @@ void define_pixel_map_bindings(py::module &m) {
new NDArray<ssize_t, 2>(GenerateMoench05PixelMapOld());
return return_image_data(ptr);
})
.def("GenerateMoench04AnalogPixelMap",
[]() {
auto ptr =
new NDArray<ssize_t, 2>(GenerateMoench04AnalogPixelMap());
return return_image_data(ptr);
})
.def("GenerateMH02SingleCounterPixelMap",
[]() {
auto ptr = new NDArray<ssize_t, 2>(
GenerateMH02SingleCounterPixelMap());
return return_image_data(ptr);
})
.def("GenerateMH02FourCounterPixelMap", []() {
auto ptr =
new NDArray<ssize_t, 3>(GenerateMH02FourCounterPixelMap());
return return_image_data(ptr);
});
.def("GenerateMH02FourCounterPixelMap",
[]() {
auto ptr =
new NDArray<ssize_t, 3>(GenerateMH02FourCounterPixelMap());
return return_image_data(ptr);
})
.def(
"GenerateMatterhorn10PixelMap",
[](const size_t dynamic_range, const size_t n_counters) {
auto ptr = new NDArray<ssize_t, 2>(
GenerateMatterhorn10PixelMap(dynamic_range, n_counters));
return return_image_data(ptr);
},
py::arg("dynamic_range") = 16, py::arg("n_counters") = 1,
R"(
Generate pixel map for Matterhorn02 detector)");
}
+16
View File
@@ -139,6 +139,22 @@ void define_ctb_raw_file_io_bindings(py::module &m) {
return output;
});
m.def("expand4to8bit",
[](py::array_t<uint8_t, py::array::c_style | py::array::forcecast>
&input) {
py::buffer_info buf = input.request();
py::array_t<uint8_t> output(buf.size * 2);
NDView<uint8_t, 1> input_view(input.mutable_data(),
{input.size()});
NDView<uint8_t, 1> output_view(output.mutable_data(),
{output.size()});
aare::expand4to8bit(input_view, output_view);
return output;
});
m.def("decode_my302",
[](py::array_t<uint8_t, py::array::c_style | py::array::forcecast>
&input,
+4 -1
View File
@@ -9,8 +9,10 @@
#include "bind_ClusterFinder.hpp"
#include "bind_ClusterFinderMT.hpp"
#include "bind_ClusterVector.hpp"
#include "bind_Defs.hpp"
#include "bind_Eta.hpp"
#include "bind_Interpolator.hpp"
#include "bind_PixelMap.hpp"
#include "bind_RawFile.hpp"
#include "bind_calibration.hpp"
@@ -20,7 +22,6 @@
#include "fit.hpp"
#include "jungfrau_data_file.hpp"
#include "pedestal.hpp"
#include "pixel_map.hpp"
#include "raw_master_file.hpp"
#include "raw_sub_file.hpp"
#include "var_cluster.hpp"
@@ -140,6 +141,8 @@ PYBIND11_MODULE(_aare, m) {
register_calculate_3x3eta<float, 3, 3, uint16_t>(m);
register_calculate_3x3eta<int16_t, 3, 3, uint16_t>(m);
define_defs_bindings(m);
using Sum_index_pair_d = Sum_index_pair<double, corner>;
PYBIND11_NUMPY_DTYPE(Sum_index_pair_d, sum, index);
using Sum_index_pair_f = Sum_index_pair<float, corner>;
+11
View File
@@ -23,6 +23,16 @@ namespace py = pybind11;
using namespace ::aare;
void define_raw_master_file_bindings(py::module &m) {
py::enum_<ReadoutMode>(m, "ReadoutMode")
.value("ANALOG_ONLY", ReadoutMode::ANALOG_ONLY)
.value("DIGITAL_ONLY", ReadoutMode::DIGITAL_ONLY)
.value("ANALOG_AND_DIGITAL", ReadoutMode::ANALOG_AND_DIGITAL)
.value("TRANSCEIVER_ONLY", ReadoutMode::TRANSCEIVER_ONLY)
.value("DIGITAL_AND_TRANSCEIVER", ReadoutMode::DIGITAL_AND_TRANSCEIVER)
.value("UNKNOWN", ReadoutMode::UNKNOWN)
.export_values();
py::class_<RawMasterFile>(m, "RawMasterFile")
.def(py::init<const std::filesystem::path &>())
.def("data_fname", &RawMasterFile::data_fname, R"(
@@ -81,6 +91,7 @@ void define_raw_master_file_bindings(py::module &m) {
.def_property_readonly("transceiver_samples",
&RawMasterFile::transceiver_samples)
.def_property_readonly("reading_mode", &RawMasterFile::get_reading_mode)
.def_property_readonly("number_of_rows", &RawMasterFile::number_of_rows)
.def_property_readonly("quad", &RawMasterFile::quad)
.def_property_readonly("scan_parameters",