plot_utils: create plot_freq_hists() and plot_temperature_hist() to plot histograms of multiple runs
Revamp the histogram plotting infrastructure in the process to deal
with multiple runs effectively.
diff --git a/tests/test_plot_utils.py b/tests/test_plot_utils.py
index 4b8007a..21f289a 100644
--- a/tests/test_plot_utils.py
+++ b/tests/test_plot_utils.py
@@ -91,7 +91,8 @@
"""Test that plost_hist doesn't bomb"""
data = pd.Series([1, 1, 2, 4])
- plot_utils.plot_hist(data, "Foo", 20, "numbers", (0, 4), "default")
+ _, ax = matplotlib.pyplot.subplots()
+ plot_utils.plot_hist(data, ax, "Foo", 20, "numbers", (0, 4), "default")
class TestPlotUtilsNeedTrace(BaseTestThermal):
def __init__(self, *args, **kwargs):
@@ -172,3 +173,31 @@
plot_utils.plot_output_power(runs, self.actor_order, width=20)
matplotlib.pyplot.close('all')
+
+ def test_plot_freq_hists(self):
+ """plot_utils.plot_freq_hists() doesn't bomb"""
+
+ run1 = cr2.Run(name="first")
+ run2 = cr2.Run(name="second")
+ runs = [run1, run2]
+
+ plot_utils.plot_freq_hists(runs, self.map_label)
+ matplotlib.pyplot.close('all')
+
+ def test_plot_freq_hists_single_run(self):
+ """plot_utils.plot_freq_hists() works with a single run"""
+
+ run = cr2.Run()
+
+ plot_utils.plot_freq_hists([run], self.map_label)
+ matplotlib.pyplot.close('all')
+
+ def test_plot_temperature_hist(self):
+ """plot_utils.plot_temperature_hist() doesn't bomb"""
+
+ run1 = cr2.Run(name="first")
+ run2 = cr2.Run(name="second")
+ runs = [run1, run2]
+
+ plot_utils.plot_temperature_hist(runs)
+ matplotlib.pyplot.close('all')
diff --git a/tests/test_run.py b/tests/test_run.py
index 408323a..1c04433 100644
--- a/tests/test_run.py
+++ b/tests/test_run.py
@@ -64,7 +64,8 @@
run = Run()
- run.plot_freq_hists(self.map_label)
+ _, axis = matplotlib.pyplot.subplots(nrows=2)
+ run.plot_freq_hists(self.map_label, axis)
matplotlib.pyplot.close('all')
def test_plot_allfreqs(self):
diff --git a/tests/test_thermal.py b/tests/test_thermal.py
index 4ea8a08..5eaa189 100644
--- a/tests/test_thermal.py
+++ b/tests/test_thermal.py
@@ -144,7 +144,8 @@
def test_plot_temperature_hist(self):
"""Test that plot_temperature_hist() doesn't bomb"""
- Thermal().plot_temperature_hist("Foo")
+ _, ax = matplotlib.pyplot.subplots()
+ Thermal().plot_temperature_hist(ax, "Foo")
matplotlib.pyplot.close('all')
def test_normalize_time(self):