Skip to content

Commit 98c7e0d

Browse files
authored
Merge branch 'main' into feature/stark_p1_frequency_scan
2 parents fda5774 + bb2b5e1 commit 98c7e0d

File tree

152 files changed

+3592
-1147
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+3592
-1147
lines changed

.github/workflows/cron-staging.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
python-version: [3.8, 3.9, "3.10", "3.11"]
13+
python-version: [3.8, "3.11"]
1414
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
1515
steps:
1616
- name: Print Concurrency Group

.github/workflows/main.yml

+14-19
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
python-version: [3.8, 3.9, "3.10", "3.11"]
18+
python-version: [3.8, "3.11"]
1919
os: ["ubuntu-latest", "macOS-latest", "windows-latest"]
2020
steps:
2121
- name: Print Concurrency Group
@@ -39,25 +39,20 @@ jobs:
3939
${{ runner.os }}-${{ matrix.python-version }}-pip-tests-
4040
${{ runner.os }}-${{ matrix.python-version }}-pip-
4141
${{ runner.os }}-${{ matrix.python-version }}
42+
- name: Stestr cache
43+
uses: actions/cache@v3
44+
with:
45+
path: .stestr
46+
key: stestr-${{ runner.os }}-${{ matrix.python-version }}
47+
restore-keys: |
48+
stestr-${{ runner.os }}-
49+
stestr-
4250
- name: Install Deps
43-
run: python -m pip install -U "tox==3.27.1" setuptools virtualenv wheel
44-
- name: Install and Run Tests (Windows and Linux)
51+
run: python -m pip install -U tox setuptools virtualenv wheel stestr
52+
- name: Install and Run Tests
4553
run: tox -e py
46-
if: runner.os != 'macOS'
47-
- name: Install and Run Tests (Macs only)
48-
run: tox -e cover
49-
if: runner.os == 'macOS'
50-
env:
51-
OMP_NUM_THREADS: 1
52-
- name: Report coverage to coveralls.io (Macs only)
53-
if: runner.os == 'macOS'
54-
uses: coverallsapp/github-action@v2
55-
env:
56-
ACTIONS_RUNNER_DEBUG: 1
57-
with:
58-
github-token: ${{ secrets.GITHUB_TOKEN }}
59-
flag-name: unit-tests_python${{ matrix.python-version }}-${{ matrix.os }}
60-
path-to-lcov: coverage.lcov
54+
- name: Clean up stestr cache
55+
run: stestr history remove all
6156

6257
lint:
6358
name: lint
@@ -98,7 +93,7 @@ jobs:
9893
python -m pip install -U tox
9994
sudo apt-get install -y pandoc graphviz
10095
- name: Build Docs
101-
run: tox -edocs
96+
run: tox -edocs-parallel
10297
- name: Compress Artifacts
10398
run: |
10499
mkdir artifacts

.github/workflows/release.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ jobs:
77
wheel-build:
88
name: Build and Publish Release Artifacts
99
runs-on: ubuntu-latest
10+
environment: release
11+
permissions:
12+
id-token: write
1013
steps:
1114
- uses: actions/checkout@v3
1215
- uses: actions/setup-python@v4
1316
name: Install Python
1417
with:
1518
python-version: '3.8'
1619
- name: Install Deps
17-
run: pip install -U twine wheel
20+
run: pip install -U wheel
1821
- name: Build Artifacts
1922
run: |
2023
python setup.py sdist
@@ -24,7 +27,4 @@ jobs:
2427
with:
2528
path: ./dist/qiskit*
2629
- name: Publish to PyPi
27-
env:
28-
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
29-
TWINE_USERNAME: qiskit
30-
run: twine upload dist/qiskit*
30+
uses: pypa/gh-action-pypi-publish@release/v1

.stestr.conf

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
[DEFAULT]
22
test_path=./test
3+
parallel_class=True

CODE_OF_CONDUCT.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Copyright Contributors to the Qiskit project. -->
22

