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

Ensure application order is respected in cascade #63

Closed Pennycook closed 2 weeks ago

Pennycook commented 1 month ago

Dropping results from the df might lead to df["application"].unique() returning a different list of applications. The order of applications in this list determines the order in which applications are plotted.

In order to respect the order of applications in the original DataFrame, and thereby ensure that cascade and navchart plots produced from the same projection use the same legend, we need to ensure that we do not change the application order.

Related issues

This was broken by #22. We didn't pick it up until now because the graphs we've been producing aren't strictly wrong -- it's hard to see the issue without plotting a cascade plot and navchart side-by-side.

@swright87, I don't know if the PGFplots backend already handles this correctly, or if it requires an equivalent fix. Please take a look.

Proposed changes

There might be a more efficient way to do this that doesn't require sorting the DataFrame, but the _sort_by_app_order function already existed elsewhere in the code base, making this an expedient fix.


It may also be worth discussing if this is actually the fix we want, or if we applied #22 too hastily. If we instead threw an error whenever there were duplicate results in a DataFrame (and required the user to remove them somehow) there would be no chance of this happening.

Pennycook commented 2 weeks ago

Closed in favor of #65.