From 0e85f7381ac641ee43c44a95834943206eb3879e Mon Sep 17 00:00:00 2001 From: chrisjbillington Date: Fri, 20 Aug 2021 14:33:25 +1000 Subject: [PATCH] Fix bug where FunctionRunner functions were sorted by name Instead of remaining in the order they were added. Functions are intended to be sorted by time, but not by anything else. But naively sorting the tuples caused them to be sorted unintentionally by name if they had the same time. --- labscript_devices/FunctionRunner/labscript_devices.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/labscript_devices/FunctionRunner/labscript_devices.py b/labscript_devices/FunctionRunner/labscript_devices.py index 5f5b04a7..804fd937 100644 --- a/labscript_devices/FunctionRunner/labscript_devices.py +++ b/labscript_devices/FunctionRunner/labscript_devices.py @@ -90,7 +90,7 @@ def func(shot_context, t, ...): def generate_code(self, hdf5_file): # Python's sorting is stable, so items with equal times will remain in the order # they were added - self.functions.sort() + self.functions.sort(key=lambda item: item[0]) vlenstr = h5py.special_dtype(vlen=str) table_dtypes = [ ('t', float),