Skip to content

Commit

Permalink
percentiles: add test for percentiles=None
Browse files Browse the repository at this point in the history
  • Loading branch information
slabasan committed Dec 22, 2023
1 parent feaef26 commit 4a3941c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion thicket/stats/percentiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def percentiles(thicket, columns=None, percentiles=[0.25, 0.50, 0.75]):
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
calculation is a separate column in the statistics table, where the column will
have the format: columnName_percentiles_percentile
have the format: {columnName}_percentiles_{percentile}.
The 25th percentile is the lower quartile, and is the value at which 25% of the
answers lie below that value.
Expand Down
13 changes: 13 additions & 0 deletions thicket/tests/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,19 @@ def test_percentiles(example_cali):
assert "Min time/rank_percentiles_50" in th_ens.statsframe.show_metric_columns()
assert "Min time/rank_percentiles_75" in th_ens.statsframe.show_metric_columns()


def test_percentiles_none(example_cali):
th_ens = th.Thicket.from_caliperreader(example_cali)

th.percentiles(th_ens, columns=["Min time/rank"], percentiles=None)

assert "Min time/rank_percentiles_25" in th_ens.statsframe.dataframe.columns
assert "Min time/rank_percentiles_50" in th_ens.statsframe.dataframe.columns
assert "Min time/rank_percentiles_75" in th_ens.statsframe.dataframe.columns

def test_percentiles_single_value(example_cali):
th_ens = th.Thicket.from_caliperreader(example_cali)

th.percentiles(th_ens, columns=["Min time/rank"], percentiles=[0.3])

assert "Min time/rank_percentiles_30" in th_ens.statsframe.dataframe.columns
Expand Down

0 comments on commit 4a3941c

Please sign in to comment.