Skip to content

Commit 4f399c4

Browse files
Merged in zaberstage (pull request #85)
Restore Zaber stage support
2 parents f2a9fd9 + eacd4d6 commit 4f399c4

File tree

8 files changed

+381
-205
lines changed

8 files changed

+381
-205
lines changed

ZaberStageController.py

Lines changed: 0 additions & 205 deletions
This file was deleted.

ZaberStageController/__init__.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#####################################################################
2+
# #
3+
# /labscript_devices/ZaberStageController/__init__.py #
4+
# #
5+
# Copyright 2019, Monash University and contributors #
6+
# #
7+
# This file is part of labscript_devices, in the labscript suite #
8+
# (see http://labscriptsuite.org), and is licensed under the #
9+
# Simplified BSD License. See the license.txt file in the root of #
10+
# the project for the full license. #
11+
# #
12+
#####################################################################
13+
14+
import sys
15+
if sys.version_info < (3, 5):
16+
raise RuntimeError("Zaber stage labscript driver requires Python 3.5+")

ZaberStageController/blacs_tabs.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#####################################################################
2+
# #
3+
# /labscript_devices/ZaberStageController/blacs_tabs.py #
4+
# #
5+
# Copyright 2019, Monash University and contributors #
6+
# #
7+
# This file is part of labscript_devices, in the labscript suite #
8+
# (see http://labscriptsuite.org), and is licensed under the #
9+
# Simplified BSD License. See the license.txt file in the root of #
10+
# the project for the full license. #
11+
# #
12+
#####################################################################
13+
14+
from blacs.device_base_class import DeviceTab
15+
from .utils import get_device_number
16+
17+
class ZaberStageControllerTab(DeviceTab):
18+
def initialise_GUI(self):
19+
# Capabilities
20+
self.base_units = 'steps'
21+
self.base_min = 0
22+
self.base_step = 100
23+
self.base_decimals = 0
24+
25+
device = self.settings['connection_table'].find_by_name(self.device_name)
26+
self.com_port = device.BLACS_connection
27+
self.mock = device.properties['mock']
28+
29+
# Create the AO output objects
30+
ao_prop = {}
31+
for stage in device.child_list.values():
32+
connection = stage.parent_port
33+
base_min, base_max = stage.properties['limits']
34+
ao_prop[connection] = {
35+
'base_unit': self.base_units,
36+
'min': base_min,
37+
'max': base_max,
38+
'step': self.base_step,
39+
'decimals': self.base_decimals,
40+
}
41+
# Sort by device number:
42+
ao_prop = {c: ao_prop[c] for c in sorted(ao_prop, key=get_device_number)}
43+
self.child_connections = list(ao_prop.keys())
44+
# Create the output objects
45+
self.create_analog_outputs(ao_prop)
46+
# Create widgets for output objects
47+
_, ao_widgets, _ = self.auto_create_widgets()
48+
# and auto place the widgets in the UI
49+
self.auto_place_widgets(("Zaber Stages", ao_widgets))
50+
51+
# Set the capabilities of this device
52+
self.supports_remote_value_check(True)
53+
self.supports_smart_programming(False) #TODO: Implement?
54+
55+
def initialise_workers(self):
56+
# Create and set the primary worker
57+
self.create_worker(
58+
"main_worker",
59+
"labscript_devices.ZaberStageController.blacs_workers.ZaberWorker",
60+
{
61+
'com_port': self.com_port,
62+
'mock': self.mock,
63+
'child_connections': self.child_connections,
64+
},
65+
)
66+
self.primary_worker = "main_worker"

0 commit comments

Comments
 (0)