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

15 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 import HardwareProperty 

4from daiquiri.core.hardware.abstract.optic import Optic as AbstractOptic 

5from daiquiri.core.hardware.bliss.object import BlissObject, EnumProperty 

6 

7from tomo.optic.base_optic import OpticState 

8 

9import logging 

10 

11logger = logging.getLogger(__name__) 

12 

13 

14class Tomooptic(BlissObject, AbstractOptic): 

15 PROPERTY_MAP = { 

16 "state": EnumProperty("state", enum_type=OpticState), 

17 "magnification": HardwareProperty("magnification"), 

18 "available_magnifications": HardwareProperty("available_magnifications"), 

19 "target_magnification": HardwareProperty("target_magnification"), 

20 "magnification_range": HardwareProperty("magnification_range"), 

21 } 

22 

23 # Call moves with wait=False 

24 def _call_move(self, value, **kwargs): 

25 logger.debug("_call_move %s %s %s", self.name(), value, kwargs) 

26 

27 try: 

28 self._object.move_magnification(value, wait=False) 

29 except Exception: 

30 logger.error( 

31 "Error while moving magnification %s to %s", 

32 self._object.name, 

33 value, 

34 exc_info=True, 

35 ) 

36 raise