microeye 2.3.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.
- microEye/__init__.py +47 -0
- microEye/_version.py +2 -0
- microEye/analysis/__init__.py +1 -0
- microEye/analysis/checklist_dialog.py +143 -0
- microEye/analysis/cmosMaps.py +228 -0
- microEye/analysis/filters/__init__.py +9 -0
- microEye/analysis/filters/base.py +21 -0
- microEye/analysis/filters/spatial.py +338 -0
- microEye/analysis/filters/temporal.py +76 -0
- microEye/analysis/fitting/__init__.py +0 -0
- microEye/analysis/fitting/fit.py +680 -0
- microEye/analysis/fitting/nena.py +375 -0
- microEye/analysis/fitting/phasor_fit.py +90 -0
- microEye/analysis/fitting/processing.py +317 -0
- microEye/analysis/fitting/psf/__init__.py +6 -0
- microEye/analysis/fitting/psf/extract.py +1129 -0
- microEye/analysis/fitting/psf/rubost_mean.py +150 -0
- microEye/analysis/fitting/psf/spline.py +167 -0
- microEye/analysis/fitting/psf/stats/__init__.py +12 -0
- microEye/analysis/fitting/psf/stats/core.py +295 -0
- microEye/analysis/fitting/psf/stats/curve_fit.py +708 -0
- microEye/analysis/fitting/psf/stats/io.py +104 -0
- microEye/analysis/fitting/psf/stats/slope_fit.py +171 -0
- microEye/analysis/fitting/psf/temp.py +147 -0
- microEye/analysis/fitting/psf/test.py +47 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUfunctions.py +657 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUmleFit_LM.py +1336 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/CPUsplineLib.py +270 -0
- microEye/analysis/fitting/pyfit3Dcspline/CPU/__init__.py +1 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUfunctions.py +609 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_EMCCD.py +1396 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUmleFit_LM_sCMOS.py +1426 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/GPUsplineLib.py +231 -0
- microEye/analysis/fitting/pyfit3Dcspline/GPU/__init__.py +2 -0
- microEye/analysis/fitting/pyfit3Dcspline/__init__.py +10 -0
- microEye/analysis/fitting/pyfit3Dcspline/constants.py +27 -0
- microEye/analysis/fitting/pyfit3Dcspline/mainfunctions.py +903 -0
- microEye/analysis/fitting/results.py +917 -0
- microEye/analysis/fitting/results_stats.py +251 -0
- microEye/analysis/fitting/tardis.py +209 -0
- microEye/analysis/multi_viewer.py +568 -0
- microEye/analysis/processing/__init__.py +1 -0
- microEye/analysis/processing/frc.py +120 -0
- microEye/analysis/rendering/__init__.py +3 -0
- microEye/analysis/rendering/base.py +452 -0
- microEye/analysis/rendering/cloud.py +215 -0
- microEye/analysis/rendering/core.py +47 -0
- microEye/analysis/rendering/volumetric.py +198 -0
- microEye/analysis/tools/__init__.py +0 -0
- microEye/analysis/tools/kymograms.py +1079 -0
- microEye/analysis/tools/roi_selectors.py +556 -0
- microEye/analysis/utils/__init__.py +3 -0
- microEye/analysis/utils/coordinates.py +18 -0
- microEye/analysis/utils/images.py +68 -0
- microEye/analysis/utils/windows.py +19 -0
- microEye/analysis/viewer/__init__.py +3 -0
- microEye/analysis/viewer/image_options_widget.py +615 -0
- microEye/analysis/viewer/images.py +1225 -0
- microEye/analysis/viewer/layers_widget.py +415 -0
- microEye/analysis/viewer/localizations.py +1304 -0
- microEye/analysis/viewer/psf.py +1003 -0
- microEye/analysis/viewer/volume.py +456 -0
- microEye/hardware/__init__.py +3 -0
- microEye/hardware/cams/__init__.py +29 -0
- microEye/hardware/cams/camera_calibration.py +99 -0
- microEye/hardware/cams/camera_list.py +528 -0
- microEye/hardware/cams/camera_options.py +694 -0
- microEye/hardware/cams/camera_panel.py +941 -0
- microEye/hardware/cams/dummy/__init__.py +1 -0
- microEye/hardware/cams/dummy/dummy_panel.py +759 -0
- microEye/hardware/cams/jobs.py +497 -0
- microEye/hardware/cams/line_profiler.py +99 -0
- microEye/hardware/cams/linescan/IR_Cam.py +474 -0
- microEye/hardware/cams/linescan/__init__.py +1 -0
- microEye/hardware/cams/micam.py +524 -0
- microEye/hardware/cams/pco/__init__.py +58 -0
- microEye/hardware/cams/pco/enums.py +382 -0
- microEye/hardware/cams/pco/pco_cam.py +761 -0
- microEye/hardware/cams/pco/pco_panel.py +477 -0
- microEye/hardware/cams/shortcuts.py +312 -0
- microEye/hardware/cams/thorlabs/__init__.py +1 -0
- microEye/hardware/cams/thorlabs/thorlabs.py +1508 -0
- microEye/hardware/cams/thorlabs/thorlabs_panel.py +850 -0
- microEye/hardware/cams/ueye/__init__.py +1 -0
- microEye/hardware/cams/ueye/ueye_camera.py +1023 -0
- microEye/hardware/cams/ueye/ueye_panel.py +861 -0
- microEye/hardware/cams/vimba/__init__.py +1 -0
- microEye/hardware/cams/vimba/vimba_cam.py +1000 -0
- microEye/hardware/cams/vimba/vimba_panel.py +813 -0
- microEye/hardware/device.py +60 -0
- microEye/hardware/lasers/__init__.py +13 -0
- microEye/hardware/lasers/io_matchbox.py +791 -0
- microEye/hardware/lasers/io_params.py +85 -0
- microEye/hardware/lasers/io_single_laser.py +742 -0
- microEye/hardware/lasers/laser_relay.py +594 -0
- microEye/hardware/mieye/__init__.py +1 -0
- microEye/hardware/mieye/acquisition_manager.py +467 -0
- microEye/hardware/mieye/devices_manager.py +533 -0
- microEye/hardware/mieye/miEye.py +659 -0
- microEye/hardware/misc/__init__.py +0 -0
- microEye/hardware/misc/acquisition_view.py +71 -0
- microEye/hardware/misc/reglo.py +761 -0
- microEye/hardware/misc/temp.py +188 -0
- microEye/hardware/port_config.py +59 -0
- microEye/hardware/protocols/__init__.py +2 -0
- microEye/hardware/protocols/actions.py +402 -0
- microEye/hardware/protocols/actions_items.py +703 -0
- microEye/hardware/protocols/designer.py +244 -0
- microEye/hardware/protocols/scene_manager.py +191 -0
- microEye/hardware/protocols/serialization.py +97 -0
- microEye/hardware/pycromanager/__init__.py +16 -0
- microEye/hardware/pycromanager/core.py +1433 -0
- microEye/hardware/pycromanager/devices.py +461 -0
- microEye/hardware/pycromanager/enums.py +107 -0
- microEye/hardware/pycromanager/headless.py +153 -0
- microEye/hardware/pycromanager/utils.py +34 -0
- microEye/hardware/pycromanager/widgets/__init__.py +5 -0
- microEye/hardware/pycromanager/widgets/bridges.py +407 -0
- microEye/hardware/pycromanager/widgets/headless_manager.py +258 -0
- microEye/hardware/pycromanager/widgets/headless_options.py +224 -0
- microEye/hardware/pycromanager/widgets/pycro_panel.py +455 -0
- microEye/hardware/stages/__init__.py +18 -0
- microEye/hardware/stages/elliptec/__init__.py +5 -0
- microEye/hardware/stages/elliptec/baseDevice.py +314 -0
- microEye/hardware/stages/elliptec/device.py +384 -0
- microEye/hardware/stages/elliptec/deviceID.py +212 -0
- microEye/hardware/stages/elliptec/devicePort.py +379 -0
- microEye/hardware/stages/elliptec/deviceStatus.py +65 -0
- microEye/hardware/stages/elliptec/devicesView.py +706 -0
- microEye/hardware/stages/elliptec/ellDevices.py +134 -0
- microEye/hardware/stages/elliptec/messageUpdater.py +34 -0
- microEye/hardware/stages/elliptec/motorInfo.py +153 -0
- microEye/hardware/stages/elliptec/stage.py +62 -0
- microEye/hardware/stages/elliptec/test.py +139 -0
- microEye/hardware/stages/kinesis/__init__.py +1 -0
- microEye/hardware/stages/kinesis/kdc101/__init__.py +1 -0
- microEye/hardware/stages/kinesis/kdc101/enums.py +1002 -0
- microEye/hardware/stages/kinesis/kdc101/factory.py +171 -0
- microEye/hardware/stages/kinesis/kdc101/kdc101.py +718 -0
- microEye/hardware/stages/kinesis/kinesis.py +776 -0
- microEye/hardware/stages/piezo_concept.py +607 -0
- microEye/hardware/stages/stabilizer.py +785 -0
- microEye/hardware/stages/stage.py +89 -0
- microEye/hardware/widgets/__init__.py +10 -0
- microEye/hardware/widgets/controller.py +246 -0
- microEye/hardware/widgets/devices.py +133 -0
- microEye/hardware/widgets/focusWidget.py +264 -0
- microEye/hardware/widgets/qlist_slider.py +113 -0
- microEye/hardware/widgets/scan_acquisition.py +424 -0
- microEye/icons/1024.png +0 -0
- microEye/icons/128.png +0 -0
- microEye/icons/16.png +0 -0
- microEye/icons/24.png +0 -0
- microEye/icons/256.png +0 -0
- microEye/icons/32.png +0 -0
- microEye/icons/48.png +0 -0
- microEye/icons/512.png +0 -0
- microEye/icons/64.png +0 -0
- microEye/icons/__init__.py +0 -0
- microEye/icons/close.svg +88 -0
- microEye/icons/mieye.png +0 -0
- microEye/icons/min.svg +83 -0
- microEye/icons/viewer.png +0 -0
- microEye/launcher.py +42 -0
- microEye/qt.py +181 -0
- microEye/utils/__init__.py +2 -0
- microEye/utils/enum_encoder.py +10 -0
- microEye/utils/expandable_groupbox.py +93 -0
- microEye/utils/gui_helper.py +457 -0
- microEye/utils/hid/__init__.py +8 -0
- microEye/utils/hid/controller.py +153 -0
- microEye/utils/hid/device.py +63 -0
- microEye/utils/hid/enums.py +140 -0
- microEye/utils/hid/utils.py +58 -0
- microEye/utils/labelled_slider.py +134 -0
- microEye/utils/metadata.py +599 -0
- microEye/utils/metadata_tree.py +718 -0
- microEye/utils/micro_launcher.py +245 -0
- microEye/utils/parameter_tree.py +325 -0
- microEye/utils/pyscripting.py +444 -0
- microEye/utils/retry_exec.py +35 -0
- microEye/utils/start_gui.py +112 -0
- microEye/utils/thread_worker.py +115 -0
- microEye/utils/uImage.py +1512 -0
- microeye-2.3.2.dist-info/METADATA +401 -0
- microeye-2.3.2.dist-info/RECORD +190 -0
- microeye-2.3.2.dist-info/WHEEL +5 -0
- microeye-2.3.2.dist-info/entry_points.txt +2 -0
- microeye-2.3.2.dist-info/licenses/LICENSE +674 -0
- microeye-2.3.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from microEye.hardware.stages.kinesis.kdc101.enums import *
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class KDC101Command:
|
|
6
|
+
command_id: int
|
|
7
|
+
data: bytes
|
|
8
|
+
|
|
9
|
+
def to_bytes(self) -> bytes:
|
|
10
|
+
return self.data
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class KDC101_Factory:
|
|
14
|
+
@staticmethod
|
|
15
|
+
def create_command(
|
|
16
|
+
cmd: KDC101_CMDS,
|
|
17
|
+
channel: Union[int, Channels] = 0x00,
|
|
18
|
+
param: Union[int, StopMode, JogDirection, ChannelEnableState] = 0x00,
|
|
19
|
+
destination: int = 0x50,
|
|
20
|
+
source: int = 0x01,
|
|
21
|
+
**kwargs,
|
|
22
|
+
) -> KDC101Command:
|
|
23
|
+
if not isinstance(cmd, KDC101_CMDS):
|
|
24
|
+
raise ValueError('Invalid command')
|
|
25
|
+
|
|
26
|
+
if isinstance(param, Enum) and isinstance(param.value, int):
|
|
27
|
+
param = param.value
|
|
28
|
+
elif not isinstance(param, int):
|
|
29
|
+
param = 0x00
|
|
30
|
+
|
|
31
|
+
if isinstance(channel, Enum) and isinstance(channel.value, int):
|
|
32
|
+
channel = channel.value
|
|
33
|
+
elif not isinstance(channel, int):
|
|
34
|
+
channel = 0x00
|
|
35
|
+
|
|
36
|
+
if cmd.cmd_type in [CommandType.CHANNEL, CommandType.COMPLEX]:
|
|
37
|
+
KDC101_Factory._validate_channel(channel)
|
|
38
|
+
|
|
39
|
+
if cmd.cmd_type == CommandType.GENERIC:
|
|
40
|
+
channel = 0x00
|
|
41
|
+
param = 0x00
|
|
42
|
+
|
|
43
|
+
if cmd.cmd_type == CommandType.COMPLEX:
|
|
44
|
+
data = KDC101_Factory._build_data(cmd.packet, kwargs)
|
|
45
|
+
|
|
46
|
+
header = struct.pack(
|
|
47
|
+
'<HHBBH', cmd.value, len(data) + 2, destination | 0x80, source, channel
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
header += data
|
|
51
|
+
else:
|
|
52
|
+
header = struct.pack(
|
|
53
|
+
'<HBBBB', cmd.value, channel, param, destination, source
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
return KDC101Command(cmd.value, header)
|
|
57
|
+
|
|
58
|
+
@staticmethod
|
|
59
|
+
def _validate_channel(channel: int):
|
|
60
|
+
try:
|
|
61
|
+
return Channels(channel)
|
|
62
|
+
except ValueError as e:
|
|
63
|
+
raise ValueError('Invalid channel') from e
|
|
64
|
+
|
|
65
|
+
@staticmethod
|
|
66
|
+
def _build_data(structure: PacketStructure, kwargs: dict) -> bytes:
|
|
67
|
+
format_string = '<' # Little-endian
|
|
68
|
+
values = []
|
|
69
|
+
missing_fields = []
|
|
70
|
+
|
|
71
|
+
for field in structure.data_fields:
|
|
72
|
+
if field.name not in kwargs:
|
|
73
|
+
missing_fields.append(field.name)
|
|
74
|
+
|
|
75
|
+
value = kwargs.get(field.name, 0)
|
|
76
|
+
|
|
77
|
+
if value is None:
|
|
78
|
+
continue # Skip optional fields that weren't provided
|
|
79
|
+
|
|
80
|
+
if field.data_type == DataType.STRING:
|
|
81
|
+
format_string += f'{field.length}s'
|
|
82
|
+
values.append(value.encode('ascii'))
|
|
83
|
+
else:
|
|
84
|
+
format_string += field.data_type.value
|
|
85
|
+
values.append(value)
|
|
86
|
+
|
|
87
|
+
if missing_fields:
|
|
88
|
+
raise ValueError(f"Missing required fields: {', '.join(missing_fields)}")
|
|
89
|
+
|
|
90
|
+
return struct.pack(format_string, *values)
|
|
91
|
+
|
|
92
|
+
@staticmethod
|
|
93
|
+
def interpret_response(
|
|
94
|
+
response_bytes: bytes,
|
|
95
|
+
) -> tuple[KDC101_RESPONSES, dict[str, Any]]:
|
|
96
|
+
if len(response_bytes) < 6:
|
|
97
|
+
raise ValueError('Response too short to be valid')
|
|
98
|
+
|
|
99
|
+
# Extract the message ID from the first two bytes
|
|
100
|
+
msg_id = struct.unpack('<H', response_bytes[:2])[0]
|
|
101
|
+
|
|
102
|
+
# Find the corresponding response enum
|
|
103
|
+
response_enum = KDC101_RESPONSES.get(msg_id)
|
|
104
|
+
if response_enum is None:
|
|
105
|
+
raise ValueError(f'Unknown response ID: 0x{msg_id:04X}')
|
|
106
|
+
|
|
107
|
+
# Parse the response based on its structure
|
|
108
|
+
parsed_data = {}
|
|
109
|
+
if response_enum.packet:
|
|
110
|
+
parsed_data = KDC101_Factory._parse_response_data(
|
|
111
|
+
response_enum.packet, response_bytes
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
return response_enum, parsed_data
|
|
115
|
+
|
|
116
|
+
@staticmethod
|
|
117
|
+
def _parse_response_data(structure: PacketStructure, data: bytes) -> dict[str, Any]:
|
|
118
|
+
parsed_data = {}
|
|
119
|
+
offset = 0
|
|
120
|
+
|
|
121
|
+
for field in structure.data_fields:
|
|
122
|
+
if field.data_type == DataType.STRING:
|
|
123
|
+
value = (
|
|
124
|
+
data[offset : offset + field.length].decode('ascii').rstrip('\x00')
|
|
125
|
+
)
|
|
126
|
+
offset += field.length
|
|
127
|
+
else:
|
|
128
|
+
format_char = field.data_type.value
|
|
129
|
+
size = struct.calcsize(format_char)
|
|
130
|
+
value = struct.unpack(f'<{format_char}', data[offset : offset + size])[
|
|
131
|
+
0
|
|
132
|
+
]
|
|
133
|
+
offset += size
|
|
134
|
+
|
|
135
|
+
parsed_data[field.name] = value
|
|
136
|
+
|
|
137
|
+
return parsed_data
|
|
138
|
+
|
|
139
|
+
@staticmethod
|
|
140
|
+
def get_packet_size(packet: PacketStructure) -> int:
|
|
141
|
+
size = 0
|
|
142
|
+
for field in packet.data_fields:
|
|
143
|
+
if field.data_type == DataType.STRING:
|
|
144
|
+
size += field.length
|
|
145
|
+
else:
|
|
146
|
+
size += struct.calcsize(field.data_type.value)
|
|
147
|
+
return size
|
|
148
|
+
|
|
149
|
+
@staticmethod
|
|
150
|
+
def get_response_size(msg_id: int) -> int:
|
|
151
|
+
try:
|
|
152
|
+
response_enum = KDC101_RESPONSES.get(msg_id)
|
|
153
|
+
if response_enum.packet:
|
|
154
|
+
return KDC101_Factory.get_packet_size(response_enum.packet)
|
|
155
|
+
else:
|
|
156
|
+
return 6 # Minimum message size
|
|
157
|
+
except ValueError:
|
|
158
|
+
return 6 # Unknown message, assume minimum size
|
|
159
|
+
|
|
160
|
+
@staticmethod
|
|
161
|
+
def interpret_status_bits(status_bits: int) -> dict[str, bool]:
|
|
162
|
+
status = {}
|
|
163
|
+
for bit in MotorStatusBits:
|
|
164
|
+
status[bit.name] = bool(status_bits & bit.value)
|
|
165
|
+
return status
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
# if __name__ == '__main__':
|
|
169
|
+
# print(KDC101_CMDS.MGMSG_MOD_IDENTIFY)
|
|
170
|
+
# KDC101_CMDS.get([1096 & 0xFF, 1096 >> 8])
|
|
171
|
+
# print(KDC101_CMDS.MGMSG_MOD_IDENTIFY)
|