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.
Files changed (73) hide show
  1. mosca/__init__.py +11 -0
  2. mosca/common/__init__.py +9 -0
  3. mosca/common/enums.py +79 -0
  4. mosca/common/logger.py +139 -0
  5. mosca/common/threads.py +199 -0
  6. mosca/common/utils.py +70 -0
  7. mosca/control/__init__.py +4 -0
  8. mosca/control/buffer.py +526 -0
  9. mosca/control/controller.py +278 -0
  10. mosca/control/datahandler.py +261 -0
  11. mosca/control/detectors.py +116 -0
  12. mosca/control/mosca.py +693 -0
  13. mosca/control/spectra.py +36 -0
  14. mosca/control/stats.py +43 -0
  15. mosca/control/tasks/__init__.py +3 -0
  16. mosca/control/tasks/background.py +118 -0
  17. mosca/control/tasks/rois.py +466 -0
  18. mosca/control/tasks/saving.py +391 -0
  19. mosca/control/tasks/spectrasums.py +185 -0
  20. mosca/control/tasks/task.py +201 -0
  21. mosca/control/tasks/taskmanager.py +133 -0
  22. mosca/devices/__init__.py +28 -0
  23. mosca/devices/hamamatsu/__init__.py +0 -0
  24. mosca/devices/hamamatsu/hamamatsu.py +88 -0
  25. mosca/devices/hamamatsu/hamamatsuhw.py +1298 -0
  26. mosca/devices/oceanoptics/__init__.py +0 -0
  27. mosca/devices/oceanoptics/oceanoptics.py +59 -0
  28. mosca/devices/oceanoptics/oceanopticshw.py +379 -0
  29. mosca/devices/simulation/__init__.py +0 -0
  30. mosca/devices/simulation/dante/__init__.py +1 -0
  31. mosca/devices/simulation/dante/simdante.py +33 -0
  32. mosca/devices/simulation/dante/simdantehw.py +506 -0
  33. mosca/devices/simulation/dummy/__init__.py +1 -0
  34. mosca/devices/simulation/dummy/dummy.py +299 -0
  35. mosca/devices/simulation/generator.py +607 -0
  36. mosca/devices/simulation/xia/__init__.py +1 -0
  37. mosca/devices/simulation/xia/iniparser.py +99 -0
  38. mosca/devices/simulation/xia/simfalconx.py +26 -0
  39. mosca/devices/simulation/xia/simfalconxhw.py +599 -0
  40. mosca/devices/xglab/__init__.py +0 -0
  41. mosca/devices/xglab/dante.py +126 -0
  42. mosca/devices/xglab/dantehw.py +1178 -0
  43. mosca/devices/xia/__init__.py +0 -0
  44. mosca/devices/xia/falconx.py +232 -0
  45. mosca/devices/xia/handel/__init__.py +14 -0
  46. mosca/devices/xia/handel/_cffi.py +62 -0
  47. mosca/devices/xia/handel/error.py +272 -0
  48. mosca/devices/xia/handel/handel_inc/handel_constants.h +127 -0
  49. mosca/devices/xia/handel/handel_inc/handel_errors.h +254 -0
  50. mosca/devices/xia/handel/handel_inc/handel_generic.h +66 -0
  51. mosca/devices/xia/handel/interface.py +1025 -0
  52. mosca/devices/xia/handel/mapping.py +107 -0
  53. mosca/devices/xia/handel/parser.py +62 -0
  54. mosca/devices/xia/handel/stats.py +85 -0
  55. mosca/devices/xia/mercury.py +160 -0
  56. mosca/devices/xia/utils.py +47 -0
  57. mosca/devices/xia/xia.py +575 -0
  58. mosca/devices/xia/xiads.py +161 -0
  59. mosca/mosca.py +0 -0
  60. mosca/tango/__init__.py +2 -0
  61. mosca/tango/controller.py +80 -0
  62. mosca/tango/main.py +163 -0
  63. mosca/tango/mosca.py +513 -0
  64. mosca/tango/moscav1.py +408 -0
  65. mosca/tango/shared.py +23 -0
  66. mosca/tango/tasks/__init__.py +0 -0
  67. mosca/tango/tasks/background.py +55 -0
  68. mosca/tango/utils.py +109 -0
  69. mosca-2.0.2.dist-info/METADATA +32 -0
  70. mosca-2.0.2.dist-info/RECORD +73 -0
  71. mosca-2.0.2.dist-info/WHEEL +4 -0
  72. mosca-2.0.2.dist-info/entry_points.txt +2 -0
  73. mosca-2.0.2.dist-info/licenses/LICENSE +166 -0
