Skip to content
Merged

Dev #11

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.wrangler/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
Expand Down Expand Up @@ -44,6 +42,7 @@ pip-delete-this-directory.txt

# Sphinx documentation
docs/_build/
.wrangler/

# Jupyter Notebook
.ipynb_checkpoints
Expand Down
3 changes: 1 addition & 2 deletions docs/_static/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ html[data-theme="dark"] .highlight > pre {
> dl:not(.method)
.sig-name
~ *:not(:last-child):not(:nth-last-child(2)),
.class.enum > dd > .attribute > dt > .property,
.attribute .sig-name ~ * {
.class.enum > dd > .attribute > dt > .property {
display: none !important;
}

Expand Down
41 changes: 19 additions & 22 deletions landscape_tools/landscape_visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,9 @@ def plot_pca_loss_scan_3d(
alpha_surface: float = 0.85,
trajectory_kwargs: dict[str, Any] | None = None,
):
"""
Plot a 3D PCA loss landscape.
"""Plot a 3D PCA loss landscape.

Parameters:
Args:
scan_result: Mapping returned by ``pca_loss_scan``.
cmap: Colormap used for the surface.
elev: Elevation angle of the view.
Expand All @@ -544,13 +543,12 @@ def plot_pca_loss_scan_3d(

Notes:
- The figure is saved to ``figures/pcaLandscape3d.pdf``.
- If ``LogNorm()`` is used for normalization,
the values in ``Z`` must be strictly positive.
- If ``LogNorm()`` is used for normalization, the values in ``Z`` must
be strictly positive.

Returns:
fig: Figure containing the plot.
axes: Tuple ``(ax1, ax2)`` containing the main
PCA landscape axis and the log-scale surface axis.
Figure containing the plot and Tuple ``(ax1, ax2)`` containing the main
PCA landscape axis and the log-scale surface axis.
"""

from scipy.interpolate import RegularGridInterpolator
Expand Down Expand Up @@ -1260,13 +1258,11 @@ def plot_pca_circuit_schematic_real_circuit(
show_entanglers: bool = True,
entangler_linewidth: float = 1.6,
):
"""
Plot a circuit schematic annotated with PCA-based parameter scores.
"""Plot a circuit schematic annotated with PCA-based parameter scores.

Parameters:
qc: Qiskit quantum circuit to visualize, or any
compatible object exposing ``qc.data``,
``qc.parameters``, ``qc.num_qubits``,
qc: Qiskit quantum circuit to visualize, or any compatible object
exposing ``qc.data``, ``qc.parameters``, ``qc.num_qubits``,
and ``qc.find_bit``.
analysis: Mapping returned by ``analyze_pca``.
score_key: Influence metric used for coloring.
Expand All @@ -1280,15 +1276,16 @@ def plot_pca_circuit_schematic_real_circuit(
the PCA score vector contains one additional score
compared to the number of Qiskit circuit parameters.
gamma_label: Optional label for the scaling parameter.
label_mode: Labeling scheme used for parameter boxes.
Supported values are:
- ``"index"``
- ``"theta"``
- ``"full"``
- ``"gate+index"``
- ``"gate"``
- ``"label"``
- ``"gate+label"``
label_mode: Labeling scheme used for parameter boxes. Supported values
are:

- ``"index"``
- ``"theta"``
- ``"full"``
- ``"gate+index"``
- ``"gate"``
- ``"label"``
- ``"gate+label"``
show_entanglers: Whether to render entangling gates.
entangler_linewidth: Line width for entangling
connections.
Expand Down
Loading