Skip to content

Commit

Permalink
update samples
Browse files Browse the repository at this point in the history
  • Loading branch information
aoymt committed Jul 19, 2024
1 parent 360e152 commit b8ecc9f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion extra/function/sample/booth/do.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

time mpiexec -np 4 python3 main.py
time python3 main.py
47 changes: 47 additions & 0 deletions extra/function/sample/himmelblau/plot_colormap_2d.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import numpy as np
import matplotlib.pyplot as plt


def himmel(x, y):
return (x ** 2 + y - 11) ** 2 + (x + y ** 2 - 7) ** 2


npts = 201
c_x, c_y = np.mgrid[-6 : 6 : npts * 1j, -6 : 6 : npts * 1j]
c_z = himmel(c_x, c_y)
levels = np.logspace(0.35, 3.2, 8)

x = []
y = []
f = []
file_input = open("output/ColorMap.txt", "r")
lines = file_input.readlines()
file_input.close()
for line in lines:
if line[0] != "/n":
data = line.split()
x.append(float(data[0]))
y.append(float(data[1]))
f.append(np.log10(float(data[2])))

vmin = np.amin(np.array(f))
vmax = np.amax(np.array(f))

plt.contour(c_x, c_y, c_z, levels, colors="k", zorder=10.0, alpha=1.0, linewidths=0.5)
plt.scatter(
x,
y,
c=f,
s=50,
vmin=vmin,
vmax=vmax,
cmap="Blues_r",
linewidth=2,
alpha=1.0,
zorder=1.0,
)
plt.xlim(-6.0, 6.0)
plt.ylim(-6.0, 6.0)
plt.colorbar(label="log10(f)")
#plt.savefig("output/ColorMapFig.pdf")
plt.savefig("output/ColorMapFig.png")

0 comments on commit b8ecc9f

Please sign in to comment.