diff --git a/python/slsdet/ctb.py b/python/slsdet/ctb.py index f4874da6b..cf2c390d1 100644 --- a/python/slsdet/ctb.py +++ b/python/slsdet/ctb.py @@ -2,7 +2,7 @@ # Copyright (C) 2021 Contributors to the SLS Detector Package from .detector import Detector, freeze from .utils import element_if_equal -from .dacs import DetectorDacs, NamedDacs +from .dacs import NamedDacs from .powers import DetectorPowers from .proxy import SlowAdcProxy from . import _slsdet diff --git a/python/tests/test_det_api.py b/python/tests/test_det_api.py index 3b21a50db..06f038608 100644 --- a/python/tests/test_det_api.py +++ b/python/tests/test_det_api.py @@ -655,11 +655,30 @@ def test_dac(session_simulator, request): d.dacvalues dacname = d.daclist[0] + assert dacname dacIndex = d.getDacList()[0] # save previous value prev_val = d.getDAC(dacIndex, False) + if det_type == 'eiger': + from slsdet import Eiger + c = Eiger() + elif det_type == 'jungfrau': + from slsdet import Jungfrau + c = Jungfrau() + elif det_type == 'gotthard2': + from slsdet import Gotthard2 + c = Gotthard2() + elif det_type == 'mythen3': + from slsdet import Mythen3 + c = Mythen3() + elif det_type == 'moench': + from slsdet import Moench + c = Moench() + else: + raise RuntimeError("Unknown detector type to test dac: " + det_type) + invalid_assignments = [ (c.dacs, "random", "1200"), # set random dac (c.dacs, dacname, "-1"), @@ -670,10 +689,12 @@ def test_dac(session_simulator, request): with pytest.raises(Exception): setattr(obj, attr, value) - d.dacs.dacname = 1200 - assert d.getDAC(dacIndex.dacname, False)[0] == 1200 - d.dacs.dacname = 0 - assert d.dacs.dacname[0] == 0 + setattr(c.dacs, dacname, 1200) + assert c.getDAC(dacIndex, False)[0] == 1200 + setattr(c.dacs, dacname, 0) + assert getattr(c.dacs, dacname)[0] == 0 + + # restore previous value for i in range(len(d)):