mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
python bindings
This commit is contained in:
parent
b591a42ae7
commit
dde24559f3
@ -2,7 +2,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import numpy as np
|
import numpy as np
|
||||||
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
sys.path.append(os.path.join(os.getcwd(), 'bin'))
|
||||||
from sls_detector import Eiger, Detector
|
from sls_detector import Eiger, Detector, defs
|
||||||
from sls_detector import ExperimentalDetector
|
from sls_detector import ExperimentalDetector
|
||||||
|
|
||||||
from _sls_detector.io import read_my302_file
|
from _sls_detector.io import read_my302_file
|
||||||
|
@ -6,6 +6,8 @@ from .jungfrau_ctb import JungfrauCTB
|
|||||||
from _sls_detector import DetectorApi
|
from _sls_detector import DetectorApi
|
||||||
|
|
||||||
import _sls_detector
|
import _sls_detector
|
||||||
|
|
||||||
|
defs = _sls_detector.slsDetectorDefs
|
||||||
runStatus = _sls_detector.slsDetectorDefs.runStatus
|
runStatus = _sls_detector.slsDetectorDefs.runStatus
|
||||||
detectorType = _sls_detector.slsDetectorDefs.detectorType
|
detectorType = _sls_detector.slsDetectorDefs.detectorType
|
||||||
detectorSettings = _sls_detector.slsDetectorDefs.detectorSettings
|
detectorSettings = _sls_detector.slsDetectorDefs.detectorSettings
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
#include <pybind11/stl.h>
|
#include <pybind11/stl.h>
|
||||||
|
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
|
#include "ToString.h"
|
||||||
|
#include "network_utils.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
#include "typecaster.h"
|
#include "typecaster.h"
|
||||||
namespace py = pybind11;
|
namespace py = pybind11;
|
||||||
@ -83,12 +85,121 @@ void init_experimental(py::module &m) {
|
|||||||
|
|
||||||
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
.def("getTemperature", &Detector::getTemperature, py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
// Acq related
|
|
||||||
|
.def("getDAC", &Detector::getDAC, py::arg(), py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setDAC", &Detector::setDAC, py::arg(), py::arg(), py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getTimingMode", &Detector::getTimingMode, py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("setTimingMode", &Detector::setTimingMode, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
// ACQUISITION
|
||||||
.def("acquire", &Detector::acquire)
|
.def("acquire", &Detector::acquire)
|
||||||
|
.def("startAcquisition", &Detector::startAcquisition)
|
||||||
|
.def("stopAcquisition", &Detector::stopAcquisition)
|
||||||
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
.def("clearAcquiringFlag", &Detector::clearAcquiringFlag)
|
||||||
|
.def("getDetectorStatus", &Detector::getDetectorStatus,
|
||||||
|
py::arg() = Positions{})
|
||||||
.def("getReceiverStatus", &Detector::getReceiverStatus,
|
.def("getReceiverStatus", &Detector::getReceiverStatus,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getFramesCaught", &Detector::getFramesCaught,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getStartingFrameNumber", &Detector::getStartingFrameNumber,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
.def("setStartingFrameNumber", &Detector::setStartingFrameNumber,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("sendSoftwareTrigger", &Detector::sendSoftwareTrigger,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
// Network Configuration (Detector<->Receiver)
|
||||||
|
.def("configureMAC", &Detector::configureMAC, py::arg() = Positions{})
|
||||||
|
.def("getNumberofUDPInterfaces", &Detector::getNumberofUDPInterfaces,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("setNumberofUDPInterfaces", &Detector::setNumberofUDPInterfaces,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getSelectedUDPInterface", &Detector::getSelectedUDPInterface,
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("selectUDPInterface", &Detector::selectUDPInterface, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getSourceUDPIP",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getSourceUDPIP())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setSourceUDPIP", &Detector::setSourceUDPIP, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getSourceUDPIP2",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getSourceUDPIP2())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setSourceUDPIP2", &Detector::setSourceUDPIP2, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getSourceUDPMAC",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getSourceUDPMAC())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setSourceUDPMAC", &Detector::setSourceUDPMAC, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getSourceUDPMAC2",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getSourceUDPMAC2())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setSourceUDPMAC2", &Detector::setSourceUDPMAC2, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getDestinationUDPIP",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getDestinationUDPIP())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setDestinationUDPIP", &Detector::setDestinationUDPIP, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getDestinationUDPIP2",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getDestinationUDPIP2())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setDestinationUDPIP2", &Detector::setDestinationUDPIP2, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
|
.def("getDestinationUDPMAC",
|
||||||
|
[](const Detector &d) {
|
||||||
|
std::vector<std::string> res;
|
||||||
|
for (const auto &s : d.getDestinationUDPMAC())
|
||||||
|
res.push_back(s.str());
|
||||||
|
return res;
|
||||||
|
})
|
||||||
|
.def("setDestinationUDPMAC", &Detector::setDestinationUDPMAC, py::arg(),
|
||||||
|
py::arg() = Positions{})
|
||||||
|
|
||||||
// Bits and registers
|
// Bits and registers
|
||||||
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
|
.def("setBit", &Detector::setBit, py::arg(), py::arg(),
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user