Skip to content

Commit

Permalink
Convert images to AVIF (Qiskit#2555)
Browse files Browse the repository at this point in the history
This PR converts all existing PNG and JPG images to AVIF and updates the
markdown to point to the new files. This is blocked by a PR in
inner-source that will add support for AVIF images.

<details><summary>Conversion script</summary>

```python
from pathlib import Path
import subprocess

# I ran this again with the extension changed to ".jpg"
image_files = Path("public/").rglob("**/*.png")

def to_relative(path: Path) -> str:
    return str(path).removeprefix("public/")

for file in image_files:
    outfile = file.with_suffix(".avif")
    subprocess.run(f"magick {file} {outfile} && rm {file}", shell=True)
    subprocess.run(f"sd -s '{to_relative(file)}' '{to_relative(outfile)}' docs/**/*", shell=True)
```

And then I had to follow it up with this (run from `docs/`) to clean up
links that didn't work for some reason.

```sh
rg '\.png\)' -l | xargs sd -s '.png)' '.avif)'
```

</details>

This PR also enables the AVIF conversion in the API docs sync script,
and the AVIF linter for markdown files.
  • Loading branch information
frankharkins authored Jan 10, 2025
1 parent b54ddb9 commit ca11486
Show file tree
Hide file tree
Showing 8,216 changed files with 3,150 additions and 3,142 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
4 changes: 2 additions & 2 deletions docs/api/qiskit-addon-mpf/backends-quimb-layers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Let us now inspect the time-evolution circuit of this Hamiltonian using a second
<Figure size 956...x869... with 1 Axes>
```

![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-2.png)
![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-2.avif)

In the circuit above, we can clearly identify its layer-wise structure. We can emphasize this further, by splitting the circuit into multiple layers as shown below (we recombine the `layers` into a single circuit with barriers between them to ease the visualization).

Expand All @@ -72,7 +72,7 @@ In the circuit above, we can clearly identify its layer-wise structure. We can e
<Figure size 1374...x869... with 1 Axes>
```

![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-3.png)
![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-quimb_layers-3.avif)

<Admonition title="Hint" type="note">
The asymmetry of the central layers is a result of the implementation of Qiskit’s [`SuzukiTrotter`](/api/qiskit/qiskit.synthesis.SuzukiTrotter "(in Qiskit v1.3)") formula. In its second-order form, it combines the two half-time evolutions of the final term in the Hamiltonian into a single one of twice the length. We could transpile this circuit to collapse all such subequent gates in the central two layers (just like the last one), but for the sake of simplicity of this example, we will not do that here.
Expand Down
4 changes: 2 additions & 2 deletions docs/api/qiskit-addon-mpf/backends-tenpy-layers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Let us now inspect the time-evolution circuit of this Hamiltonian using a second
<Figure size 956...x869... with 1 Axes>
```

![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-tenpy_layers-2.png)
![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-tenpy_layers-2.avif)

In the circuit above, we can clearly identify its layer-wise structure. We can emphasize this further, by splitting the circuit into multiple layers as shown below (we recombine the `layers` into a single circuit with barriers between them to ease the visualization).

Expand All @@ -76,7 +76,7 @@ In the circuit above, we can clearly identify its layer-wise structure. We can e
<Figure size 1374...x869... with 1 Axes>
```

![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-tenpy_layers-3.png)
![Output from the previous code.](/images/api/qiskit-addon-mpf/qiskit_addon_mpf-backends-tenpy_layers-3.avif)

<Admonition title="Hint" type="note">
The asymmetry of the central layers is a result of the implementation of Qiskit’s [`SuzukiTrotter`](/api/qiskit/qiskit.synthesis.SuzukiTrotter "(in Qiskit v1.3)") formula. In its second-order form, it combines the two half-time evolutions of the final term in the Hamiltonian into a single one of twice the length. We could transpile this circuit to collapse all such subequent gates in the central two layers (just like the last one), but for the sake of simplicity of this example, we will not do that here.
Expand Down
14 changes: 7 additions & 7 deletions docs/api/qiskit-addon-obp/utils-visualization.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Various visualization utilities.
>>> plot_accumulated_error(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-2.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-2.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The accumulated error due to truncated Pauli terms is displayed along the y-axis. If `OBPMetadata.truncation_error_budget.max_error_total` is not [`numpy.inf`](https://numpy.org/doc/stable/reference/constants.html#numpy.inf "(in NumPy v2.2)"), it is displayed as a red horizontal line. Each observable that was backpropagated, gets its own line.

Expand Down Expand Up @@ -60,7 +60,7 @@ Various visualization utilities.
>>> plot_left_over_error_budget(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-4.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-4.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The left-over error budget available at each backpropagation step is displayed along the y-axis. Since each observable that was backpropagated has its own budget, they are plotted as separate lines.

Expand Down Expand Up @@ -88,7 +88,7 @@ Various visualization utilities.
>>> plot_slice_errors(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-6.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-6.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The truncation error incurred at each backpropagation step is displayed along the y-axis. Since each observable is treated individually, they are plotted separately.

Expand Down Expand Up @@ -118,7 +118,7 @@ Various visualization utilities.
>>> plot_num_paulis(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-8.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-8.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The number of Pauli terms at each backpropagation step is displayed along the y-axis. Since each observable is treated individually, they are plotted separately.

Expand Down Expand Up @@ -148,7 +148,7 @@ Various visualization utilities.
>>> plot_num_truncated_paulis(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-10.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-10.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The number of truncated Pauli terms at each backpropagation step is displayed along the y-axis. Since each observable is treated individually, they are plotted separately.

Expand Down Expand Up @@ -178,7 +178,7 @@ Various visualization utilities.
>>> plot_sum_paulis(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-12.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-12.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The total number of all Pauli terms at each backpropagation step is displayed along the y-axis. If `OBPMetadata.operator_budget.max_paulis` is not None, it is displayed as a red horizontal line.

Expand Down Expand Up @@ -208,7 +208,7 @@ Various visualization utilities.
>>> plot_num_qwc_groups(metadata, axes)
```

![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-14.png)
![Output from the previous code.](/images/api/qiskit-addon-obp/qiskit_addon_obp-utils-visualization-14.avif)

As you can see in the figure above, the number of backpropagated slices is displayed along the x-axis. You can think of this as the “time” of the backpropagation algorithm. The number of qubit-wise commuting Pauli groups at each backpropagation step is displayed along the y-axis. If `OBPMetadata.operator_budget.max_qwc_groups` is not None, it is displayed as a red horizontal line.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/qiskit-addon-utils/problem-generators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ $$
>>> _ = circ.draw("mpl", fold=-1)
```

![Output from the previous code.](/images/api/qiskit-addon-utils/qiskit_addon_utils-problem_generators-1.png)
![Output from the previous code.](/images/api/qiskit-addon-utils/qiskit_addon_utils-problem_generators-1.avif)

**Parameters**

Expand Down
6 changes: 3 additions & 3 deletions docs/api/qiskit-ibm-runtime/0.18/fake_provider.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ counts = job.result().get_counts()
plot_histogram(counts)
```

![../\_images/fake\_provider-1\_00.png](/images/api/qiskit-ibm-runtime/0.18/fake_provider-1_00.png)
![../\_images/fake\_provider-1\_00.png](/images/api/qiskit-ibm-runtime/0.18/fake_provider-1_00.avif)

![../\_images/fake\_provider-1\_01.png](/images/api/qiskit-ibm-runtime/0.18/fake_provider-1_01.png)
![../\_images/fake\_provider-1\_01.png](/images/api/qiskit-ibm-runtime/0.18/fake_provider-1_01.avif)

![../\_images/fake\_provider-1\_02.png](/images/api/qiskit-ibm-runtime/0.18/fake_provider-1_02.png)
![../\_images/fake\_provider-1\_02.png](/images/api/qiskit-ibm-runtime/0.18/fake_provider-1_02.avif)

<Admonition title="Important" type="danger">
Please note that the simulation is done using a noise model generated from system snapshots obtained in the past (sometimes a few years ago) and the results are not representative of the latest behaviours of the real quantum system which the fake backend is mimicking. If you want to run noisy simulations to compare with the real quantum system, you should use the `qiskit_aer` library. After installation, you can follow the steps below to generate a simulator that mimics a real quantum system with the latest calibration results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ scheduled_teleport = pm.run(teleport)
scheduled_teleport.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_0\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_0_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_0\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_0_0.avif)

Instead of padding with delays we may also insert a dynamical decoupling sequence using the [`PadDynamicalDecoupling`](qiskit_ibm_runtime.transpiler.passes.scheduling.PadDynamicalDecoupling "qiskit_ibm_runtime.transpiler.passes.scheduling.PadDynamicalDecoupling") pass as shown below:

Expand All @@ -99,7 +99,7 @@ dd_teleport = pm.run(teleport)
dd_teleport.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_1\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_1_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_1\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_1_0.avif)

When compiling a circuit with Qiskit, it is more efficient and more robust to perform all the transformations in a single transpilation. This has been done above by extending Qiskit’s preset pass managers. For example, Qiskit’s `transpile()` function internally builds its pass set by using `generate_preset_pass_manager()`. This returns instances of `StagedPassManager`, which can be extended.

Expand All @@ -115,7 +115,7 @@ qc_c_if.x(0).c_if(0, 1)
qc_c_if.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_2\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_2_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_2\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_2_0.avif)

The [`IBMBackend`](qiskit_ibm_runtime.IBMBackend "qiskit_ibm_runtime.IBMBackend") configures a translation plugin `IBMTranslationPlugin` to automatically apply transformations and optimizations for IBM hardware backends when invoking `transpile()`. This will automatically convert all old style `c_if` conditioned gates to new-style control-flow. We may then schedule the transpiled circuit without further modification.

Expand All @@ -135,7 +135,7 @@ qc_if_dd = pm.run(qc_c_if, backend)
qc_if_dd.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_3\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_3_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_3\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_3_0.avif)

If you are not using the transpiler plugin stages to work around this please manually run the pass `qiskit.transpiler.passes.ConvertConditionsToIfOps` prior to your scheduling pass.

Expand All @@ -155,7 +155,7 @@ qc_if_dd = pm.run(qc_c_if)
qc_if_dd.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_4\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_4_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_4\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_4_0.avif)

<span id="exploiting-ibm-backend-s-local-parallel-fast-path" />

Expand All @@ -178,7 +178,7 @@ with qc.if_test((1, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_5\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_5_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_5\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_5_0.avif)

The circuit below will not use the fast-path as the conditional gate is on a different qubit than the measurement qubit.

Expand All @@ -191,7 +191,7 @@ with qc.if_test((0, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_6\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_6_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_6\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_6_0.avif)

Similarly, the circuit below contains gates on multiple qubits and will not be performed using the fast-path.

Expand All @@ -205,7 +205,7 @@ with qc.if_test((0, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_7\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_7_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_7\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_7_0.avif)

A fast-path block may contain multiple gates as long as they are on the fast-path qubit. If there are multiple fast-path blocks being performed in parallel each block will be padded out to the duration of the longest block.

Expand All @@ -223,7 +223,7 @@ with qc.if_test((1, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_8\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_8_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_8\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_8_0.avif)

This behavior is also applied to the else condition of a fast-path eligible branch.

Expand All @@ -240,7 +240,7 @@ with else_:
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_9\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_9_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_9\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_9_0.avif)

If a single measurement result is used with several conditional blocks, if there is a fast-path eligible block it will be applied followed by the non-fast-path blocks which will execute with the standard higher latency conditional branch.

Expand All @@ -258,7 +258,7 @@ with qc.if_test((0, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_10\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_10_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_10\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_10_0.avif)

If you wish to prevent the usage of the fast-path you may insert a barrier between the measurement and the conditional branch.

Expand All @@ -273,7 +273,7 @@ with qc.if_test((0, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_11\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_11_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_11\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_11_0.avif)

Conditional measurements are not eligible for the fast-path.

Expand All @@ -287,7 +287,7 @@ with qc.if_test((0, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_12\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_12_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_12\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_12_0.avif)

Similarly nested control-flow is not eligible.

Expand All @@ -303,7 +303,7 @@ with qc.if_test((0, 1)):
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_13\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_13_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_13\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_13_0.avif)

The scheduler is aware of the fast-path behavior and will not insert delays on idle qubits in blocks that satisfy the fast-path conditions so as to avoid preventing the backend compiler from performing the necessary optimizations to utilize the fast-path. If 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

Expand Down Expand Up @@ -337,7 +337,7 @@ qc_dd = pm.run(qc)
qc_dd.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_14\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_14_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_14\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_14_0.avif)

<Admonition title="Note" type="note">
If there are qubits that are *not* involved in a fast-path decision it is not currently possible to use them in a fast-path branch in parallel with the fast-path qubits resulting from a measurement. This will be revised in the future as we further improve these capabilities.
Expand All @@ -361,7 +361,7 @@ qc_dd.draw(output="mpl", style="iqp")
qc.draw(output="mpl", style="iqp")
```

![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_15\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_15_0.png)
![../\_images/qiskit\_ibm\_runtime.transpiler.passes.scheduling\_15\_0.png](/images/api/qiskit-ibm-runtime/0.18/qiskit_ibm_runtime.transpiler.passes.scheduling_15_0.avif)
</Admonition>

<span id="scheduling-dynamical-decoupling" />
Expand Down
Loading

0 comments on commit ca11486

Please sign in to comment.