Files
slsDetectorPackage/python/slsdet/ctb.py
T
maliakal_d 5ec5d46c48
Build and Deploy on local RHEL9 / build (push) Successful in 2m12s
Build on RHEL9 docker image / build (push) Successful in 3m33s
Build on RHEL8 docker image / build (push) Successful in 4m54s
Build and Deploy on local RHEL8 / build (push) Successful in 4m54s
Run Simulator Tests on local RHEL9 / build (push) Successful in 14m41s
Run Simulator Tests on local RHEL8 / build (push) Successful in 17m10s
Dev/ctb separate dac and power (#1420)
* not allowing power names for dac names to prevent duplicate names

* wip

* v_abcd commands should be removed to prevent unintentional usage and throw with a suggestion command for dac and power

* binary in

* dacs with power dac names should work and do not take in dac units to avoid ambiguity, test with 0 value for power dacs should fail, to do: implement power commands

* wip: power in client, tests, and fixed server interfaces and ctb implementation, not tested

* wip. client and xilinx todo

* wip: ctb power works, tests left

* fixed some tests

* added vchip check

* python cmds still left. wip

* fixed xilinx. python left

* wip

* wip. xilinx

* fixed powerchip for ctb

* power all returns all

* configtransceiver is removed

* wip python

* wip

* wip

* wip

* wip

* wip

* wip

* wip xilinx

* wip

* wip

* wip

* pybindings

* fix getdacindex and getdacname for normal detectors to throw if random index that doesnt fit to the detector

* wip

* fixed tests

* fixes for python api

* wip

* python: moved powerlist to Ctb

* fixed tests to work for powelist in Ctb

* moved signallist, adclist, slowadc, slowadclist to Ctb

* throw approperiate error when no modules added for powers

* added dac test

* fix dac default names and test for dacs

* ctb dacs, yet to do othe rdacs

* dacs should work now even in tests

* run all tests

* DetectorPowers->NamedPowers in ctb

* comments

* removed unnecessary test code

* removed hard coded dac names in python NamedDacs and NamedPowers

* minor

* minor

* fixed error messages

* changed power to  be able to set DAC directly, using enable and disable methods with enabled to get
2026-04-15 10:33:01 +02:00

93 lines
2.1 KiB
Python

# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from .detector import Detector, freeze
from .utils import element_if_equal
from .dacs import NamedDacs
from .powers import NamedPowers
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
class Ctb(Detector):
def __init__(self, id = 0):
super().__init__(id)
self._frozen = False
self._dacs = NamedDacs(self)
self._powers = NamedPowers(self)
@property
def dacs(self):
return self._dacs
@property
def powers(self):
return self._powers
@property
def powerlist(self):
return self.getPowerNames()
@powerlist.setter
def powerlist(self, 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()
}