mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
removed setClockFrequency and added some python commands
This commit is contained in:
parent
e8cd75a6ac
commit
6d01348bf4
@ -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
|
||||
|
@ -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)
|
||||
|
||||
"""
|
||||
<<<Gotthard2>>>
|
||||
---------------------------<<<Gotthard2 specific>>>---------------------------
|
||||
"""
|
||||
|
||||
@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----------------------->>>
|
||||
|
||||
---------------------------<<<Gotthard specific>>>---------------------------
|
||||
"""
|
||||
|
||||
@property
|
||||
def exptimel(self):
|
||||
t = self.getExptimeLeft()
|
||||
return reduce_time(t)
|
||||
|
||||
|
||||
"""
|
||||
---------------------------<<<Mythen3 specific>>>---------------------------
|
||||
"""
|
||||
|
||||
@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)
|
||||
|
||||
"""
|
||||
---------------------------<<<Debug>>>---------------------------
|
||||
"""
|
||||
|
||||
@property
|
||||
def initialchecks(self):
|
||||
return self.getInitialChecks()
|
||||
|
||||
@initialchecks.setter
|
||||
def initialchecks(self, value):
|
||||
self.setInitialChecks(value)
|
@ -83,3 +83,46 @@ class ClkDivProxy:
|
||||
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')
|
@ -253,10 +253,6 @@ void init_det(py::module &m) {
|
||||
(Result<int>(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<int>(Detector::*)(int, sls::Positions)) &
|
||||
Detector::getClockPhase,
|
||||
|
@ -310,9 +310,6 @@ class Detector {
|
||||
/** [Mythen3][Gotthard2] Hz */
|
||||
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
||||
|
||||
/** [not implemented] Hz */
|
||||
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
||||
|
||||
/** [Mythen3][Gotthard2] */
|
||||
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
||||
|
||||
|
@ -699,13 +699,7 @@ std::string CmdProxy::ClockFrequency(int action) {
|
||||
std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setClockFrequency(StringTo<int>(args[0]),
|
||||
StringTo<int>(args[1]),
|
||||
std::vector<int>{det_id});
|
||||
os << StringTo<int>(args[1]) << '\n';
|
||||
throw sls::RuntimeError("cannot put");
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
|
@ -384,9 +384,6 @@ Result<int> 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<int> Detector::getClockPhase(int clkIndex, Positions pos) {
|
||||
return pimpl->Parallel(&Module::getClockPhase, pos, clkIndex, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user