|
4 | 4 | from math import ceil |
5 | 5 |
|
6 | 6 | exact = True |
7 | | -angle_res = 0.005 # radians |
| 7 | +angle_res = 0.005 # radians |
8 | 8 |
|
9 | | -x, y, pot_interpolated, pot_exact, err = np.loadtxt('pot_at_angles.dat', unpack=True) |
| 9 | +x, y, pot_interpolated, pot_exact, err = np.loadtxt("pot_at_angles.dat", unpack=True) |
10 | 10 | if exact: |
11 | 11 | pot = pot_exact |
12 | 12 | else: |
|
19 | 19 | ngridy = ceil((y.max() - y.min()) / angle_res) |
20 | 20 | xi = np.linspace(x.min(), x.max(), ngridx) |
21 | 21 | yi = np.linspace(y.min(), y.max(), ngridy) |
22 | | -zi = griddata((x, y), pot, (xi[None,:], yi[:,None]), method='linear') |
23 | | -plt.contourf(xi, yi, zi, 20, cmap = plt.cm.RdBu) |
| 22 | +zi = griddata((x, y), pot, (xi[None, :], yi[:, None]), method="linear") |
| 23 | +plt.contourf(xi, yi, zi, 20, cmap=plt.cm.RdBu) |
24 | 24 |
|
25 | 25 | # Overlay exact potential from each vertex (colored circles) |
26 | | -x, y, z, theta, phi, pot = np.loadtxt('pot_at_vertices.dat', unpack=True) |
27 | | -plt.scatter(theta, phi, c=pot, cmap=plt.cm.RdBu, s=15, marker='o', edgecolor='k', linewidths=0.1) |
28 | | -plt.colorbar() # draw colorbar |
| 26 | +x, y, z, theta, phi, pot = np.loadtxt("pot_at_vertices.dat", unpack=True) |
| 27 | +plt.scatter( |
| 28 | + theta, phi, c=pot, cmap=plt.cm.RdBu, s=15, marker="o", edgecolor="k", linewidths=0.1 |
| 29 | +) |
| 30 | +plt.colorbar() # draw colorbar |
29 | 31 | plt.clim(-maxpot, maxpot) |
30 | | -plt.ylim(0.0, 2.0*np.pi) |
| 32 | +plt.ylim(0.0, 2.0 * np.pi) |
31 | 33 | plt.xlim(0.0, np.pi) |
32 | 34 | plt.xlabel(r"Polar angle, $\theta$") |
33 | 35 | plt.ylabel(r"Azimuthal angle, $\phi$") |
34 | | -plt.title("Electric potential around a patchy particle:\n(Circles = ref. points on subdivided icosahedron)", fontsize=12) |
35 | | -plt.savefig('potential.pdf') |
36 | | - |
| 36 | +plt.title( |
| 37 | + "Electric potential around a patchy particle:\n(Circles = ref. points on subdivided icosahedron)", |
| 38 | + fontsize=12, |
| 39 | +) |
| 40 | +plt.savefig("potential.pdf") |
0 commit comments