More uniform binding of Numpy arrays (#381)
Build on RHEL9 / build (push) Successful in 2m54s
Build on RHEL8 / build (push) Successful in 3m31s
Run tests using data on local RHEL8 / build (push) Failing after 4m28s
Build on local RHEL8 / build (push) Successful in 3m6s

- Introduce a standard way to bind numpy arrays: py::array_t<T> and
.noconvert() on the argument
- Take py::array_t by value since it's just a small wrapper
- Update bindings
This commit is contained in:
Erik Fröjdh
2026-09-25 14:40:33 +02:00
committed by GitHub
parent 8579a140f7
commit 941325ea15
26 changed files with 597 additions and 280 deletions
+6 -4
View File
@@ -138,9 +138,10 @@ void define_ClusterFile(py::module &m, const std::string &typestr) {
"Estimate the number of clusters from the file size. Frame "
"headers can make this larger than the actual count.")
.def(
"set_noise_map",
"set_noise_map", // conversions ok
[](ClusterFile<ClusterType> &self,
py::array_t<int32_t, py::array::c_style> noise_map) {
py::array_t<int32_t, py::array::c_style | py::array::forcecast>
noise_map) {
auto view = make_view_2d(noise_map);
self.set_noise_map(view);
},
@@ -149,9 +150,10 @@ void define_ClusterFile(py::module &m, const std::string &typestr) {
"[y, x]. The map must cover every cluster center coordinate.")
.def(
"set_gain_map",
"set_gain_map", // conversions ok
[](ClusterFile<ClusterType> &self,
py::array_t<double, py::array::c_style> gain_map) {
py::array_t<double, py::array::c_style | py::array::forcecast>
gain_map) {
auto view = make_view_2d(gain_map);
self.set_gain_map(view);
},