-
Notifications
You must be signed in to change notification settings - Fork 127
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
@@ -33,7 +34,7 @@ | |||
AnalysisStatus, | |||
) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good for now. I noticed our FakeJob
is implemented differently from the removed FakeJob
and also from current Job
s. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
LGTM!
This change adjusts for several remaining changes in Qiskit 1.0:
qiskit.providers.basicaer was removed in Qiskit 1.0 (see Rename
BasicAer
toBasicProvider
and refactor interface to followBackendV2
Qiskit/qiskit#11422). Here its use is replaced with qiskit-aer.qiskit.providers.fake_provider.FakeJob
was removed in Qiskit 1.0 (see Remove provider-specific fake backends,FakeProvider
class and related tools in 1.0 Qiskit/qiskit#11376). Here theFakeJob
already inqiskit_experiments.test
is used instead. This update was missed in f22bb7b which switched the otherfake_provider
usage.Replace
qiskit.provider.FakeProvider
with a custom subclass ofProviderV1
.FakeProvider
was moved out of Qiskit 1.0 to qiskit-ibm-runtime.calibration/test_rabi.py
was 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_histogram
was exchanged for one ofplot_distribution
.Guard
FakeBackendV2
import that was removed in Qiskit 1.0. Try to importFakeBackendV2
from 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.