-
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
Plugin Docs: Python Tools & Matplotlib #2726
Plugin Docs: Python Tools & Matplotlib #2726
Conversation
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.
Thank you very much!
For the PR, I suggest little open improvements and have a few follow-up PR tasks we should tackle next.
Python postprocessing tool structure | ||
==================================== | ||
|
||
For each plugin there are (or have to be implemented) three different classes. |
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.
Each plugin should implement at least one of the following Python classes.
2. A visualizer class that outputs a matplotlib plot | ||
3. A jupyter-widget class that exposes the parameters of the matplotlib visualizer to the user | ||
via other widgets | ||
|
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
|
||
Data reader | ||
~~~~~~~~~~~ | ||
The data readers should reside in the ``lib/python/picongpu/plugins/`` directory. |
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.
This is a follow-up to this PR:
they should actually get their own sub-directory soon for clean-up :)
E.g., lib/python/picongpu/plugins/data
def __init__(self, run_directory) | ||
|
||
def get_data_path(self, your_specific_arguments) | ||
# has to return the path to the underlying data file |
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.
Can we write the usual
"""
Comments as now...
Returns
-------
str
...
"""
...
format?
The visualizers should reside in the ``lib/python/picongpu/plugins/plot_mpl/`` directory. | ||
The module names should end on ``_visualizer.py`` and the class name should only be ``Visualizer``. | ||
|
||
There is a base class for visualization found in ``base_visualizer.py`` which already handles the plotting logic. It uses the |
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.
As in latex, just start a newline when starting a new sentence. No limit on line length in prose text to break for.
This will make diffs more readable.
docs/source/usage/plugins.rst
Outdated
Python postprocessing | ||
===================== | ||
|
||
In order to further work with the data produced by a plugin during a simulation run, PIConGPU provides |
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.
please keep one sentence per line for smaller diffs.
docs/source/usage/plugins.rst
Outdated
|
||
|
||
They can be found under ``lib/python/picongpu/``. | ||
It is our goal to provide three modules for each plugin to make postprocessing as convenient as possible: |
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.
provide at least
the thing is: every plugin can have multiple data readers and multiple data visualization methods. For example, the energy histogram can analyze
- a histogram
- an integrated charge per opening angle in a detector for a range in the histogram
- cut-off energies
- ...
docs/source/usage/plugins/png.rst
Outdated
@@ -6,7 +6,7 @@ PNG | |||
This plugin generates **images in the png format** for slices through the simulated volume. | |||
It allows to draw a **species density** together with electric, magnetic and/or current field values. | |||
The exact field values, their coloring and their normalization can be set using ``*.param`` files. | |||
It is a very rudimentary and useful tool to get a first impression on what happens in the simulation and to verify that the parameter set chosen leads to the desired physics. | |||
It is a very rudimentary and useful tool to get a first impression on what happens in the simulation and to verify that the parameter set chosen leads to the desired physics. |
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.
Just spotted a double whitespace between "to" and "the desired physics".
docs/source/usage/plugins/png.rst
Outdated
|
||
.. note:: | ||
|
||
For a 2D simulation, even a 2D image can be a quite heavy output. | ||
Make sure to reduce the preview size! | ||
|
||
It is possible to draw the borders between the GPUs used as white lines. | ||
It is possible to draw the borders between the GPUs used as white lines. |
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.
Just spotted a double whitespace between "It" and "is possible to ...".
|
||
Each reader class needs to implement the following interface functions: | ||
|
||
.. code:: python |
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.
Did we forget to write a base class for this? If so, we should build one in a follow-up PR.
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.
Another follow-up to this PR:
On Friday, we realized we forgot to add a meta-data method to return which units (and unit dimensions) the read data have. We should add a get_meta
or similar method. We should make this similar or identical to unitSI
and unitDimension
in openPMD and/or can rely on pint-strings.
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.
Yes, so far we don't have a base class for the readers. Would you want it to contain all the interface functions (and raising NotImplementedError
or should this class already implement some logic?
I think only the phase_space.py
file contains some metadata class. Is it something like this you had in mind?
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.
Implemented in #2730
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.
added now with last commit to avoid updating the interface in the manual and the source (now source only :) )
I adressed most of your comments locally but after rebasing on the current dev, I am not able to generate my docs anymore, the |
That's a Sphinx 1.8 bug. You need to downgrade to sphinx 1.7: #2725 |
Actually I'm using Sphinx 1.7.0. Anyway, it is working now...don't know what the issue was. |
91918eb
to
3be055c
Compare
What do I have to change so that the |
Allow Numpy-style Python autodocs for classes, modules and members with Napoleon.
f830e53
to
3c159ba
Compare
Don't be confused: I moved all widget docs to a follow-up in #2691. |
3c159ba
to
c1e2cd2
Compare
c1e2cd2
to
16d9a6a
Compare
Add section on postproc tools (PNG, Energy Histogram, PS). Devel: Architecture of postprocessing tools.
16d9a6a
to
3832df5
Compare
@codingS3b are you ok with my modifications and can I merge this? :) |
Yes, thanks for restructuring! |
Adds sections on how to develop and use the new python tools.
It already includes documentation for the jupyter_widgets as well (see #2691)