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

48 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 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 ScanSchema(Schema): 

20 scanid = fields.Int(required=True) 

21 node_name = fields.Str() 

22 npoints = fields.Int() 

23 shape = fields.Nested(ScanShapeSchema) 

24 count_time = fields.Float() 

25 filename = fields.Str() 

26 scan_number = fields.Int() 

27 start_timestamp = fields.Float() 

28 end_timestamp = fields.Float() 

29 estimated_time = fields.Float() 

30 status = OneOf(ScanStates) 

31 title = fields.Str() 

32 type = fields.Str() 

33 children = fields.List(fields.Dict()) 

34 group = fields.Bool() 

35 

36 

37class ScanStatusSchema(Schema): 

38 scanid = fields.Int() 

39 progress = fields.Int() 

40 

41 

42class ScanDataSchema(Schema): 

43 scanid = fields.Int(required=True) 

44 axes = fields.Dict() 

45 data = fields.Dict() 

46 npoints = fields.Int() 

47 shape = fields.Nested(ScanShapeSchema) 

48 npoints_avail = fields.Int() 

49 pages = fields.Int() 

50 page = fields.Int() 

51 

52 

53class ScanSpectrumConversionSchema(Schema): 

54 zero = fields.Float() 

55 scale = fields.Float() 

56 

57 

58class ScanSpectraSchema(Schema): 

59 scanid = fields.Int() 

60 node_name = fields.Str() 

61 data = fields.Dict() 

62 npoints = fields.Int() 

63 npoints_avail = fields.Int() 

64 conversion = fields.Nested(ScanSpectrumConversionSchema)