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

19 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 -*- 

3from daiquiri.core.hardware.abstract.tomoholo import ( 

4 TomoHolo as AbstractTomoHolo, 

5) 

6from daiquiri.core.hardware.abstract import HardwareProperty 

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

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

9from tomo.controllers.holotomo import HolotomoState, HolotomoDistance 

10 

11import logging 

12 

13logger = logging.getLogger(__name__) 

14 

15 

16class _DistancesProperty(HardwareProperty): 

17 def translate_from(self, values: list[HolotomoDistance]): 

18 if values is None: 

19 return None 

20 result = [] 

21 for v in values: 

22 result.append(v._asdict()) 

23 return result 

24 

25 

26class TomoHolo(BlissObject, AbstractTomoHolo): 

27 PROPERTY_MAP = { 

28 "state": EnumProperty("state", enum_type=HolotomoState), 

29 "pixel_size": HardwareProperty("pixel_size"), 

30 "nb_distances": HardwareProperty("nb_distances"), 

31 "settle_time": HardwareProperty("settle_time"), 

32 "distances": _DistancesProperty("distances"), 

33 } 

34 

35 CALLABLE_MAP = { 

36 "move": "move", 

37 } 

38 

39 

40Default = TomoHolo