mosca 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mosca/__init__.py +11 -0
- mosca/common/__init__.py +9 -0
- mosca/common/enums.py +79 -0
- mosca/common/logger.py +139 -0
- mosca/common/threads.py +199 -0
- mosca/common/utils.py +70 -0
- mosca/control/__init__.py +4 -0
- mosca/control/buffer.py +526 -0
- mosca/control/controller.py +278 -0
- mosca/control/datahandler.py +261 -0
- mosca/control/detectors.py +116 -0
- mosca/control/mosca.py +693 -0
- mosca/control/spectra.py +36 -0
- mosca/control/stats.py +43 -0
- mosca/control/tasks/__init__.py +3 -0
- mosca/control/tasks/background.py +118 -0
- mosca/control/tasks/rois.py +466 -0
- mosca/control/tasks/saving.py +391 -0
- mosca/control/tasks/spectrasums.py +185 -0
- mosca/control/tasks/task.py +201 -0
- mosca/control/tasks/taskmanager.py +133 -0
- mosca/devices/__init__.py +28 -0
- mosca/devices/hamamatsu/__init__.py +0 -0
- mosca/devices/hamamatsu/hamamatsu.py +88 -0
- mosca/devices/hamamatsu/hamamatsuhw.py +1298 -0
- mosca/devices/oceanoptics/__init__.py +0 -0
- mosca/devices/oceanoptics/oceanoptics.py +59 -0
- mosca/devices/oceanoptics/oceanopticshw.py +379 -0
- mosca/devices/simulation/__init__.py +0 -0
- mosca/devices/simulation/dante/__init__.py +1 -0
- mosca/devices/simulation/dante/simdante.py +33 -0
- mosca/devices/simulation/dante/simdantehw.py +506 -0
- mosca/devices/simulation/dummy/__init__.py +1 -0
- mosca/devices/simulation/dummy/dummy.py +299 -0
- mosca/devices/simulation/generator.py +607 -0
- mosca/devices/simulation/xia/__init__.py +1 -0
- mosca/devices/simulation/xia/iniparser.py +99 -0
- mosca/devices/simulation/xia/simfalconx.py +26 -0
- mosca/devices/simulation/xia/simfalconxhw.py +599 -0
- mosca/devices/xglab/__init__.py +0 -0
- mosca/devices/xglab/dante.py +126 -0
- mosca/devices/xglab/dantehw.py +1178 -0
- mosca/devices/xia/__init__.py +0 -0
- mosca/devices/xia/falconx.py +232 -0
- mosca/devices/xia/handel/__init__.py +14 -0
- mosca/devices/xia/handel/_cffi.py +62 -0
- mosca/devices/xia/handel/error.py +272 -0
- mosca/devices/xia/handel/handel_inc/handel_constants.h +127 -0
- mosca/devices/xia/handel/handel_inc/handel_errors.h +254 -0
- mosca/devices/xia/handel/handel_inc/handel_generic.h +66 -0
- mosca/devices/xia/handel/interface.py +1025 -0
- mosca/devices/xia/handel/mapping.py +107 -0
- mosca/devices/xia/handel/parser.py +62 -0
- mosca/devices/xia/handel/stats.py +85 -0
- mosca/devices/xia/mercury.py +160 -0
- mosca/devices/xia/utils.py +47 -0
- mosca/devices/xia/xia.py +575 -0
- mosca/devices/xia/xiads.py +161 -0
- mosca/mosca.py +0 -0
- mosca/tango/__init__.py +2 -0
- mosca/tango/controller.py +80 -0
- mosca/tango/main.py +163 -0
- mosca/tango/mosca.py +513 -0
- mosca/tango/moscav1.py +408 -0
- mosca/tango/shared.py +23 -0
- mosca/tango/tasks/__init__.py +0 -0
- mosca/tango/tasks/background.py +55 -0
- mosca/tango/utils.py +109 -0
- mosca-2.0.2.dist-info/METADATA +32 -0
- mosca-2.0.2.dist-info/RECORD +73 -0
- mosca-2.0.2.dist-info/WHEEL +4 -0
- mosca-2.0.2.dist-info/entry_points.txt +2 -0
- mosca-2.0.2.dist-info/licenses/LICENSE +166 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
logger = logging.getLogger(__name__)
|
|
3
|
+
|
|
4
|
+
# -*- coding: utf-8 -*-
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
import pathlib
|
|
8
|
+
import hashlib
|
|
9
|
+
import numpy as np
|
|
10
|
+
|
|
11
|
+
import tango
|
|
12
|
+
from tango.server import device_property, attribute, command
|
|
13
|
+
|
|
14
|
+
from ...tango import ControllerDS
|
|
15
|
+
|
|
16
|
+
from ...common import to_enum
|
|
17
|
+
from .xia import XiaPresets, XiaAdvanceModes, XiaGatePolarity
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# def ini_hash(filename):
|
|
21
|
+
# if not filename:
|
|
22
|
+
# return None
|
|
23
|
+
# with open(filename, "rb") as f:
|
|
24
|
+
# return hashlib.md5(f.read()).hexdigest()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class XiaDS(ControllerDS):
|
|
28
|
+
default_ini_file = device_property(dtype=str, mandatory=False, default_value="")
|
|
29
|
+
default_ini_dir = device_property(dtype=str, mandatory=False, default_value="")
|
|
30
|
+
# set this non mandatory, with a warning
|
|
31
|
+
lib_path = device_property(dtype=str, mandatory=False, default_value=None)
|
|
32
|
+
|
|
33
|
+
ini_dir = attribute(lambda self: self._ini_dir, dtype=str)
|
|
34
|
+
|
|
35
|
+
pixels_per_buffer = attribute(lambda self: int(self.control.pixels_per_buffer), dtype=int)
|
|
36
|
+
mapping_mode = attribute(lambda self: int(self.control.mapping_mode), dtype=int)
|
|
37
|
+
gate_ignore = attribute(lambda self: int(self.control.gate_ignore), dtype=int)
|
|
38
|
+
preset_value = attribute(lambda self: self.control.preset_value, dtype=float)
|
|
39
|
+
num_map_pixels = attribute(lambda self: int(self.control.num_map_pixels), dtype=int)
|
|
40
|
+
number_mca_channels = attribute(lambda self: int(self.control.number_mca_channels), dtype=int)
|
|
41
|
+
modules = attribute(lambda self: self.control.modules, dtype=[str], max_dim_x=200)
|
|
42
|
+
|
|
43
|
+
def __init__(self, *args, **kwargs):
|
|
44
|
+
# self._ini_hash = None
|
|
45
|
+
self._ini_dir = None
|
|
46
|
+
super().__init__(*args, **kwargs)
|
|
47
|
+
|
|
48
|
+
def init_device(self):
|
|
49
|
+
super().init_device()
|
|
50
|
+
|
|
51
|
+
ini_file = self.default_ini_file.strip()
|
|
52
|
+
ini_dir = self.default_ini_dir.strip()
|
|
53
|
+
|
|
54
|
+
logger.info("default_ini_dir = %s", ini_dir)
|
|
55
|
+
logger.info("default_ini_file = %s", ini_file)
|
|
56
|
+
|
|
57
|
+
if ini_dir:
|
|
58
|
+
ini_dir = os.path.abspath(ini_dir)
|
|
59
|
+
else:
|
|
60
|
+
ini_dir = os.getcwd()
|
|
61
|
+
|
|
62
|
+
logger.info("ini_dir = %s", ini_dir)
|
|
63
|
+
logger.info("ini_file = %s", ini_file)
|
|
64
|
+
|
|
65
|
+
self._ini_dir = ini_dir.strip()
|
|
66
|
+
if ini_file:
|
|
67
|
+
if not os.path.isabs(ini_file):
|
|
68
|
+
ini_file = os.path.join(ini_dir, ini_file)
|
|
69
|
+
self.control.set_ini_file(ini_file)
|
|
70
|
+
|
|
71
|
+
def _create_control(self, *args, **kwargs):
|
|
72
|
+
raise NotImplementedError
|
|
73
|
+
|
|
74
|
+
@command(dtype_in=str)
|
|
75
|
+
def xiaSetLogLevel(self, level):
|
|
76
|
+
self.control.xiaSetLogLevel(level)
|
|
77
|
+
|
|
78
|
+
@command(dtype_in=str)
|
|
79
|
+
def xiaSetLogOutput(self, filename):
|
|
80
|
+
self.control.xiaSetLogOutput(filename)
|
|
81
|
+
|
|
82
|
+
@attribute(dtype=str)
|
|
83
|
+
def preset_type(self):
|
|
84
|
+
return XiaPresets(int(self.control.preset_type)).name
|
|
85
|
+
|
|
86
|
+
@attribute(dtype=str)
|
|
87
|
+
def pixel_advance_mode(self):
|
|
88
|
+
return XiaAdvanceModes(int(self.control.pixel_advance_mode)).name
|
|
89
|
+
|
|
90
|
+
@attribute(dtype=str)
|
|
91
|
+
def input_logic_polarity(self):
|
|
92
|
+
return XiaGatePolarity(int(self.control.input_logic_polarity)).name
|
|
93
|
+
|
|
94
|
+
# @attribute(dtype=str)
|
|
95
|
+
# def ini_hash(self):
|
|
96
|
+
# return self._ini_hash
|
|
97
|
+
|
|
98
|
+
@command(dtype_out=[str])
|
|
99
|
+
def available_ini_files(self):
|
|
100
|
+
logger.debug("getting available ini_files"
|
|
101
|
+
" from [%s]", self.ini_dir)
|
|
102
|
+
path = self._ini_dir
|
|
103
|
+
ext = ".ini"
|
|
104
|
+
return sorted([
|
|
105
|
+
os.path.relpath(os.path.join(dp, f), path).lstrip(r"\/")
|
|
106
|
+
for dp, dn, fn in os.walk(path)
|
|
107
|
+
for f in fn
|
|
108
|
+
if f.endswith(ext)])
|
|
109
|
+
|
|
110
|
+
@attribute(dtype=str)
|
|
111
|
+
def ini_file(self):
|
|
112
|
+
ini_file = self.control.ini_file
|
|
113
|
+
if ini_file:
|
|
114
|
+
ini_file = os.path.relpath(ini_file, self._ini_dir)
|
|
115
|
+
else:
|
|
116
|
+
ini_file = ""
|
|
117
|
+
return ini_file
|
|
118
|
+
|
|
119
|
+
@ini_file.write
|
|
120
|
+
def ini_file(self, ini_file):
|
|
121
|
+
if ini_file and not os.path.isabs(ini_file):
|
|
122
|
+
ini_file = os.path.join(self._ini_dir, ini_file)
|
|
123
|
+
self.control.set_ini_file(ini_file)
|
|
124
|
+
ini_set = self.control.ini_file
|
|
125
|
+
# self._ini_hash = ini_hash(ini_set)
|
|
126
|
+
|
|
127
|
+
@pixels_per_buffer.write
|
|
128
|
+
def pixels_per_buffer(self, pixels_per_buffer):
|
|
129
|
+
self.control.pixels_per_buffer = pixels_per_buffer
|
|
130
|
+
|
|
131
|
+
@num_map_pixels.write
|
|
132
|
+
def num_map_pixels(self, num_map_pixels):
|
|
133
|
+
self.control.num_map_pixels = num_map_pixels
|
|
134
|
+
|
|
135
|
+
@number_mca_channels.write
|
|
136
|
+
def number_mca_channels(self, number_mca_channels):
|
|
137
|
+
self.control.number_mca_channels = number_mca_channels
|
|
138
|
+
|
|
139
|
+
@input_logic_polarity.write
|
|
140
|
+
def input_logic_polarity(self, input_logic_polarity):
|
|
141
|
+
self.control.input_logic_polarity = input_logic_polarity
|
|
142
|
+
|
|
143
|
+
@pixel_advance_mode.write
|
|
144
|
+
def pixel_advance_mode(self, pixel_advance_mode):
|
|
145
|
+
self.control.pixel_advance_mode = pixel_advance_mode
|
|
146
|
+
|
|
147
|
+
@gate_ignore.write
|
|
148
|
+
def gate_ignore(self, gate_ignore):
|
|
149
|
+
self.control.gate_ignore = gate_ignore
|
|
150
|
+
|
|
151
|
+
@mapping_mode.write
|
|
152
|
+
def mapping_mode(self, mapping_mode):
|
|
153
|
+
self.control.mapping_mode = mapping_mode
|
|
154
|
+
|
|
155
|
+
@preset_type.write
|
|
156
|
+
def preset_type(self, preset_type):
|
|
157
|
+
self.control.preset_type = preset_type
|
|
158
|
+
|
|
159
|
+
@preset_value.write
|
|
160
|
+
def preset_value(self, preset_value):
|
|
161
|
+
self.control.preset_value = preset_value
|
mosca/mosca.py
ADDED
|
File without changes
|
mosca/tango/__init__.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
logger = logging.getLogger(__name__)
|
|
3
|
+
|
|
4
|
+
from abc import abstractmethod
|
|
5
|
+
|
|
6
|
+
from tango.server import Device, attribute, command, device_property
|
|
7
|
+
from tango import DevState
|
|
8
|
+
|
|
9
|
+
from .shared import _set_controller
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ControllerDS(Device):
|
|
13
|
+
|
|
14
|
+
control = property(lambda self: self._control)
|
|
15
|
+
|
|
16
|
+
# properties to overwrite the default timeouts
|
|
17
|
+
start_timeout = device_property(dtype=float, default_value=0.)
|
|
18
|
+
stop_timeout = device_property(dtype=float, default_value=0.)
|
|
19
|
+
setup_timeout = device_property(dtype=float, default_value=0.)
|
|
20
|
+
prepare_timeout = device_property(dtype=float, default_value=0)
|
|
21
|
+
|
|
22
|
+
def __init__(self, *args, **kwargs):
|
|
23
|
+
self._control = None
|
|
24
|
+
Device.__init__(self, *args, **kwargs)
|
|
25
|
+
|
|
26
|
+
@attribute(dtype=str)
|
|
27
|
+
def mca_status(self):
|
|
28
|
+
return self._control.mca_status().name
|
|
29
|
+
|
|
30
|
+
def init_device(self):
|
|
31
|
+
super().init_device()
|
|
32
|
+
self.set_state(DevState.INIT)
|
|
33
|
+
self._control = self._create_control()
|
|
34
|
+
_set_controller(self._control)
|
|
35
|
+
self.set_state(DevState.ON)
|
|
36
|
+
|
|
37
|
+
@attribute(dtype=str)
|
|
38
|
+
def init_message(self):
|
|
39
|
+
init_message = self.control.init_message
|
|
40
|
+
return init_message or "UNKNOWN"
|
|
41
|
+
|
|
42
|
+
@attribute(dtype=float)
|
|
43
|
+
def timeout_start(self):
|
|
44
|
+
prop_to = self.start_timeout
|
|
45
|
+
if prop_to is None or prop_to <= 0.:
|
|
46
|
+
return self.control.timeout_start()
|
|
47
|
+
return prop_to
|
|
48
|
+
|
|
49
|
+
@attribute(dtype=float)
|
|
50
|
+
def timeout_stop(self):
|
|
51
|
+
prop_to = self.stop_timeout
|
|
52
|
+
if prop_to is None or prop_to <= 0.:
|
|
53
|
+
return self.control.timeout_stop()
|
|
54
|
+
return prop_to
|
|
55
|
+
|
|
56
|
+
@attribute(dtype=float)
|
|
57
|
+
def timeout_setup(self):
|
|
58
|
+
prop_to = self.setup_timeout
|
|
59
|
+
if prop_to is None or prop_to <= 0.:
|
|
60
|
+
return self.control.timeout_setup()
|
|
61
|
+
return prop_to
|
|
62
|
+
|
|
63
|
+
@attribute(dtype=float)
|
|
64
|
+
def timeout_prepare(self):
|
|
65
|
+
prop_to = self.prepare_timeout
|
|
66
|
+
if prop_to is None or prop_to <= 0.:
|
|
67
|
+
return self.control.timeout_prepare()
|
|
68
|
+
return prop_to
|
|
69
|
+
|
|
70
|
+
@abstractmethod
|
|
71
|
+
def _create_control(self, *args, **kwargs):
|
|
72
|
+
raise NotImplementedError
|
|
73
|
+
|
|
74
|
+
@command
|
|
75
|
+
def prepare_acq(self):
|
|
76
|
+
self._control.prepare_acq()
|
|
77
|
+
|
|
78
|
+
@command
|
|
79
|
+
def start_acq(self):
|
|
80
|
+
self._control.start_acq()
|
mosca/tango/main.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# import faulthandler
|
|
2
|
+
# faulthandler.enable()
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import argparse
|
|
9
|
+
|
|
10
|
+
import tango
|
|
11
|
+
from tango.server import run
|
|
12
|
+
|
|
13
|
+
from .utils import get_device_class_dict, register_device
|
|
14
|
+
from .mosca import Mosca
|
|
15
|
+
from ..common.logger import mosca_enable_log_file, mosca_logger_names, set_mosca_log_level
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
import logging
|
|
19
|
+
logger = logging.getLogger(__name__)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def disable_quick_edit_mode():
|
|
23
|
+
import ctypes
|
|
24
|
+
|
|
25
|
+
# Constants
|
|
26
|
+
STD_INPUT_HANDLE = -10
|
|
27
|
+
|
|
28
|
+
# Enum for ConsoleModes
|
|
29
|
+
class ConsoleModes(ctypes.c_uint):
|
|
30
|
+
ENABLE_PROCESSED_INPUT = 0x1
|
|
31
|
+
ENABLE_LINE_INPUT = 0x2
|
|
32
|
+
ENABLE_ECHO_INPUT = 0x4
|
|
33
|
+
ENABLE_WINDOW_INPUT = 0x8
|
|
34
|
+
ENABLE_MOUSE_INPUT = 0x10
|
|
35
|
+
ENABLE_INSERT_MODE = 0x20
|
|
36
|
+
ENABLE_QUICK_EDIT_MODE = 0x40
|
|
37
|
+
ENABLE_EXTENDED_FLAGS = 0x80
|
|
38
|
+
ENABLE_AUTO_POSITION = 0x100
|
|
39
|
+
|
|
40
|
+
# Import kernel32.dll functions
|
|
41
|
+
kernel32 = ctypes.windll.kernel32
|
|
42
|
+
GetStdHandle = kernel32.GetStdHandle
|
|
43
|
+
GetConsoleMode = kernel32.GetConsoleMode
|
|
44
|
+
SetConsoleMode = kernel32.SetConsoleMode
|
|
45
|
+
|
|
46
|
+
std_in = GetStdHandle(STD_INPUT_HANDLE)
|
|
47
|
+
mode = ctypes.c_uint()
|
|
48
|
+
if GetConsoleMode(std_in, ctypes.byref(mode)):
|
|
49
|
+
if mode.value & ConsoleModes.ENABLE_QUICK_EDIT_MODE:
|
|
50
|
+
mode.value ^= ConsoleModes.ENABLE_QUICK_EDIT_MODE
|
|
51
|
+
SetConsoleMode(std_in, mode)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def main():
|
|
55
|
+
sys.argv[0] = "Mosca"
|
|
56
|
+
parser = argparse.ArgumentParser(
|
|
57
|
+
prog="mosca",
|
|
58
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
59
|
+
description="""
|
|
60
|
+
Mosca DS.
|
|
61
|
+
"""
|
|
62
|
+
)
|
|
63
|
+
parser.add_argument("instance", help="Instance name.", nargs="?", default="")
|
|
64
|
+
parser.add_argument("--register", dest="register", type=str, help="registers a new DS", nargs=2, metavar=("prefix", "mca_type"))
|
|
65
|
+
|
|
66
|
+
# Force the registration of the servers, even if a server with the same name already exists.
|
|
67
|
+
parser.add_argument("--overwrite",
|
|
68
|
+
help=argparse.SUPPRESS,
|
|
69
|
+
action='store_true',
|
|
70
|
+
dest="overwrite")
|
|
71
|
+
|
|
72
|
+
args = parser.parse_known_args()[0]
|
|
73
|
+
|
|
74
|
+
db = tango.Database()
|
|
75
|
+
instances = [name.casefold()
|
|
76
|
+
for name in db.get_instance_name_list("Mosca")]
|
|
77
|
+
|
|
78
|
+
if not args.register and args.instance.casefold() not in instances:
|
|
79
|
+
if not args.instance:
|
|
80
|
+
print("Missing instance name.")
|
|
81
|
+
else:
|
|
82
|
+
print(f"Unknown instance [{args.instance}].")
|
|
83
|
+
if instances:
|
|
84
|
+
print("Defined instances in database:")
|
|
85
|
+
print("- " + "\n- ".join(instances))
|
|
86
|
+
else:
|
|
87
|
+
print("No Mosca instance found in database!")
|
|
88
|
+
sys.exit(-1)
|
|
89
|
+
|
|
90
|
+
if args.register:
|
|
91
|
+
return register_device(args.instance, args.register[0], args.register[1])
|
|
92
|
+
instance_name = args.instance
|
|
93
|
+
|
|
94
|
+
from .moscav1 import MoscaV1
|
|
95
|
+
from ..devices import get_tango_classinfo
|
|
96
|
+
|
|
97
|
+
server_instance = "/".join(("Mosca", instance_name))
|
|
98
|
+
|
|
99
|
+
class_dict = get_device_class_dict(server_instance)
|
|
100
|
+
mosca_name = class_dict.get("mosca")
|
|
101
|
+
if mosca_name:
|
|
102
|
+
mosca = tango.DeviceProxy(mosca_name)
|
|
103
|
+
else:
|
|
104
|
+
logger.critical("Instance %s not found.", instance_name)
|
|
105
|
+
sys.exit(-1)
|
|
106
|
+
|
|
107
|
+
mca_type = mosca.get_property('mca_type')['mca_type'][0]
|
|
108
|
+
mca_info = get_tango_classinfo(mca_type)
|
|
109
|
+
|
|
110
|
+
log_file = mosca.get_property('log_file')['log_file']
|
|
111
|
+
if not log_file:
|
|
112
|
+
log_file = os.path.join(Path.home(), f"mosca_{instance_name}.log")
|
|
113
|
+
else:
|
|
114
|
+
log_file = log_file[0]
|
|
115
|
+
mosca_enable_log_file(log_file, maxBytes=2e6, backupCount=5)
|
|
116
|
+
|
|
117
|
+
if sys.platform == "win32":
|
|
118
|
+
logger.warning("Windows: disabling selection in console.")
|
|
119
|
+
disable_quick_edit_mode()
|
|
120
|
+
|
|
121
|
+
set_mosca_log_level(level=logging.INFO)
|
|
122
|
+
|
|
123
|
+
# Background
|
|
124
|
+
from .tasks.background import Background
|
|
125
|
+
prefix, _, detname = mosca_name.split("/")
|
|
126
|
+
bkg_name = f"{prefix}/Background/{detname}"
|
|
127
|
+
try:
|
|
128
|
+
_ = tango.DeviceProxy(bkg_name)
|
|
129
|
+
except tango.DevFailed:
|
|
130
|
+
logger.warning(f"Background device {bkg_name} doesn't exist! Registering it now.")
|
|
131
|
+
db = tango.Database()
|
|
132
|
+
dbi = tango.DbDevInfo()
|
|
133
|
+
dbi.name = bkg_name
|
|
134
|
+
dbi._class = "Background"
|
|
135
|
+
dbi.server = server_instance
|
|
136
|
+
db.add_device(dbi)
|
|
137
|
+
|
|
138
|
+
klasses = [mca_info.klass, Mosca, MoscaV1, Background]
|
|
139
|
+
if mca_type.casefold() in ("simfalconx", "simdante"):
|
|
140
|
+
from mosca.devices.simulation.generator import Generator
|
|
141
|
+
klasses += [Generator]
|
|
142
|
+
|
|
143
|
+
prefix, _, detname = mosca_name.split("/")
|
|
144
|
+
gen_name = f"{prefix}/generator/{detname}"
|
|
145
|
+
try:
|
|
146
|
+
_ = tango.DeviceProxy(gen_name)
|
|
147
|
+
except tango.DevFailed:
|
|
148
|
+
logger.warning(f"Generator device {gen_name} doesn't exist! Registering it now.")
|
|
149
|
+
db = tango.Database()
|
|
150
|
+
dbi = tango.DbDevInfo()
|
|
151
|
+
dbi.name = gen_name
|
|
152
|
+
dbi._class = "Generator"
|
|
153
|
+
dbi.server = server_instance
|
|
154
|
+
db.add_device(dbi)
|
|
155
|
+
|
|
156
|
+
run(klasses)
|
|
157
|
+
|
|
158
|
+
return 0
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
if __name__ == "__main__":
|
|
162
|
+
res = main()
|
|
163
|
+
sys.exit(res)
|