mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
added slowadc to python
This commit is contained in:
parent
34043c358f
commit
a95d8f664a
@ -36,6 +36,7 @@ set( PYTHON_FILES
|
|||||||
gotthard2.py
|
gotthard2.py
|
||||||
moench.py
|
moench.py
|
||||||
jsonproxy.py
|
jsonproxy.py
|
||||||
|
slowadcproxy.py
|
||||||
ctb.py
|
ctb.py
|
||||||
jungfrau.py
|
jungfrau.py
|
||||||
mythen3.py
|
mythen3.py
|
||||||
|
@ -70,6 +70,7 @@ dacs = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
intentionally_missing = [
|
intentionally_missing = [
|
||||||
|
'activate', #use getActive and getRxPadDeactivatedMode syntax is not a good fit for python
|
||||||
'temp_10ge', #temperatures already available from enum or specialized class
|
'temp_10ge', #temperatures already available from enum or specialized class
|
||||||
'temp_adc',
|
'temp_adc',
|
||||||
'temp_dcdc',
|
'temp_dcdc',
|
||||||
|
@ -12,6 +12,7 @@ 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 .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
||||||
from . import utils as ut
|
from . import utils as ut
|
||||||
from .jsonproxy import JsonProxy
|
from .jsonproxy import JsonProxy
|
||||||
|
from .slowadcproxy import SlowAdcProxy
|
||||||
from .registers import Register, Adc_register
|
from .registers import Register, Adc_register
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
|
|
||||||
@ -1013,6 +1014,10 @@ class Detector(CppDetectorApi):
|
|||||||
"""
|
"""
|
||||||
return self._register
|
return self._register
|
||||||
|
|
||||||
|
@property
|
||||||
|
def slowadc(self):
|
||||||
|
return SlowAdcProxy(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def daclist(self):
|
def daclist(self):
|
||||||
"""Gets the list of enums for every dac for this detector."""
|
"""Gets the list of enums for every dac for this detector."""
|
||||||
|
25
python/slsdet/slowadcproxy.py
Normal file
25
python/slsdet/slowadcproxy.py
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
from .utils import element_if_equal
|
||||||
|
from .enums import dacIndex
|
||||||
|
class SlowAdcProxy:
|
||||||
|
"""
|
||||||
|
Proxy class to allow for more intuitive reading the slow ADCs
|
||||||
|
"""
|
||||||
|
def __init__(self, det):
|
||||||
|
self.det = det
|
||||||
|
|
||||||
|
def __getitem__(self, key):
|
||||||
|
dac_index = dacIndex(int(dacIndex.SLOW_ADC0)+key)
|
||||||
|
return element_if_equal(self.det.getSlowADC(dac_index))
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
rstr = ''
|
||||||
|
for i in range(7):
|
||||||
|
r = element_if_equal(self.__getitem__(i))
|
||||||
|
if isinstance(r, list):
|
||||||
|
rstr += ' '.join(f'{item} mV' for item in r)
|
||||||
|
else:
|
||||||
|
rstr += f'{i}: {r} mV\n'
|
||||||
|
|
||||||
|
return rstr.strip('\n')
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user