Skip to content
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

Calibration experiments do not have the flexibility to use custom calibrations #1158

Closed
wshanks opened this issue Apr 28, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@wshanks
Copy link
Contributor

wshanks commented Apr 28, 2023

Informations

  • Qiskit Experiments version: 5d840c8
  • Python version: 3.10
  • Operating system: Fedora Linux 37

What is the current behavior?

With #952, BaseCalibrationExperiment was changed to override _transpiled_circuits and run its own pass manager rather than using the default method which calls transpile() on the circuits. Additionally, an _attach_calibrations method was added for calibration experiments to use to attach the calibrations for the schedules being calibrated. The problem with this approach is that it does not provide much flexibility for other schedules in the experiment's circuits. For example, with a fine x amplitude calibration, what should be done with the sx gate? Should it use the default calibration, always pull the sx calibration from Calibrations as well, or try Calibrations and fall back to the default?

Additionally, currently the calibration tests call transpile() on the circuits() output rather than testing _transpiled_circuits() because they were not updated along with the experiments in #952. This means that the tests are not currently testing the actual behavior of running the calibration experiments.

Steps to reproduce the problem

#1157 currently updates the calibration tests to test _transpiled_circuits() rather than transpile(). Doing this change causes a couple tests to fail, specifically:

  • test.library.calibration.test_rough_amplitude.TestSpecializations.test_ef_circuits
  • test.library.calibration.test_fine_drag.TestFineDragCal.test_update_cals

The rough amplitude test fails because the EFRoughAmplitudeCal inherits from the Rabi which attaches a calibration schedule for the gate being calibrated. Nothing attaches a schedule for the preparation x gate int he EF case.

The fine drag test fails also because the calibration experiment again only attaches the calibration for the gate under test. For the x calibration, the sx gate is also used.

Both tests check for the presence of multiple calibrations. EF wants to find an x calibration and an x12 calibration. The drag test wants to find both x and sx.

What is the expected behavior?

The tests need to pass. The simplest approach is to attach all the needed calibrations from Calibrations. We may want to allow flexibility here -- a user could want to calibration x12 while just using the default x.

Suggested solutions

A quick fix would be to use the knowledge of the experiments to update their _attach_calibrations methods accordingly. I think we should also consider if we could go back to calling transpile with just some custom transpile options (like routhing_method="none") rather than using a custom pass manager.

@wshanks
Copy link
Contributor Author

wshanks commented May 4, 2023

Closed by #1160, but we can still consider the transpiler pass to add more flexibility.

@wshanks wshanks closed this as completed May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant