From 97a7e0149f636ca4cb47ad65586303df21b02f0c Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Fri, 13 Sep 2024 17:21:45 +0100 Subject: [PATCH 1/2] Fix typo in column selection Due to a copy-paste error, NavChart was looking for columns with the "eff" suffix instead of columns with the "pp" suffix. Signed-off-by: John Pennycook --- p3analysis/plot/backend/matplotlib.py | 2 +- p3analysis/plot/backend/pgfplots.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/p3analysis/plot/backend/matplotlib.py b/p3analysis/plot/backend/matplotlib.py index 387ef33..c09d005 100644 --- a/p3analysis/plot/backend/matplotlib.py +++ b/p3analysis/plot/backend/matplotlib.py @@ -467,7 +467,7 @@ def __init__( else: if eff not in ["app", "arch"]: raise ValueError("'eff' must be 'app' or 'arch'.") - pp_column = eff + " eff" + pp_column = eff + " pp" if pp_column not in pp: msg = "DataFrame does not contain an '%s' column." raise ValueError(msg % (pp_column)) diff --git a/p3analysis/plot/backend/pgfplots.py b/p3analysis/plot/backend/pgfplots.py index ef509a4..030563a 100644 --- a/p3analysis/plot/backend/pgfplots.py +++ b/p3analysis/plot/backend/pgfplots.py @@ -289,7 +289,7 @@ def __init__( else: if eff not in ["app", "arch"]: raise ValueError("'eff' must be 'app' or 'arch'.") - pp_column = eff + " eff" + pp_column = eff + " pp" if pp_column not in pp: msg = "DataFrame does not contain an '%s' column." raise ValueError(msg % (pp_column)) From 247011bea4a8e818023f3769e49953a6df313562 Mon Sep 17 00:00:00 2001 From: John Pennycook Date: Fri, 13 Sep 2024 17:36:56 +0100 Subject: [PATCH 2/2] Add regression test for NavChart column names Signed-off-by: John Pennycook --- tests/plot/test_navchart.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/plot/test_navchart.py b/tests/plot/test_navchart.py index 24753b2..95f0d92 100644 --- a/tests/plot/test_navchart.py +++ b/tests/plot/test_navchart.py @@ -34,6 +34,19 @@ def test_required_columns(self): with self.assertRaises(ValueError): navchart(pp, cd, eff="invalid") + pp = pd.DataFrame({ + "problem": ["problem"], + "platform": ["platform"], + "application": ["application"], + "app pp": [1.0], + }) + cd = pd.DataFrame({ + "problem": ["problem"], + "application": ["application"], + "divergence": [0.0], + }) + navchart(pp, cd) + def test_options(self): """p3analysis.plot.navchart.options"""