Remove remaining code usage deprecated in Qiskit 0.46#1384
Conversation
|
@coruscating This fixes the tests against Qiskit main which I noticed had started failing again. |
| # Change rotation angle with square root of amplitude so that | ||
| # population versus amplitude will not be sinusoidal and the fit will | ||
| # be bad. | ||
| thetas = np.sqrt(np.linspace(0.0, 4 * np.pi**2, 31)) |
There was a problem hiding this comment.
It seemed like this test chose somewhat arbitrary input data to be "bad" but changing simulators made it start fitting as good again. I made the data worse so that it should more reliably fit as bad.
qiskit.providers.basicaer was removed in Qiskit 1.0. See Qiskit/qiskit#11422
There was a problem hiding this comment.
This works with Qiskit 0.46, but FakeBackendV2 has also been removed in 1.0 (the code is still there but the import path is gone). I think this import was probably meant to be updated in #1369:
| ) | ||
| from qiskit_experiments.test.fake_backend import FakeBackend | ||
| from qiskit_experiments.database_service import Qubit | ||
| from qiskit_experiments.test.utils import FakeJob |
There was a problem hiding this comment.
This is good for now. I noticed our FakeJob is implemented differently from the removed FakeJob and also from current Jobs. For example, the qiskit-ibm-runtime Job doesn't have time_per_step() implemented currently. If we're using our own FakeJob going forward, we should make sure it matches the external specs.
There was a problem hiding this comment.
That sounds good. If possible, I would like to see us push more for external specs. The Qiskit base classes are minimal and we rely on a lot of private attributes of the provider classes in a way that seems very brittle.
6558622 to
632f793
Compare
I added a change for it. I think the cron tests will still fail because we need qiskit-ibm-runtime which still depends on qiskit-ibm-provider in its latest release and qiskit-ibm-provider is not compatible with qiskit 1.0. If we don't want to wait for qiskit-ibm-runtime, we might need to fork it, patch out the qiskit-ibm-provider part (sloppily since we just need the fake backends), and install from the fork until qiskit-ibm-runtime can properly remove the qiskit-ibm-provider parts. I think we should deprecate |
This change adjusts for several remaining changes in Qiskit 1.0:
qiskit.providers.basicaer was removed in Qiskit 1.0 (see Rename
BasicAertoBasicProviderand refactor interface to followBackendV2Qiskit/qiskit#11422). Here its use is replaced with qiskit-aer.qiskit.providers.fake_provider.FakeJobwas removed in Qiskit 1.0 (see Remove provider-specific fake backends,FakeProviderclass and related tools in 1.0 Qiskit/qiskit#11376). Here theFakeJobalready inqiskit_experiments.testis used instead. This update was missed in f22bb7b which switched the otherfake_providerusage.Replace
qiskit.provider.FakeProviderwith a custom subclass ofProviderV1.FakeProviderwas moved out of Qiskit 1.0 to qiskit-ibm-runtime.calibration/test_rabi.pywas modified to make the data for a test of bad data worse as the test started fitting the data as good with the original parameters and qiskit-aer in place of basicaer.In the readout mitigation manual, a use of
plot_histogramwas exchanged for one ofplot_distribution.Guard
FakeBackendV2import that was removed in Qiskit 1.0. Try to importFakeBackendV2from qiskit-ibm-runtime as well.Also, this change unpins qiskit which had to be pinned in f22bb7b until these fixes could be merged since 0.46.0 was released with deprecation warnings for some of the usage changed here.