Skip to content

Commit 8bda25d

Browse files
coruscatingwshanks
andauthored
Add sessions how-to and update links (#1297)
### Summary This PR adds a sessions how-to based on the discussions in #1226. It also updates some outdated documentation, such as the links to the Qiskit Textbook which were all broken. --------- Co-authored-by: Will Shanks <willshanks@us.ibm.com>
1 parent 8556c08 commit 8bda25d

File tree

19 files changed

+82
-51
lines changed

19 files changed

+82
-51
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,17 @@ https://stestr.readthedocs.io/en/stable/MANUAL.html#test-selection
104104
If you want to run a single test module, test class, or individual test method you can
105105
do this faster with the `-n`/`--no-discover` option. For example, to run a module:
106106
```
107-
tox -- -n test.python.test_examples
107+
tox -epy310 -- -n test.framework.test_composite
108108
```
109-
Or to run the same module by path:
110109

111-
```
112-
tox -- -n test/python/test_examples.py
113-
```
114110
To run a class:
115-
116111
```
117-
tox -- -n test.python.test_examples.TestPythonExamples
112+
tox -epy310 -- -n test.framework.test_composite.TestCompositeExperimentData
118113
```
114+
119115
To run a method:
120116
```
121-
tox -- -n test.python.test_examples.TestPythonExamples.test_all_examples
117+
tox -epy310 -- -n test.framework.test_composite.TestCompositeExperimentData.test_composite_save_load
122118
```
123119

124120
Note that tests will fail automatically if they do not finish execution within 60 seconds.

docs/_ext/custom_styles/formatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def format_header(self, lines: List[str]) -> List[str]:
3838
def format_overview(self, lines: List[str]) -> List[str]:
3939
"""Format overview section."""
4040
format_lines = [
41-
""
41+
"",
4242
".. rubric:: Overview",
4343
"",
4444
]
@@ -167,7 +167,7 @@ def format_analysis_opts(self, lines: List[str]) -> List[str]:
167167
format_lines = [
168168
".. rubric:: Analysis options",
169169
"",
170-
"These are the keyword arguments of :meth:`run` method.",
170+
"These are the keyword arguments of the :meth:`run` method.",
171171
"",
172172
]
173173
for line in _write_options(lines, self.indent):

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
"qiskit_ibm_provider": ("https://qiskit.org/ecosystem/ibm-provider/", None),
175175
"qiskit_aer": ("https://qiskit.org/ecosystem/aer", None),
176176
"qiskit_dynamics": ("https://qiskit.org/documentation/dynamics", None),
177+
"qiskit_ibm_runtime": ("https://qiskit.org/ecosystem/ibm-runtime/", None),
177178
}
178179

179180

docs/howtos/cloud_service.rst

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,4 @@ Web interface
189189

190190
You can also view experiment results as well as change the tags and share level at the `IBM Quantum Experiments
191191
pane <https://quantum-computing.ibm.com/experiments?date_interval=last-90-days&owner=me>`__
192-
on the cloud. The documentation below explains how to view, search, and share experiment
193-
data entries.
194-
195-
See also
196-
--------
197-
198-
* `Experiments web interface documentation <https://quantum-computing.ibm.com/lab/docs/iql/manage/experiments/>`__
199-
192+
on the cloud.

docs/howtos/runtime_sessions.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Use Experiments with Runtime sessions
2+
=====================================
3+
4+
Problem
5+
-------
6+
7+
You want to run experiments in a `Runtime session
8+
<https://qiskit.org/ecosystem/ibm-runtime/sessions.html>`_ so that jobs can run in close temporal proximity.
9+
10+
Solution
11+
--------
12+
13+
Use the :class:`~qiskit_ibm_provider.IBMBackend` object in ``qiskit-ibm-provider``, which supports sessions.
14+
15+
In this example, we will set the ``max_circuits`` property to an artificially low value so that the experiment will be
16+
split into multiple jobs that run sequentially in a single session. When running real experiments with a
17+
large number of circuits that can't fit in a single job, it may be helpful to follow this usage pattern:
18+
19+
.. jupyter-input::
20+
21+
from qiskit_ibm_provider import IBMProvider
22+
from qiskit_experiments.library.tomography import ProcessTomography
23+
from qiskit import QuantumCircuit
24+
25+
provider = IBMProvider()
26+
backend = provider.get_backend("ibm_nairobi")
27+
qc = QuantumCircuit(1)
28+
qc.x(0)
29+
30+
with backend.open_session() as session:
31+
exp = ProcessTomography(qc)
32+
exp.set_experiment_options(max_circuits=3)
33+
exp_data = exp.run(backend)
34+
exp_data.block_for_results()
35+
# Calling cancel because session.close() is not available for qiskit-ibm-provider<=0.7.2.
36+
# It is safe to call cancel since block_for_results() ensures there are no outstanding jobs
37+
# still running that would be canceled.
38+
session.cancel()
39+
40+
Note that runtime primitives are not currently supported natively in Qiskit Experiments, so
41+
the ``backend.run()`` path is required to run experiments.

docs/manuals/measurement/readout_mitigation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,4 +180,4 @@ See also
180180

181181
* API documentation: :mod:`~qiskit_experiments.library.characterization.LocalReadoutError`,
182182
:mod:`~qiskit_experiments.library.characterization.CorrelatedReadoutError`
183-
* Qiskit Textbook: `Measurement Error Mitigation <https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html>`__
183+
* Qiskit Textbook: `Measurement Error Mitigation <https://github.com/Qiskit/textbook/blob/main/notebooks/quantum-hardware/measurement-error-mitigation.ipynb>`__

