mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
default value for setDAC
This commit is contained in:
parent
2733bc5320
commit
2bc33ad34a
@ -60,6 +60,23 @@ def get_arguments(node):
|
||||
args = f", {args}"
|
||||
return args
|
||||
|
||||
def get_arguments_with_default(node):
|
||||
args = []
|
||||
for arg in node.get_arguments():
|
||||
tokens = [t.spelling for t in arg.get_tokens()]
|
||||
print(tokens)
|
||||
if '=' in tokens:
|
||||
if arg.type.spelling == "sls::Positions": #TODO! automate
|
||||
args.append("py::arg() = Positions{}")
|
||||
else:
|
||||
args.append('py::arg()' + ''.join(tokens[tokens.index('='):]))
|
||||
else:
|
||||
args.append('py::arg()')
|
||||
args = ", ".join(args)
|
||||
if args:
|
||||
args = f", {args}"
|
||||
return args
|
||||
|
||||
|
||||
def get_fdec(node):
|
||||
args = [a.type.spelling for a in node.get_arguments()]
|
||||
@ -86,7 +103,8 @@ def visit(node):
|
||||
and child.access_specifier == cindex.AccessSpecifier.PUBLIC
|
||||
):
|
||||
m.append(child)
|
||||
args = get_arguments(child)
|
||||
# args = get_arguments(child)
|
||||
args = get_arguments_with_default(child)
|
||||
fs = get_fdec(child)
|
||||
lines.append(
|
||||
f'.def("{child.spelling}",{fs} &Detector::{child.spelling}{args})'
|
||||
|
@ -322,11 +322,11 @@ void init_det(py::module &m) {
|
||||
(Result<int>(Detector::*)(defs::dacIndex, bool, sls::Positions)
|
||||
const) &
|
||||
Detector::getDAC,
|
||||
py::arg(), py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg() = false, py::arg() = Positions{})
|
||||
.def("setDAC",
|
||||
(void (Detector::*)(defs::dacIndex, int, bool, sls::Positions)) &
|
||||
Detector::setDAC,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg(), py::arg() = false, py::arg() = Positions{})
|
||||
.def("getOnChipDAC",
|
||||
(Result<int>(Detector::*)(defs::dacIndex, int, sls::Positions)
|
||||
const) &
|
||||
@ -488,14 +488,14 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort",
|
||||
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("getDestinationUDPPort2",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDestinationUDPPort2,
|
||||
py::arg() = Positions{})
|
||||
.def("setDestinationUDPPort2",
|
||||
(void (Detector::*)(int, int)) & Detector::setDestinationUDPPort2,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("reconfigureUDPDestination",
|
||||
(void (Detector::*)(sls::Positions)) &
|
||||
Detector::reconfigureUDPDestination,
|
||||
@ -568,7 +568,7 @@ void init_det(py::module &m) {
|
||||
Detector::getRxPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setRxPort", (void (Detector::*)(int, int)) & Detector::setRxPort,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("getRxFifoDepth",
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxFifoDepth,
|
||||
@ -730,7 +730,7 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setRxZmqPort",
|
||||
(void (Detector::*)(int, int)) & Detector::setRxZmqPort, py::arg(),
|
||||
py::arg())
|
||||
py::arg() = -1)
|
||||
.def("getRxZmqIP",
|
||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getRxZmqIP,
|
||||
@ -745,7 +745,7 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setClientZmqPort",
|
||||
(void (Detector::*)(int, int)) & Detector::setClientZmqPort,
|
||||
py::arg(), py::arg())
|
||||
py::arg(), py::arg() = -1)
|
||||
.def("getClientZmqIp",
|
||||
(Result<sls::IpAddr>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getClientZmqIp,
|
||||
@ -778,7 +778,8 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(int, defs::detectorSettings, bool,
|
||||
sls::Positions)) &
|
||||
Detector::setThresholdEnergy,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{})
|
||||
py::arg(), py::arg() = defs::STANDARD, py::arg() = true,
|
||||
py::arg() = Positions{})
|
||||
.def("getSettingsPath",
|
||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getSettingsPath,
|
||||
|
@ -367,9 +367,9 @@ class Detector {
|
||||
/** gets list of dac enums for this detector */
|
||||
std::vector<defs::dacIndex> getDacList() const;
|
||||
|
||||
Result<int> getDAC(defs::dacIndex index, bool mV, Positions pos = {}) const;
|
||||
Result<int> getDAC(defs::dacIndex index, bool mV = false, Positions pos = {}) const;
|
||||
|
||||
void setDAC(defs::dacIndex index, int value, bool mV, Positions pos = {});
|
||||
void setDAC(defs::dacIndex index, int value, bool mV = false, Positions pos = {});
|
||||
|
||||
/* [Gotthard2] */
|
||||
Result<int> getOnChipDAC(defs::dacIndex index, int chipIndex,
|
||||
|
Loading…
x
Reference in New Issue
Block a user