@@ -0,0 +1,126 @@
1
+ import logging
2
+ logger = logging.getLogger(__name__)
3
+
4
+ import os
5
+ import sys
6
+ import pathlib
7
+ import numpy as np
8
+
9
+ import tango
10
+ from tango.server import Device, DeviceMeta, device_property, attribute, command #, GreenMode
11
+
12
+ from ...tango import TangoDevInfo
13
+
14
+ from ...tango import ControllerDS
15
+ from .dantehw import XGLabDante
16
+
17
+
18
+ class Dante(ControllerDS):
19
+ config_dir = device_property(dtype=str, mandatory=True)#, default_value="c:\\blissadm\\dante_config")
20
+ config_file = device_property(dtype=str, default_value=None)
21
+ address = device_property(dtype=str, mandatory=False, default_value="")
22
+ expected_n_boards = device_property(dtype=int, mandatory=False, default_value=0)
23
+ serial = device_property(dtype=str, mandatory=False, default_value="")
24
+ keepalive_period = device_property(dtype=float, default_value=4.0)
25
+ max_init_time = device_property(dtype=float, default_value=30.0)
26
+
27
+ acq_time = attribute(lambda self: self.control.acq_time, dtype=float)
28
+ spectrum_depth = attribute(lambda self: self.control.spectrum_depth, dtype=int)
29
+ points = attribute(lambda self: self.control.points, dtype=int)
30
+ sp_time = attribute(lambda self: self.control.sp_time, dtype=float)
31
+
32
+ def init_device(self):
33
+ super().init_device()
34
+ # config_file = os.path.join(self.config_dir, self.config_file)
35
+ self.control.connect()
36
+ self._set_config_file(self.config_file)
37
+
38
+ def _create_control(self):
39
+ return XGLabDante(
40
+ self.address,
41
+ self.serial,
42
+ self.config_dir,
43
+ expected_n_boards=self.expected_n_boards,
44
+ keepalive_period=self.keepalive_period,
45
+ max_init_time=self.max_init_time
46
+ )
47
+
48
+ @attribute(dtype=str)
49
+ def gating_mode(self):
50
+ gating_mode = self.control.gating_mode
51
+ if gating_mode is not None:
52
+ return self.control.gating_mode.name
53
+ else:
54
+ return "None"
55
+
56
+ # @attribute(dtype=str)
57
+ # def input_modes(self):
58
+ # raise NotImplementedError("TODO")
59
+ # input_modes = self.control.input_modes
60
+ # return ", ".join(f"{det}={mode}" for det, mode in input_modes.items())
61
+
62
+ @attribute(dtype=int)
63
+ def block_size(self):
64
+ return self.control.block_size
65
+
66
+ @block_size.write
67
+ def block_size(self, block_size):
68
+ self.control.block_size = block_size
69
+
70
+ @gating_mode.write
71
+ def gating_mode(self, gating_mode):
72
+ self.control.gating_mode = gating_mode
73
+
74
+ @acq_time.write
75
+ def acq_time(self, acq_time):
76
+ self.control.acq_time = acq_time
77
+
78
+ @spectrum_depth.write
79
+ def spectrum_depth(self, spectrum_depth):
80
+ self.control.spectrum_depth = spectrum_depth
81
+
82
+ @points.write
83
+ def points(self, points):
84
+ self.control.points = points
85
+
86
+ @attribute(dtype=str)
87
+ def configuration_file(self):
88
+ cfg = self.control.config_file
89
+ return cfg or ""
90
+
91
+ @attribute(dtype=[str], max_dim_x=100)
92
+ def available_configurations(self):
93
+ return self.control.available_configurations() or [""]
94
+
95
+ @attribute(dtype=str)
96
+ def configuration_directory(self):
97
+ return self.control.config_dir
98
+
99
+ # @configuration_file.write
100
+ # def configuration_file(self, configuration_file):
101
+ # return self.control.load_configuration(configuration_file)
102
+
103
+ @command(dtype_out=str)
104
+ def dante_init_msg(self):
105
+ return self.control.init_message
106
+
107
+ @command(dtype_in=str)
108
+ def set_configuration_file_async(self, config_file):
109
+ self._set_config_file(config_file, wait=False)
110
+
111
+ def _set_config_file(self, config_file, wait=True):
112
+ # if not os.path.isabs(config_file):
113
+ # config_file = os.path.join(self.config_dir, config_file)
114
+ logger.info("Setting configuration file to [%s]", config_file)
115
+ self.control.load_configuration(config_file, wait=wait)
116
+
117
+ @command
118
+ def stop_keepalive(self):
119
+ self.control.comm._keepalive_task.stop()
120
+
121
+
122
+ DANTE_DEVINFO = TangoDevInfo(
123
+ klass = Dante,
124
+ properties = {"config_dir": "c:/blissadm/dante/config",
125
+ "config_file": "config.hdf",
126
+ "address": ""})