8 parser = argparse.ArgumentParser()
9 parser.add_argument(
"bindir", help=
"Binary directory")
10 parser.add_argument(
"testdata", help=
"Test data directory")
11 parser.add_argument(
"test", help=
"Test name")
12 parser.add_argument(
"mpi", help=
"Number of MPI tasks")
13 parser.add_argument(
"omp", help=
"Number of OpenMP threads")
14 args = parser.parse_args()
17 sys.path.insert(1, os.path.join(args.bindir,
"saber_plot"))
20 plot_list=[
"avg",
"diag",
"dirac",
"lct",
"lct_cor",
"local_diag_cor",
"local_diag_loc",
"normality",
"randomization",
"sampling_grids",
"umf",
"var"]
21 done_list=[
"normality",
"sampling_grids",
"lct",
"lct_cor"]
26 "dirac":
"contour_centered",
27 "lct":
"contour_positive",
29 "local_diag_cor":
"contour_positive",
30 "local_diag_loc":
"contour_positive",
31 "normality":
"normality",
32 "randomization":
"randomization",
33 "sampling_grids":
"sampling_grids",
35 "var":
"contour_positive"
37 for plot
in plot_list:
41 if args.test.find(
"bump_")==0:
43 testfig = args.testdata +
"/" + args.test +
"/fig"
44 if not os.path.exists(testfig):
48 for f
in sorted(os.listdir(os.path.join(args.testdata, args.test))):
49 if os.path.isfile(os.path.join(args.testdata, args.test, f))
and f.find(
"test_" + args.mpi +
"-" + args.omp)==0:
50 suffix = f.split(
"test_" + args.mpi +
"-" + args.omp +
"_")[1][:-(len(f.rsplit(
".")[-1])+1)]
51 for plot
in plot_list:
52 if suffix.find(plot)==0
and not done[plot]:
53 print(
"Calling " + plot +
" in " + args.test +
" (" + args.mpi +
"-" + args.omp +
")")
54 plot_alias = alias_list[plot]
55 module = __import__(plot_alias)
56 func = getattr(module, plot_alias)
58 func(args.testdata, args.test, args.mpi, args.omp, plot, testfig)
61 func(args.testdata, args.test, args.mpi, args.omp, suffix, testfig)
63 if (os.path.isdir(os.path.join(args.testdata, args.test,
"fig"))):
65 message =
"<html><head></head><body><h1>" + args.test +
"</h1><ul>"
66 for f
in sorted(os.listdir(os.path.join(args.testdata, args.test,
"fig"))):
67 if f.find(
"test_" + args.mpi +
"-" + args.omp)==0:
68 short_name = f.replace(
"test_" + args.mpi +
"-" + args.omp +
"_",
"").replace(
".jpg",
"")
69 message = message +
"<li><a href=\"#" + short_name +
"\">" + short_name +
"</a></li>"
70 message = message +
"</ul>"
71 for f
in sorted(os.listdir(os.path.join(args.testdata, args.test,
"fig"))):
72 if f.find(
"test_" + args.mpi +
"-" + args.omp)==0:
73 short_name = f.replace(
"test_" + args.mpi +
"-" + args.omp +
"_",
"").replace(
".jpg",
"")
74 cmd =
"mogrify -trim " + os.path.join(args.testdata, args.test,
"fig", f)
76 message = message +
"<h2 id=\"" + short_name +
"\">" + short_name +
"</h2><img src=\"" + f +
"\" width=800px><br><a href=\"#top\">Back to top</a>"
78 message = message +
"</body></html>"
79 f = open(os.path.join(args.testdata, args.test,
"fig",
"index_" + args.mpi +
"-" + args.omp +
".html"),
"w")