Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/bliss/tomodetectors.py: 0%

21 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-15 02:12 +0000

1#!/usr/bin/env python 

2# -*- coding: utf-8 -*- 

3 

4import logging 

5from bliss.config.static import get_config 

6from tomo.controllers.tomo_detectors import TomoDetectorsState 

7from daiquiri.core.hardware.abstract.tomodetectors import ( 

8 TomoDetectors as AbstractTomoDetectors, 

9) 

10from daiquiri.core.hardware.bliss.object import BlissObject 

11from daiquiri.core.hardware.bliss.object import ObjectRefProperty 

12from daiquiri.core.hardware.bliss.object import ObjectRefListProperty 

13from daiquiri.core.hardware.bliss.object import EnumProperty 

14 

15 

16logger = logging.getLogger(__name__) 

17 

18 

19class TomoDetectors(BlissObject, AbstractTomoDetectors): 

20 PROPERTY_MAP = { 

21 "state": EnumProperty("state", enum_type=TomoDetectorsState), 

22 "active_detector": ObjectRefProperty("active_detector"), 

23 "detectors": ObjectRefListProperty("detectors", compose=True), 

24 } 

25 

26 # Call moves with wait=False 

27 def _call_mount(self, value, **kwargs): 

28 logger.debug(f"_call_mount {self.name()} {value} {kwargs}") 

29 

30 if value.startswith("hardware:"): 

31 device_name = value[9:] 

32 else: 

33 device_name = value 

34 

35 config = get_config() 

36 device = config.get(device_name) 

37 if device is not None: 

38 self._object.mount(device, wait=False) 

39 

40 

41Default = TomoDetectors