Visualization#

Simple parameter sweeps#

Plotting the energy spectrum with varying one of the circuit parameters works just as for other qubit classes. For example:

[2]:
import numpy as np
zero_pi.plot_evals_vs_paramvals("Φ1", np.linspace(0,1,21), num_cpus=4);
../../../_images/guide_circuit_ipynb_custom_circuit_visualization_2_1.svg

Potential: symbolic expression and visualization#

The expression of the potential is obtained from potential_symbolic:

[3]:
zero_pi.potential_symbolic
[3]:
0.008*θ3**2 + 0.032*θ2**2 - EJ*cos(1.0*θ1 + 1.0*θ3) - EJ*cos(Φ1 + 1.0*θ1 - 1.0*θ3)

The potential can be visualized using plot_potential.

For the zero-pi example, there are three degrees of freedoms \((\theta_1, \theta_2, \theta_3)\). We can either fix all but two, or all but one variable. This produces either a contour plot of the potential within the selected 2d region,

[4]:
zero_pi.plot_potential(θ1=np.linspace(-np.pi, np.pi),
                       θ3=np.linspace(-6*np.pi, 6*np.pi, 200),
                       θ2 = 0.);
../../../_images/guide_circuit_ipynb_custom_circuit_visualization_6_0.svg

or a line plot when only one variable is specified with a range:

[5]:
zero_pi.plot_potential(θ1=np.linspace(-np.pi, np.pi), θ3=0, θ2 = 0);
../../../_images/guide_circuit_ipynb_custom_circuit_visualization_8_0.svg

Plotting the wavefunction#

Visualization of the wavefunction are obtained with plot_wavefunction. The argument which specifies the energy eigenstate for which the wavefunction is plotted; var_indices specifies the variable axis along which the wavefunction is plotted; mode specifies how the wavefunction amplitude is processed for visualization, options are real, image, abs, and abs-sqr as introduced in Wavefunctions.

Depending on the argument provided for var_indices and degrees of freedom that a system possess, different sets of options for mode are available.

  • If var_indices includes all the degrees of freedom in the system, all four options of the mode are supported.

For example, consider a subsystem of a \(0-\pi\) circuit that only includes the \(\zeta\)-mode (the subsystem is esssentially a harmonic oscillator), the real part of the first excited state wavefunction can be plotted as follows.

[6]:
zero_pi.subsystems[1].plot_wavefunction(which=1, var_indices=(2,), mode="real");
../../../_images/guide_circuit_ipynb_custom_circuit_visualization_11_0.svg

Likewise, consider the other subsystem of a \(0-\pi\) which forms the counterpart of the \(\zeta\)-mode, we can plot the imaginary part of its third excited state wavefunction. The wavefunction is visualized over two variable axes.

[7]:
zero_pi.subsystems[0].plot_wavefunction(which=3, var_indices=(1,3), mode="imag");
../../../_images/guide_circuit_ipynb_custom_circuit_visualization_13_0.svg

Since the degree of freedom \(\theta_1\) is periodic, the wavefunction can also be plotted in \((n_1, \theta_3)\) basis by switching off change_discrete_charge_to_phi.

[8]:
zero_pi.subsystems[0].plot_wavefunction(which=0, var_indices=(1,3), mode="real", change_discrete_charge_to_phi=False);
../../../_images/guide_circuit_ipynb_custom_circuit_visualization_15_0.svg
  • If var_indices does not includes all the degrees of freedom in the system, the wavefunction can only be visualized in the abs-sqr mode. The probability density (i.e. the absolute square of the wavefunction) is integrated over the non-specified variable indices, which produces a marginal probability density function.

[ ]:
zero_pi.plot_wavefunction(which=0, var_indices=(3,), mode="abs-sqr");
[ ]:
zero_pi.plot_wavefunction(which=0, var_indices=(1,3), mode="abs-sqr");

To avoid diagonalizing the system for every call of plot_wavefunction, we can diagonalize the system once using eigensys and use it to plot the wavefunction repeatedly.

[ ]:
eigensys = zero_pi.eigensys()
zero_pi.plot_wavefunction(which=1, var_indices=(1,3), mode="abs-sqr", esys=eigensys);