mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 04:17:15 +02:00
Minimal shared memory for receiver
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
from _slsdet import CppDetectorApi
|
||||
from _slsdet import slsDetectorDefs
|
||||
from _slsdet import IpAddr, MacAddr
|
||||
|
||||
runStatus = slsDetectorDefs.runStatus
|
||||
speedLevel = slsDetectorDefs.speedLevel
|
||||
@ -12,12 +13,13 @@ import datetime as dt
|
||||
|
||||
from functools import wraps
|
||||
from collections import namedtuple
|
||||
import socket
|
||||
|
||||
def freeze(cls):
|
||||
cls._frozen = False
|
||||
|
||||
def frozensetattr(self, key, value):
|
||||
if self._frozen and not hasattr(self, key):
|
||||
if self._frozen and not key in dir(self):
|
||||
raise AttributeError(
|
||||
"Class {} is frozen. Cannot set {} = {}".format(
|
||||
cls.__name__, key, value
|
||||
@ -58,7 +60,6 @@ class Detector(CppDetectorApi):
|
||||
self._adc_register = Adc_register(self)
|
||||
|
||||
|
||||
|
||||
# CONFIGURATION
|
||||
def __len__(self):
|
||||
return self.size()
|
||||
@ -71,9 +72,6 @@ class Detector(CppDetectorApi):
|
||||
def free(self):
|
||||
self.freeSharedMemory()
|
||||
|
||||
|
||||
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
return NotImplementedError("config is set only")
|
||||
@ -92,6 +90,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@property
|
||||
def hostname(self):
|
||||
print('getting host!')
|
||||
return self.getHostname()
|
||||
|
||||
@hostname.setter
|
||||
@ -422,7 +421,9 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@udp_dstip.setter
|
||||
def udp_dstip(self, ip):
|
||||
self.getDestinationUDPIP(ip)
|
||||
if ip == 'auto':
|
||||
ip = socket.gethostbyname(self.rx_hostname)
|
||||
self.setDestinationUDPIP(IpAddr(ip))
|
||||
|
||||
@property
|
||||
def udp_dstip2(self):
|
||||
@ -430,7 +431,9 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@udp_dstip2.setter
|
||||
def udp_dstip2(self, ip):
|
||||
self.getDestinationUDPIP2(ip)
|
||||
if ip == 'auto':
|
||||
ip = socket.gethostbyname(self.rx_hostname)
|
||||
self.setDestinationUDPIP2(IpAddr(ip))
|
||||
|
||||
@property
|
||||
def udp_dstmac(self):
|
||||
@ -438,7 +441,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@udp_dstmac.setter
|
||||
def udp_dstmac(self, mac):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
self.setDestinationUDPMAC(MacAddr(mac))
|
||||
|
||||
@property
|
||||
def udp_dstmac2(self):
|
||||
@ -446,7 +449,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@udp_dstmac2.setter
|
||||
def udp_dstmac2(self, mac):
|
||||
self.getDestinationUDPMAC2(mac)
|
||||
self.setDestinationUDPMAC2(MacAddr(mac))
|
||||
|
||||
|
||||
@property
|
||||
@ -455,7 +458,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@udp_srcip.setter
|
||||
def udp_srcip(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
self.setSourceUDPIP(IpAddr(ip))
|
||||
|
||||
@property
|
||||
def udp_srcip2(self):
|
||||
@ -487,7 +490,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@src_udpmac.setter
|
||||
def src_udpmac(self, mac):
|
||||
self.setSourceUDPMAC(mac)
|
||||
self.setSourceUDPMAC(MacAddr(mac))
|
||||
|
||||
@property
|
||||
def src_udpip2(self):
|
||||
@ -495,7 +498,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@src_udpip2.setter
|
||||
def src_udpip2(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
self.setSourceUDPIP(IpAddr(ip))
|
||||
|
||||
@property
|
||||
def src_udpip(self):
|
||||
@ -503,7 +506,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@src_udpip.setter
|
||||
def src_udpip(self, ip):
|
||||
self.setSourceUDPIP(ip)
|
||||
self.setSourceUDPIP(IpAddr(ip))
|
||||
|
||||
|
||||
@property
|
||||
@ -512,7 +515,7 @@ class Detector(CppDetectorApi):
|
||||
|
||||
@src_udpmac2.setter
|
||||
def src_udpmac2(self, mac):
|
||||
self.setSourceUDPMAC2(mac)
|
||||
self.setSourceUDPMAC2(MacAddr(mac))
|
||||
|
||||
@property
|
||||
def vhighvoltage(self):
|
||||
|
@ -92,6 +92,15 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setADCPhaseInDegrees", &Detector::setADCPhaseInDegrees, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPhase", &Detector::getDBITPhase, py::arg() = Positions{})
|
||||
.def("setDBITPhase", &Detector::setDBITPhase, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMaxDBITPhaseShift", &Detector::getMaxDBITPhaseShift,
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPhaseInDegrees", &Detector::getDBITPhaseInDegrees,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPhaseInDegrees", &Detector::setDBITPhaseInDegrees,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getClockFrequency", &Detector::getClockFrequency, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setClockFrequency", &Detector::setClockFrequency, py::arg(),
|
||||
@ -464,29 +473,9 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfAnalogSamples", &Detector::setNumberOfAnalogSamples,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getNumberOfDigitalSamples", &Detector::getNumberOfDigitalSamples,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfDigitalSamples", &Detector::setNumberOfDigitalSamples,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getReadoutMode", &Detector::getReadoutMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setReadoutMode", &Detector::setReadoutMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPhase", &Detector::getDBITPhase, py::arg() = Positions{})
|
||||
.def("setDBITPhase", &Detector::setDBITPhase, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMaxDBITPhaseShift", &Detector::getMaxDBITPhaseShift,
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPhaseInDegrees", &Detector::getDBITPhaseInDegrees,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPhaseInDegrees", &Detector::setDBITPhaseInDegrees,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getADCClock", &Detector::getADCClock, py::arg() = Positions{})
|
||||
.def("setADCClock", &Detector::setADCClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITClock", &Detector::getDBITClock, py::arg() = Positions{})
|
||||
.def("setDBITClock", &Detector::setDBITClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getRUNClock", &Detector::getRUNClock, py::arg() = Positions{})
|
||||
.def("setRUNClock", &Detector::setRUNClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
@ -495,20 +484,10 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setADCPipeline", &Detector::setADCPipeline, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPipeline", &Detector::getDBITPipeline,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPipeline", &Detector::setDBITPipeline, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getVoltage", &Detector::getVoltage, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("setVoltage", &Detector::setVoltage, py::arg(), py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredVoltage", &Detector::getMeasuredVoltage, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredCurrent", &Detector::getMeasuredCurrent, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSlowADC", &Detector::getSlowADC, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getADCEnableMask", &Detector::getADCEnableMask,
|
||||
py::arg() = Positions{})
|
||||
.def("setADCEnableMask", &Detector::setADCEnableMask, py::arg(),
|
||||
@ -517,8 +496,26 @@ void init_det(py::module &m) {
|
||||
py::arg() = Positions{})
|
||||
.def("setTenGigaADCEnableMask", &Detector::setTenGigaADCEnableMask,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getADCInvert", &Detector::getADCInvert, py::arg() = Positions{})
|
||||
.def("setADCInvert", &Detector::setADCInvert, py::arg(),
|
||||
.def("getNumberOfDigitalSamples", &Detector::getNumberOfDigitalSamples,
|
||||
py::arg() = Positions{})
|
||||
.def("setNumberOfDigitalSamples", &Detector::setNumberOfDigitalSamples,
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getReadoutMode", &Detector::getReadoutMode,
|
||||
py::arg() = Positions{})
|
||||
.def("setReadoutMode", &Detector::setReadoutMode, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITClock", &Detector::getDBITClock, py::arg() = Positions{})
|
||||
.def("setDBITClock", &Detector::setDBITClock, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getDBITPipeline", &Detector::getDBITPipeline,
|
||||
py::arg() = Positions{})
|
||||
.def("setDBITPipeline", &Detector::setDBITPipeline, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredVoltage", &Detector::getMeasuredVoltage, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getMeasuredCurrent", &Detector::getMeasuredCurrent, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getSlowADC", &Detector::getSlowADC, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getExternalSamplingSource", &Detector::getExternalSamplingSource,
|
||||
py::arg() = Positions{})
|
||||
@ -627,6 +624,9 @@ void init_det(py::module &m) {
|
||||
py::arg(), py::arg() = Positions{})
|
||||
.def("getInitialChecks", &Detector::getInitialChecks)
|
||||
.def("setInitialChecks", &Detector::setInitialChecks, py::arg())
|
||||
.def("getADCInvert", &Detector::getADCInvert, py::arg() = Positions{})
|
||||
.def("setADCInvert", &Detector::setADCInvert, py::arg(),
|
||||
py::arg() = Positions{})
|
||||
.def("getControlPort", &Detector::getControlPort,
|
||||
py::arg() = Positions{})
|
||||
.def("setControlPort", &Detector::setControlPort, py::arg(),
|
||||
|
@ -184,6 +184,11 @@ void init_enums(py::module &m) {
|
||||
.value("VB_PIXBUF", slsDetectorDefs::dacIndex::VB_PIXBUF)
|
||||
.value("VIN_COM", slsDetectorDefs::dacIndex::VIN_COM)
|
||||
.value("VDD_PROT", slsDetectorDefs::dacIndex::VDD_PROT)
|
||||
.value("VBP_COLBUF", slsDetectorDefs::dacIndex::VBP_COLBUF)
|
||||
.value("VB_SDA", slsDetectorDefs::dacIndex::VB_SDA)
|
||||
.value("VCASC_SFP", slsDetectorDefs::dacIndex::VCASC_SFP)
|
||||
.value("VIPRE_CDS", slsDetectorDefs::dacIndex::VIPRE_CDS)
|
||||
.value("IBIAS_SFP", slsDetectorDefs::dacIndex::IBIAS_SFP)
|
||||
.value("V_POWER_A", slsDetectorDefs::dacIndex::V_POWER_A)
|
||||
.value("V_POWER_B", slsDetectorDefs::dacIndex::V_POWER_B)
|
||||
.value("V_POWER_C", slsDetectorDefs::dacIndex::V_POWER_C)
|
||||
@ -224,6 +229,18 @@ void init_enums(py::module &m) {
|
||||
.value("FORCESWITCHG2",
|
||||
slsDetectorDefs::detectorSettings::FORCESWITCHG2)
|
||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
||||
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
||||
.value("G2_HIGHCAP_HIGHGAIN",
|
||||
slsDetectorDefs::detectorSettings::G2_HIGHCAP_HIGHGAIN)
|
||||
.value("G2_HIGHCAP_LOWGAIN",
|
||||
slsDetectorDefs::detectorSettings::G2_HIGHCAP_LOWGAIN)
|
||||
.value("G2_LOWCAP_HIGHGAIN",
|
||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_HIGHGAIN)
|
||||
.value("G2_LOWCAP_LOWGAIN",
|
||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
||||
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
||||
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||
.value("UNINITIALIZED",
|
||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||
|
@ -15,10 +15,11 @@ using sls::IpAddr;
|
||||
using sls::MacAddr;
|
||||
void init_network(py::module &m) {
|
||||
|
||||
py::class_ <IpAddr> IpAddr(m, "IpAddr");
|
||||
IpAddr.def(py::init())
|
||||
py::class_ <IpAddr>(m, "IpAddr")
|
||||
.def(py::init())
|
||||
.def(py::init<const std::string&>())
|
||||
.def(py::init<uint32_t>())
|
||||
.def(py::init<const IpAddr&>())
|
||||
.def("hex", &IpAddr::hex)
|
||||
.def("uint32", &IpAddr::uint32)
|
||||
.def(py::self == py::self)
|
||||
@ -26,10 +27,11 @@ void init_network(py::module &m) {
|
||||
.def("str", &IpAddr::str);
|
||||
|
||||
|
||||
py::class_ <MacAddr> MacAddr(m, "MacAddr");
|
||||
MacAddr.def(py::init())
|
||||
py::class_ <MacAddr>(m, "MacAddr")
|
||||
.def(py::init())
|
||||
.def(py::init<const std::string&>())
|
||||
.def(py::init<uint64_t>())
|
||||
.def(py::init<const MacAddr&>())
|
||||
.def("hex", &MacAddr::hex)
|
||||
.def(py::self == py::self)
|
||||
.def("uint64", &MacAddr::uint64)
|
||||
|
Reference in New Issue
Block a user