mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-05-14 00:15:36 +02:00
moved signallist, adclist, slowadc, slowadclist to Ctb
This commit is contained in:
+58
-2
@@ -4,10 +4,13 @@ from .detector import Detector, freeze
|
||||
from .utils import element_if_equal
|
||||
from .dacs import DetectorDacs, NamedDacs
|
||||
from .powers import DetectorPowers
|
||||
from .proxy import SlowAdcProxy
|
||||
from . import _slsdet
|
||||
dacIndex = _slsdet.slsDetectorDefs.dacIndex
|
||||
from .detector_property import DetectorProperty
|
||||
|
||||
import numpy as np
|
||||
|
||||
|
||||
from .utils import element
|
||||
@freeze
|
||||
@@ -26,11 +29,64 @@ class Ctb(Detector):
|
||||
def powers(self):
|
||||
return self._powers
|
||||
|
||||
|
||||
@property
|
||||
def powerlist(self):
|
||||
return self.getPowerNames()
|
||||
|
||||
@powerlist.setter
|
||||
def powerlist(self, value):
|
||||
self.setPowerNames(value)
|
||||
self.setPowerNames(value)
|
||||
|
||||
|
||||
@property
|
||||
def adclist(self):
|
||||
return self.getAdcNames()
|
||||
|
||||
@adclist.setter
|
||||
def adclist(self, value):
|
||||
self.setAdcNames(value)
|
||||
|
||||
@property
|
||||
def signallist(self):
|
||||
return self.getSignalNames()
|
||||
|
||||
@signallist.setter
|
||||
def signallist(self, value):
|
||||
self.setSignalNames(value)
|
||||
|
||||
@property
|
||||
def slowadc(self):
|
||||
"""
|
||||
[Ctb] Slow ADC channel in uV of all channels or specific ones from 0-7.
|
||||
|
||||
Example
|
||||
-------
|
||||
>>> d.slowadc
|
||||
0: 0 uV
|
||||
1: 0 uV
|
||||
2: 0 uV
|
||||
3: 0 uV
|
||||
4: 0 uV
|
||||
5: 0 uV
|
||||
6: 0 uV
|
||||
7: 0 uV
|
||||
>>> d.slowadc[3]
|
||||
0
|
||||
"""
|
||||
return SlowAdcProxy(self)
|
||||
|
||||
@property
|
||||
def slowadclist(self):
|
||||
return self.getSlowADCNames()
|
||||
|
||||
@slowadclist.setter
|
||||
def slowadclist(self, value):
|
||||
self.setSlowADCNames(value)
|
||||
|
||||
@property
|
||||
def slowadcvalues(self):
|
||||
"""[Chiptestboard][Xilinx CTB] Gets the slow adc values for every slow adc for this detector."""
|
||||
return {
|
||||
slowadc.name.lower(): element_if_equal(np.array(self.getSlowADC(slowadc)))
|
||||
for slowadc in self.getSlowADCList()
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ from .utils import Geometry, to_geo, element, reduce_time, is_iterable, hostname
|
||||
from ._slsdet import xy, freeSharedMemory, getUserDetails
|
||||
from .gaincaps import Mythen3GainCapsWrapper
|
||||
from . import utils as ut
|
||||
from .proxy import JsonProxy, SlowAdcProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
||||
from .proxy import JsonProxy, ClkDivProxy, MaxPhaseProxy, ClkFreqProxy, PatLoopProxy, PatNLoopProxy, PatWaitProxy, PatWaitTimeProxy
|
||||
from .registers import Register, Adc_register
|
||||
import datetime as dt
|
||||
|
||||
@@ -1987,26 +1987,7 @@ class Detector(CppDetectorApi):
|
||||
return super().getBit(resolved)
|
||||
|
||||
|
||||
@property
|
||||
def slowadc(self):
|
||||
"""
|
||||
[Ctb] Slow ADC channel in uV of all channels or specific ones from 0-7.
|
||||
|
||||
Example
|
||||
-------
|
||||
>>> d.slowadc
|
||||
0: 0 uV
|
||||
1: 0 uV
|
||||
2: 0 uV
|
||||
3: 0 uV
|
||||
4: 0 uV
|
||||
5: 0 uV
|
||||
6: 0 uV
|
||||
7: 0 uV
|
||||
>>> d.slowadc[3]
|
||||
0
|
||||
"""
|
||||
return SlowAdcProxy(self)
|
||||
|
||||
|
||||
@property
|
||||
def daclist(self):
|
||||
@@ -2022,41 +2003,7 @@ class Detector(CppDetectorApi):
|
||||
def daclist(self, value):
|
||||
self.setDacNames(value)
|
||||
|
||||
@property
|
||||
def adclist(self):
|
||||
"""
|
||||
[Chiptestboard] List of names for every adc for this board. 32 adcs
|
||||
"""
|
||||
return self.getAdcNames()
|
||||
|
||||
@adclist.setter
|
||||
def adclist(self, value):
|
||||
self.setAdcNames(value)
|
||||
|
||||
@property
|
||||
def signallist(self):
|
||||
"""
|
||||
[Chiptestboard] List of names for every io signal for this board. 64 signals
|
||||
"""
|
||||
return self.getSignalNames()
|
||||
|
||||
@signallist.setter
|
||||
def signallist(self, value):
|
||||
self.setSignalNames(value)
|
||||
|
||||
|
||||
@property
|
||||
def slowadclist(self):
|
||||
"""
|
||||
[Chiptestboard] List of names for every slowadc for this board. 8 slowadc
|
||||
|
||||
"""
|
||||
return self.getSlowADCNames()
|
||||
|
||||
@slowadclist.setter
|
||||
def slowadclist(self, value):
|
||||
self.setSlowADCNames(value)
|
||||
|
||||
@property
|
||||
def dacvalues(self):
|
||||
"""Gets the dac values for every dac for this detector."""
|
||||
@@ -2066,14 +2013,6 @@ class Detector(CppDetectorApi):
|
||||
}
|
||||
|
||||
|
||||
@property
|
||||
def slowadcvalues(self):
|
||||
"""[Chiptestboard][Xilinx CTB] Gets the slow adc values for every slow adc for this detector."""
|
||||
return {
|
||||
slowadc.name.lower(): element_if_equal(np.array(self.getSlowADC(slowadc)))
|
||||
for slowadc in self.getSlowADCList()
|
||||
}
|
||||
|
||||
@property
|
||||
def timinglist(self):
|
||||
"""Gets the list of timing modes (timingMode) for this detector."""
|
||||
|
||||
@@ -472,7 +472,7 @@ def test_v_abcd(session_simulator, request):
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
def test_powers(session_simulator, request):
|
||||
"""Test powers."""
|
||||
"""Test powers and powerlist."""
|
||||
det_type, num_interfaces, num_mods, d = session_simulator
|
||||
assert d is not None
|
||||
|
||||
@@ -537,6 +537,72 @@ def test_powers(session_simulator, request):
|
||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
def test_adclist(session_simulator, request):
|
||||
"""Test ADC list."""
|
||||
det_type, num_interfaces, num_mods, d = session_simulator
|
||||
assert d is not None
|
||||
|
||||
from slsdet import Ctb
|
||||
c = Ctb()
|
||||
|
||||
if det_type in ['ctb', 'xilinx_ctb']:
|
||||
c.adclist
|
||||
c.adclist = ["1", "2", "3", "test", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32"]
|
||||
c.adclist
|
||||
|
||||
else:
|
||||
with pytest.raises(Exception) as exc_info:
|
||||
c.adclist
|
||||
assert "only for CTB" in str(exc_info.value)
|
||||
|
||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
def test_signallist(session_simulator, request):
|
||||
"""Test signal list."""
|
||||
det_type, num_interfaces, num_mods, d = session_simulator
|
||||
assert d is not None
|
||||
|
||||
from slsdet import Ctb
|
||||
c = Ctb()
|
||||
|
||||
if det_type in ['ctb', 'xilinx_ctb']:
|
||||
c.signallist
|
||||
c.signallist = ["1", "2", "3", "test", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64"]
|
||||
c.signallist
|
||||
|
||||
else:
|
||||
with pytest.raises(Exception) as exc_info:
|
||||
c.signallist
|
||||
assert "only for CTB" in str(exc_info.value)
|
||||
|
||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||
|
||||
|
||||
@pytest.mark.detectorintegration
|
||||
def test_slowadc(session_simulator, request):
|
||||
"""Test slow ADC and slow adc list."""
|
||||
det_type, num_interfaces, num_mods, d = session_simulator
|
||||
assert d is not None
|
||||
|
||||
from slsdet import Ctb
|
||||
c = Ctb()
|
||||
|
||||
if det_type in ['ctb', 'xilinx_ctb']:
|
||||
c.slowadc
|
||||
c.slowadc.SLOWADC5
|
||||
c.slowadclist = ["1", "2", "3", "test", "5", "6", "7", "8"]
|
||||
c.slowadc.test
|
||||
|
||||
else:
|
||||
with pytest.raises(Exception) as exc_info:
|
||||
c.signallist
|
||||
assert "only for CTB" in str(exc_info.value)
|
||||
|
||||
Log(LogLevel.INFOGREEN, f"✅ {request.node.name} passed")
|
||||
|
||||
|
||||
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user