-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
#!/bin/sh | ||
|
||
python3 ../../../src/py2dmat_main.py input.toml | ||
rm -rf output | ||
|
||
python3 ../plot_himmel.py --xcol=1 --ycol=2 --output=output/res.pdf output/SimplexData.txt | ||
# python3 ../plot_himmel.py --xcol=1 --ycol=2 --output=output/res.png output/SimplexData.txt | ||
time python3 ../../../src/py2dmat_main.py input.toml | ||
# time mpirun -np 16 python3 ../../../src/py2dmat_main.py input.toml | ||
|
||
# python3 plot.py --xcol=1 --ycol=2 --output=output/res.png output/*/SimplexData.txt | ||
python3 plot.py --xcol=1 --ycol=2 --output=output/res.pdf output/*/SimplexData.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
import argparse | ||
|
||
plot_style = { "linewidth": 2.0, "markersize": 4.0 } | ||
|
||
def himmelblau(x, y): | ||
return (x ** 2 + y - 11) ** 2 + (x + y ** 2 - 7) ** 2 | ||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("--xcol", type=int, default=0) | ||
parser.add_argument("--ycol", type=int, default=1) | ||
parser.add_argument("--output", default="res.pdf") | ||
parser.add_argument("--format", default="-o") | ||
parser.add_argument("--skip", type=int, default=0) | ||
parser.add_argument("inputfiles", nargs="+") | ||
args = parser.parse_args() | ||
|
||
npts = 201 | ||
c_x, c_y = np.mgrid[-6 : 6 : npts * 1j, -6 : 6 : npts * 1j] | ||
c_z = himmelblau(c_x, c_y) | ||
levels = np.logspace(0.35, 3.2, 8) | ||
|
||
fig = plt.figure() | ||
ax = fig.add_subplot(1,1,1) | ||
ax.set_aspect("equal", adjustable="box") | ||
ax.contour(c_x, c_y, c_z, levels, colors="k") | ||
|
||
cmap = plt.get_cmap("tab10") | ||
for idx,filename in enumerate(args.inputfiles): | ||
data = np.loadtxt(filename, unpack=True, skiprows=args.skip) | ||
ax.plot(data[args.xcol], data[args.ycol], args.format, color=cmap(idx%10), **plot_style) | ||
|
||
ax.set_xticks(np.linspace(-6, 6, num=5, endpoint=True)) | ||
ax.set_yticks(np.linspace(-6, 6, num=5, endpoint=True)) | ||
|
||
fig.savefig(args.output) |