cr2: add plot_allfreqs()
diff --git a/cr2/__init__.py b/cr2/__init__.py
index fd276a9..d5cef99 100644
--- a/cr2/__init__.py
+++ b/cr2/__init__.py
@@ -7,6 +7,7 @@
def summary_plots(**kwords):
"""A summary of plots as similar as possible to what CompareRuns plots"""
+ import plot_utils
if "path" in kwords:
path = kwords["path"]
@@ -16,6 +17,7 @@
gov_data = ThermalGovernor(path=path)
inpower_data = InPower(path=path)
+ outpower_data = OutPower(path=path)
pid_data = PIDController(path=path)
if "width" not in kwords:
@@ -28,6 +30,7 @@
gov_data.plot_temperature(**kwords)
inpower_data.plot_load(map_label, **kwords)
+ plot_utils.plot_allfreqs(inpower_data, outpower_data, map_label, **kwords)
pid_data.plot_controller(**kwords)
gov_data.plot_input_power(**kwords)
gov_data.plot_output_power(**kwords)
diff --git a/cr2/plot_utils.py b/cr2/plot_utils.py
index da892ef..63e395c 100644
--- a/cr2/plot_utils.py
+++ b/cr2/plot_utils.py
@@ -63,3 +63,19 @@
cur_ylim[1] + 0.1 * (cur_ylim[1] - cur_ylim[0]))
ax.set_ylim(ylim[0], ylim[1])
+
+def plot_allfreqs(in_power, out_power, map_label, **kwords):
+ """Do allfreqs plots similar to those of CompareRuns"""
+ import power
+
+ if "title" in kwords:
+ orig_title = kwords["title"]
+ del kwords["title"]
+ else:
+ orig_title = ""
+
+ all_freqs = power.get_all_freqs_data(in_power, out_power, map_label)
+
+ for label, dfr in all_freqs.iteritems():
+ title = normalize_title("allfreqs", orig_title)
+ dfr.plot()
diff --git a/tests/test_plot_utils.py b/tests/test_plot_utils.py
index 8deab38..e4403fa 100644
--- a/tests/test_plot_utils.py
+++ b/tests/test_plot_utils.py
@@ -2,6 +2,8 @@
import unittest
+from test_thermal import TestThermalBase
+import cr2
import plot_utils
class TestPlotUtils(unittest.TestCase):
@@ -25,3 +27,13 @@
plot_utils.post_plot_setup(ax)
plot_utils.post_plot_setup(ax, title="Foo")
plot_utils.post_plot_setup(ax, ylim=(0, 72))
+
+class TestPlotUtilsNeedTrace(TestThermalBase):
+ def test_plot_allfreqs(self):
+ """Test that plot_allfreqs() doesn't bomb"""
+
+ inp = cr2.InPower()
+ outp = cr2.OutPower()
+ map_label = {"0000000f": "A7", "000000f0": "A15"}
+
+ plot_utils.plot_allfreqs(inp, outp, map_label)