33
# Code of Conduct
4-
All members of this project agree to adhere to the Qiskit Code of Conduct listed at [https://github.com/Qiskit/qiskit-metapackage/blob/master/CODE_OF_CONDUCT.md](https://github.com/Qiskit/qiskit-metapackage/blob/master/CODE_OF_CONDUCT.md)
4+
All members of this project agree to adhere to the [Qiskit Code of Conduct](https://github.com/Qiskit/qiskit/blob/main/CODE_OF_CONDUCT.md).
55

66
----
77

CONTRIBUTING.md

+2
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ To run a method:
121121
tox -- -n test.python.test_examples.TestPythonExamples.test_all_examples
122122
```
123123

124+
Note that tests will fail automatically if they do not finish execution within 60 seconds.
125+
124126
#### STDOUT/STDERR and logging capture
125127

126128
When running tests in parallel using `stestr` either via tox, the Makefile (`make

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![License](https://img.shields.io/github/license/Qiskit-Extensions/qiskit-experiments.svg)](https://opensource.org/licenses/Apache-2.0)
44
[![Release](https://img.shields.io/github/release/Qiskit-Extensions/qiskit-experiments.svg)](https://github.com/Qiskit-Extensions/qiskit-experiments/releases)
55
![Python](https://img.shields.io/pypi/pyversions/qiskit-experiments.svg)
6-
[![Coverage Status](https://coveralls.io/repos/github/Qiskit-Extensions/qiskit-experiments/badge.svg?branch=main)](https://coveralls.io/github/Qiskit-Extensions/qiskit-experiments?branch=main)
76
[![DOI](https://joss.theoj.org/papers/10.21105/joss.05329/status.svg)](https://doi.org/10.21105/joss.05329)
87

98
**Qiskit Experiments** is a repository that builds tools for building, running,

docs/conf.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"sphinx.ext.autodoc",
5454
"sphinx.ext.autosummary",
5555
"sphinx.ext.mathjax",
56-
"sphinx.ext.viewcode",
5756
"sphinx.ext.extlinks",
5857
"sphinx_copybutton",
5958
"jupyter_sphinx",
@@ -69,11 +68,14 @@
6968
"sphinx_remove_toctrees",
7069
]
7170

72-
# Remove stubs from the toctree by default because the full build is slow
73-
# This is turned off for docs deployment
74-
if not os.getenv("FULL_TOCTREE", None):
71+
if os.getenv("PROD_BUILD", None):
72+
# Turn on view code source for production build
73+
extensions.append("sphinx.ext.viewcode")
74+
else:
75+
# Remove stubs from the toctree for non-prod build because the full build is slow
7576
remove_from_toctrees = ["stubs/*"]
7677

78+
7779
html_static_path = ["_static"]
7880
templates_path = ["_templates"]
7981
# Manually add the gallery CSS file for now

docs/howtos/figure_generation.rst

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
Control figure generation
2+
=========================
3+
4+
Problem
5+
-------
6+
7+
You want to change the default behavior where figures are generated with every experiment.
8+
9+
Solution
10+
--------
11+
12+
For a single non-composite experiment, figure generation can be switched off by setting the analysis
13+
option ``plot`` to ``False``:
14+
15+
.. jupyter-input::
16+
17+
experiment.analysis.set_options(plot = False)
18+
19+
For composite experiments, there is a ``generate_figures`` analysis option which controls how child figures are
20+
generated. There are three options:
21+
22+
- ``always``: The default behavior, generate figures for each child experiment.
23+
- ``never``: Never generate figures for any child experiment.
24+
- ``selective``: Only generate figures for analysis results where ``quality`` is ``bad``. This is useful
25+
for large composite experiments where you only want to examine qubits with problems.
26+
27+
This parameter should be set on the analysis of a composite experiment before the analysis runs:
28+
29+
.. jupyter-input::
30+
31+
parallel_exp = ParallelExperiment(
32+
[T1(physical_qubits=(i,), delays=delays) for i in range(2)]
33+
)
34+
parallel_exp.analysis.set_options(generate_figures="selective")
35+
36+
Discussion
37+
----------
38+
39+
These options are useful for large composite experiments, where generating all figures incurs a significant
40+
overhead.
41+
42+
See Also
43+
--------
44+
45+
* The `Visualization tutorial <visualization.html>`_ discusses how to customize figures

docs/manuals/characterization/stark_experiment.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ By default, the Stark tone is applied to the same channel as the qubit drive
104104
with a frequency shift. This frequency shift might update the channel frame,
105105
which accumulates unwanted phase against the frequency difference between
106106
the qubit drive :math:`f_0` and Stark tone frequencies :math:`f_S` in addition to
107-
the qubit Stark shfit :math:`\delta f_s`.
107+
the qubit Stark shift :math:`\delta f_s`.
108108
You can use a dedicated Stark drive channel if available.
109109
Otherwise, you may want to use a control channel associated with the physical
110110
drive port of the qubit.

docs/manuals/measurement/readout_mitigation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ experiments to generate the corresponding mitigators.
6060
num_qubits = len(qubits)
6161

6262
Standard mitigation experiment
63-
==============================
63+
------------------------------
6464

6565
The default mitigation experiment is *local*, meaning error probability
6666
is measured individually for each qubit. The experiment generates two
@@ -99,7 +99,7 @@ The individual mitigation matrices can be read off the mitigator.
9999
print()
100100

101101

102-
Mitigation Example
102+
Mitigation example
103103
------------------
104104

105105
.. jupyter-execute::

docs/manuals/verification/randomized_benchmarking.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ for the single qubit channel :math:`n=1`. Accordingly,
161161
162162
as a composition of depolarization from every primitive gates per qubit.
163163
This correction will give you two EPC values as a result of the two-qubit RB experiment.
164-
The corrected EPC must be closer to the outcome of of interleaved RB.
164+
The corrected EPC must be closer to the outcome of interleaved RB.
165165
The EPGs of two-qubit RB are analyzed with the corrected EPC if available.
166166

167167
.. jupyter-execute::

docs/tutorials/calibrations.rst

+2-6
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ This automatic updating can also be disabled using the ``auto_update`` flag.
3434
This tutorial requires the :mod:`qiskit_dynamics` package to run simulations.
3535
You can install it with ``python -m pip install qiskit-dynamics``.
3636

37-
.. note::
38-
This tutorial requires the ``pandas`` package to visualize calibration tables.
39-
You can install it with ``python -m pip install pandas``.
40-
4137
.. jupyter-execute::
4238

4339
import pandas as pd
@@ -382,7 +378,7 @@ instruction schedule map with this over/under-rotated pulse.
382378
over_amp = ideal_amp*1.02
383379
under_amp = ideal_amp*0.98
384380
print(f"The reported amplitude of the X pulse is {ideal_amp:.4f} which we set as ideal_amp.")
385-
print(f"we use {over_amp:.4f} amplitude for overroation pulse and {under_amp:.4f} for underrotation pulse.")
381+
print(f"we use {over_amp:.4f} amplitude for overrotation pulse and {under_amp:.4f} for underrotation pulse.")
386382
# build the over rotated pulse and add it to the instruction schedule map
387383
with pulse.build(backend=backend, name="x") as x_over:
388384
pulse.play(pulse.Drag(x_pulse.duration, over_amp, x_pulse.sigma, x_pulse.beta), d0)
@@ -441,7 +437,7 @@ error but also its sign.
441437
scale_under = target_angle / (target_angle + dtheta_under)
442438
print(f"The ideal angle is {target_angle:.2f} rad. We measured a deviation of {dtheta_over:.3f} rad in over-rotated pulse case.")
443439
print(f"Thus, scale the {over_amp:.4f} pulse amplitude by {scale_over:.3f} to obtain {over_amp*scale_over:.5f}.")
444-
print(f"On the other hand, we measued a deviation of {dtheta_under:.3f} rad in under-rotated pulse case.")
440+
print(f"On the other hand, we measured a deviation of {dtheta_under:.3f} rad in under-rotated pulse case.")
445441
print(f"Thus, scale the {under_amp:.4f} pulse amplitude by {scale_under:.3f} to obtain {under_amp*scale_under:.5f}.")
446442

447443

docs/tutorials/curve_analysis.rst

+5
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,11 @@ every logic defined in ``AnalysisA``.
266266
Curve Analysis workflow
267267
-----------------------
268268

269+
.. warning::
270+
271+
:class:`CurveData` dataclass is replaced with :class:`.ScatterTable` dataframe.
272+
This class will be deprecated and removed in the future release.
273+
269274
Typically curve analysis performs fitting as follows.
270275
This workflow is defined in the method :meth:`CurveAnalysis._run_analysis`.
271276

docs/tutorials/custom_experiment.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ to 10.
249249
self._circuit = circuit
250250
self._measured_qubits = measured_qubits
251251

252-
# Set any init optinos
252+
# Set any init options
253253
self.set_experiment_options(num_samples=num_samples, seed=seed)
254254

255255
Now we consider default experiment options. We choose to only let the user change
@@ -555,7 +555,7 @@ To test our code, we first simulate a noisy backend with asymmetric readout erro
555555

556556
backend_ideal = AerSimulator()
557557

558-
# Backend with asymetric readout error
558+
# Backend with asymmetric readout error
559559
p0g1 = 0.3
560560
p1g0 = 0.05
561561
noise_model = noise.NoiseModel()
@@ -588,7 +588,7 @@ Check that the experiment is appending a random Pauli and measurements as expect
588588
exp = RandomizedMeasurement(qc, num_samples=num_samples)
589589
exp.circuits()[0].draw("mpl")
590590

591-
We now run the experiment with a GHZ circuit on an ideal backend, whic produces nearly
591+
We now run the experiment with a GHZ circuit on an ideal backend, which produces nearly
592592
perfect symmetrical results between :math:`|0000\rangle` and :math:`|1111\rangle`:
593593

594594
.. jupyter-execute::

docs/tutorials/getting_started.rst

+32-5
Original file line numberDiff line numberDiff line change
@@ -238,21 +238,24 @@ supports can be set:
238238

239239
exp.set_run_options(shots=1000,
240240
meas_level=MeasLevel.CLASSIFIED)
241+
print(f"Shots set to {exp.run_options.get('shots')}, "
242+
"measurement level set to {exp.run_options.get('meas_level')}")
241243

242244
Consult the documentation of the run method of your
243245
specific backend type for valid options.
244246
For example, see :meth:`qiskit_ibm_provider.IBMBackend.run` for IBM backends.
245247

246248
Transpile options
247249
-----------------
248-
These options are passed to the Terra transpiler to transpile the experiment circuits
250+
These options are passed to the Qiskit :mod:`~qiskit.transpiler` to transpile the experiment circuits
249251
before execution:
250252

251253
.. jupyter-execute::
252254

253255
exp.set_transpile_options(scheduling_method='asap',
254256
optimization_level=3,
255257
basis_gates=["x", "sx", "rz"])
258+
print(f"Transpile options are {exp.transpile_options}")
256259

257260
Consult the documentation of :func:`qiskit.compiler.transpile` for valid options.
258261

@@ -267,14 +270,15 @@ upon experiment instantiation, but can also be explicitly set via
267270
exp = T1(physical_qubits=(0,), delays=delays)
268271
new_delays=np.arange(1e-6, 600e-6, 50e-6)
269272
exp.set_experiment_options(delays=new_delays)
273+
print(f"Experiment options are {exp.experiment_options}")
270274

271275
Consult the :doc:`API documentation </apidocs/index>` for the options of each experiment
272276
class.
273277

274278
Analysis options
275279
----------------
276280

277-
These options are unique to each analysis class. Unlike the other options, analyis
281+
These options are unique to each analysis class. Unlike the other options, analysis
278282
options are not directly set via the experiment object but use instead a method of the
279283
associated ``analysis``:
280284

@@ -295,7 +299,7 @@ Running experiments on multiple qubits
295299
======================================
296300

297301
To run experiments across many qubits of the same device, we use **composite
298-
experiments**. A composite experiment is a parent object that contains one or more child
302+
experiments**. A :class:`.CompositeExperiment` is a parent object that contains one or more child
299303
experiments, which may themselves be composite. There are two core types of composite
300304
experiments:
301305

@@ -323,7 +327,7 @@ Note that when the transpile and run options are set for a composite experiment,
323327
child experiments's options are also set to the same options recursively. Let's examine
324328
how the parallel experiment is constructed by visualizing child and parent circuits. The
325329
child experiments can be accessed via the
326-
:meth:`~.ParallelExperiment.component_experiment` method, which indexes from zero:
330+
:meth:`~.CompositeExperiment.component_experiment` method, which indexes from zero:
327331

328332
.. jupyter-execute::
329333

@@ -333,6 +337,16 @@ child experiments can be accessed via the
333337

334338
parallel_exp.component_experiment(1).circuits()[0].draw(output='mpl')
335339

340+
Similarly, the child analyses can be accessed via :meth:`.CompositeAnalysis.component_analysis` or via
341+
the analysis of the child experiment class:
342+
343+
.. jupyter-execute::
344+
345+
parallel_exp.component_experiment(0).analysis.set_options(plot = True)
346+
347+
# This should print out what we set because it's the same option
348+
print(parallel_exp.analysis.component_analysis(0).options.get("plot"))
349+
336350
The circuits of all experiments assume they're acting on virtual qubits starting from
337351
index 0. In the case of a parallel experiment, the child experiment
338352
circuits are composed together and then reassigned virtual qubit indices:
@@ -393,4 +407,17 @@ into one level:
393407
parallel_data = parallel_exp.run(backend, seed_simulator=101).block_for_results()
394408

395409
for result in parallel_data.analysis_results():
396-
print(result)
410+
print(result)
411+
412+
Broadcasting analysis options to child experiments
413+
--------------------------------------------------
414+
415+
Use the `broadcast` parameter to set analysis options to each of the child experiments.
416+
417+
.. jupyter-execute::
418+
419+
parallel_exp.analysis.set_options(plot=False, broadcast=True)
420+
421+
If the child experiment inherits from :class:`.CompositeExperiment` (such as :class:`.ParallelExperiment`
422+
and :class:`.BatchExperiment` classes), this process will continue to work recursively.
423+
In this instance, the analysis will not generate a figure for the child experiment after the analysis.

0 commit comments

Comments
 (0)