diff --git a/python/scripts/compare_with_commandline.py b/python/scripts/compare_with_commandline.py index 2e6b78985..9d4474b20 100644 --- a/python/scripts/compare_with_commandline.py +++ b/python/scripts/compare_with_commandline.py @@ -80,7 +80,10 @@ dacs = [ 'vth1', 'vth2', 'vth3', - 'vtrim' + 'vtrim', + 'ib_test_c', + 'ibias_sfp', + ] intentionally_missing = [ @@ -106,6 +109,10 @@ intentionally_missing = [ 'resetfpga', #use resetFPGA() 'rebootcontroller', #use rebootController() 'firmwaretest', #use executeFirmwareTest + 'bustest', # executeBusTest + 'programfpga', #programFPGA + 'dac', #use setDAC or detector specific class + 'clearroi', #clearROI ] pycmd += intentionally_missing diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 7613d34be..53f20f977 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -11,7 +11,7 @@ detectorType = slsDetectorDefs.detectorType from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask from .utils import Geometry, to_geo, element, reduce_time, is_iterable from . import utils as ut -from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy +from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy from .registers import Register, Adc_register import datetime as dt @@ -1180,6 +1180,21 @@ class Detector(CppDetectorApi): def rx_lock(self, value): self.setRxLock(value) + + @property + @element + def scanerrmsg(self): + return self.getScanErrorMessage() + + @property + @element + def rx_zmqstartfnum(self): + return self.getRxZmqStartingFrame() + + @rx_zmqstartfnum.setter + def rx_zmqstartfnum(self, value): + ut.set_using_dict(self.setRxZmqStartingFrame, value) + @property def lastclient(self): """Get Client IP Address that last communicated with the detector.""" @@ -1246,6 +1261,15 @@ class Detector(CppDetectorApi): """ return self._adc_register + @property + @element + def adcinvert(self): + return self.getADCInvert() + + @adcinvert.setter + def adcinvert(self, value): + ut.set_using_dict(self.setADCInvert, value) + @property @element def triggersl(self): @@ -1801,9 +1825,31 @@ class Detector(CppDetectorApi): self.selectUDPInterface(i) """ - <<>> + ---------------------------<<>>--------------------------- """ + @property + @element + def bursts(self): + return self.getNumberOfBursts() + + @bursts.setter + def bursts(self, value): + self.setNumberOfBursts(value) + + @property + @element + def filter(self): + return self.getFilter() + + @filter.setter + def filter(self, value): + ut.set_using_dict(self.setFilter, value) + + @property + def maxclkphaseshift(self): + return MaxPhaseProxy(self) + @property @element def timingsource(self): @@ -2561,12 +2607,41 @@ class Detector(CppDetectorApi): """ - - <<<-----------------------Gotthard specific----------------------->>> - + ---------------------------<<>>--------------------------- """ @property def exptimel(self): t = self.getExptimeLeft() return reduce_time(t) + + + """ + ---------------------------<<>>--------------------------- + """ + + @property + @element + def gates(self): + return self.getNumberOfGates() + + @gates.setter + def gates(self, value): + ut.set_using_dict(self.setNumberOfGates, value) + + + @property + def clkfreq(self): + return ClkFreqProxy(self) + + """ + ---------------------------<<>>--------------------------- + """ + + @property + def initialchecks(self): + return self.getInitialChecks() + + @initialchecks.setter + def initialchecks(self, value): + self.setInitialChecks(value) \ No newline at end of file diff --git a/python/slsdet/proxy.py b/python/slsdet/proxy.py index 7bcec15c3..aa2383b3c 100644 --- a/python/slsdet/proxy.py +++ b/python/slsdet/proxy.py @@ -82,4 +82,47 @@ class ClkDivProxy: else: rstr += f'{i}: {r}\n' + return rstr.strip('\n') + + +class MaxPhaseProxy: + """ + Proxy class to allow for more intuitive reading clockdivider + """ + def __init__(self, det): + self.det = det + + def __getitem__(self, key): + return element_if_equal(self.det.getMaxClockPhaseShift(key)) + + def __repr__(self): + rstr = '' + for i in range(5): + r = element_if_equal(self.__getitem__(i)) + if isinstance(r, list): + rstr += ' '.join(f'{item}' for item in r) + else: + rstr += f'{i}: {r}\n' + + return rstr.strip('\n') + +class ClkFreqProxy: + """ + Proxy class to allow for more intuitive reading clockdivider + """ + def __init__(self, det): + self.det = det + + def __getitem__(self, key): + return element_if_equal(self.det.getClockFrequency(key)) + + def __repr__(self): + rstr = '' + for i in range(5): + r = element_if_equal(self.__getitem__(i)) + if isinstance(r, list): + rstr += ' '.join(f'{item}' for item in r) + else: + rstr += f'{i}: {r}\n' + return rstr.strip('\n') \ No newline at end of file diff --git a/python/src/detector.cpp b/python/src/detector.cpp index f5d0cbf72..1f62ab323 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -253,10 +253,6 @@ void init_det(py::module &m) { (Result(Detector::*)(int, sls::Positions)) & Detector::getClockFrequency, py::arg(), py::arg() = Positions{}) - .def("setClockFrequency", - (void (Detector::*)(int, int, sls::Positions)) & - Detector::setClockFrequency, - py::arg(), py::arg(), py::arg() = Positions{}) .def("getClockPhase", (Result(Detector::*)(int, sls::Positions)) & Detector::getClockPhase, diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 08bd1d1bd..5bf4f1cfd 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -310,9 +310,6 @@ class Detector { /** [Mythen3][Gotthard2] Hz */ Result getClockFrequency(int clkIndex, Positions pos = {}); - /** [not implemented] Hz */ - void setClockFrequency(int clkIndex, int value, Positions pos = {}); - /** [Mythen3][Gotthard2] */ Result getClockPhase(int clkIndex, Positions pos = {}); diff --git a/slsDetectorSoftware/src/CmdProxy.cpp b/slsDetectorSoftware/src/CmdProxy.cpp index 72d0b7754..6cb26f3de 100644 --- a/slsDetectorSoftware/src/CmdProxy.cpp +++ b/slsDetectorSoftware/src/CmdProxy.cpp @@ -699,13 +699,7 @@ std::string CmdProxy::ClockFrequency(int action) { std::vector{det_id}); os << OutString(t) << '\n'; } else if (action == defs::PUT_ACTION) { - if (args.size() != 2) { - WrongNumberOfParameters(2); - } - det->setClockFrequency(StringTo(args[0]), - StringTo(args[1]), - std::vector{det_id}); - os << StringTo(args[1]) << '\n'; + throw sls::RuntimeError("cannot put"); } else { throw sls::RuntimeError("Unknown action"); } diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 9de9e7e05..05815ef6c 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -384,9 +384,6 @@ Result Detector::getClockFrequency(int clkIndex, Positions pos) { return pimpl->Parallel(&Module::getClockFrequency, pos, clkIndex); } -void Detector::setClockFrequency(int clkIndex, int value, Positions pos) { - pimpl->Parallel(&Module::setClockFrequency, pos, clkIndex, value); -} Result Detector::getClockPhase(int clkIndex, Positions pos) { return pimpl->Parallel(&Module::getClockPhase, pos, clkIndex, false);