add python bindings to the updated find_clusters function
Build on RHEL9 / build (push) Successful in 2m19s
Build on RHEL8 / build (push) Successful in 2m55s
Run tests using data on local RHEL8 / build (push) Successful in 3m46s

This commit is contained in:
2026-05-05 15:15:52 +02:00
parent 95762ae459
commit 6c69b13da6
5 changed files with 23 additions and 13 deletions
+2 -2
View File
@@ -39,14 +39,14 @@ def ClusterFinder(image_size, cluster_size=(3,3), n_sigma=5, dtype = np.int32, c
def ClusterFinderMT(image_size, cluster_size = (3,3), dtype=np.int32, n_sigma=5, capacity = 1024, n_threads = 3):
def ClusterFinderMT(image_size, cluster_size = (3,3), dtype=np.int32, n_sigma=5, capacity = 1024, n_threads = 3, update_pedestal = True):
"""
Factory function to create a ClusterFinderMT object. Provides a cleaner syntax for
the templated ClusterFinderMT in C++.
"""
cls = _get_class("ClusterFinderMT", cluster_size, dtype)
return cls(image_size, n_sigma=n_sigma, capacity=capacity, n_threads=n_threads)
return cls(image_size, n_sigma=n_sigma, capacity=capacity, n_threads=n_threads, update_pedestal=update_pedestal)
def ClusterCollector(clusterfindermt, dtype=np.int32):
+5 -3
View File
@@ -74,12 +74,14 @@ void define_ClusterFinder(py::module &m, const std::string &typestr) {
.def(
"find_clusters",
[](ClusterFinder<ClusterType, uint16_t, pd_type> &self,
py::array_t<uint16_t> frame, uint64_t frame_number) {
py::array_t<uint16_t> frame, uint64_t frame_number,
bool update_pedestal) {
auto view = make_view_2d(frame);
self.find_clusters(view, frame_number);
self.find_clusters(view, frame_number, update_pedestal);
return;
},
py::arg(), py::arg("frame_number") = 0);
py::arg(), py::arg("frame_number") = 0,
py::arg("update_pedestal") = true);
}
#pragma GCC diagnostic pop
+3 -2
View File
@@ -31,9 +31,10 @@ void define_ClusterFinderMT(py::module &m, const std::string &typestr) {
py::class_<ClusterFinderMT<ClusterType, uint16_t, pd_type>>(
m, class_name.c_str())
.def(py::init<Shape<2>, pd_type, size_t, size_t>(),
.def(py::init<Shape<2>, pd_type, size_t, size_t, bool>(),
py::arg("image_size"), py::arg("n_sigma") = 5.0,
py::arg("capacity") = 2048, py::arg("n_threads") = 3)
py::arg("capacity") = 2048, py::arg("n_threads") = 3,
py::arg("update_pedestal") = true)
.def("push_pedestal_frame",
[](ClusterFinderMT<ClusterType, uint16_t, pd_type> &self,
py::array_t<uint16_t> frame) {