mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-30 09:50:06 +02:00

* added patterntools from mythen3tools * refactored do use implementation from slsSupportLib
30 lines
987 B
C++
30 lines
987 B
C++
// SPDX-License-Identifier: LGPL-3.0-or-other
|
|
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
|
#include "py_headers.h"
|
|
|
|
#include "sls/Pattern.h"
|
|
#include "sls/sls_detector_defs.h"
|
|
namespace py = pybind11;
|
|
void init_pattern(py::module &m) {
|
|
|
|
using pat = sls::patternParameters;
|
|
py::class_<pat> patternParameters(m, "patternParameters");
|
|
|
|
PYBIND11_NUMPY_DTYPE(pat, word, ioctrl, limits, startloop, stoploop, nloop, wait,
|
|
waittime);
|
|
|
|
patternParameters.def(py::init());
|
|
patternParameters.def("numpy_view", [](py::object &obj) {
|
|
pat &o = obj.cast<pat &>();
|
|
return py::array_t<pat>(1, &o, obj);
|
|
});
|
|
|
|
py::class_<sls::Pattern> Pattern(m, "Pattern");
|
|
Pattern.def(py::init())
|
|
.def("load", &sls::Pattern::load)
|
|
.def("save", &sls::Pattern::save)
|
|
.def("str", &sls::Pattern::str)
|
|
.def("data", (pat * (sls::Pattern::*)()) & sls::Pattern::data,
|
|
py::return_value_policy::reference);
|
|
}
|