From 05d7487968ab937410dca716222aaae80ed6fecc Mon Sep 17 00:00:00 2001 From: Will Shanks Date: Tue, 5 Nov 2024 01:39:03 -0500 Subject: [PATCH] Handle test incompatibilities with Qiskit 1.3 (#1478) These changes should get the daily test run against Qiskit main passing again for now. The necessary changes were: * Specify `num_qubits` for the `SingleTransmonTestBackend` target which now must match the number of qubit properties passed. * Only convert deprecation warnings to errors in the tests when the warning appears to be triggered by qiskit-experiments code. Qiskit 1.3 triggers new deprecation warnings by calling its own deprecated code internally and the Experiments tests either need to ignore those lower level warnings globally or individually each time they come up. Here they are just ignored globally. * Ignore deprecation warnings related to Qiskit Pulse. There are many of these and they need to be addressed, but there is too much work to address them, so they are ignored in favor of being to catch other errors in the tests. * Ignore some deprecated usage of Experiments code in the tests. As part of reworking which warnings are converted to errors warnings triggered by the test code are now converted to errors. Previously only warnings triggered by the `qiskit_experiments` package or deprecation warnings were converted to errors. The few new cases that were surfaced were explicitly testing deprecated functions, so those cases were ignored. * Regenerate the quantum volume expected results. Qiskit 1.3 has a reworked quantum volume function that generates different circuits than Qiskit 1.2 for a given seed number. * Modify an RB test that was checking that RB code gave an error when a target was missing a gate that the experiment wanted to interleave. The test was implemented by deleting an instruction from the target but with Qiskit 1.3 the target is less mutable, so a new target needed to be constructed without the instruction rather than deleting it from a larger target. * Ignore warnings about Qiskit Pulse and internal Qiskit deprecations in the jupyter-sphinx documentation. --- .../characterization/stark_experiment.rst | 5 + .../measurement/restless_measurements.rst | 10 ++ docs/tutorials/calibrations.rst | 5 + docs/tutorials/data_processor.rst | 5 + docs/tutorials/visualization.rst | 5 + .../library/characterization/drag.py | 5 + .../library/characterization/rabi.py | 10 ++ qiskit_experiments/test/pulse_backend.py | 1 + test/base.py | 3 +- test/curve_analysis/test_baseclass.py | 38 +++--- test/curve_analysis/test_curve_fitting.py | 128 +++++++++++------- .../qv_ideal_probabilities_qiskit_1_3.json | 1 + test/library/quantum_volume/test_qv.py | 4 +- .../test_interleaved_rb.py | 5 +- 14 files changed, 153 insertions(+), 72 deletions(-) create mode 100644 test/library/quantum_volume/qv_ideal_probabilities_qiskit_1_3.json diff --git a/docs/manuals/characterization/stark_experiment.rst b/docs/manuals/characterization/stark_experiment.rst index 68e51d353e..c1683a2879 100644 --- a/docs/manuals/characterization/stark_experiment.rst +++ b/docs/manuals/characterization/stark_experiment.rst @@ -160,6 +160,11 @@ by a variant of the Hahn-echo pulse sequence [5]_. message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) from qiskit_experiments.library import StarkRamseyXY from qiskit import schedule, pulse diff --git a/docs/manuals/measurement/restless_measurements.rst b/docs/manuals/measurement/restless_measurements.rst index 9f7e6078cf..e431c64b86 100644 --- a/docs/manuals/measurement/restless_measurements.rst +++ b/docs/manuals/measurement/restless_measurements.rst @@ -77,6 +77,16 @@ they use always starts with the qubits in the ground state. message=".*Support for restless.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) + warnings.filterwarnings( + "ignore", + message=".*QuantumCircuit.duration.*", + category=DeprecationWarning, + ) # Temporary workaround for missing support in Qiskit and qiskit-ibm-runtime from qiskit_experiments.test.patching import patch_sampler_test_support diff --git a/docs/tutorials/calibrations.rst b/docs/tutorials/calibrations.rst index 377a9dfb0c..2555d60a00 100644 --- a/docs/tutorials/calibrations.rst +++ b/docs/tutorials/calibrations.rst @@ -51,6 +51,11 @@ This automatic updating can also be disabled using the ``auto_update`` flag. message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) .. jupyter-execute:: diff --git a/docs/tutorials/data_processor.rst b/docs/tutorials/data_processor.rst index 890a1a164e..2468cecbfd 100644 --- a/docs/tutorials/data_processor.rst +++ b/docs/tutorials/data_processor.rst @@ -78,6 +78,11 @@ The code below sets up the Rabi experiment. message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) .. jupyter-execute:: diff --git a/docs/tutorials/visualization.rst b/docs/tutorials/visualization.rst index e9dd4a38c0..0be15a8775 100644 --- a/docs/tutorials/visualization.rst +++ b/docs/tutorials/visualization.rst @@ -48,6 +48,11 @@ First, we display the default figure from a :class:`.Rabi` experiment as a start message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) .. jupyter-execute:: diff --git a/qiskit_experiments/library/characterization/drag.py b/qiskit_experiments/library/characterization/drag.py index 558415a8a0..3c6c531081 100644 --- a/qiskit_experiments/library/characterization/drag.py +++ b/qiskit_experiments/library/characterization/drag.py @@ -77,6 +77,11 @@ class RoughDrag(BaseExperiment, RestlessMixin): message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) # backend from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend diff --git a/qiskit_experiments/library/characterization/rabi.py b/qiskit_experiments/library/characterization/rabi.py index 7306ce23f5..fd16a7c05b 100644 --- a/qiskit_experiments/library/characterization/rabi.py +++ b/qiskit_experiments/library/characterization/rabi.py @@ -69,6 +69,11 @@ class Rabi(BaseExperiment, RestlessMixin): message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) # backend from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend @@ -254,6 +259,11 @@ class EFRabi(Rabi): message=".*Due to the deprecation of Qiskit Pulse.*", category=DeprecationWarning, ) + warnings.filterwarnings( + "ignore", + message=".*The entire Qiskit Pulse package is being deprecated.*", + category=DeprecationWarning, + ) # backend from qiskit_experiments.test.pulse_backend import SingleTransmonTestBackend diff --git a/qiskit_experiments/test/pulse_backend.py b/qiskit_experiments/test/pulse_backend.py index adeaa835e1..5d961b0601 100644 --- a/qiskit_experiments/test/pulse_backend.py +++ b/qiskit_experiments/test/pulse_backend.py @@ -603,6 +603,7 @@ def __init__( } ) self._target = Target( + num_qubits=1, qubit_properties=[QubitProperties(frequency=qubit_frequency)], dt=self.dt, granularity=16, diff --git a/test/base.py b/test/base.py index 486de3ca06..40b66bc3a5 100644 --- a/test/base.py +++ b/test/base.py @@ -111,11 +111,11 @@ def setUpClass(cls): patch_sampler_test_support() - warnings.filterwarnings("error", category=DeprecationWarning) # Tests should not generate any warnings unless testing those # warnings. In that case, the test should catch the warning # assertWarns or warnings.catch_warnings. warnings.filterwarnings("error", module="qiskit_experiments") + warnings.filterwarnings("error", module=r"test\.") # Ideally, changes introducing pending deprecations should include # alternative code paths and not need to generate warnings in the # tests but until this exception is necessary until the use of the @@ -176,6 +176,7 @@ def setUpClass(cls): ".*qiskit.providers.models.backendproperties.BackendProperties.*", ".*qiskit.providers.fake_provider.fake_backend.FakeBackend.*", ".*qiskit.providers.backend.BackendV1.*", + ".*The entire Qiskit Pulse package is being deprecated.*", ] for msg in allow_deprecationwarning_message: warnings.filterwarnings("default", category=DeprecationWarning, message=msg) diff --git a/test/curve_analysis/test_baseclass.py b/test/curve_analysis/test_baseclass.py index 06a9d0b68c..0e03b56a67 100644 --- a/test/curve_analysis/test_baseclass.py +++ b/test/curve_analysis/test_baseclass.py @@ -13,6 +13,8 @@ # pylint: disable=invalid-name """Test curve fitting base class.""" +import warnings + from test.base import QiskitExperimentsTestCase from test.fake_experiment import FakeExperiment @@ -139,22 +141,26 @@ def test_data_extraction(self): }, ) - curve_data = analysis._run_data_processing(raw_data=expdata1.data() + expdata2.data()) - self.assertListEqual(curve_data.labels, ["s1", "s2"]) - - # check data of series1 - sub1 = curve_data.get_subset_of("s1") - self.assertListEqual(sub1.labels, ["s1"]) - np.testing.assert_array_equal(sub1.x, x) - np.testing.assert_array_almost_equal(sub1.y, y1, decimal=3) - np.testing.assert_array_equal(sub1.data_allocation, np.full(x.size, 0)) - - # check data of series2 - sub2 = curve_data.get_subset_of("s2") - self.assertListEqual(sub2.labels, ["s2"]) - np.testing.assert_array_equal(sub2.x, x) - np.testing.assert_array_almost_equal(sub2.y, y2, decimal=3) - np.testing.assert_array_equal(sub2.data_allocation, np.full(x.size, 1)) + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message=".*ScatterTable.labels.*") + warnings.filterwarnings("ignore", message=".*ScatterTable.get_subset_of.*") + warnings.filterwarnings("ignore", message=".*ScatterTable.data_allocation.*") + curve_data = analysis._run_data_processing(raw_data=expdata1.data() + expdata2.data()) + self.assertListEqual(curve_data.labels, ["s1", "s2"]) + + # check data of series1 + sub1 = curve_data.get_subset_of("s1") + self.assertListEqual(sub1.labels, ["s1"]) + np.testing.assert_array_equal(sub1.x, x) + np.testing.assert_array_almost_equal(sub1.y, y1, decimal=3) + np.testing.assert_array_equal(sub1.data_allocation, np.full(x.size, 0)) + + # check data of series2 + sub2 = curve_data.get_subset_of("s2") + self.assertListEqual(sub2.labels, ["s2"]) + np.testing.assert_array_equal(sub2.x, x) + np.testing.assert_array_almost_equal(sub2.y, y2, decimal=3) + np.testing.assert_array_equal(sub2.data_allocation, np.full(x.size, 1)) def test_create_result(self): """A testcase for creating analysis result data from fit data.""" diff --git a/test/curve_analysis/test_curve_fitting.py b/test/curve_analysis/test_curve_fitting.py index 937cd65b95..d58382bb5c 100644 --- a/test/curve_analysis/test_curve_fitting.py +++ b/test/curve_analysis/test_curve_fitting.py @@ -11,6 +11,8 @@ # that they have been altered from the originals. """Test version string generation.""" +import warnings + from test.base import QiskitExperimentsTestCase import numpy as np @@ -88,55 +90,77 @@ def test_process_curve_data(self): def test_mean_xy_data(self): """Test mean_xy_data function""" # pylint: disable=unbalanced-tuple-unpacking - x = np.array([1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 5, 5, 5, 5]) - y = np.array([1, 2, 3, 8, 10, 50, 60, 10, 11, 17, 10, 10, 10, 10]) - x_mean, y_mean, y_sigma, _ = mean_xy_data(x, y, method="sample") - - expected_x_mean = np.array([1, 2, 3, 4, 5]) - expected_y_mean = np.array([2, 32, 10.5, 17, 10]) - expected_y_sigma = np.sqrt(np.array([2 / 9, 542 / 4, 0.25 / 2, 0, 0])) - self.assertTrue(np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}") - self.assertTrue(np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}") - self.assertTrue( - np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" - ) - - sigma = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) - x_mean, y_mean, y_sigma, _ = mean_xy_data(x, y, sigma, method="iwv") - expected_y_mean = np.array([1.34693878, 23.31590234, 10.44137931, 17.0, 10.0]) - expected_y_sigma = np.array([0.85714286, 2.57610543, 5.97927455, 10.0, 6.17470935]) - self.assertTrue(np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}") - self.assertTrue(np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}") - self.assertTrue( - np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" - ) - - sigma = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) - shots = np.array([10, 20, 10, 30, 20, 10, 40, 10, 10, 20, 30, 20, 30, 10]) - x_mean, y_mean, y_sigma, y_shots = mean_xy_data(x, y, sigma, shots, method="shots_weighted") - expected_y_mean = np.array([2.0, 33.4, 10.5, 17.0, 10.0]) - expected_y_sigma = np.array([1.27475488, 3.26190129, 6.02079729, 10.0, 6.46166282]) - expected_y_shots = np.array([40, 100, 20, 20, 90]) - self.assertTrue(np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}") - self.assertTrue(np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}") - self.assertTrue( - np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" - ) - self.assertTrue( - np.allclose(expected_y_shots, y_shots), msg=f"{y_shots} != {expected_y_shots}" - ) - - x = np.array([1, 1, 1, 1, 2, 2, 2, 2]) - y = np.array([2, 6, 100, 200, 17, 50, 60, 70]) - series = np.array([0, 0, 1, 1, 0, 1, 1, 1]) - series, x_mean, y_mean, y_sigma, _ = multi_mean_xy_data(series, x, y, method="sample") - expected_x_mean = np.array([1, 2, 1, 2]) - expected_y_mean = np.array([4, 17, 150, 60]) - expected_y_sigma = np.sqrt(np.array([4.0 / 2, 0.0 / 1, 2500.0 / 2, 66.66666667 / 3])) - expected_series = np.array([0, 0, 1, 1]) - self.assertTrue(np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}") - self.assertTrue(np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}") - self.assertTrue( - np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" - ) - self.assertTrue(np.allclose(expected_series, series), msg=f"{series} != {expected_series}") + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", message=".*mean_xy_data.*") + x = np.array([1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 5, 5, 5, 5]) + y = np.array([1, 2, 3, 8, 10, 50, 60, 10, 11, 17, 10, 10, 10, 10]) + x_mean, y_mean, y_sigma, _ = mean_xy_data(x, y, method="sample") + + expected_x_mean = np.array([1, 2, 3, 4, 5]) + expected_y_mean = np.array([2, 32, 10.5, 17, 10]) + expected_y_sigma = np.sqrt(np.array([2 / 9, 542 / 4, 0.25 / 2, 0, 0])) + self.assertTrue( + np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}" + ) + self.assertTrue( + np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}" + ) + self.assertTrue( + np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" + ) + + sigma = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) + x_mean, y_mean, y_sigma, _ = mean_xy_data(x, y, sigma, method="iwv") + expected_y_mean = np.array([1.34693878, 23.31590234, 10.44137931, 17.0, 10.0]) + expected_y_sigma = np.array([0.85714286, 2.57610543, 5.97927455, 10.0, 6.17470935]) + self.assertTrue( + np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}" + ) + self.assertTrue( + np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}" + ) + self.assertTrue( + np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" + ) + + sigma = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) + shots = np.array([10, 20, 10, 30, 20, 10, 40, 10, 10, 20, 30, 20, 30, 10]) + x_mean, y_mean, y_sigma, y_shots = mean_xy_data( + x, y, sigma, shots, method="shots_weighted" + ) + expected_y_mean = np.array([2.0, 33.4, 10.5, 17.0, 10.0]) + expected_y_sigma = np.array([1.27475488, 3.26190129, 6.02079729, 10.0, 6.46166282]) + expected_y_shots = np.array([40, 100, 20, 20, 90]) + self.assertTrue( + np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}" + ) + self.assertTrue( + np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}" + ) + self.assertTrue( + np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" + ) + self.assertTrue( + np.allclose(expected_y_shots, y_shots), msg=f"{y_shots} != {expected_y_shots}" + ) + + x = np.array([1, 1, 1, 1, 2, 2, 2, 2]) + y = np.array([2, 6, 100, 200, 17, 50, 60, 70]) + series = np.array([0, 0, 1, 1, 0, 1, 1, 1]) + series, x_mean, y_mean, y_sigma, _ = multi_mean_xy_data(series, x, y, method="sample") + expected_x_mean = np.array([1, 2, 1, 2]) + expected_y_mean = np.array([4, 17, 150, 60]) + expected_y_sigma = np.sqrt(np.array([4.0 / 2, 0.0 / 1, 2500.0 / 2, 66.66666667 / 3])) + expected_series = np.array([0, 0, 1, 1]) + self.assertTrue( + np.allclose(expected_x_mean, x_mean), msg=f"{x_mean} != {expected_x_mean}" + ) + self.assertTrue( + np.allclose(expected_y_mean, y_mean), msg=f"{y_mean} != {expected_y_mean}" + ) + self.assertTrue( + np.allclose(expected_y_sigma, y_sigma), msg=f"{y_sigma} != {expected_y_sigma}" + ) + self.assertTrue( + np.allclose(expected_series, series), msg=f"{series} != {expected_series}" + ) diff --git a/test/library/quantum_volume/qv_ideal_probabilities_qiskit_1_3.json b/test/library/quantum_volume/qv_ideal_probabilities_qiskit_1_3.json new file mode 100644 index 0000000000..e91ff76f23 --- /dev/null +++ b/test/library/quantum_volume/qv_ideal_probabilities_qiskit_1_3.json @@ -0,0 +1 @@ +[[0.016967836206746738, 0.11989893254007651, 0.00394654461853002, 0.13589528784677357, 0.20511482048008703, 0.0816791691977386, 0.14060546401643623, 0.2958919450936116], [0.12056007843940977, 0.10070988761274678, 0.41332860589623954, 0.07543734133716322, 0.021096066850169303, 0.1601488559241172, 0.03780114546996992, 0.0709180184701846], [0.10058394660184918, 0.39126225007098714, 0.09012977139125049, 0.02982028558144569, 0.005523508253283623, 0.040983681969626276, 0.2946239196681466, 0.04707263646341052], [0.3688522014926478, 0.09580420366241688, 0.027757018918742504, 0.15826915582072928, 0.13834528025457885, 0.11281057034461814, 0.04713950685498301, 0.05102206265128345], [0.2238855389562393, 0.0177775881962427, 0.0010361793224677451, 0.49743548639570334, 0.14345035837415962, 0.010983952529157095, 0.030086371572847458, 0.07534452465318305], [0.07191730758022169, 0.08577798556935443, 0.05222185324072163, 0.011505080428938406, 0.1506083560400655, 0.07947214515779061, 0.06954659702813472, 0.4789506749547722], [0.02933798117949475, 0.0905804630987942, 0.13414073913728367, 0.3283400904287246, 0.0039327427715444745, 0.06305126971619468, 0.07960132612718543, 0.27101538754077775], [0.10361935285611489, 0.5602661574454084, 0.0033379483277632236, 0.024104300671844853, 0.11180012107386983, 0.018590174540476845, 0.06496224115302754, 0.11331970393149465], [0.28002251748562146, 0.15659108128101512, 0.06931560231414717, 0.015939512694748054, 0.20272160865971692, 0.06437155774108827, 0.17997014329975955, 0.031067976523903224], [0.2583110429786593, 0.39280733849970395, 0.01004465642965845, 0.10112365839530935, 0.04820792916847759, 0.019172100821762683, 0.07396094843817139, 0.09637232526825651], [0.04205005835070806, 0.5982838080237505, 0.24825488091343656, 0.11141125271210575, 0.0, 0.0, 0.0, 0.0], [0.21631173866223324, 0.07201585886194255, 0.19647582952426423, 0.10741584491273042, 0.054982878753641044, 0.021165794683348307, 0.2526914377956466, 0.07894061680619284], [0.04109901108305593, 0.5346418163425509, 0.0, 0.0, 0.19988603142757153, 0.22437314114682205, 0.0, 0.0], [0.1069722912636189, 0.19610594120528163, 0.13827775538043613, 0.12862292833267164, 0.05652810658633324, 0.0979666878234763, 0.15917488848657904, 0.1163514009216026], [0.1599264302659344, 0.32405634292478286, 0.050423144948197246, 0.03657193295081257, 0.13405197214337658, 0.1872187743627101, 0.0005017400591434017, 0.1072496623450432], [0.057428879095657914, 0.07553302531949552, 0.05869499440092844, 0.031696849711854186, 0.20158700775693938, 0.20118430243224272, 0.02391580078822289, 0.34995914049465865], [0.12733557958689173, 0.08478618874152216, 0.032857670388396855, 0.08627573094283553, 0.18807352626751228, 0.2365561765088683, 0.15519965863714033, 0.08891546892683337], [0.05434853562358783, 0.1282198611011262, 0.11416220587356729, 0.049568640406240184, 0.1511891111128068, 0.14032078289874864, 0.3087935419191839, 0.05339732106473909], [0.06135629616886566, 0.25774569674205117, 0.0464794921453153, 0.15917144757251409, 0.1677568850176423, 0.18787259587234334, 0.05248811617198047, 0.0671294703092877], [0.005879541314725802, 0.025021402090856428, 0.44431583322312285, 0.05198340090748109, 0.04211534913258567, 0.013297849871047806, 0.26003956333041356, 0.15734706012976746]] diff --git a/test/library/quantum_volume/test_qv.py b/test/library/quantum_volume/test_qv.py index 1906350527..7d6d0e24a1 100644 --- a/test/library/quantum_volume/test_qv.py +++ b/test/library/quantum_volume/test_qv.py @@ -89,7 +89,9 @@ def test_qv_ideal_probabilities(self): ) # compare to pre-calculated probabilities dir_name = os.path.dirname(os.path.abspath(__file__)) - if version_is_at_least("qiskit", 1.1): + if version_is_at_least("qiskit", 1.3): + probabilities_json_file = "qv_ideal_probabilities_qiskit_1_3.json" + elif version_is_at_least("qiskit", 1.1): probabilities_json_file = "qv_ideal_probabilities_qiskit_1_1.json" else: probabilities_json_file = "qv_ideal_probabilities.json" diff --git a/test/library/randomized_benchmarking/test_interleaved_rb.py b/test/library/randomized_benchmarking/test_interleaved_rb.py index 58f2eecf22..c64671666b 100644 --- a/test/library/randomized_benchmarking/test_interleaved_rb.py +++ b/test/library/randomized_benchmarking/test_interleaved_rb.py @@ -20,6 +20,7 @@ from qiskit.circuit import Delay, QuantumCircuit, Parameter, Gate from qiskit.circuit.library import SXGate, CXGate, TGate, CZGate from qiskit.exceptions import QiskitError +from qiskit.providers.fake_provider import GenericBackendV2 from qiskit.transpiler import InstructionProperties from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel, depolarizing_error @@ -268,14 +269,14 @@ def test_interleaved_circuit_is_decomposed(self): def test_interleaving_cnot_gate_with_non_supported_direction(self): """Test if fails to interleave cx(1, 2) for backend that support only cx(2, 1).""" - del self.backend.target["cx"][(1, 2)] # make support only cx(2, 1) + backend = GenericBackendV2(3, coupling_map=[[0, 1], [2, 1]]) exp = rb.InterleavedRB( interleaved_element=CXGate(), physical_qubits=(1, 2), lengths=[3], num_samples=4, - backend=self.backend, + backend=backend, seed=1234, ) with self.assertRaises(QiskitError):