Coverage for /opt/conda/envs/apienv/lib/python3.10/site-packages/daiquiri/core/schema/components/__init__.py: 100%
20 statements
« prev ^ index » next coverage.py v7.6.5, created at 2024-11-15 02:12 +0000
« 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 marshmallow import Schema, fields, validate
5import logging
7logger = logging.getLogger(__name__)
10class ComponentInfoSchema(Schema):
11 name = fields.Str()
12 baseurl = fields.Str()
13 config = fields.Dict()
16class VersionSchema(Schema):
17 version = fields.Str()
18 libraries = fields.Dict()
21class DebugStateSchema(Schema):
22 state = fields.Bool(metadata={"description": "The application debug state"})
25class RegionSchema(Schema):
26 start_e = fields.Float(
27 required=True, metadata={"title": "Start Energy", "unit": "eV"}
28 )
29 end_e = fields.Float(required=True, metadata={"title": "End Energy", "unit": "eV"})
30 step = fields.Float(
31 required=True,
32 metadata={"title": "Step Size", "unit": "eV"},
33 validate=validate.Range(min=0.01),
34 )
35 dwell = fields.Float(
36 required=True,
37 metadata={"title": "Dwell time", "unit": "s"},
38 validate=validate.Range(min=0.01),
39 )
41 class Meta:
42 uiorder = ["start_e", "end_e", "step", "dwell"]
44 presets = {
45 "Five Region": [
46 {"start_e": -200, "end_e": -100, "step": 5},
47 {"start_e": -100, "end_e": -20, "step": 0.5},
48 {"start_e": -20, "end_e": 100, "step": 0.1},
49 {"start_e": 100, "end_e": 250, "step": 1},
50 {"start_e": 250, "end_e": 500, "step": 5},
51 ],
52 "Three Region": [
53 {"start_e": -200, "end_e": -100, "step": 5},
54 {"start_e": -100, "end_e": 250, "step": 1},
55 {"start_e": 250, "end_e": 500, "step": 5},
56 ],
57 }