Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/hardware/abstract/lima.py: 100%

36 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-14 02:13 +0000

1#!/usr/bin/env python 

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

3from marshmallow import fields, Schema 

4 

5from daiquiri.core.hardware.abstract import HardwareObject 

6from daiquiri.core.schema.hardware import HardwareSchema 

7 

8import logging 

9 

10logger = logging.getLogger(__name__) 

11 

12CameraStatuses = ["READY", "ACQUIRING", "CONFIGURATION", "FAULT", "UNKNOWN", "OFFLINE"] 

13 

14 

15class _LimaStaticPropertiesSchema(Schema): 

16 """Static information valid during the whole device life cycle. 

17 

18 Properties from https://lima1.readthedocs.io/en/latest/applications/tango/python/doc/index.html 

19 """ 

20 

21 lima_version = fields.Str() 

22 """The lima core library version number""" 

23 

24 lima_type = fields.Str() 

25 """Name of the camera plugin: Maxipix, Pilatus, Frelon, Pco, Basler, Simulator...""" 

26 

27 camera_type = fields.Str() 

28 """Type of the camera as exposed by the camera plugin.""" 

29 

30 camera_model = fields.Str() 

31 """Model of the camera as exposed by the camera plugin: 5x1- TPX1""" 

32 

33 camera_pixelsize = fields.List(fields.Float()) 

34 """The camera pixel size in x and y dimension, in micron. 

35 

36 Despit the Lima Tango API, this value is returned in micron instead of meter. 

37 """ 

38 

39 image_max_dim = fields.List(fields.Int()) 

40 """Maximum image dimension, width and height in pixel""" 

41 

42 

43class LimaPropertiesSchema(HardwareSchema): 

44 state = fields.Str(metadata={"readOnly": True}) 

45 static = fields.Nested( 

46 _LimaStaticPropertiesSchema, 

47 allow_none=True, 

48 metadata={"readOnly": True}, 

49 ) 

50 rotation = fields.Int(allow_none=True) 

51 binning = fields.List(fields.Int(), allow_none=True) 

52 raw_roi = fields.List( 

53 fields.Int(), 

54 metadata={"readOnly": True}, 

55 ) 

56 roi = fields.List( 

57 fields.Int(), 

58 metadata={"readOnly": True}, 

59 ) 

60 flip = fields.List(fields.Bool(), allow_none=True) 

61 size = fields.List(fields.Int(), allow_none=True, metadata={"readOnly": True}) 

62 acc_max_expo_time = fields.Float(allow_none=True) 

63 

64 

65class LimaCallablesSchema(HardwareSchema): 

66 pass 

67 

68 

69class Lima(HardwareObject): 

70 _type = "lima" 

71 _state_ok = [CameraStatuses[0], CameraStatuses[1]] 

72 

73 _properties = LimaPropertiesSchema() 

74 _callables = LimaCallablesSchema()