mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-12-29 07:31:18 +01:00
Setting pattern from memory (#218)
* ToString accepts c-style arrays * added patternParameters to python * fixed patwait time bug in validation * moved load from file function to patterParameters * server using patternparamters structure to get pattern Co-authored-by: Erik Frojdh <erik.frojdh@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/numpy.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
@@ -9,10 +10,22 @@ void init_enums(py::module &m) {
|
||||
py::class_<slsDetectorDefs> Defs(m, "slsDetectorDefs");
|
||||
py::class_<slsDetectorDefs::xy> xy(m, "xy");
|
||||
xy.def(py::init());
|
||||
xy.def(py::init<int,int>());
|
||||
xy.def(py::init<int, int>());
|
||||
xy.def_readwrite("x", &slsDetectorDefs::xy::x);
|
||||
xy.def_readwrite("y", &slsDetectorDefs::xy::y);
|
||||
|
||||
[[ENUMS]]
|
||||
py::class_<slsDetectorDefs::patternParameters> patternParameters(
|
||||
m, "patternParameters");
|
||||
|
||||
using pat = slsDetectorDefs::patternParameters;
|
||||
PYBIND11_NUMPY_DTYPE(pat, word, patioctrl, patlimits, patloop, patnloop,
|
||||
patwait, patwaittime);
|
||||
|
||||
patternParameters.def(py::init());
|
||||
patternParameters.def("numpy_view", [](py::object &obj) {
|
||||
pat& o = obj.cast<pat&>();
|
||||
return py::array_t<pat>(1, &o, obj); });
|
||||
patternParameters.def("load", &pat::load);
|
||||
|
||||
[[ENUMS]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user