Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Replace jupyter-execute
Browse files Browse the repository at this point in the history
  • Loading branch information
kt474 committed Apr 16, 2024
1 parent f42f137 commit 7795a32
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 29 deletions.
8 changes: 4 additions & 4 deletions qiskit_ibm_provider/jupyter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,28 @@
Detailed information on a single backend
========================================
.. jupyter-execute::
.. code-block:: python
:hide-code:
:hide-output:
from qiskit_ibm_provider.test.ibm_provider_mock import mock_get_backend
mock_get_backend('Fake1Q')
.. jupyter-execute::
.. code-block:: python
from qiskit_ibm_provider import IBMProvider
import qiskit_ibm_provider.jupyter
provider = IBMProvider(hub='ibm-q')
backend = provider.get_backend('ibmq_vigo')
.. jupyter-execute::
.. code-block:: python
:hide-code:
:hide-output:
backend.jobs = lambda *args, **kwargs: []
.. jupyter-execute::
.. code-block:: python
backend
Expand Down
2 changes: 1 addition & 1 deletion qiskit_ibm_provider/jupyter/dashboard/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
The dashboard can be instantiated using
.. jupyter-execute::
.. code-block:: python
from qiskit_ibm_provider import IBMProvider
import qiskit_ibm_provider.jupyter
Expand Down
34 changes: 17 additions & 17 deletions qiskit_ibm_provider/transpiler/passes/scheduling/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
Below we demonstrate how to schedule and pad a teleportation circuit with delays
for a dynamic circuit backend's execution model:
.. jupyter-execute::
.. code-block:: python
:hide-code:
:hide-output:
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
.. jupyter-execute::
.. code-block:: python
from qiskit.circuit import ClassicalRegister, QuantumCircuit, QuantumRegister
from qiskit.transpiler.preset_passmanagers import generate_preset_pass_manager
Expand Down Expand Up @@ -96,7 +96,7 @@
Instead of padding with delays we may also insert a dynamical decoupling sequence
using the :class:`PadDynamicalDecoupling` pass as shown below:
.. jupyter-execute::
.. code-block:: python
from qiskit.circuit.library import XGate
Expand Down Expand Up @@ -129,7 +129,7 @@
Scheduling with old format ``c_if`` conditioned gates is not supported.
.. jupyter-execute::
.. code-block:: python
qc_c_if = QuantumCircuit(1, 1)
qc_c_if.x(0).c_if(0, 1)
Expand All @@ -142,7 +142,7 @@
conditioned gates to new-style control-flow.
We may then schedule the transpiled circuit without further modification.
.. jupyter-execute::
.. code-block:: python
# Temporary workaround for mock backends. For real backends this is not required.
backend.get_translation_stage_plugin = lambda: "ibm_dynamic_circuits"
Expand All @@ -164,7 +164,7 @@
:class:`qiskit.transpiler.passes.ConvertConditionsToIfOps`
prior to your scheduling pass.
.. jupyter-execute::
.. code-block:: python
from qiskit.transpiler.passes import ConvertConditionsToIfOps
Expand Down Expand Up @@ -193,7 +193,7 @@
as the measurements flow directly into the conditional blocks which in turn only apply
gates to the same measurement qubit.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(2, 2)
qc.measure(0, 0)
Expand All @@ -210,7 +210,7 @@
The circuit below will not use the fast-path as the conditional gate is
on a different qubit than the measurement qubit.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(2, 2)
qc.measure(0, 0)
Expand All @@ -222,7 +222,7 @@
Similarly, the circuit below contains gates on multiple qubits
and will not be performed using the fast-path.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(2, 2)
qc.measure(0, 0)
Expand All @@ -236,7 +236,7 @@
If there are multiple fast-path blocks being performed in parallel each block will be
padded out to the duration of the longest block.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(2, 2)
qc.measure(0, 0)
Expand All @@ -252,7 +252,7 @@
This behavior is also applied to the else condition of a fast-path eligible branch.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(1, 1)
qc.measure(0, 0)
Expand All @@ -270,7 +270,7 @@
eligible block it will be applied followed by the non-fast-path blocks which will execute with
the standard higher latency conditional branch.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(2, 2)
qc.measure(0, 0)
Expand All @@ -287,7 +287,7 @@
If you wish to prevent the usage of the fast-path you may insert a barrier between the measurement and
the conditional branch.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(1, 2)
qc.measure(0, 0)
Expand All @@ -300,7 +300,7 @@
Conditional measurements are not eligible for the fast-path.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(1, 2)
qc.measure(0, 0)
Expand All @@ -312,7 +312,7 @@
Similarly nested control-flow is not eligible.
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(1, 1)
qc.measure(0, 0)
Expand All @@ -331,7 +331,7 @@
there are fast-path blocks that will be performed in parallel they currently *will not*
be padded out by the scheduler to ensure they are of the same duration in Qiskit
.. jupyter-execute::
.. code-block:: python
dd_sequence = [XGate(), XGate()]
Expand Down Expand Up @@ -369,7 +369,7 @@
For example:
.. jupyter-execute::
.. code-block:: python
qc = QuantumCircuit(3, 2)
qc.x(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class PadDynamicalDecoupling(BlockBasePadder):
This pass ensures that the inserted sequence preserves the circuit exactly
(including global phase).
.. jupyter-execute::
.. code-block:: python
import numpy as np
from qiskit.circuit import QuantumCircuit
Expand All @@ -75,7 +75,7 @@ class PadDynamicalDecoupling(BlockBasePadder):
("x", None, 50), ("measure", None, 1000)]
)
.. jupyter-execute::
.. code-block:: python
# balanced X-X sequence on all qubits
dd_sequence = [XGate(), XGate()]
Expand All @@ -84,7 +84,7 @@ class PadDynamicalDecoupling(BlockBasePadder):
circ_dd = pm.run(circ)
circ_dd.draw()
.. jupyter-execute::
.. code-block:: python
# Uhrig sequence on qubit 0
n = 8
Expand Down
4 changes: 2 additions & 2 deletions qiskit_ibm_provider/visualization/interactive/error_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def iplot_error_map(
VisualizationTypeError: If the specified `backend` is a simulator.
Example:
.. jupyter-execute::
.. code-block:: python
:hide-code:
:hide-output:
Expand All @@ -65,7 +65,7 @@ def iplot_error_map(
# a fake backend in the following cell.
mock_get_backend('FakeOpenPulse2Q')
.. jupyter-execute::
.. code-block:: python
from qiskit_ibm_provider import IBMProvider
from qiskit_ibm_provider.visualization import iplot_error_map
Expand Down
4 changes: 2 additions & 2 deletions qiskit_ibm_provider/visualization/interactive/gate_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def iplot_gate_map(
Example:
.. jupyter-execute::
.. code-block:: python
:hide-code:
:hide-output:
Expand All @@ -69,7 +69,7 @@ def iplot_gate_map(
# a fake backend in the following cell.
mock_get_backend('FakeOpenPulse2Q')
.. jupyter-execute::
.. code-block:: python
from qiskit_ibm_provider import IBMProvider
from qiskit_ibm_provider.visualization import iplot_gate_map
Expand Down

0 comments on commit 7795a32

Please sign in to comment.