docs/manuals/verification/quantum_volume.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ that the computer successfully implements. Quantum computing systems
88
with high-fidelity operations, high connectivity, large calibrated gate
99
sets, and circuit rewriting toolchains are expected to have higher
1010
quantum volumes. See the `Qiskit
11-
Textbook <https://learn.qiskit.org/course/quantum-hardware/measuring-quantum-volume>`__
11+
Textbook <https://github.com/Qiskit/textbook/blob/main/notebooks/quantum-hardware/measuring-quantum-volume.ipynb>`__
1212
for an explanation on the QV method, which is described in Refs. [1]_ [2]_.
1313

1414
The Quantum Volume is determined by the largest successful circuit depth
@@ -20,8 +20,8 @@ a random permutation on the :math:`d` qubit. Then these circuits run on
2020
the quantum backend and on an ideal simulator (either :class:`qiskit_aer.AerSimulator`
2121
or :class:`qiskit.quantum_info.Statevector`).
2222

23-
A depth :math:`d` QV circuit is successful if it has mean heavy-output
24-
probability > 2/3 with confidence level > 0.977 (corresponding to
23+
A depth :math:`d` QV circuit is successful if it has `mean heavy-output
24+
probability` > 2/3 with confidence level > 0.977 (corresponding to
2525
z_value = 2), and at least 100 trials have been ran.
2626

2727
.. note::
@@ -68,7 +68,7 @@ more trials may reduce the error bars to allow passing the threshold.
6868

6969
The analysis results of the QV Experiment are:
7070

71-
- The mean heavy output probabilities (HOP) and standard deviation
71+
- The mean heavy-output probabilities (HOP) and standard deviation
7272

7373
- The calculated quantum volume, which will be None if the experiment
7474
does not pass the threshold
@@ -190,5 +190,5 @@ See also
190190
--------
191191

192192
* API documentation: :mod:`~qiskit_experiments.library.quantum_volume`
193-
* Qiskit Textbook: `Measuring Quantum Volume <https://qiskit.org/textbook/ch-quantum-hardware/measuring-quantum-volume.html>`__
193+
* Qiskit Textbook: `Measuring Quantum Volume <https://github.com/Qiskit/textbook/blob/main/notebooks/quantum-hardware/measuring-quantum-volume.ipynb>`__
194194

docs/manuals/verification/randomized_benchmarking.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ identity. After running the circuits, the number of shots resulting in an error
88
output different from the ground state) are counted, and from this data one can infer
99
error estimates for the quantum device, by calculating the Error Per Clifford. See the
1010
`Qiskit Textbook
11-
<https://learn.qiskit.org/course/quantum-hardware/randomized-benchmarking>`__ for an
11+
<https://github.com/Qiskit/textbook/blob/main/notebooks/quantum-hardware/randomized-benchmarking.ipynb>`__ for an
1212
explanation on the RB method, which is based on Refs. [1]_ [2]_.
1313

1414
.. jupyter-execute::
@@ -309,4 +309,4 @@ See also
309309
--------
310310

311311
* API documentation: :mod:`~qiskit_experiments.library.randomized_benchmarking`
312-
* Qiskit Textbook: `Randomized Benchmarking <https://learn.qiskit.org/course/quantum-hardware/randomized-benchmarking>`__
312+
* Qiskit Textbook: `Randomized Benchmarking <https://github.com/Qiskit/textbook/blob/main/notebooks/quantum-hardware/randomized-benchmarking.ipynb>`__

docs/tutorials/calibrations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ See also
491491
--------
492492

493493
* API documentation: :mod:`~qiskit_experiments.calibration_management` and :mod:`~qiskit_experiments.library.calibration`
494-
* Qiskit Textbook: `Calibrating Qubits with Qiskit Pulse <https://qiskit.org/textbook/ch-quantum-hardware/calibrating-qubits-pulse.html>`__
494+
* Qiskit Textbook: `Calibrating Qubits with Qiskit Pulse <https://github.com/Qiskit/textbook/blob/main/notebooks/quantum-hardware-pulses/calibrating-qubits-pulse.ipynb>`__
495495

496496

497497

qiskit_experiments/data_processing/data_processor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ class DataProcessor:
4848
A DataProcessor defines a sequence of operations to perform on experimental data.
4949
Calling an instance of DataProcessor applies this sequence on the input argument.
5050
A DataProcessor is created with a list of DataAction instances. Each DataAction
51-
applies its _process method on the data and returns the processed data. The nodes
51+
applies its ``_process`` method on the data and returns the processed data. The nodes
5252
in the DataProcessor may also perform data validation and some minor formatting.
5353
The output of one data action serves as input for the next data action.
54-
DataProcessor.__call__(datum) usually takes in an entry from the data property of
54+
``DataProcessor.__call__(datum)`` usually takes in an entry from the data property of
5555
an ExperimentData object (i.e. a dict containing metadata and memory keys and
5656
possibly counts, like the Result.data property) and produces the formatted data.
57-
DataProcessor.__call__(datum) extracts the data from the given datum under
58-
DataProcessor._input_key (which is specified at initialization) of the given datum.
57+
``DataProcessor.__call__(datum)`` extracts the data from the given datum under
58+
``DataProcessor._input_key`` (which is specified at initialization) of the given datum.
5959
"""
6060

6161
def __init__(

0 commit comments

Comments
 (0)