[wip] Add experimental qcodes.measure_v2 package (tracer bullet)#8116
Open
jenshnielsen wants to merge 2 commits into
Open
[wip] Add experimental qcodes.measure_v2 package (tracer bullet)#8116jenshnielsen wants to merge 2 commits into
jenshnielsen wants to merge 2 commits into
Conversation
Introduce a parallel, async-capable measurement API for QCoDeS that decouples plan description from execution. Plans are Python generators yielding typed messages (Set, Read, Sleep, Emit, OpenRun, CloseRun); a MeasurementEngine drives them on a dedicated worker thread and publishes events (RunStarted, RowEmitted, RunStopped) to pluggable sinks via a publisher thread with a bounded queue. Key properties of the tracer-bullet implementation: - Non-blocking submission via engine.submit(...) returning a RunHandle with futures for the dataset and final result. - Cancellation via it.throw(CancelRequested) at the next yield point; plan try/finally blocks always run for safe cleanup. scan_1d guarantees a ramp-to-zero of the swept parameter on any exit path. - Cancel flag re-checked between .send() and dispatch to prevent one extra Set/Read leaking to hardware after cancellation. - handle.wait() returning guarantees data is durably committed: the publisher thread completes futures only after all sinks have processed RunStopped. - SqliteSink reuses existing DataSaver/Measurement infrastructure; opens its own SQLite connection on the publisher thread to satisfy check_same_thread=True. ~50 lines of integration code. - MemorySink for tests and lightweight in-memory consumption. Public surface: import qcodes as qc ds = qc.measure_v2.scan(LinSweep(g, 0, 1, 11), measure=[i]) Advanced users construct an explicit MeasurementEngine and submit plans built via run(...) + plan-builders (scan_1d, or custom generators). Tracer scope is deliberately small: 1D scans of scalar parameters with the default SQLite sink. Multi-dim scans, Call/Describe messages, parallel reads via underlying_instrument grouping, queueing, pause/resume, live-plot/progress sinks, and a dond shim are P0-P2 for the v1 release. See src/qcodes/measure_v2/DESIGN.md for the full architecture. 50 tests across L1 (message-stream), L2 (engine + MemorySink), and L3 (engine + SqliteSink) levels. All three end-to-end acceptance scenarios pass. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #8116 +/- ##
==========================================
- Coverage 70.80% 70.41% -0.39%
==========================================
Files 302 312 +10
Lines 31911 32474 +563
==========================================
+ Hits 22593 22865 +272
- Misses 9318 9609 +291 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Introduce a parallel, async-capable measurement API for QCoDeS that decouples plan description from execution. Plans are Python generators yielding typed messages (Set, Read, Sleep, Emit, OpenRun, CloseRun); a MeasurementEngine drives them on a dedicated worker thread and publishes events (RunStarted, RowEmitted, RunStopped) to pluggable sinks via a publisher thread with a bounded queue.
Key properties of the tracer-bullet implementation:
Public surface:
import qcodes as qc ds = qc.measure_v2.scan(LinSweep(g, 0, 1, 11), measure=[i])
Advanced users construct an explicit MeasurementEngine and submit plans built via run(...) + plan-builders (scan_1d, or custom generators).
Tracer scope is deliberately small: 1D scans of scalar parameters with the default SQLite sink. Multi-dim scans, Call/Describe messages, parallel reads via underlying_instrument grouping, queueing, pause/resume, live-plot/progress sinks, and a dond shim are P0-P2 for the v1 release. See src/qcodes/measure_v2/DESIGN.md for the full architecture.
50 tests across L1 (message-stream), L2 (engine + MemorySink), and L3 (engine + SqliteSink) levels. All three end-to-end acceptance scenarios pass.