quchip.viz.chip

Chip topology (pyvis) and dressed-spectrum (matplotlib) plots.

Functions

plot_energy_levels(chip, *[, ax, max_states])

Plot dressed chip eigenenergies relative to the ground state.

plot_graph(chip[, path, full, exclude, ...])

Write an interactive HTML chip topology and return its path.

quchip.viz.chip.plot_graph(chip, path='chip_topology.html', *, full=True, exclude=None, layout='force_atlas', height='800px', width='100%')[source]

Write an interactive HTML chip topology and return its path.

The rendered graph is a standalone, offline-capable HTML file: devices are drawn as dots and drives as diamonds, with couplings, control wiring, and crosstalk distinguished by edge colour and dash pattern. Node colours are auto-assigned per class (DuffingTransmon, Resonator, ChargeDrive, …) so new device/drive kinds are visually distinct without user intervention.

Layouts:

  • "force_atlas" (default) — force_atlas_2based physics with larger/heavier computational devices so the register sits centrally and auxiliary couplers/drives orbit.

  • "hierarchical" — pyvis hrepulsion on explicit levels (computational devices → other devices/couplings → drives), useful for chips with many auxiliary drives or cross-resonance lines.

exclude takes priority over full; passing full=False with no exclude hides drives and crosstalk (chip-only view). Every coupling is rendered as its own junction node splitting the device-device edge (so an edge-pump control has a node to attach to); excluding couplings also removes any edge-pump controls that would otherwise dangle (see _collect_topology()).

Parameters:
  • chip (Chip) – The chip to visualise.

  • path (str) – Destination .html path. Returned for convenience.

  • full (bool) – If False, hide drives and crosstalk unless exclude is given.

  • exclude (set of str, optional) – Any of {"coupling", "drive", "crosstalk"} to hide entirely.

  • layout (str) – "force_atlas" or "hierarchical".

  • height (str) – CSS dimensions forwarded to pyvis.network.Network.

  • width (str) – CSS dimensions forwarded to pyvis.network.Network.

Returns:

path, unchanged — returned for convenience so the call can be chained into whatever opens/serves the file.

Return type:

str

Raises:
  • ImportErrorpyvis is not installed.

  • ValueErrorlayout is not one of "force_atlas" or "hierarchical".

quchip.viz.chip.plot_energy_levels(chip, *, ax=None, max_states=None)[source]

Plot dressed chip eigenenergies relative to the ground state.

Each level is rendered as a horizontal bar annotated with its dressed represented-basis tuple label |n_1 n_2 ...> — the per-device bare-basis assignment selected by the chip’s dressing analysis (see chip.analysis). The y-axis is energy in GHz; the ground state is shifted to zero.

Parameters:
  • chip (Chip) – The chip whose dressed spectrum should be plotted.

  • ax (matplotlib.axes.Axes, optional) – Existing axes to draw onto. When None a new figure is created.

  • max_states (int, optional) – How many of the lowest-lying levels to show. Defaults to min(12, total_levels).

Returns:

The figure holding the energy-ladder axes (ax.figure when ax was given).

Return type:

Figure

Examples

>>> import quchip as qc
>>> from quchip.viz.chip import plot_energy_levels
>>> qb0 = qc.DuffingTransmon(freq=5.0, anharmonicity=-0.3, levels=3)
>>> qb1 = qc.DuffingTransmon(freq=5.2, anharmonicity=-0.3, levels=3)
>>> chip = qc.Chip([qb0, qb1], [qc.Capacitive(qb0, qb1, g=0.005)])
>>> fig = plot_energy_levels(chip, max_states=6)