Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bda942a

Browse files
Save the full import path of unit conversion classes
This allows unit conversion classes located outside of `labscript_utils` to be used. Closes #71
1 parent 13239cc commit bda942a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

labscript/labscript.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,12 +2975,17 @@ def generate_connection_table(hdf5_file):
29752975
#if there is no BLACS connection, make sure there is no "gui" or "worker" entry in the connection table properties
29762976
if 'worker' in properties or 'gui' in properties:
29772977
raise LabscriptError('You cannot specify a remote GUI or worker for a device (%s) that does not have a tab in BLACS'%(device.name))
2978-
2979-
2978+
2979+
if getattr(device, 'unit_conversion_class', None) is not None:
2980+
c = device.unit_conversion_class
2981+
unit_conversion_class_repr = f"{c.__module__}.{c.__name__}"
2982+
else:
2983+
unit_conversion_class_repr = repr(None)
2984+
29802985
connection_table.append((device.name, device.__class__.__name__,
29812986
device.parent_device.name if device.parent_device else str(None),
29822987
str(device.connection if device.parent_device else str(None)),
2983-
device.unit_conversion_class.__name__ if hasattr(device,"unit_conversion_class") and device.unit_conversion_class is not None else str(None),
2988+
unit_conversion_class_repr,
29842989
serialised_unit_conversion_parameters,
29852990
BLACS_connection,
29862991
serialised_properties))

0 commit comments

Comments
 (0)