plot_utils: add a plot_input_power() to plot the input power of multiple runs
diff --git a/cr2/plot_utils.py b/cr2/plot_utils.py
index f0acdd8..113471f 100644
--- a/cr2/plot_utils.py
+++ b/cr2/plot_utils.py
@@ -164,3 +164,14 @@
for ax, run in zip(axis, runs):
run.pid_controller.plot_controller(title=run.name, ax=ax)
+
+def plot_input_power(runs, actor_order, width=None, height=None):
+ """Make a multicolumn plot of the input power of each run"""
+ num_runs = len(runs)
+ axis = pre_plot_setup(width=width, height=height, ncols=num_runs)
+
+ if num_runs == 1:
+ axis = [axis]
+
+ for ax, run in zip(axis, runs):
+ run.thermal_governor.plot_input_power(actor_order, title=run.name, ax=ax)
diff --git a/tests/test_plot_utils.py b/tests/test_plot_utils.py
index 3c3b145..12d9b4e 100644
--- a/tests/test_plot_utils.py
+++ b/tests/test_plot_utils.py
@@ -97,6 +97,7 @@
def __init__(self, *args, **kwargs):
super(TestPlotUtilsNeedTrace, self).__init__(*args, **kwargs)
self.map_label = {"0000000f": "A7", "000000f0": "A15"}
+ self.actor_order = ["GPU", "A15", "A7"]
def test_plot_temperature(self):
"""Test that plot_utils.plot_temperature() doesn't bomb"""
@@ -151,3 +152,13 @@
plot_utils.plot_controller(runs, height=5)
matplotlib.pyplot.close('all')
+
+ def test_plot_input_power(self):
+ """plot_utils.plot_input_power() doesn't bomb"""
+
+ run1 = cr2.Run(name="first")
+ run2 = cr2.Run(name="second")
+ runs = [run1, run2]
+
+ plot_utils.plot_input_power(runs, self.actor_order, width=20)
+ matplotlib.pyplot.close('all')