Skip to content

Commit

Permalink
Merge branch 'main' into save-cals-no-schedule-params
Browse files Browse the repository at this point in the history
  • Loading branch information
wshanks authored Jan 31, 2024
2 parents 7374d97 + 32f02b1 commit 37985d4
Show file tree
Hide file tree
Showing 56 changed files with 2,828 additions and 1,889 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Check for updates to GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
14 changes: 7 additions & 7 deletions .github/workflows/cron-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
echo -e "\033[31;1;4mConcurrency Group\033[0m"
echo -e "$CONCURRENCY_GROUP\n"
shell: bash
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements.txt','requirements-extras.txt','requirements-dev.txt','constraints.txt') }}
Expand All @@ -50,15 +50,15 @@ jobs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.11
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('setup.py','requirements.txt','requirements-extras.txt','requirements-dev.txt','constraints.txt') }}
Expand All @@ -73,7 +73,7 @@ jobs:
mkdir artifacts
tar -Jcvf html_docs.tar.xz docs/_build/html
mv html_docs.tar.xz artifacts/.
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: html_docs
path: artifacts
19 changes: 11 additions & 8 deletions .github/workflows/docs_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,24 @@ jobs:
if: github.repository_owner == 'Qiskit-Extensions'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U virtualenv setuptools wheel tox
sudo apt-get install graphviz pandoc
- name: Build and publish
env:
encrypted_rclone_key: ${{ secrets.encrypted_rclone_key }}
encrypted_rclone_iv: ${{ secrets.encrypted_rclone_iv }}
run: |
tools/deploy_documentation_dev.sh
- name: Build docs dev
run: EXPERIMENTS_DEV_DOCS=1 PROD_BUILD=1 RELEASE_STRING=`git describe` tox -edocs
- name: Bypass Jekyll Processing # Necessary for setting the correct css path
run: touch docs/_build/html/.nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html/
target-folder: dev/
20 changes: 13 additions & 7 deletions .github/workflows/docs.yml → .github/workflows/docs_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,28 @@ jobs:
if: github.repository_owner == 'Qiskit-Extensions'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U virtualenv setuptools wheel tox
sudo apt-get install graphviz pandoc
- name: Build and publish
- name: Build docs
env:
encrypted_rclone_key: ${{ secrets.encrypted_rclone_key }}
encrypted_rclone_iv: ${{ secrets.encrypted_rclone_iv }}
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: |
tools/deploy_documentation.sh
run: EXPERIMENTS_DEV_DOCS=1 PROD_BUILD=1 tox -edocs
- name: Bypass Jekyll Processing # Necessary for setting the correct css path
run: touch docs/_build/html/.nojekyll
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html/
clean-exclude: |
stable/*
dev/*
38 changes: 38 additions & 0 deletions .github/workflows/docs_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Stable Docs Publish
on:
workflow_dispatch:
push:
tags:
- "*"

jobs:
deploy:
if: github.repository_owner == 'Qiskit-Extensions'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U virtualenv setuptools wheel tox
sudo apt-get install graphviz pandoc
- name: Build docs stable
env:
QISKIT_DOCS_BUILD_TUTORIALS: 'always'
run: EXPERIMENTS_DEV_DOCS=1 PROD_BUILD=1 tox -e docs
- name: Bypass Jekyll Processing # Necessary for setting the correct css path
run: touch docs/_build/html/.nojekyll
- name: Set current version
run: |
echo "version=$(git describe --abbrev=0 | cut -d'.' -f1,2)" >> "$GITHUB_ENV"
- name: Deploy stable
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/_build/html
target-folder: stable/${{ env.version }}
22 changes: 11 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ jobs:
echo -e "\033[31;1;4mConcurrency Group\033[0m"
echo -e "$CONCURRENCY_GROUP\n"
shell: bash
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-tests-${{ hashFiles('setup.py','requirements.txt','requirements-extras.txt','requirements-dev.txt','constraints.txt') }}
Expand All @@ -41,7 +41,7 @@ jobs:
${{ runner.os }}-${{ matrix.python-version }}-pip-
${{ runner.os }}-${{ matrix.python-version }}
- name: Stestr cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: .stestr
key: stestr-${{ runner.os }}-${{ matrix.python-version }}
Expand All @@ -66,13 +66,13 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-lint-${{ hashFiles('setup.py','requirements.txt','requirements-extras.txt','requirements-dev.txt','constraints.txt') }}
Expand All @@ -85,15 +85,15 @@ jobs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-docs-${{ hashFiles('setup.py','requirements.txt','requirements-extras.txt','requirements-dev.txt','constraints.txt') }}
Expand All @@ -108,7 +108,7 @@ jobs:
mkdir artifacts
tar -Jcvf html_docs.tar.xz docs/_build/html
mv html_docs.tar.xz artifacts/.
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: html_docs
path: artifacts
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.8'
Expand All @@ -23,7 +23,7 @@ jobs:
python setup.py sdist
python setup.py bdist_wheel
shell: bash
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
path: ./dist/qiskit*
- name: Publish to PyPi
Expand Down
3 changes: 2 additions & 1 deletion docs/_ext/custom_styles/option_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
from typing import Type, Optional

import numpy as np
from sphinx.ext.autodoc import Sphinx, Options as SphinxOptions
from sphinx.application import Sphinx
from sphinx.ext.autodoc import Options as SphinxOptions
from sphinx.ext.napoleon import Config as NapoleonConfig
from sphinx.ext.napoleon import GoogleDocstring

Expand Down
1 change: 1 addition & 0 deletions docs/apidocs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Experiment Modules

mod_calibration
mod_characterization
mod_driven_freq_tuning
mod_randomized_benchmarking
mod_tomography
mod_quantum_volume
6 changes: 6 additions & 0 deletions docs/apidocs/mod_driven_freq_tuning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.. _qiskit-experiments-driven-freq-tuning:

.. automodule:: qiskit_experiments.library.driven_freq_tuning
:no-members:
:no-inherited-members:
:no-special-members:
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@

html_title = f"{project} {release}"

docs_url_prefix = "ecosystem/experiments"
docs_url_prefix = "qiskit-experiments"

html_last_updated_fmt = "%Y/%m/%d"

Expand All @@ -171,7 +171,6 @@
"matplotlib": ("https://matplotlib.org/stable/", None),
"qiskit": ("https://qiskit.org/documentation/", None),
"uncertainties": ("https://pythonhosted.org/uncertainties", None),
"qiskit_ibm_provider": ("https://qiskit.org/ecosystem/ibm-provider/", None),
"qiskit_aer": ("https://qiskit.org/ecosystem/aer", None),
"qiskit_dynamics": ("https://qiskit.org/documentation/dynamics", None),
"qiskit_ibm_runtime": ("https://qiskit.org/ecosystem/ibm-runtime/", None),
Expand Down
13 changes: 7 additions & 6 deletions docs/howtos/cloud_service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,22 @@ Saving
~~~~~~

.. note::
This guide requires :mod:`qiskit-ibm-provider`. For how to migrate from the deprecated :mod:`qiskit-ibmq-provider` to :mod:`qiskit-ibm-provider`,
consult the `migration guide <https://qiskit.org/ecosystem/ibm-provider/tutorials/Migration_Guide_from_qiskit-ibmq-provider.html>`_.\
This guide requires :mod:`qiskit-ibm-runtime` version 0.15 and up, which can be installed with ``python -m pip install qiskit-ibm-runtime``.
For how to migrate from the older :mod:`qiskit-ibm-provider` to :mod:`qiskit-ibm-runtime`,
consult the `migration guide <https://docs.quantum.ibm.com/api/migration-guides/qiskit-runtime-from-provider>`_.\

You must run the experiment on a real IBM
backend and not a simulator to be able to save the experiment data. This is done by calling
:meth:`~.ExperimentData.save`:

.. jupyter-input::

from qiskit_ibm_provider import IBMProvider
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_experiments.library.characterization import T1
import numpy as np

provider = IBMProvider()
backend = provider.get_backend("ibmq_lima")
service = QiskitRuntimeService(channel="ibm_quantum")
backend = service.backend("ibm_osaka")

t1_delays = np.arange(1e-6, 600e-6, 50e-6)

Expand Down Expand Up @@ -142,7 +143,7 @@ The :meth:`~.ExperimentData.auto_save` feature automatically saves changes to th
.. jupyter-output::

You can view the experiment online at https://quantum.ibm.com/experiments/cdaff3fa-f621-4915-a4d8-812d05d9a9ca
<ExperimentData[T1], backend: ibmq_lima, status: ExperimentStatus.DONE, experiment_id: cdaff3fa-f621-4915-a4d8-812d05d9a9ca>
<ExperimentData[T1], backend: ibm_osaka, status: ExperimentStatus.DONE, experiment_id: cdaff3fa-f621-4915-a4d8-812d05d9a9ca>

Setting ``auto_save = True`` works by triggering :meth:`.ExperimentData.save`.

Expand Down
6 changes: 3 additions & 3 deletions docs/howtos/rerun_analysis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Solution
--------

.. note::
Some of this guide uses the :mod:`qiskit-ibm-provider` package. For how to migrate from
the deprecated ``qiskit-ibmq-provider`` to ``qiskit-ibm-provider``, consult the
`migration guide <https://qiskit.org/ecosystem/ibm-provider/tutorials/Migration_Guide_from_qiskit-ibmq-provider.html>`_.\
This guide requires :mod:`qiskit-ibm-runtime` version 0.15 and up, which can be installed with ``python -m pip install qiskit-ibm-runtime``.
For how to migrate from the older :mod:`qiskit-ibm-provider` to :mod:`qiskit-ibm-runtime`,
consult the `migration guide <https://docs.quantum.ibm.com/api/migration-guides/qiskit-runtime-from-provider>`_.\

Once you recreate the exact experiment you ran and all of its parameters and options,
you can call the :meth:`.add_jobs` method with a list of :class:`Job
Expand Down
29 changes: 16 additions & 13 deletions docs/howtos/runtime_sessions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,35 @@ You want to run experiments in a `Runtime session
Solution
--------

Use the :class:`~qiskit_ibm_provider.IBMBackend` object in ``qiskit-ibm-provider``, which supports sessions.
.. note::
This guide requires :mod:`qiskit-ibm-runtime` version 0.15 and up, which can be installed with ``python -m pip install qiskit-ibm-runtime``.
For how to migrate from the older :mod:`qiskit-ibm-provider` to :mod:`qiskit-ibm-runtime`,
consult the `migration guide <https://docs.quantum.ibm.com/api/migration-guides/qiskit-runtime-from-provider>`_.\

Use the :class:`~qiskit_ibm_runtime.IBMBackend` object in :mod:`qiskit-ibm-runtime`, which supports sessions.

In this example, we will set the ``max_circuits`` property to an artificially low value so that the experiment will be
split into multiple jobs that run sequentially in a single session. When running real experiments with a
large number of circuits that can't fit in a single job, it may be helpful to follow this usage pattern:

.. jupyter-input::

from qiskit_ibm_provider import IBMProvider
from qiskit_ibm_runtime import QiskitRuntimeService
from qiskit_experiments.library.tomography import ProcessTomography
from qiskit import QuantumCircuit

provider = IBMProvider()
backend = provider.get_backend("ibm_nairobi")
service = QiskitRuntimeService(channel="ibm_quantum")
backend = service.backend("ibm_osaka")
qc = QuantumCircuit(1)
qc.x(0)

with backend.open_session() as session:
exp = ProcessTomography(qc)
exp.set_experiment_options(max_circuits=3)
exp_data = exp.run(backend)
exp_data.block_for_results()
# Calling cancel because session.close() is not available for qiskit-ibm-provider<=0.7.2.
# It is safe to call cancel since block_for_results() ensures there are no outstanding jobs
# still running that would be canceled.
session.cancel()
backend.open_session()
exp = ProcessTomography(qc)
# Artificially lower circuits per job, adjust value for your own application
exp.set_experiment_options(max_circuits=3)
exp_data = exp.run(backend)
# This will prevent further jobs from being submitted without terminating current jobs
backend.close_session()

Note that runtime primitives are not currently supported natively in Qiskit Experiments, so
the ``backend.run()`` path is required to run experiments.
Loading

0 comments on commit 37985d4

Please sign in to comment.