quchip.viz.device¶
Per-device spectrum and eigenstate plots.
Functions
|
Plot a single device's bare-Hamiltonian eigenenergies. |
|
Plot the represented-basis probability weights of eigenstate n. |
- quchip.viz.device.plot_energy_levels(device, *, ax=None, color=None, linewidth=2.0)[source]¶
Plot a single device’s bare-Hamiltonian eigenenergies.
Each eigenvalue of
device.hamiltonian()is drawn as a horizontal bar annotated with its index in the represented basis. The y-axis is energy in GHz. For aDuffingTransmonthe gaps reveal the anharmonicity directly; for aResonatorthey are exactly equal.- Parameters:
device (BaseDevice) – The device whose bare spectrum should be plotted.
ax (matplotlib.axes.Axes, optional) – Existing axes to draw onto. When
Nonea new figure is created.color (str, optional) – Line colour for every level. Defaults to the first
tab10colour.linewidth (float) – Width of each level bar.
- Returns:
The figure holding the energy-ladder axes (
ax.figurewhen ax was given).- Return type:
Figure
Examples
>>> import quchip as qc >>> qubit = qc.DuffingTransmon(freq=5.0, anharmonicity=-0.3, levels=4) >>> qubit.plot_energy_levels()
- quchip.viz.device.plot_wavefunction(device, n, *, ax=None, color=None)[source]¶
Plot the represented-basis probability weights of eigenstate n.
Shows
|<k|psi_n>|^2for each bare basis state|k>,k = 0 ... levels - 1, where|k>indexes whatever basisdevice.hamiltonian()is expressed in. Every stock device model shipped withquchip— includingDuffingTransmon,ChargeBasisTransmon,Fluxonium, andResonator— returns a Hamiltonian that is already diagonal in its own retained eigenbasis, so eigenstatenis exactly|n>and the bar chart is a single delta bar for every one of them: this plot cannot show “mixing” for any built-in model. Mixing becomes visible only for a custom device whosehamiltonian()returns a matrix that is not diagonal in its represented basis.- Parameters:
device (BaseDevice) – The device whose eigenstates are diagonalised.
n (int) – Eigenstate index (
0 <= n < device.levels).ax (matplotlib.axes.Axes, optional) – Existing axes to draw onto. When
Nonea new figure is created.color (str, optional) – Bar colour. Defaults to a per-index
tab10cycle.
- Returns:
The figure holding the bar-chart axes (
ax.figurewhen ax was given).- Return type:
Figure
- Raises:
IndexError – n is outside
[0, device.levels).
Examples
>>> import quchip as qc >>> transmon = qc.DuffingTransmon(freq=5.0, anharmonicity=-0.3, levels=4) >>> transmon.plot_wavefunction(n=1)