-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mermin refactor #1038
Mermin refactor #1038
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Just to add my 2c: whenever the circuits expression is supposed to be equivalent (i.e. usually the original protocol's definition is given in terms of circuits), it'd be better to express anything as circuits, as the higher level abstraction. |
I agree, but from what I understood, there are some discrepancies. Maybe @igres26 could elaborate more on this. |
After #1040 I think we can use circuits |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1038 +/- ##
==========================================
- Coverage 97.37% 97.32% -0.06%
==========================================
Files 120 124 +4
Lines 9749 9893 +144
==========================================
+ Hits 9493 9628 +135
- Misses 256 265 +9
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I am trying to test this. What other branches of Qibo and qibolab should I be using to run this? I cannot get the versions to work on my end. |
figures = [] | ||
targets = data.targets | ||
|
||
n_targets = len(targets) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
n_targets = len(targets) | |
n_targets = len(targets[0]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so n_targets = len(target)
would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just has to be the number of qubits involved. Any way we get that it should work.
Together with my proposed changes and @andrea-pasquale's it finally works. Here are some results for 3 qubit Mermin: http://login.qrccluster.com:9000/bAaPJfD_RCyLslDSTgNkFA==/ And some for 2 qubit Mermin: http://login.qrccluster.com:9000/L-IDUlkmTRSYQp8oW95_GQ==/ Readout error mitigation works weirdly. It seems to invert the results, so it might be easy to fix. This is a result with it enabled: http://login.qrccluster.com:9000/Fp6E5gXxRpqhISPPmWPnmA==/ |
Co-authored-by: Andrea Pasquale <andreapasquale97@gmail.com> Co-authored-by: Sergi Ramos <36544268+igres26@users.noreply.github.com>
for more information, see https://pre-commit.ci
This is because the zeros are treated as ones and vice versa. The cause of this is the strange shape of the mitigation matrix, where the columns are flipped respect to what it is usually expected.
This should be fixed in #1045 |
Then we should be ready to merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the readout error mitigation fixed in another pull request, this should be ready.
Increase the compatibility between transpiler and chsh
Refactor readout mitigation matrix routine
Did you try to run it? I am getting an error now: �[38;20m[Qibocal 0.1.1|INFO|2024-11-25 09:18:57]: Finished acquisition in 310.17 seconds�[0m
Traceback (most recent call last):
File "/nfs/users/sergi.ramos/qiboenv/bin/qq", line 8, in <module>
sys.exit(command())
File "/nfs/users/sergi.ramos/qiboenv/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
File "/nfs/users/sergi.ramos/qiboenv/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/nfs/users/sergi.ramos/qiboenv/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/nfs/users/sergi.ramos/qiboenv/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/nfs/users/sergi.ramos/qiboenv/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/cli/_base.py", line 75, in run
protocols_execution(runcard, folder, force, update)
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/cli/run.py", line 42, in protocols_execution
history = runcard.run(
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/auto/runcard.py", line 63, in run
instance.run_protocol(
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/auto/execute.py", line 131, in run_protocol
completed = task.run(platform=self.platform, targets=self.targets, mode=mode)
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/auto/task.py", line 169, in run
completed.results, completed.results_time = operation.fit(completed.data)
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/auto/operation.py", line 42, in wrapper
out = func(*args, **kwds)
File "/nfs/users/sergi.ramos/qibocal/src/qibocal/protocols/two_qubit_interaction/mermin/protocol.py", line 153, in _fit
mitigated_output = np.dot(
ValueError: shapes (8,8) and (1,) not aligned: 8 (dim 1) != 1 (dim 0) In the error mitigation part. |
@Edoardo-Pedicillo @igres26 I have tried with qblox and IQM chip and it seems to work using qibolab 0.1. The only thing is that, qblox intruments are connected and disconnected multiple times: �[38;20m[Qibocal 0.1.1|INFO|2024-11-28 11:27:56]: Executing mode AUTOCALIBRATION on mermin.�[0m
INFO:qibocal.config:Executing mode AUTOCALIBRATION on mermin.
[Qibo 0.2.12|INFO|2024-11-28 11:27:56]: Loading platform /home/users/david.fuentes/qibolab_platforms_qrc/iqm5q
INFO:qibo.config:Loading platform /home/users/david.fuentes/qibolab_platforms_qrc/iqm5q
[Qibo 0.2.12|INFO|2024-11-28 11:27:56]: Using qibolab (/home/users/david.fuentes/qibolab_platforms_qrc/iqm5q) backend on /CPU:0
INFO:qibo.config:Using qibolab (/home/users/david.fuentes/qibolab_platforms_qrc/iqm5q) backend on /CPU:0
[Qibo 0.2.12|INFO|2024-11-28 11:27:56]: Minimal execution time (sequence): 1.236992
INFO:qibo.config:Minimal execution time (sequence): 1.236992
[Qibo 0.2.12|INFO|2024-11-28 11:28:00]: Connecting to instrument <qibolab.instruments.qblox.controller.QbloxController object at 0x77a99e9e5c60>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.controller.QbloxController object at 0x77a99e9e5c60>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: QbloxController: all modules connected.
INFO:qibo.config:QbloxController: all modules connected.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.rohde_schwarz.SGS100A object at 0x77a99e9e5c90>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.rohde_schwarz.SGS100A object at 0x77a99e9e5c90>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f75ed0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f75ed0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f76bc0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f76bc0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5cf0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5cf0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5b70>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5b70>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5840>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5840>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7010>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7010>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7910>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7910>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7fd0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7fd0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7340>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7340>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:09]: Minimal execution time (sequence): 1.2373196800000001
INFO:qibo.config:Minimal execution time (sequence): 1.2373196800000001
[Qibo 0.2.12|INFO|2024-11-28 11:28:13]: Connecting to instrument <qibolab.instruments.qblox.controller.QbloxController object at 0x77a99e9e5c60>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.controller.QbloxController object at 0x77a99e9e5c60>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:21]: QbloxController: all modules connected.
INFO:qibo.config:QbloxController: all modules connected.
[Qibo 0.2.12|INFO|2024-11-28 11:28:21]: Connecting to instrument <qibolab.instruments.rohde_schwarz.SGS100A object at 0x77a99e9e5c90>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.rohde_schwarz.SGS100A object at 0x77a99e9e5c90>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f75ed0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f75ed0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f76bc0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qrm_rf.QrmRf object at 0x77a9a5f76bc0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5cf0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5cf0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5b70>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5b70>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5840>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_rf.QcmRf object at 0x77a99e9e5840>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7010>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7010>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7910>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7910>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7fd0>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7fd0>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7340>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.cluster_qcm_bb.QcmBb object at 0x77a99e9e7340>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:22]: Minimal execution time (sequence): 1.2373196800000001
INFO:qibo.config:Minimal execution time (sequence): 1.2373196800000001
[Qibo 0.2.12|INFO|2024-11-28 11:28:26]: Connecting to instrument <qibolab.instruments.qblox.controller.QbloxController object at 0x77a99e9e5c60>.
INFO:qibo.config:Connecting to instrument <qibolab.instruments.qblox.controller.QbloxController object at 0x77a99e9e5c60>.
[Qibo 0.2.12|INFO|2024-11-28 11:28:34]: QbloxController: all modules connected.
INFO:qibo.config:QbloxController: all modules connected. Is it normal?? |
Yes, because the platform is connected twice in the acquisition: when we evaluate the mitigation matrix, the platform is connected to execute the circuits and disconnected by Qibolab afterwards, so before running the Mermin experiment, we need to reconnect it again. |
@igres26 I have opened this PR to track the Mermin refactoring.
I have some questions:
qibocal/src/qibocal/protocols/two_qubit_interaction/mermin/pulses.py
Line 30 in 3219031
Checklist:
master
0.1
0.1