Skip to content

Refactoring Qibolab Emulator - #1401

Open
lballerio wants to merge 30 commits into
mainfrom
rebasing_emulator_fix_to_main
Open

Refactoring Qibolab Emulator#1401
lballerio wants to merge 30 commits into
mainfrom
rebasing_emulator_fix_to_main

Conversation

@lballerio

@lballerio lballerio commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

In this PR I worked on the following:

  • Fixing emulator simulator: when I first started working on the emulator, I realized it was not propagating correctly the results from the solver engine (in this case QuTiP).
  • Added Classical Crosstalk cause by Drive lines (their parameters are given in the hamiltonian definition).
  • format some structures in Qubit and HamiltonianConfig classes, specifically moving transmon_levels from HamitlonianConfig to Qubit.
  • Modified how AcquisitionMode and AveragingMode process data and added Confusion Matrix correction for the computed probabilities.
  • Added first draft of documentation for the emulator.
  • Adding crosstalk for Flux channels.
  • Adding new tests for new emulator.
  • Changing the logic for crosstalk factors for both drive and flux channels

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@lballerio
lballerio requested a review from alecandido March 9, 2026 15:16
@lballerio
lballerio force-pushed the rebasing_emulator_fix_to_main branch from 41c5933 to 0515820 Compare March 10, 2026 15:49
@lballerio
lballerio marked this pull request as ready for review March 16, 2026 06:06
@lballerio
lballerio requested review from a team March 16, 2026 06:06
@codecov

codecov Bot commented Mar 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.18405% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.71%. Comparing base (98b5b6a) to head (cdb2fcf).
⚠️ Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
src/qibolab/_core/instruments/emulator/results.py 89.61% 8 Missing ⚠️
...qibolab/_core/instruments/emulator/hamiltonians.py 90.41% 7 Missing ⚠️
src/qibolab/_core/instruments/emulator/emulator.py 92.30% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1401      +/-   ##
==========================================
+ Coverage   38.96%   39.71%   +0.75%     
==========================================
  Files         120      120              
  Lines        6216     6320     +104     
==========================================
+ Hits         2422     2510      +88     
- Misses       3794     3810      +16     
Flag Coverage Δ
unittests 39.71% <90.18%> (+0.75%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lballerio lballerio changed the title Rebasing emulator fix to main Refactoring Qibolab Emulator Mar 17, 2026
@lballerio
lballerio marked this pull request as draft March 18, 2026 11:33
@lballerio
lballerio force-pushed the rebasing_emulator_fix_to_main branch from 45a5b86 to c794739 Compare March 26, 2026 07:57
@lballerio
lballerio force-pushed the rebasing_emulator_fix_to_main branch 2 times, most recently from 32f860d to 40f7841 Compare June 3, 2026 13:32
@lballerio
lballerio marked this pull request as ready for review June 3, 2026 13:46
@lballerio
lballerio requested a review from RoyStegeman June 3, 2026 13:46
@lballerio
lballerio marked this pull request as draft June 23, 2026 05:53
@lballerio
lballerio force-pushed the rebasing_emulator_fix_to_main branch from 7bc0ce1 to a69a675 Compare July 3, 2026 11:52
@lballerio

lballerio commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

In 0c506d2 I decided to change _single_shot_results in results.py module.
In fact I decided to remove changes in #1509 and also delete the usage of inverse and direct mapping for the measurements.
The first decision was taken for the sake of simplycity of the code: I think implementing confusion matrices with those changes would be inconvenient.

Deleting np.unique usage was due to the following fact:
We decided to insert this in order to keep correlation between simultaneous measurements, i.e. if qubits 1 and 2 were measured at the same time T, the shots had to be the same, so both have to measure state 4;
however this condition does not hold anymore when adding confusion matrices and the correlation is lost because of the error in the measurement. This is why I decided to take the full probability tensor and multiply by the tensor product of all the qubits' confusion matrices and after that sample.
I am open to discussions on the topic and new suggestions.

@lballerio
lballerio force-pushed the rebasing_emulator_fix_to_main branch from abafeaf to 0c506d2 Compare July 9, 2026 13:50
lballerio and others added 18 commits July 9, 2026 18:08
Removing gaussian noise for SINGLESHOT averaging mode because it does not work.
…esults) and modifying emulator parameters.json in test
@lballerio
lballerio force-pushed the rebasing_emulator_fix_to_main branch from 3f38b4e to dea8764 Compare July 9, 2026 18:26
@RoyStegeman
RoyStegeman removed their request for review July 10, 2026 10:50
@lballerio
lballerio marked this pull request as ready for review July 16, 2026 07:35
@lballerio

Copy link
Copy Markdown
Contributor Author

I encourage reviewers to give me feedback on the 'tensorization' of the functions _cyclic_results and _singleshot_results; if you don't understand or you have simpler and better ideas please let's discuss!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants