From 6837e4cf36c98c54222cd29b8dd7843096831303 Mon Sep 17 00:00:00 2001 From: Helena Zhang Date: Tue, 13 Aug 2024 14:52:16 -0400 Subject: [PATCH] Cherry pick #1465 and #1467 (#1468) Co-authored-by: Naoki Kanazawa --- .github/ISSUE_TEMPLATE/NEW_EXPERIMENT.md | 6 +- .github/workflows/cron-staging.yml | 4 +- .github/workflows/docs_dev.yml | 2 +- .github/workflows/docs_release.yml | 2 +- .github/workflows/docs_stable.yml | 2 +- .github/workflows/main.yml | 6 +- .github/workflows/neko.yml | 2 +- CONTRIBUTING.md | 20 ++-- README.md | 12 +- docs/GUIDELINES.md | 8 +- docs/_ext/autoref.py | 2 +- docs/conf.py | 4 +- docs/howtos/index.rst | 2 +- docs/index.rst | 4 +- .../characterization/stark_experiment.rst | 6 +- docs/release_notes.rst | 26 ++--- docs/tutorials/getting_started.rst | 4 +- .../randomized_benchmarking/clifford_utils.py | 9 +- .../0.7/fix-ecr-epg-59c8db98494966b0.yaml | 2 +- setup.py | 8 +- test/framework/test_backend_timing.py | 99 +++++++--------- .../test_cross_resonance_hamiltonian.py | 106 ++++++------------ .../characterization/test_half_angle.py | 4 +- .../test_interleaved_rb.py | 19 ++-- tox.ini | 2 +- 25 files changed, 151 insertions(+), 210 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/NEW_EXPERIMENT.md b/.github/ISSUE_TEMPLATE/NEW_EXPERIMENT.md index 73a2e11e33..cd44168171 100644 --- a/.github/ISSUE_TEMPLATE/NEW_EXPERIMENT.md +++ b/.github/ISSUE_TEMPLATE/NEW_EXPERIMENT.md @@ -85,9 +85,9 @@ different qubits. Verify this also on a real device experiment data is displayed correctly in the results DB webpage - [ ] Add unit testing for the experiment and analysis classes. If needed implement a mock-backend for your experiment Include in your testing running the experiment in the context of `ParallelExperiment` -- [ ] Write API docs for all your API methods. Follow the guideline [here](https://github.com/Qiskit-Extensions/qiskit-experiments/blob/main/CONTRIBUTING.md) -- [ ] Write a user guide for your experiment. Follow the guideline [here](https://github.com/Qiskit-Extensions/qiskit-experiments/blob/main/docs/GUIDELINES.md) -- [ ] Add a new release note. Follow the guideline [here](https://github.com/Qiskit-Extensions/qiskit-experiments/blob/main/CONTRIBUTING.md#adding-a-new-release-note) +- [ ] Write API docs for all your API methods. Follow the guideline [here](https://github.com/Qiskit-Community/qiskit-experiments/blob/main/CONTRIBUTING.md) +- [ ] Write a user guide for your experiment. Follow the guideline [here](https://github.com/Qiskit-Community/qiskit-experiments/blob/main/docs/GUIDELINES.md) +- [ ] Add a new release note. Follow the guideline [here](https://github.com/Qiskit-Community/qiskit-experiments/blob/main/CONTRIBUTING.md#adding-a-new-release-note) - [ ] Ask for a final review for the implementation, documentation and testing - [ ] Celebrate! diff --git a/.github/workflows/cron-staging.yml b/.github/workflows/cron-staging.yml index 0f9c667bc3..4b7a82ea61 100644 --- a/.github/workflows/cron-staging.yml +++ b/.github/workflows/cron-staging.yml @@ -6,7 +6,7 @@ on: jobs: qiskit-main-tests: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' name: tests-python${{ matrix.python-version }}-${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -46,7 +46,7 @@ jobs: env: TEST_TIMEOUT: 120 docs: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' name: docs runs-on: ubuntu-latest steps: diff --git a/.github/workflows/docs_dev.yml b/.github/workflows/docs_dev.yml index a2f0d03b50..5a9851ebfc 100644 --- a/.github/workflows/docs_dev.yml +++ b/.github/workflows/docs_dev.yml @@ -6,7 +6,7 @@ on: jobs: deploy: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/docs_release.yml b/.github/workflows/docs_release.yml index 38e517b057..d8680bf56d 100644 --- a/.github/workflows/docs_release.yml +++ b/.github/workflows/docs_release.yml @@ -7,7 +7,7 @@ on: jobs: deploy: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/docs_stable.yml b/.github/workflows/docs_stable.yml index fa32b8c42c..966e261025 100644 --- a/.github/workflows/docs_stable.yml +++ b/.github/workflows/docs_stable.yml @@ -7,7 +7,7 @@ on: jobs: deploy: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0e660d004b..63009e687c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,7 +11,7 @@ concurrency: cancel-in-progress: true jobs: tests: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' name: tests-python${{ matrix.python-version }}-${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -62,7 +62,7 @@ jobs: run: stestr history remove all lint: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' name: lint runs-on: ubuntu-latest steps: @@ -81,7 +81,7 @@ jobs: - name: Run lint run: tox -elint docs: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' name: docs runs-on: ubuntu-latest steps: diff --git a/.github/workflows/neko.yml b/.github/workflows/neko.yml index c4f3736139..d886e8e79f 100644 --- a/.github/workflows/neko.yml +++ b/.github/workflows/neko.yml @@ -8,7 +8,7 @@ concurrency: cancel-in-progress: true jobs: neko: - if: github.repository_owner == 'Qiskit-Extensions' + if: github.repository_owner == 'Qiskit-Community' name: Qiskit Neko Integration Tests runs-on: ubuntu-latest steps: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a35679c5b..3b174680da 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -38,7 +38,7 @@ experimentalist community. If there is an experiment you would like to see added, you can propose it by creating a [new experiment proposal -issue](https://github.com/Qiskit-Extensions/qiskit-experiments/issues/new?assignees=&labels=enhancement&template=NEW_EXPERIMENT.md&title=) +issue](https://github.com/Qiskit-Community/qiskit-experiments/issues/new?assignees=&labels=enhancement&template=NEW_EXPERIMENT.md&title=) in GitHub. The issue template will ask you to fill in details about the experiment type, protocol, analysis, and implementation, which will give us the necessary information to decide whether the experiment is feasible to implement and useful to include in our @@ -49,12 +49,12 @@ We use the following labels to help non-maintainers find issues best suited to t interests and experience level: * [good first - issue](https://github.com/Qiskit-Extensions/qiskit-experiments/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) + issue](https://github.com/Qiskit-Community/qiskit-experiments/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) - these issues are typically the simplest available to work on, perfect for newcomers. They should already be fully scoped, with a clear approach outlined in the descriptions. * [help - wanted](https://github.com/Qiskit-Extensions/qiskit-experiments/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) + wanted](https://github.com/Qiskit-Community/qiskit-experiments/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) - these issues are generally more complex than good first issues. They typically cover work that core maintainers don't currently have capacity to implement and may require more investigation/discussion. These are a great option for experienced contributors @@ -275,7 +275,7 @@ deprecations: Note that we are using subsections within the `features`, `upgrade`, and `fixes` sections to organize the notes by functional area. We strongly encourage you to file your note under the most appropriate category. You can see the current list of categories in -[release_notes/config.yaml](https://github.com/Qiskit-Extensions/qiskit-experiments/blob/main/releasenotes/config.yaml). +[release_notes/config.yaml](https://github.com/Qiskit-Community/qiskit-experiments/blob/main/releasenotes/config.yaml). You can use any restructured text feature in them (code sections, tables, enumerated lists, bulleted list, etc.) to express what is being changed as needed. In general, you @@ -296,7 +296,7 @@ example you would write a release note with a link to issue 12345 as: fixes: - | Fixed a race condition in the function ``foo()``. Refer to - `#12345 ` for more + `#12345 ` for more details. ``` @@ -317,11 +317,11 @@ tagged): At release time, ``reno report`` is used to generate the release notes for the release, and the output will be submitted as a pull request to the documentation repository's [release notes file]( -https://github.com/Qiskit-Extensions/qiskit-experiments/blob/main/docs/release_notes.rst). +https://github.com/Qiskit-Community/qiskit-experiments/blob/main/docs/release_notes.rst). ### Documentation -The [Qiskit Experiments documentation](https://qiskit-extensions.github.io/qiskit-experiments) is +The [Qiskit Experiments documentation](https://qiskit-community.github.io/qiskit-experiments) is rendered from `.rst` files as well as experiment and analysis class docstrings into HTML files. @@ -329,7 +329,7 @@ files. Any change that would affect existing documentation, or a new feature that requires a documentation, should be updated correspondingly. Before updating, review the [existing -documentation](https://qiskit-extensions.github.io/qiskit-experiments) for their style and +documentation](https://qiskit-community.github.io/qiskit-experiments) for their style and content, and read the [documentation guidelines](docs/GUIDELINES.md) for further details. @@ -355,7 +355,7 @@ will remove Sphinx's cache. If you are still having issues, try adding `-r` your e.g. `tox -e docs -r`. `-r` tells Tox to reinstall the dependencies. If you encounter a build error involving `config-inited`, you need to be in the root of the qiskit-experiments git repository then run `git remote add upstream -https://github.com/Qiskit-Extensions/qiskit-experiments` and `git fetch upstream` before building. +https://github.com/Qiskit-Community/qiskit-experiments` and `git fetch upstream` before building. There are a few other build options available: @@ -440,7 +440,7 @@ policy](https://github.com/Qiskit/qiskit/blob/1.0.0rc1/DEPRECATION.md#issuing-de The development cycle for Qiskit Experiments is all handled in the open using project boards in GitHub for project management. We use -[milestones](https://github.com/Qiskit-Extensions/qiskit-experiments/milestones) in GitHub to track +[milestones](https://github.com/Qiskit-Community/qiskit-experiments/milestones) in GitHub to track work for specific releases. Features or other changes that we want to include in a release will be tagged and discussed in GitHub. diff --git a/README.md b/README.md index 1db2dcd42d..70f16dd996 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Qiskit Experiments -[![License](https://img.shields.io/github/license/Qiskit-Extensions/qiskit-experiments.svg)](https://opensource.org/licenses/Apache-2.0) -[![Release](https://img.shields.io/github/release/Qiskit-Extensions/qiskit-experiments.svg)](https://github.com/Qiskit-Extensions/qiskit-experiments/releases) +[![License](https://img.shields.io/github/license/Qiskit-Community/qiskit-experiments.svg)](https://opensource.org/licenses/Apache-2.0) +[![Release](https://img.shields.io/github/release/Qiskit-Community/qiskit-experiments.svg)](https://github.com/Qiskit-Community/qiskit-experiments/releases) ![Python](https://img.shields.io/pypi/pyversions/qiskit-experiments.svg) [![DOI](https://joss.theoj.org/papers/10.21105/joss.05329/status.svg)](https://doi.org/10.21105/joss.05329) @@ -9,9 +9,9 @@ and analyzing experiments on noisy quantum computers using Qiskit. To learn more about the package, you can see the -[most up-to-date documentation](https://qiskit-extensions.github.io/qiskit-experiments/dev) +[most up-to-date documentation](https://qiskit-community.github.io/qiskit-experiments/dev) corresponding to the main branch of this repository or the -[documentation for the latest stable release](https://qiskit-extensions.github.io/qiskit-experiments). +[documentation for the latest stable release](https://qiskit-community.github.io/qiskit-experiments). ## Contribution Guidelines @@ -20,7 +20,7 @@ If you'd like to contribute to Qiskit Experiments, please take a look at our [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. -We use [GitHub issues](https://github.com/Qiskit-Extensions/qiskit-experiments/issues) for +We use [GitHub issues](https://github.com/Qiskit-Community/qiskit-experiments/issues) for tracking requests and bugs. Please [join the Qiskit Slack community](https://qisk.it/join-slack) and use the [#experiments](https://qiskit.slack.com/archives/CGZDF48EN) channel for discussion and @@ -30,7 +30,7 @@ For questions that are more suited for a forum we use the Qiskit tag in ## Authors and Citation -Qiskit Experiments is the work of [many people](https://github.com/Qiskit-Extensions/qiskit-experiments/graphs/contributors) who contribute +Qiskit Experiments is the work of [many people](https://github.com/Qiskit-Community/qiskit-experiments/graphs/contributors) who contribute to the project at different levels. If you use Qiskit Experiments, please cite our [paper](https://doi.org/10.21105/joss.05329) as per the included [citation file](CITATION.cff). diff --git a/docs/GUIDELINES.md b/docs/GUIDELINES.md index 282e013646..293539d6ee 100644 --- a/docs/GUIDELINES.md +++ b/docs/GUIDELINES.md @@ -162,7 +162,7 @@ example and example outputs by printing relevant analysis results and plot figur Required and common parameters, such as experiment and analysis options, should be covered. -See the [Randomized Benchmarking](https://qiskit-extensions.github.io/qiskit-experiments/manuals/verification/randomized_benchmarking.html) +See the [Randomized Benchmarking](https://qiskit-community.github.io/qiskit-experiments/manuals/verification/randomized_benchmarking.html) guide and its [source code](manuals/verification/randomized_benchmarking.rst) for an example. Here is a simple template for a manual: @@ -276,7 +276,7 @@ There are several predefined sections for the class docstring. For referring to the website, - .. ref_website:: Qiskit Experiment GitHub, https://github.com/Qiskit-Extensions/qiskit-experiments + .. ref_website:: Qiskit Experiment GitHub, https://github.com/Qiskit-Community/qiskit-experiments you can use the above macro, where you can provide a string for the hyperlink and the destination location separated by single comma. @@ -380,9 +380,9 @@ header should be named `Analysis Options` to be parsed correctly. After you complete documentation of your classes, you must add documentation to the toctree so that it can be rendered as the API documentation. In Qiskit Experiments, we have a separate tables of contents for each experiment module (e.g. [characterization -experiments](https://qiskit-extensions.github.io/qiskit-experiments/apidocs/mod_characterization.html)) +experiments](https://qiskit-community.github.io/qiskit-experiments/apidocs/mod_characterization.html)) and for the [entire -library](https://qiskit-extensions.github.io/qiskit-experiments/apidocs/library.html). Thus we +library](https://qiskit-community.github.io/qiskit-experiments/apidocs/library.html). Thus we should add document to the tree of a particular module and then reference it to the entire module. diff --git a/docs/_ext/autoref.py b/docs/_ext/autoref.py index 15606221fe..b4f820a1c6 100644 --- a/docs/_ext/autoref.py +++ b/docs/_ext/autoref.py @@ -27,7 +27,7 @@ class WebSite(Directive): .. code-block:: - .. ref_website:: qiskit-experiments, https://github.com/Qiskit-Extensions/qiskit-experiments + .. ref_website:: qiskit-experiments, https://github.com/Qiskit-Community/qiskit-experiments """ diff --git a/docs/conf.py b/docs/conf.py index 27d4ba580d..151ffb9e72 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -165,7 +165,7 @@ "uncertainties": ("https://pythonhosted.org/uncertainties", None), "pandas": ("http://pandas.pydata.org/docs/", None), "qiskit_aer": ("https://qiskit.github.io/qiskit-aer/", None), - "qiskit_dynamics": ("https://qiskit-extensions.github.io/qiskit-dynamics/", None), + "qiskit_dynamics": ("https://qiskit-community.github.io/qiskit-dynamics/", None), "qiskit_ibm_runtime": ("https://docs.quantum.ibm.com/api/qiskit-ibm-runtime/", None), } @@ -176,7 +176,7 @@ rst_prolog = """ .. note:: This is the documentation for the current state of the `development branch - `_ + `_ of Qiskit Experiments. The documentation or APIs here can change prior to being released. """ diff --git a/docs/howtos/index.rst b/docs/howtos/index.rst index 1716563c80..8759b44ab1 100644 --- a/docs/howtos/index.rst +++ b/docs/howtos/index.rst @@ -15,7 +15,7 @@ familiarize with :ref:`the basics ` of the package before using these gu | If there are guides on solving specific problems that you'd like to see added, please -`file an issue on GitHub `_. +`file an issue on GitHub `_. | diff --git a/docs/index.rst b/docs/index.rst index 77020e517c..707ec39b50 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -102,8 +102,8 @@ We've divided up the documentation into four sections with different purposes: manuals/index apidocs/index release_notes - GitHub - Development Branch Docs + GitHub + Development Branch Docs | diff --git a/docs/manuals/characterization/stark_experiment.rst b/docs/manuals/characterization/stark_experiment.rst index f34c83b981..fd4f11fbda 100644 --- a/docs/manuals/characterization/stark_experiment.rst +++ b/docs/manuals/characterization/stark_experiment.rst @@ -147,10 +147,10 @@ by a variant of the Hahn-echo pulse sequence [5]_. from qiskit_experiments.library import StarkRamseyXY from qiskit import schedule, pulse - from qiskit_ibm_runtime.fake_provider import FakeHanoi + from qiskit_ibm_runtime.fake_provider import FakeHanoiV2 from qiskit.visualization.pulse_v2 import IQXSimple - backend = FakeHanoi() + backend = FakeHanoiV2() exp = StarkRamseyXY( physical_qubits=[0], backend=backend, @@ -169,7 +169,7 @@ by a variant of the Hahn-echo pulse sequence [5]_. "formatter.label_offset.pulse_name": 0.1, "formatter.text_size.annotate": 14, } - ram_x_schedule.draw(time_range=(0, 1600), style=IQXSimple(**opt), backend=backend) + ram_x_schedule.draw(time_range=(0, 1600), style=IQXSimple(**opt)) The qubit is initialized in the :math:`Y`-eigenstate with the first half-pi pulse. This state may be visualized by a Bloch vector located on the equator of the Bloch sphere, diff --git a/docs/release_notes.rst b/docs/release_notes.rst index 87575aad81..63e04cdb38 100644 --- a/docs/release_notes.rst +++ b/docs/release_notes.rst @@ -30,7 +30,7 @@ Bug Fixes :mod:`qiskit_dynamics` version 0.5.0. The updates accounted for changes in the expected arguments to Dynamics API's and did not change behavior. See `#1427 - `__. + `__. .. releasenotes/notes/figure-names-inconsistency-afca1ac8e00fabac.yaml @ b'32813b86b04b956bb7b1334759a79af6ce9068df' @@ -38,7 +38,7 @@ Bug Fixes with ``replace_results=True`` does not result in the ``figure_names`` property having incorrect data (both old and new figure names if the names changed). See `#1430 - `__. + `__. .. releasenotes/notes/figure-names-inconsistency-afca1ac8e00fabac.yaml @ b'32813b86b04b956bb7b1334759a79af6ce9068df' @@ -46,7 +46,7 @@ Bug Fixes argument to the ``run()`` method. Previously, this argument was ignored and ``figure_names`` could only be set as an analysis option prior to calling ``run()``. See `#1430 - `__. + `__. .. releasenotes/notes/mock-iq-backend-without-qiskit-runtime-20d2bf9edb48312d.yaml @ b'2045689df74b74a94f1f5e5a8d4598354c4e5385' @@ -58,7 +58,7 @@ Bug Fixes .. releasenotes/notes/remove_backendv2-b608a2f380698710.yaml @ b'5c6f4b2c8226bca2276c5eecfab5193748a8e524' - Removed a ``FakeBackendV2`` import path which would have been incompatible with Qiskit 1.1 and above. See - `#1420 `_. + `#1420 `_. .. _Release Notes_0.6.0: @@ -155,7 +155,7 @@ Experiment Class Features - A new method :meth:`.BaseExperiment.job_info` has been added that will output the number of jobs the experiment is expected to be split into based on the provided backend. Refer to issue - `#1247 `_ + `#1247 `_ for more details. .. releasenotes/notes/0.6/setter-methods-for-experiment-099074e59faffb49.yaml @ b'e8531c4f6af9432827bc28c772c5a179737f0c3c' @@ -338,7 +338,7 @@ Visualization Features - An :meth:`~.BaseDrawer.hline` method was added to :class:`.BaseDrawer` for generating horizontal lines. See `#1348 - `__. + `__. .. releasenotes/notes/0.6/qvplotter-04efe280aaa9d555.yaml @ b'e8531c4f6af9432827bc28c772c5a179737f0c3c' @@ -350,7 +350,7 @@ Visualization Features as in previous releases, but now it is easier to customize the figure by setting options on the plotter object. See `#1348 - `__. + `__. .. releasenotes/notes/0.6/scale_options-745ee6f8e560043f.yaml @ b'e8531c4f6af9432827bc28c772c5a179737f0c3c' @@ -369,7 +369,7 @@ Known Issues - Copied :class:`.ExperimentData` objects don't save their analysis results to the cloud service. See `#1396 - `_. + `_. .. _Release Notes_0.6.0_Upgrade Notes: @@ -606,7 +606,7 @@ Experiment Library Fixes Previously, it could only be run through the :class:`.HalfAngleCal` subclass in combination with a :class:`.Calibrations` instance containing a custom calibration for the ``y`` gate. - Fixes issue `#1233 `_. + Fixes issue `#1233 `_. .. releasenotes/notes/0.6/plugable-rb-clifford-synthesis-0e66c62fa3088fba.yaml @ b'e8531c4f6af9432827bc28c772c5a179737f0c3c' @@ -614,7 +614,7 @@ Experiment Library Fixes sampled Cliffords may be changed during their circuits synthesis (in the worst case, the resulting circuits may use qubits not in ``physical_qubits``). See issue - `#1279 `_ + `#1279 `_ for additional details. .. releasenotes/notes/0.6/rabi-and-qv-bugfix-34636baee6651af1.yaml @ b'e8531c4f6af9432827bc28c772c5a179737f0c3c' @@ -648,7 +648,7 @@ Experiment Data Fixes deserialized using Python's ``pickle`` module, but deserialized objects were not completely restored and an exception would be raised when doing some operations like running analysis on the restored object. See `#1326 - `__. + `__. .. releasenotes/notes/0.6/experiment_data_fixes-f69c3569a8ba1342.yaml @ b'e8531c4f6af9432827bc28c772c5a179737f0c3c' @@ -815,7 +815,7 @@ Bug Fixes ``qiskit-aer`` 0.13.0. Version 0.13.0 of ``qiskit-aer`` changed the default :class:`qiskit_aer.AerSimulator` to have such a :class:`qiskit.transpiler.Target` without specific coupled pairs. - See `#1292 `__. + See `#1292 `__. .. _Release Notes_0.5.4_Other Notes: @@ -829,7 +829,7 @@ Other Notes Since qubits are usually reset between circuits, this change should have no impact on tomography experiments, but it should allow backends that do not provide a reset instruction to run tomography experiments. See `#1250 - `__. + `__. .. _Release Notes_0.5.3: diff --git a/docs/tutorials/getting_started.rst b/docs/tutorials/getting_started.rst index 5c5092b0cd..72062fde4a 100644 --- a/docs/tutorials/getting_started.rst +++ b/docs/tutorials/getting_started.rst @@ -28,14 +28,14 @@ install the latest main branch: .. code-block:: - python -m pip install git+https://github.com/Qiskit-Extensions/qiskit-experiments.git + python -m pip install git+https://github.com/Qiskit-Community/qiskit-experiments.git If you want to develop the package, you can install Qiskit Experiments from source by cloning the repository: .. code-block:: - git clone https://github.com/Qiskit-Extensions/qiskit-experiments.git + git clone https://github.com/Qiskit-Community/qiskit-experiments.git python -m pip install -e "qiskit-experiments[extras]" The ``-e`` option will keep your installed package up to date as you make or pull new diff --git a/qiskit_experiments/library/randomized_benchmarking/clifford_utils.py b/qiskit_experiments/library/randomized_benchmarking/clifford_utils.py index acf0935d4b..95dbeb610b 100644 --- a/qiskit_experiments/library/randomized_benchmarking/clifford_utils.py +++ b/qiskit_experiments/library/randomized_benchmarking/clifford_utils.py @@ -57,11 +57,9 @@ def _transpile_clifford_circuit( def _decompose_clifford_ops(circuit: QuantumCircuit) -> QuantumCircuit: # Simplified QuantumCircuit.decompose, which decomposes only Clifford ops - # Note that the resulting circuit depends on the input circuit, - # that means the changes on the input circuit may affect the resulting circuit. - # For example, the resulting circuit shares the parameter_table of the input circuit, res = circuit.copy_empty_like() - res._parameter_table = circuit._parameter_table + if hasattr(circuit, "_parameter_table"): + res._parameter_table = circuit._parameter_table for inst in circuit: if inst.operation.name.startswith("Clifford"): # Decompose rule = inst.operation.definition.data @@ -89,7 +87,8 @@ def _apply_qubit_layout(circuit: QuantumCircuit, physical_qubits: Sequence[int]) for reg in circuit.cregs: res.add_register(reg) _circuit_compose(res, circuit, qubits=physical_qubits) - res._parameter_table = circuit._parameter_table + if hasattr(circuit, "_parameter_table"): + res._parameter_table = circuit._parameter_table return res diff --git a/releasenotes/notes/0.7/fix-ecr-epg-59c8db98494966b0.yaml b/releasenotes/notes/0.7/fix-ecr-epg-59c8db98494966b0.yaml index ce78428727..b370d59978 100644 --- a/releasenotes/notes/0.7/fix-ecr-epg-59c8db98494966b0.yaml +++ b/releasenotes/notes/0.7/fix-ecr-epg-59c8db98494966b0.yaml @@ -6,5 +6,5 @@ fixes: as a 2-qubit basis gate (e.g. IBM Eagle processors). See `#1419 - `_. + `_. for the details of the bug. diff --git a/setup.py b/setup.py index fdb4b0529e..08d71a949e 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ description="Software for developing quantum computing programs", long_description=README, long_description_content_type="text/markdown", - url="https://github.com/Qiskit-Extensions/qiskit-experiments", + url="https://github.com/Qiskit-Community/qiskit-experiments", author="Qiskit Development Team", author_email="qiskit@us.ibm.com", license="Apache 2.0", @@ -65,9 +65,9 @@ include_package_data=True, python_requires=">=3.8", project_urls={ - "Bug Tracker": "https://github.com/Qiskit-Extensions/qiskit-experiments/issues", - "Documentation": "https://qiskit-extensions.github.io/qiskit-experiments", - "Source Code": "https://github.com/Qiskit-Extensions/qiskit-experiments", + "Bug Tracker": "https://github.com/Qiskit-Community/qiskit-experiments/issues", + "Documentation": "https://qiskit-community.github.io/qiskit-experiments", + "Source Code": "https://github.com/Qiskit-Community/qiskit-experiments", }, zip_safe=False, entry_points={ diff --git a/test/framework/test_backend_timing.py b/test/framework/test_backend_timing.py index a7951b2c21..c2384b405d 100644 --- a/test/framework/test_backend_timing.py +++ b/test/framework/test_backend_timing.py @@ -28,42 +28,36 @@ class TestBackendTiming(QiskitExperimentsTestCase): @classmethod def setUpClass(cls): super().setUpClass() - + cls.acquire_alignment = 16 + cls.dt = 1 / 4.5e9 + cls.granularity = 16 + cls.min_length = 64 + cls.pulse_alignment = 1 + + def setUp(self): + super().setUp() # Creating a complete fake backend is difficult so we use one from - # qiskit. Just to be safe, we check that the properties we care about - # for these tests are never changed from what the tests assume. - backend = FakeNairobiV2() - target = backend.target - assumptions = ( - (abs(target.dt * 4.5e9 - 1) < 1e-6) - and target.acquire_alignment == 16 - and target.pulse_alignment == 1 - and target.min_length == 64 - and target.granularity == 16 - ) - if not assumptions: # pragma: no cover - raise ValueError("FakeNairobiV2 properties have changed!") - - cls.acquire_alignment = target.acquire_alignment - cls.dt = target.dt - cls.granularity = target.granularity - cls.min_length = target.min_length - cls.pulse_alignment = target.pulse_alignment + # qiskit. Just to be safe, we override hardware properties + # with the values assumed for the unit tests. + self.backend = FakeNairobiV2() + self.backend.target.dt = self.dt + self.backend.target.acquire_alignment = self.acquire_alignment + self.backend.target.pulse_alignment = self.pulse_alignment + self.backend.target.min_length = self.min_length + self.backend.target.granularity = self.granularity @data((True, "s"), (False, "dt")) @unpack def test_delay_unit(self, null_dt, result): """Test delay unit matches dt""" - backend = FakeNairobiV2() if null_dt: - backend.target.dt = None - timing = BackendTiming(backend) + self.backend.target.dt = None + timing = BackendTiming(self.backend) self.assertEqual(timing.delay_unit, result) def test_round_delay_args(self): """Test argument checking in round_delay""" - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) with self.assertRaises(QiskitError): timing.round_delay(time=self.dt * 16, samples=16) with self.assertRaises(QiskitError): @@ -71,8 +65,7 @@ def test_round_delay_args(self): def test_round_pulse_args(self): """Test argument checking in round_pulse""" - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) with self.assertRaises(QiskitError): timing.round_pulse(time=self.dt * 64, samples=64) with self.assertRaises(QiskitError): @@ -84,25 +77,22 @@ def test_round_delay(self, samples_in, samples_out): """Test delay calculation with time input""" time = self.dt * samples_in - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertEqual(timing.round_delay(time=time), samples_out) def test_round_delay_no_dt(self): """Test delay when dt is None""" time = self.dt * 16 - backend = FakeNairobiV2() - backend.target.dt = None - timing = BackendTiming(backend) + self.backend.target.dt = None + timing = BackendTiming(self.backend) self.assertEqual(timing.round_delay(time=time), time) @data([14, 16], [16, 16], [18, 16], [64.5, 64]) @unpack def test_round_delay_samples_in(self, samples_in, samples_out): """Test delay calculation with samples input""" - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertEqual(timing.round_delay(samples=samples_in), samples_out) @data([12, 64], [65, 64], [79, 80], [83, 80]) @@ -111,16 +101,14 @@ def test_round_pulse(self, samples_in, samples_out): """Test round pulse calculation with time input""" time = self.dt * samples_in - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertEqual(timing.round_pulse(time=time), samples_out) @data([12, 64], [65, 64], [79, 80], [83, 80], [80.5, 80]) @unpack def test_round_pulse_samples_in(self, samples_in, samples_out): """Test round pulse calculation with samples input""" - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertEqual(timing.round_pulse(samples=samples_in), samples_out) def test_delay_time(self): @@ -128,8 +116,7 @@ def test_delay_time(self): time_in = self.dt * 16.1 time_out = self.dt * 16 - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertAlmostEqual(timing.delay_time(time=time_in), time_out, delta=1e-6 * self.dt) def test_delay_time_samples_in(self): @@ -137,8 +124,7 @@ def test_delay_time_samples_in(self): samples_in = 16.1 time_out = self.dt * 16 - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertAlmostEqual( timing.delay_time(samples=samples_in), time_out, delta=1e-6 * self.dt ) @@ -148,9 +134,8 @@ def test_delay_time_no_dt(self): time_in = self.dt * 16.1 time_out = time_in - backend = FakeNairobiV2() - backend.target.dt = None - timing = BackendTiming(backend) + self.backend.target.dt = None + timing = BackendTiming(self.backend) self.assertAlmostEqual(timing.delay_time(time=time_in), time_out, delta=1e-6 * self.dt) def test_pulse_time(self): @@ -158,8 +143,7 @@ def test_pulse_time(self): time_in = self.dt * 85.1 time_out = self.dt * 80 - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertAlmostEqual(timing.pulse_time(time=time_in), time_out, delta=1e-6 * self.dt) def test_pulse_time_samples_in(self): @@ -167,17 +151,15 @@ def test_pulse_time_samples_in(self): samples_in = 85.1 time_out = self.dt * 80 - backend = FakeNairobiV2() - timing = BackendTiming(backend) + timing = BackendTiming(self.backend) self.assertAlmostEqual( timing.pulse_time(samples=samples_in), time_out, delta=1e-6 * self.dt ) def test_round_pulse_no_dt_error(self): """Test methods that don't work when dt is None raise exceptions""" - backend = FakeNairobiV2() - backend.target.dt = None - timing = BackendTiming(backend) + self.backend.target.dt = None + timing = BackendTiming(self.backend) time = self.dt * 81 @@ -186,19 +168,14 @@ def test_round_pulse_no_dt_error(self): def test_unexpected_pulse_alignment(self): """Test that a weird pulse_alignment parameter is caught""" - backend = FakeNairobiV2() - backend.target.pulse_alignment = 33 - timing = BackendTiming(backend) + self.backend.target.pulse_alignment = 33 + timing = BackendTiming(self.backend) with self.assertRaises(QiskitError): timing.round_pulse(samples=81) def test_unexpected_acquire_alignment(self): """Test that a weird acquire_alignment parameter is caught""" - backend = FakeNairobiV2() - try: - backend.target.acquire_alignment = 33 - except AttributeError: - backend.target.aquire_alignment = 33 - timing = BackendTiming(backend) + self.backend.target.acquire_alignment = 33 + timing = BackendTiming(self.backend) with self.assertRaises(QiskitError): timing.round_pulse(samples=81) diff --git a/test/library/characterization/test_cross_resonance_hamiltonian.py b/test/library/characterization/test_cross_resonance_hamiltonian.py index 00b574430a..3ed70b85e7 100644 --- a/test/library/characterization/test_cross_resonance_hamiltonian.py +++ b/test/library/characterization/test_cross_resonance_hamiltonian.py @@ -14,13 +14,15 @@ """Spectroscopy tests.""" from test.base import QiskitExperimentsTestCase -from test.extended_equality import is_equivalent import functools import io +from unittest.mock import patch + import numpy as np from ddt import ddt, data, unpack from qiskit import QuantumCircuit, pulse, qpy, quantum_info as qi +from qiskit.circuit import Gate # TODO: remove old path after we stop supporting the relevant version of Qiskit try: @@ -34,36 +36,6 @@ from qiskit_experiments.library.characterization import cr_hamiltonian -def is_equivalent_circuit(circ1: QuantumCircuit, circ2: QuantumCircuit) -> bool: - """ - Check if two circuits are structurally the same. - We use it due to the field 'operation' under 'circ.data[i]' wich its '__qe__' - method isn't good for reconstructed circuits (by using qpy) with custom pulse gates. - """ - check = ( - is_equivalent(circ1.calibrations, circ2.calibrations) - and is_equivalent(circ1.qregs, circ2.qregs) - and is_equivalent(circ1.qubits, circ2.qubits) - ) - - for data1, data2 in zip(circ1.data, circ2.data): - circ1_op = data1.operation - circ2_op = data2.operation - check = ( - check - and is_equivalent(data1.clbits, data2.clbits) - and is_equivalent(data1.qubits, data2.qubits) - and is_equivalent(circ1_op.definition, circ2_op.definition) - and is_equivalent(circ1_op.name, circ2_op.name) - and is_equivalent(circ1_op.params, circ2_op.params) - and is_equivalent(circ1_op.unit, circ2_op.unit) - and is_equivalent(circ1_op.num_clbits, circ2_op.num_clbits) - and is_equivalent(circ1_op.num_qubits, circ2_op.num_qubits) - ) - - return check - - class SimulatableCRGate(HamiltonianGate): """Hamiltonian Gate for simulation.""" @@ -302,48 +274,44 @@ def test_circuit_serialization(self): """Test generated circuits.""" backend = FakeBogotaV2() - expr = cr_hamiltonian.CrossResonanceHamiltonian( - physical_qubits=(0, 1), - amp=0.1, - sigma=64, - risefall=2, - ) - expr.backend = backend - - with pulse.build(default_alignment="left", name="cr") as _: - pulse.play( - pulse.GaussianSquare( - duration=1256, - amp=0.1, - sigma=64, - width=1000, - ), - pulse.ControlChannel(0), + with patch.object( + cr_hamiltonian.CrossResonanceHamiltonian.CRPulseGate, + "base_class", + Gate, + ): + # Monkey patching the Instruction.base_class property of the CRPulseGate. + # QPY loader is not aware of Gate subclasses defined outside Qiskit core, + # and a Gate subclass instance is reconstructed as a Gate class instance. + # This results in the failure in comparison of structurally same circuits. + # In this context, CRPulseGate looks like a Gate class. + expr = cr_hamiltonian.CrossResonanceHamiltonian( + physical_qubits=(0, 1), + amp=0.1, + sigma=64, + risefall=2, ) - pulse.delay(1256, pulse.DriveChannel(0)) - pulse.delay(1256, pulse.DriveChannel(1)) + expr.backend = backend - width_sec = 1000 * backend.dt - cr_gate = cr_hamiltonian.CrossResonanceHamiltonian.CRPulseGate(width=width_sec) - circuits = expr._transpiled_circuits() + width_sec = 1000 * backend.dt + cr_gate = cr_hamiltonian.CrossResonanceHamiltonian.CRPulseGate(width=width_sec) + circuits = expr._transpiled_circuits() - x0_circ = QuantumCircuit(2, 1) - x0_circ.append(cr_gate, [0, 1]) - x0_circ.rz(np.pi / 2, 1) - x0_circ.sx(1) - x0_circ.measure(1, 0) + x0_circ = QuantumCircuit(2, 1) + x0_circ.append(cr_gate, [0, 1]) + x0_circ.rz(np.pi / 2, 1) + x0_circ.sx(1) + x0_circ.measure(1, 0) - circuits.append(x0_circ) + circuits.append(x0_circ) - with io.BytesIO() as buff: - qpy.dump(circuits, buff) - buff.seek(0) - serialized_data = buff.read() + with io.BytesIO() as buff: + qpy.dump(circuits, buff) + buff.seek(0) + serialized_data = buff.read() - with io.BytesIO() as buff: - buff.write(serialized_data) - buff.seek(0) - decoded = qpy.load(buff) + with io.BytesIO() as buff: + buff.write(serialized_data) + buff.seek(0) + decoded = qpy.load(buff) - for circ1, circ2 in zip(circuits, decoded): - self.assertTrue(is_equivalent_circuit(circ1, circ2)) + self.assertListEqual(circuits, decoded) diff --git a/test/library/characterization/test_half_angle.py b/test/library/characterization/test_half_angle.py index 7e2359b292..9d0ebfd58f 100644 --- a/test/library/characterization/test_half_angle.py +++ b/test/library/characterization/test_half_angle.py @@ -17,7 +17,7 @@ from qiskit import pulse, transpile from qiskit.pulse import InstructionScheduleMap -from qiskit_ibm_runtime.fake_provider import FakeAthens +from qiskit_ibm_runtime.fake_provider import FakeAthensV2 from qiskit_experiments.test.mock_iq_backend import MockIQBackend from qiskit_experiments.test.mock_iq_helpers import MockIQHalfAngleHelper as HalfAngleHelper @@ -58,7 +58,7 @@ def test_circuits(self): # mimic what will happen in the experiment. transpile_opts = copy.copy(hac.transpile_options.__dict__) transpile_opts["initial_layout"] = list(hac._physical_qubits) - circuits = transpile(hac.circuits(), FakeAthens(), **transpile_opts) + circuits = transpile(hac.circuits(), FakeAthensV2(), **transpile_opts) for idx, circ in enumerate(circuits): self.assertEqual(circ.count_ops()["sx"], idx * 2 + 2) diff --git a/test/library/randomized_benchmarking/test_interleaved_rb.py b/test/library/randomized_benchmarking/test_interleaved_rb.py index f01fd6a764..47f46d4d07 100644 --- a/test/library/randomized_benchmarking/test_interleaved_rb.py +++ b/test/library/randomized_benchmarking/test_interleaved_rb.py @@ -23,7 +23,7 @@ from qiskit.transpiler import InstructionProperties from qiskit_aer import AerSimulator from qiskit_aer.noise import NoiseModel, depolarizing_error -from qiskit_ibm_runtime.fake_provider import FakeManila, FakeManilaV2, FakeWashington +from qiskit_ibm_runtime.fake_provider import FakeManilaV2 from qiskit_experiments.library import randomized_benchmarking as rb @@ -34,8 +34,7 @@ class TestInterleavedRB(QiskitExperimentsTestCase, RBTestMixin): def setUp(self): """Setup the tests.""" super().setUp() - self.backend = FakeManila() - self.backend_with_timing_constraint = FakeWashington() + self.backend = FakeManilaV2() # ### Tests for configuration ### def test_non_clifford_interleaved_element(self): @@ -56,7 +55,7 @@ def test_interleaving_delay_with_invalid_duration(self, duration, unit): interleaved_element=Delay(duration, unit=unit), physical_qubits=[0], lengths=[1, 2, 3], - backend=self.backend_with_timing_constraint, + backend=self.backend, ) def test_experiment_config(self): @@ -269,15 +268,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).""" - my_backend = FakeManilaV2() - del my_backend.target["cx"][(1, 2)] # make support only cx(2, 1) + del self.backend.target["cx"][(1, 2)] # make support only cx(2, 1) exp = rb.InterleavedRB( interleaved_element=CXGate(), physical_qubits=(1, 2), lengths=[3], num_samples=4, - backend=my_backend, + backend=self.backend, seed=1234, ) with self.assertRaises(QiskitError): @@ -285,13 +283,12 @@ def test_interleaving_cnot_gate_with_non_supported_direction(self): def test_interleaving_three_qubit_gate_with_calibration(self): """Test if circuits for 3Q InterleavedRB contain custom calibrations supplied via target.""" - my_backend = FakeManilaV2() - with pulse.build(my_backend) as custom_3q_sched: # meaningless schedule + with pulse.build(self.backend) as custom_3q_sched: # meaningless schedule pulse.play(pulse.GaussianSquare(1600, 0.2, 64, 1300), pulse.drive_channel(0)) physical_qubits = (2, 1, 3) custom_3q_gate = self.ThreeQubitGate() - my_backend.target.add_instruction( + self.backend.target.add_instruction( custom_3q_gate, {physical_qubits: InstructionProperties(calibration=custom_3q_sched)} ) @@ -300,7 +297,7 @@ def test_interleaving_three_qubit_gate_with_calibration(self): physical_qubits=physical_qubits, lengths=[3], num_samples=1, - backend=my_backend, + backend=self.backend, seed=1234, ) circuits = exp._transpiled_circuits() diff --git a/tox.ini b/tox.ini index fbb6447084..a00cc60f99 100644 --- a/tox.ini +++ b/tox.ini @@ -54,7 +54,7 @@ basepython = python3 allowlist_externals = git commands = black --check {posargs} qiskit_experiments test tools setup.py - -git fetch -q https://github.com/Qiskit-Extensions/qiskit-experiments :lint_incr_latest + -git fetch -q https://github.com/Qiskit-Community/qiskit-experiments :lint_incr_latest python {toxinidir}/tools/pylint_incr.py -rn {posargs} -sn --paths :/qiskit_experiments/*.py :/test/*.py :/tools/*.py python {toxinidir}/tools/verify_headers.py qiskit_experiments test tools