quchip.viz.chip¶
Chip topology (pyvis) and dressed-spectrum (matplotlib) plots.
Functions
|
Plot dressed chip eigenenergies relative to the ground state. |
|
Write an interactive HTML chip topology and return its path. |
- quchip.viz.chip.plot_graph(chip, path='chip_topology.html', *, full=True, exclude=None, values='bare', layout='force_atlas', height='800px', width='100%')[source]¶
Write an interactive HTML chip topology and return its path.
The HTML file is standalone and works offline. Devices show as dots and drives as diamonds. Edge colour and dash pattern identify couplings, control wiring, and crosstalk. Node colours follow the class (
DuffingTransmon,Resonator,ChargeDrive, …) automatically, so new kinds of device and drive look different without user action.Layouts:
"force_atlas"(default):force_atlas_2basedphysics with larger and heavier computational devices, so the register sits at the center and the auxiliary couplers and drives orbit it."hierarchical": pyvishrepulsionon explicit levels (computational devices → other devices/couplings → drives). It is useful for chips with many auxiliary drives or cross-resonance lines.
exclude has priority over full. If you pass
full=Falseand no exclude, the plot hides drives and crosstalk (chip-only view). Each coupling renders as its own junction node that splits the device-device edge, so an edge-pump control has a node to attach to. Excluding couplings also removes all edge-pump controls that would otherwise dangle.values="bare"keeps the declaration view: device frequencies and coupling strengths come directly from component parameters, without diagonalization.values="dressed"labels devices with dressed \(f_{01}\) and coupling junctions with the full-pull cross-Kerr \(K_{ab}\).values="both"shows both annotations. These modes do not change the topology.- Parameters:
chip (Chip) – The chip to visualise.
path (str) – Destination
.htmlpath, also returned.full (bool) – If
False, hide drives and crosstalk unless exclude is given.exclude (set of str, optional) – The items of
{"coupling", "drive", "crosstalk"}to hide fully.values ({"bare", "dressed", "both"}) – Physical values that show on device and coupling nodes. The default is the declared bare values.
layout (str) –
"force_atlas"or"hierarchical".height (str) – CSS dimensions passed to
pyvis.network.Network.width (str) – CSS dimensions passed to
pyvis.network.Network.
- Returns:
path, unchanged, so you can chain the call into code that opens or serves the file.
- Return type:
- Raises:
ImportError –
pyvisis not installed.ValueError – layout or values is not one of its supported choices.
- quchip.viz.chip.plot_energy_levels(chip, *, ax=None, max_states=None)[source]¶
Plot dressed chip eigenenergies relative to the ground state.
Each level shows as a horizontal bar with its dressed represented-basis tuple label
|n_1 n_2 ...>. This label is the per-device bare-basis assignment that the chip’s dressing analysis selects (seechip.analysis). The y-axis is energy in GHz, with the ground state shifted to zero.- Parameters:
- Returns:
The figure that holds the energy-ladder axes (
ax.figurewhen 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)