-
-
Save amankharwal/f16413eb5d27c88a6e1832583efc9452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
from mpl_toolkits.mplot3d.axes3d import Axes3D | |
import matplotlib | |
alpha = 0.7 | |
phi_ext = 2 * np.pi * 0.5 | |
def flux_qubit_potential(phi_m, phi_p): | |
return 2 + alpha - 2 * np.cos(phi_p) * np.cos(phi_m) - alpha * np.cos(phi_ext - 2*phi_p) | |
phi_m = np.linspace(0, 2*np.pi, 100) | |
phi_p = np.linspace(0, 2*np.pi, 100) | |
X,Y = np.meshgrid(phi_p, phi_m) | |
Z = flux_qubit_potential(X, Y).T | |
fig = plt.figure(figsize=(14, 6)) | |
ax = fig.add_subplot(1, 2, 1, projection='3d') | |
p = ax.plot_surface(X, Y, Z, rstride=4, cstride=4, linewidth=0) | |
# surface_plot with color grading and color bar | |
ax = fig.add_subplot(1, 2, 2, projection='3d') | |
p = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=matplotlib.cm.coolwarm, linewidth=0, antialiased=False) | |
cb = fig.colorbar(p, shrink=0.5) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment