Group singleshot emulator result extraction - #1509
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1509 +/- ##
==========================================
+ Coverage 39.41% 39.47% +0.05%
==========================================
Files 115 115
Lines 6152 6158 +6
==========================================
+ Hits 2425 2431 +6
Misses 3727 3727
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR refactors the emulator single-shot result extraction path to group acquisitions that share the same sampled full-system state, reducing repeated unraveling work while preserving the public result shape and clipping behavior.
Changes:
- Introduces
_sampled_measurementsto extract measured subsystem states by grouping acquisitions by shared sampled state. - Updates
_singleshot_resultsto use_sampled_measurementsinstead of the previous diagonal-style extraction through a larger temporary array. - Adds a focused unit test validating the acquisition grouping/extraction behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/qibolab/_core/instruments/emulator/results.py |
Adds _sampled_measurements and switches single-shot extraction to use it. |
tests/instruments/emulator/test_results.py |
Adds a unit test for grouped single-shot measurement extraction. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks, this is a fair point. I applied the preallocation change manually rather than accepting the suggestion directly, so I could keep the patch aligned with the existing helper and rerun the local checks before pushing.
cc @alecandido |
|
Agreed @lballerio, thanks for catching this. I removed the guard and its dedicated test since |
lballerio
left a comment
There was a problem hiding this comment.
the comment before was not critical, now the uninfluent check has been removed, for me is OK
961a69d to
f17f05c
Compare
Summary
This is a follow-up to
qiboteam/qibolab#1505 and addresses the singleshot result-handling cleanup described inqiboteam/qibolab#1223.The change extracts measured subsystem states by grouping acquisitions that share the same sampled full-system state. For each unique measurement sample, the full-system state is unraveled once, then each acquisition reads only the subsystem index it needs.
This replaces the previous diagonal-style extraction through a larger temporary array:
with a more direct helper:
The public result shape and clipping behavior are unchanged.
Context
#1505 simplified the cyclic/non-shot probability path. This PR keeps the next result-handling step narrow by touching only the singleshot extraction path.
I kept this independent from #1413, because #1413 still depends on the confusion-matrix path from draft
qiboteam/qibolab#1401.Follow-Up
If this PR lands, my next planned step is to use the merged Qibocal emulator platforms from
qiboteam/qibocal#1551 to run Qibocal workflows with the Dynamiqs emulator engine and report concrete validation findings. That follow-up does not depend on #1401 or #1413 (unless @alecandido wants us to take a second look); those remain separate result/confusion-matrix work.Validation
pytest tests/instruments/emulator/test_results.py -qpytest tests/instruments/emulator/test_emulator.py tests/instruments/emulator/test_results.py -qpytest tests/instruments/emulator -qruff check src/qibolab/_core/instruments/emulator/results.py tests/instruments/emulator/test_results.pyruff format --check src/qibolab/_core/instruments/emulator/results.py tests/instruments/emulator/test_results.pyqubitacquisition + fit passedqutritacquisition + fit passed