Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/schema/components/scan.py: 100%

58 statements  

« prev     ^ index     » next       coverage.py v7.6.10, created at 2025-02-06 02:13 +0000

1#!/usr/bin/env python 

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

3from marshmallow import Schema, fields 

4from daiquiri.core.schema.validators import OneOf 

5from daiquiri.core.hardware.abstract.scansource import ScanStates 

6 

7import logging 

8 

9logger = logging.getLogger(__name__) 

10 

11 

12class ScanShapeSchema(Schema): 

13 npoints1 = fields.Int() 

14 npoints2 = fields.Int() 

15 dim = fields.Int() 

16 requests = fields.Dict() 

17 

18 

19class ScanChildSchema(Schema): 

20 scanid = fields.Int() 

21 type = fields.Str() 

22 node = fields.Str() 

23 

24 

25class ScanSchema(Schema): 

26 scanid = fields.Int(required=True) 

27 node_name = fields.Str() 

28 npoints = fields.Int() 

29 shape = fields.Nested(ScanShapeSchema) 

30 count_time = fields.Float() 

31 filename = fields.Str() 

32 scan_number = fields.Int() 

33 start_timestamp = fields.Float() 

34 end_timestamp = fields.Float() 

35 estimated_time = fields.Float() 

36 status = OneOf(ScanStates) 

37 title = fields.Str() 

38 type = fields.Str() 

39 children = fields.List(fields.Nested(ScanChildSchema)) 

40 group = fields.Bool() 

41 

42 

43class ScanStatusSchema(Schema): 

44 scanid = fields.Int() 

45 progress = fields.Int() 

46 

47 

48class ScanDataChannel(Schema): 

49 name = fields.Str() 

50 shape = fields.List(fields.Int()) 

51 data = fields.List(fields.Float()) 

52 size = fields.Int() 

53 dtype = fields.Str() 

54 

55 

56class ScanDataSchema(Schema): 

57 scanid = fields.Int(required=True) 

58 axes = fields.Dict() 

59 data = fields.Nested(ScanDataChannel) 

60 npoints = fields.Int() 

61 shape = fields.Nested(ScanShapeSchema) 

62 npoints_avail = fields.Int() 

63 pages = fields.Int() 

64 page = fields.Int() 

65 

66 

67class ScanSpectrumConversionSchema(Schema): 

68 zero = fields.Float() 

69 scale = fields.Float() 

70 

71 

72class ScanSpectraSchema(Schema): 

73 scanid = fields.Int() 

74 node_name = fields.Str() 

75 data = fields.Dict() 

76 npoints = fields.Int() 

77 npoints_avail = fields.Int() 

78 conversion = fields.Nested(ScanSpectrumConversionSchema)