Visualization Tools (qiskit_addon_slc.visualization)¶
Visualization methods for shaded lightcones.
This module provides visualization methods for shaded lightcones.
- draw_shaded_lightcone(circuit, bounds, noise_model_paulis, *, pauli_filter=None, include_empty_boxes=True, **rendering_kwargs)[source]¶
Draws a shaded lightcone.
First, the provided
boundsare accumulated and filtered according topauli_filter. See alsoaccumulate_filtered_bounds(). Then, the resulting bounds are overlaid onto the providedcircuit(seeoverlay_bounds_onto_circuit()) and subsequently rendered (seerender_bounds()).- Parameters:
circuit (QuantumCircuit) – the circuit whose shaded lightcone to draw.
bounds (dict[str, PauliLindbladMap]) – the bounds to use for the shaded lightcone.
noise_model_paulis (dict[str, QubitSparsePauliList]) – the Pauli error terms of the circuit’s noise models.
pauli_filter (Pauli | str | int | None) – the optional Pauli type by which the bounds were filtered.
include_empty_boxes (bool) – whether to include empty boxes or not.
rendering_kwargs – any additional keyword arguments are forwarded to
QuantumCircuit.draw().
- Returns:
The
mplfigure.- Return type:
Figure
- accumulate_filtered_bounds(circuit, bounds, noise_model_paulis, pauli_filter=None)[source]¶
Accumulates the bound values filtered by a specified Pauli type.
- Parameters:
circuit (QuantumCircuit) – the circuit whose bounds to accumulate.
bounds (dict[str, PauliLindbladMap]) – the bounds whose values to accumulate.
noise_model_paulis (dict[str, QubitSparsePauliList]) – the Pauli noise terms for each noise model.
pauli_filter (Pauli | str | int | None) – the optional Pauli type to filter by. It behaves as follows: -
None: accumulates all noise term bounds of equal support. -int: only accumulates noise term bounds of the specified Pauli weight. -str: selects this specific Pauli noise term. -Pauli: selects this specific Pauli noise term.
- Returns:
A nested dictionary. The outer most key is the
InjectNoise.modifier_ref(same as the originalbounds). The next key is the support of the accumulated and filtered bound value (i.e. a tuple of integers). This maps to the actual bound value as a float.- Return type:
- overlay_bounds_onto_circuit(pauli_bounds, circuit, *, include_empty_boxes=True)[source]¶
Overlays the bounds onto the circuit.
This produces a new “QuantumCircuit” with “fake” gates reproducing those
BoxOpinstructions from the originalcircuitthat had anInjectNoiseannotation. Those boxes are replaced by visual representations of the computed bounds for Pauli errors of their respective support (see alsoaccumulate_filtered_bounds()).- Parameters:
- Returns:
A “fake” quantum circuit with “Gate” instructions displaying the computed bound values. The returned quantum circuit’s
QuantumCircuit.metadatacontains the maximum bound value under “max_bound”.- Return type:
- render_bounds(bounds_circuit, *, pauli_filter=None, **kwargs)[source]¶
Renders a quantum circuit with overlaid bounds and according styling.
- Parameters:
bounds_circuit (QuantumCircuit) – the quantum circuit with overlaid bounds. See also
overlay_bounds_onto_circuit().pauli_filter (Pauli | str | int | None) – the optional Pauli type by which the bounds were filtered. This will be indicated in the produced figure’s title.
kwargs – any additional keyword arguments are forwarded to
QuantumCircuit.draw().
- Returns:
The
mplfigure.- Return type:
Figure