quchip.viz.device

Spectrum and eigenstate plots for each device.

Functions

plot_energy_levels(device, *[, ax, color, ...])

Plot the bare-Hamiltonian eigenenergies of a single device.

plot_wavefunction(device, n, *[, ax, color])

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 the bare-Hamiltonian eigenenergies of a single device.

Each eigenvalue of device.hamiltonian() shows as a horizontal bar with its index in the represented basis. The y-axis is energy in GHz. For a DuffingTransmon, the gaps show the anharmonicity directly. For a Resonator, the gaps are exactly equal.

Parameters:
  • device (BaseDevice) – Device whose bare spectrum is plotted.

  • ax (matplotlib.axes.Axes, optional) – Existing axes to draw on. When None, the function makes a new figure.

  • color (str, optional) – Line colour for all levels. The default is the first tab10 colour.

  • linewidth (float) – Width of each level bar.

Returns:

The figure that holds the energy-ladder axes (ax.figure when 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.

Show the eigenvector probabilities in the device’s authored local coordinates. Circuit models can have more native basis coordinates than retained energy levels. The axis follows the actual length of the eigenvector.

Parameters:
  • device (BaseDevice) – Device whose eigenstates are diagonalised.

  • n (int) – Eigenstate index (0 <= n < device.levels).

  • ax (matplotlib.axes.Axes, optional) – Existing axes to draw on. When None, the function makes a new figure.

  • color (str, optional) – Bar colour. The default is a tab10 cycle per index.

Returns:

The figure that holds the bar-chart axes (ax.figure when 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)