You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Introduce a new attribute for IntermediateDevices that allows them to specify a minimum clock high time in order to allow asymmetric clock ticks when combined with gated clocks on a pseudoclock. minimum_clock_high_time defaults to half of the minimum time between IntermediateDevice instructions. It be backwards compatible with previous versions of labscript devices.
Fixes#51.
I also discovered a bug where the check against the next all change time did not capture the last change time on the clock line because the stop time had not yet been added. This is now fixed.
There were also some issues with various error messages. I've fixed those too and moved to use f strings so they're more readable.
The whole `Pseudoclock.collect_change_times` method has also been reformatted in line with how `black` would format it (since I was working on it anyway). Some commented out code was also removed here too.
# Sort change times so self.stop_time will be in the middle
869
+
# somewhere if it is prior to the last actual instruction.
870
+
# Whilst this means the user has set stop_time in error, not
871
+
# catching the error here allows it to be caught later by the
872
+
# specific device that has more instructions after
873
+
# self.stop_time. Thus we provide the user with sligtly more
874
+
# detailed error info.
875
+
change_time_list.sort()
876
+
824
877
# index to keep track of in all_change_times
825
878
j=0
826
879
# Check that no two instructions are too close together:
827
880
fori, tinenumerate(change_time_list[:-1]):
828
881
dt=change_time_list[i+1] -t
829
882
ifdt<1.0/clock_line.clock_limit:
830
-
raiseLabscriptError('Commands have been issued to devices attached to clockline %s at t= %s s and %s s. '%(clock_line.name, str(t),str(change_time_list[i+1])) +
831
-
'One or more connected devices on ClockLine %s cannot support update delays shorter than %s sec.'%(clock_line.name, str(1.0/clock_line.clock_limit)))
832
-
883
+
raiseLabscriptError(
884
+
"Commands have been issued to devices attached to "
885
+
f"clockline {clock_line.name} at t={t} and "
886
+
f"t={change_time_list[i+1]}. One or more connected "
raiseLabscriptError('The stop time of the experiment is t= %s s, but the last instruction for a device attached to %s is at t= %s s. '%( str(self.stop_time), self.name, str(change_time_list[-1])) +
849
-
'One or more connected devices cannot support update delays shorter than %s sec. Please set the stop_time a bit later.'%str(1.0/clock_line.clock_limit))
"""For each time interval delimited by change_times, constructs
869
922
an array of times at which the clock for this device needs to
@@ -2412,7 +2465,11 @@ def go_high(self):
2412
2465
self.add_instruction(0,1)
2413
2466
self._static_value=1
2414
2467
else:
2415
-
raiseLabscriptError('%s %s has already been set to %s. It cannot also be set to %s.'%(self.description, self.name, self.instruction_to_string[self._static_value], self.instruction_to_string[value]))
2468
+
raiseLabscriptError(
2469
+
f"{self.description}{self.name} has already been set to "
2470
+
f"{self.instruction_to_string(self._static_value)}. It cannot "
2471
+
"also be set to 1."
2472
+
)
2416
2473
2417
2474
defgo_low(self):
2418
2475
"""Command a static low output.
@@ -2424,7 +2481,11 @@ def go_low(self):
2424
2481
self.add_instruction(0,0)
2425
2482
self._static_value=0
2426
2483
else:
2427
-
raiseLabscriptError('%s %s has already been set to %s. It cannot also be set to %s.'%(self.description, self.name, self.instruction_to_string[self._static_value], self.instruction_to_string[value]))
2484
+
raiseLabscriptError(
2485
+
f"{self.description}{self.name} has already been set to "
2486
+
f"{self.instruction_to_string(self._static_value)}. It cannot "
0 commit comments