intel / p3-analysis-library

A library simplifying the collection and interpretation of P3 data.
https://intel.github.io/p3-analysis-library/
MIT License
7 stars 10 forks source link

Cascade plot crashes with more than 26 platforms #39

Open Pennycook opened 4 months ago

Pennycook commented 4 months ago

Expected behavior

We should either:

Supporting a larger number of platforms would be my preference, but we'll need to come up with an alternative naming scheme for platforms that isn't A-Z. We'll also need to make sure that the plot correctly resizes everything to fit the new naming scheme.

Actual behavior

Traceback (most recent call last):
  File "/home/p3-analysis-library/cascade.py", line 15, in <module>
    cascade = p3.plot.cascade(df, size=(6, 5))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/p3-analysis-library/p3/plot/_cascade.py", line 95, in cascade
    return CascadePlot(df, eff, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/p3-analysis-library/p3/plot/backend/matplotlib.py", line 181, in __init__
    self.__platform_chart(
  File "/home/p3-analysis-library/p3/plot/backend/matplotlib.py", line 361, in __platform_chart
    plat_labels[supported_platforms[j]],
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'PlatformName'

This occurs because of how we choose platform labels:

# Choose labels for each platform
plat_labels = dict(zip(platforms, string.ascii_uppercase))

Steps to reproduce the problem

Try to plot a cascade with more than 26 platforms.

Specifications

Tested with the tip of main.