diff --git a/thicket/stats/percentiles.py b/thicket/stats/percentiles.py index bce1ab60..c678a228 100644 --- a/thicket/stats/percentiles.py +++ b/thicket/stats/percentiles.py @@ -9,8 +9,7 @@ def percentiles(thicket, columns=None, percentiles=[0.25, 0.50, 0.75]): - """ - Calculate the q-th percentile for each node in the performance data table. + """Calculate the q-th percentile for each node in the performance data table. Designed to take in a thicket, and append one or more columns to the aggregated statistics table for the q-th percentile calculation for each node. Each percentile @@ -76,7 +75,7 @@ def percentiles(thicket, columns=None, percentiles=[0.25, 0.50, 0.75]): and column_to_append not in thicket.statsframe.exc_metrics ): thicket.statsframe.exc_metrics.append(column_to_append) - # check to see if inclusive metric + # check inclusive metrics elif ( column in thicket.inc_metrics and column_to_append not in thicket.statsframe.inc_metrics diff --git a/thicket/tests/test_stats.py b/thicket/tests/test_stats.py index 9abe04bb..151d3a71 100644 --- a/thicket/tests/test_stats.py +++ b/thicket/tests/test_stats.py @@ -305,6 +305,46 @@ def test_percentiles_columnar_join(thicket_axis_columns): combined_th, columns=[(idx, "Min time/rank")], percentiles=[0.4] ) + assert ( + idx, + "Min time/rank_percentiles_25", + ) in combined_th.statsframe.dataframe.columns + assert ( + idx, + "Min time/rank_percentiles_50", + ) in combined_th.statsframe.dataframe.columns + assert ( + idx, + "Min time/rank_percentiles_75", + ) in combined_th.statsframe.dataframe.columns + assert ( + idx, + "Min time/rank_percentiles_25", + ) in combined_th.statsframe.exc_metrics + combined_th.statsframe.inc_metrics + assert ( + idx, + "Min time/rank_percentiles_50", + ) in combined_th.statsframe.exc_metrics + combined_th.statsframe.inc_metrics + assert ( + idx, + "Min time/rank_percentiles_75", + ) in combined_th.statsframe.exc_metrics + combined_th.statsframe.inc_metrics + + assert ( + idx, + "Min time/rank_percentiles_25", + ) in combined_th.statsframe.show_metric_columns() + assert ( + idx, + "Min time/rank_percentiles_50", + ) in combined_th.statsframe.show_metric_columns() + assert ( + idx, + "Min time/rank_percentiles_75", + ) in combined_th.statsframe.show_metric_columns() + + th.percentiles(combined_th, columns=[(idx, "Min time/rank")], percentiles=[0.4]) + assert ( idx, "Min time/rank_percentiles_40",