Skip to content

Commit 32d31a3

Browse files
committed
Added ymin for plots and logging of CPU time in results files
1 parent 0f2013d commit 32d31a3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

text/source/_sphinxext/xogeny/gen_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __repr__(self):
7777
simple_plot_tmpl = """
7878
# Autogenerated script to plot named %s using results: %s
7979
from xogeny.plot_utils import render_simple_plot
80-
render_simple_plot(name=%s, vars=%s, title=%s, legloc=%s, ylabel=%s, ncols=%s, ymax=%s)
80+
render_simple_plot(name=%s, vars=%s, title=%s, legloc=%s, ylabel=%s, ncols=%s, ymin=%s, ymax=%s)
8181
""";
8282

8383
comp_plot_tmpl = """
@@ -88,7 +88,7 @@ def __repr__(self):
8888
""";
8989

9090
def add_simple_plot(plot, vars, title, legloc="upper right", ylabel="",
91-
res=None, ncols=1, ymax=None):
91+
res=None, ncols=1, ymin=None, ymax=None):
9292
if plot in plots:
9393
raise NameError("Plot named "+plot+" already exists");
9494
if res==None:
@@ -105,6 +105,7 @@ def add_simple_plot(plot, vars, title, legloc="upper right", ylabel="",
105105
"ylabel": ylabel,
106106
"ncols": ncols,
107107
"ymax": ymax,
108+
"ymin": ymin,
108109
"res": res
109110
};
110111

@@ -151,7 +152,8 @@ def _generate_plots():
151152
repr(pdata["res"]),
152153
repr(pdata["vars"]), repr(pdata["title"]),
153154
repr(pdata["legloc"]), repr(pdata["ylabel"]),
154-
repr(pdata["ncols"]), repr(pdata["ymax"])))
155+
repr(pdata["ncols"]),
156+
repr(pdata["ymin"]), repr(pdata["ymax"])))
155157
elif pdata["type"]=="compare":
156158
ofp.write(comp_plot_tmpl % (repr(plot),
157159
repr(pdata["res1"]), repr(pdata["v1"]),
@@ -216,9 +218,9 @@ def _generate_makefile():
216218
directory = data["directory"]
217219
srcpath = data["path"]
218220
if len(mods)==0:
219-
simflags = ""
221+
simflags = "-cpu"
220222
else:
221-
simflags = "-override "+(",".join(map(lambda x: str(x)+"="+str(mods[x]), mods)))
223+
simflags = "-cpu -override "+(",".join(map(lambda x: str(x)+"="+str(mods[x]), mods)))
222224

223225
simfails = "true" if data["simfails"] else "false"
224226
compfails = "true" if data["compfails"] else "false"

text/source/_sphinxext/xogeny/plot_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def render_comp_plot(name1, vars1, name2, vars2, title, legloc, ylabel):
8181
plt.show()
8282

8383

84-
def render_simple_plot(name, vars, title, legloc, ylabel, ncols=1, ymax=None):
84+
def render_simple_plot(name, vars, title, legloc, ylabel, ncols=1, ymin=None, ymax=None):
8585
import matplotlib.pyplot as plt
8686
import math
8787

@@ -136,5 +136,7 @@ def render_simple_plot(name, vars, title, legloc, ylabel, ncols=1, ymax=None):
136136
plt.xlabel('Time [s]')
137137
if ymax!=None:
138138
plt.axis(ymax=ymax)
139+
if ymin!=None:
140+
plt.axis(ymin=ymin)
139141

140142
plt.show()

0 commit comments

Comments
 (0)