-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorter python imports for postprocessing tools #2727
Shorter python imports for postprocessing tools #2727
Conversation
|
||
__all__ = ["EnergyHistogram", | ||
"PhaseSpace", | ||
"PNG"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing EOF
from .png_visualizer import Visualizer as PNGVisualizer | ||
|
||
|
||
__all__ = ["EnergyHistogramVisualizer", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not suffix them with Visualizer
, although I see the charm when importing data readers and visualizers at the same time into main scope... Do you know any best practices on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not really. I would also have to read up on that.
Naming collisions were the main reason for suffixing them this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but then let us at least Suffix them with PlotMPL
or just MPL
to be descriptive and consistent with the dir name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I changed the suffix to 'MPL'
In order to shorten the import statements when using python visualizers, they are now included within the
plot_mpl/__init__.py
with meaningful aliases (since they are all called Visualizer).Instead of writing
from picongpu.plugins.plot_mpl.phase_space_visualizer import Visualizer as PhaseSpaceVisualizer
one could then shorten this tofrom picongpu.plugins.plot_mpl import PhaseSpaceVisualizer