Repository navigation
Remove the pylab star import and check shared triggers of secondary pseudoclocks - #130
Merged
Merged
Conversation
…unctions (#104) `from labscript import *` re-exported every name of `from pylab import *`, so experiment scripts received numpy and matplotlib names from labscript, and every compilation imported matplotlib. The star import is removed from both modules, which now use `np.` for the numpy functions they call. Scripts that relied on those names must import numpy themselves. The docs extra no longer pins numpy<2, which was needed because the star import shadowed the `labscript.core` submodule with `numpy.core`. The intermediate device example in the developer docs imports numpy explicitly. Verified by compiling a shot with every analog ramp function (ramp, sine, sine_ramp, sine4_ramp, sine4_reverse_ramp, exp_ramp, exp_ramp_t, piecewise_accel_ramp, square_wave) on master and on this branch: the output tables, the pulse program and the connection table are identical, and `linspace` is no longer in the labscript namespace. The documentation builds with Sphinx 8.2.3 and NumPy 2.5.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1BcGgwHXD3Lcx1FgWYwee
TriggerableDevice.do_checks() checks that all devices on one trigger line have identical triggers. PseudoclockDevice overrides do_checks() with a different signature and did not call it, so the check never ran for secondary pseudoclocks. PseudoclockDevice.do_checks() now calls it before checking the outputs. A secondary pseudoclock that shares its trigger line with another device whose triggers differ, for example a second pseudoclock with a different initial trigger time, now fails to compile with a LabscriptError naming both devices. Verified with two PineBlasters triggered by one digital output of a DummyIntermediateDevice: with identical triggers the shot compiles on master and on this branch; with set_initial_trigger_time() on one of them it compiles on master and fails on this branch with the shared-trigger error. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L1BcGgwHXD3Lcx1FgWYwee
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes for the next release, one commit each. Closes #104.
from labscript import *no longer imports all of pylab.labscript.labscriptandlabscript.functionsdidfrom pylab import *, so experiment scripts got every numpy and matplotlib name, and every compilation imported matplotlib. Now they get only labscript's own names. This is a breaking change: a script that uses names such aslinspace,arrayorpiwithout importing them now needs to import numpy itself. The docs now build with NumPy 2, so thenumpy<2pin on the docs extra is removed.Secondary pseudoclocks now get the shared-trigger check. Devices on the same trigger line must have identical triggers, but this was never checked for secondary pseudoclocks, because
PseudoclockDevice.do_checks()overrides the check without calling it. Now it calls it. For example, two pseudoclocks on the same trigger line with different initial trigger times now fail to compile, with an error that names both.Testing: A shot that uses every ramp function compiles to identical output with and without this change. None of the other labscript-suite packages use pylab names from
from labscript import *. The docs build with NumPy 2.5.4. Two PineBlasters on one trigger line compile as before, and fail with the new error when one of them is given a different initial trigger time. An end-to-end test that installs the suite, compiles the example experiment, loads the shot in lyse and runviewer, and starts BLACS, runmanager, runviewer and lyse passed on Ubuntu and Windows for Python 3.11 to 3.14 with PySide6, PyQt6 and PyQt5 (run 39119010476).🤖 Generated with Claude Code