mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 00:00:02 +02:00
Merge branch 'developer' into programsync
This commit is contained in:
commit
5977103312
@ -6,6 +6,7 @@ pybind11_add_module(_slsdet
|
||||
src/network.cpp
|
||||
src/pattern.cpp
|
||||
src/scan.cpp
|
||||
src/current.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(_slsdet PUBLIC
|
||||
|
11
python/examples/use_currentsource.py
Normal file
11
python/examples/use_currentsource.py
Normal file
@ -0,0 +1,11 @@
|
||||
from slsdet import Detector, currentSrcParameters
|
||||
|
||||
s = currentSrcParameters()
|
||||
s.enable_ = 1
|
||||
s.fix_= 1
|
||||
s.normal_ = 1
|
||||
s.select_ = 10
|
||||
|
||||
|
||||
d = Detector()
|
||||
d.currentsource = s
|
@ -15,5 +15,7 @@ sp.dacSettleTime_ns = int(1e9)
|
||||
d = Mythen3()
|
||||
d.setScan(sp)
|
||||
|
||||
#or d.scan = sp
|
||||
|
||||
|
||||
|
||||
|
@ -20,4 +20,5 @@ from .enums import *
|
||||
|
||||
IpAddr = _slsdet.IpAddr
|
||||
MacAddr = _slsdet.MacAddr
|
||||
scanParameters = _slsdet.scanParameters
|
||||
scanParameters = _slsdet.scanParameters
|
||||
currentSrcParameters = _slsdet.currentSrcParameters
|
@ -362,6 +362,21 @@ class Detector(CppDetectorApi):
|
||||
"""
|
||||
return self.getNumberOfFramesFromStart()
|
||||
|
||||
|
||||
@property
|
||||
@element
|
||||
def scan(self):
|
||||
"""
|
||||
Pass in a scanParameters object
|
||||
see python/examples/use_scan.py
|
||||
|
||||
"""
|
||||
return self.getScan()
|
||||
|
||||
@scan.setter
|
||||
def scan(self, s):
|
||||
ut.set_using_dict(self.setScan, s)
|
||||
|
||||
@property
|
||||
@element
|
||||
def powerchip(self):
|
||||
@ -1991,7 +2006,7 @@ class Detector(CppDetectorApi):
|
||||
return ut.reduce_time(self.getMeasuredSubFramePeriod())
|
||||
|
||||
"""
|
||||
Jungfrau specific
|
||||
------------------<<<Jungfrau specific>>>-------------------------
|
||||
"""
|
||||
|
||||
@property
|
||||
@ -2212,6 +2227,20 @@ class Detector(CppDetectorApi):
|
||||
def gainmode(self, value):
|
||||
self.setGainMode(value)
|
||||
|
||||
@property
|
||||
@element
|
||||
def currentsource(self):
|
||||
"""
|
||||
Pass in a currentSrcParameters object
|
||||
see python/examples/use_currentsource.py
|
||||
|
||||
"""
|
||||
return self.getCurrentSource()
|
||||
|
||||
@currentsource.setter
|
||||
def currentsource(self, cs):
|
||||
ut.set_using_dict(self.setCurrentSource, cs)
|
||||
|
||||
"""
|
||||
---------------------------<<<Gotthard2 specific>>>---------------------------
|
||||
"""
|
||||
|
26
python/src/current.cpp
Normal file
26
python/src/current.cpp
Normal file
@ -0,0 +1,26 @@
|
||||
#include <pybind11/chrono.h>
|
||||
#include <pybind11/numpy.h>
|
||||
#include <pybind11/operators.h>
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
// #include "sls/Pattern.h"
|
||||
#include "sls/ToString.h"
|
||||
#include "sls/sls_detector_defs.h"
|
||||
|
||||
namespace py = pybind11;
|
||||
void init_source(py::module &m) {
|
||||
|
||||
using src = slsDetectorDefs::currentSrcParameters;
|
||||
py::class_<src> currentSrcParameters(m, "currentSrcParameters");
|
||||
|
||||
currentSrcParameters.def(py::init());
|
||||
currentSrcParameters.def_readwrite("enable_", &src::enable_);
|
||||
currentSrcParameters.def_readwrite("fix_", &src::fix_);
|
||||
currentSrcParameters.def_readwrite("normal_", &src::normal_);
|
||||
currentSrcParameters.def_readwrite("select_", &src::select_);
|
||||
currentSrcParameters.def(pybind11::self == pybind11::self);
|
||||
|
||||
currentSrcParameters.def("__repr__",
|
||||
[](const src &a) { return sls::ToString(a); });
|
||||
}
|
@ -160,6 +160,13 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(const bool)) &
|
||||
Detector::setGapPixelsinCallback,
|
||||
py::arg())
|
||||
.def("getFlipRows",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFlipRows,
|
||||
py::arg() = Positions{})
|
||||
.def("setFlipRows",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("isVirtualDetectorServer",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::isVirtualDetectorServer,
|
||||
@ -416,6 +423,39 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setParallelMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getFilterResistor",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFilterResistor,
|
||||
py::arg() = Positions{})
|
||||
.def("setFilterResistor",
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setFilterResistor,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getCurrentSource",
|
||||
(Result<defs::currentSrcParameters>(Detector::*)(sls::Positions)
|
||||
const) &
|
||||
Detector::getCurrentSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setCurrentSource",
|
||||
(void (Detector::*)(defs::currentSrcParameters, sls::Positions)) &
|
||||
Detector::setCurrentSource,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDBITPipeline",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDBITPipeline,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPipeline",
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setDBITPipeline,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getReadNRows",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getReadNRows,
|
||||
py::arg() = Positions{})
|
||||
.def("setReadNRows",
|
||||
(void (Detector::*)(const int, sls::Positions)) &
|
||||
Detector::setReadNRows,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("acquire", (void (Detector::*)()) & Detector::acquire)
|
||||
.def("clearAcquiringFlag",
|
||||
(void (Detector::*)()) & Detector::clearAcquiringFlag)
|
||||
@ -516,6 +556,31 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(const sls::MacAddr, sls::Positions)) &
|
||||
Detector::setSourceUDPMAC2,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDestinationUDPList",
|
||||
(Result<sls::UdpDestination>(Detector::*)(const uint32_t,
|
||||
sls::Positions) const) &
|
||||
Detector::getDestinationUDPList,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("setDestinationUDPList",
|
||||
(void (Detector::*)(const sls::UdpDestination, const int)) &
|
||||
Detector::setDestinationUDPList,
|
||||
py::arg(), py::arg())
|
||||
.def("getNumberofUDPDestinations",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getNumberofUDPDestinations,
|
||||
py::arg() = Positions{})
|
||||
.def("clearUDPDestinations",
|
||||
(void (Detector::*)(sls::Positions)) &
|
||||
Detector::clearUDPDestinations,
|
||||
py::arg() = Positions{})
|
||||
.def("getFirstUDPDestination",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFirstUDPDestination,
|
||||
py::arg() = Positions{})
|
||||
.def("setFirstUDPDestination",
|
||||
(void (Detector::*)(const int, sls::Positions)) &
|
||||
Detector::setFirstUDPDestination,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDestinationUDPIP",
|
||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDestinationUDPIP,
|
||||
@ -852,13 +917,6 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setOverFlowMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getFlipRows",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFlipRows,
|
||||
py::arg() = Positions{})
|
||||
.def("setFlipRows",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setFlipRows,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getRateCorrection",
|
||||
(Result<sls::ns>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRateCorrection,
|
||||
@ -871,14 +929,6 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(sls::ns, sls::Positions)) &
|
||||
Detector::setRateCorrection,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getReadNRows",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getReadNRows,
|
||||
py::arg() = Positions{})
|
||||
.def("setReadNRows",
|
||||
(void (Detector::*)(const int, sls::Positions)) &
|
||||
Detector::setReadNRows,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getInterruptSubframe",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getInterruptSubframe,
|
||||
@ -1022,9 +1072,17 @@ void init_det(py::module &m) {
|
||||
Detector::getGainMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setGainMode",
|
||||
(void (Detector::*)(defs::gainMode, sls::Positions)) &
|
||||
(void (Detector::*)(const defs::gainMode, sls::Positions)) &
|
||||
Detector::setGainMode,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getFilterCell",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFilterCell,
|
||||
py::arg() = Positions{})
|
||||
.def("setFilterCell",
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setFilterCell,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getROI",
|
||||
(Result<defs::ROI>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getROI,
|
||||
@ -1100,30 +1158,6 @@ void init_det(py::module &m) {
|
||||
.def("setCDSGain",
|
||||
(void (Detector::*)(bool, sls::Positions)) & Detector::setCDSGain,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getFilterResistor",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFilterResistor,
|
||||
py::arg() = Positions{})
|
||||
.def("setFilterResistor",
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setFilterResistor,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getFilterCell",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFilterCell,
|
||||
py::arg() = Positions{})
|
||||
.def("setFilterCell",
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setFilterCell,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getCurrentSource",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getCurrentSource,
|
||||
py::arg() = Positions{})
|
||||
.def("setCurrentSource",
|
||||
(void (Detector::*)(bool, sls::Positions)) &
|
||||
Detector::setCurrentSource,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getTimingSource",
|
||||
(Result<defs::timingSourceType>(Detector::*)(sls::Positions)
|
||||
const) &
|
||||
@ -1315,14 +1349,6 @@ void init_det(py::module &m) {
|
||||
.def("setDBITClock",
|
||||
(void (Detector::*)(int, sls::Positions)) & Detector::setDBITClock,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getDBITPipeline",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDBITPipeline,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPipeline",
|
||||
(void (Detector::*)(int, sls::Positions)) &
|
||||
Detector::setDBITPipeline,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getMeasuredVoltage",
|
||||
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
|
||||
Detector::getMeasuredVoltage,
|
||||
|
@ -21,6 +21,7 @@ void init_det(py::module &);
|
||||
void init_network(py::module &);
|
||||
void init_pattern(py::module &);
|
||||
void init_scan(py::module &);
|
||||
void init_source(py::module &);
|
||||
PYBIND11_MODULE(_slsdet, m) {
|
||||
m.doc() = R"pbdoc(
|
||||
C/C++ API
|
||||
@ -37,6 +38,7 @@ PYBIND11_MODULE(_slsdet, m) {
|
||||
init_network(m);
|
||||
init_pattern(m);
|
||||
init_scan(m);
|
||||
init_source(m);
|
||||
// init_experimental(m);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user