Skip to content

Added struphy-plots integration - #408

Draft
max-models wants to merge 219 commits into
develfrom
struphy-plots-integration
Draft

max-models wants to merge 219 commits into
develfrom
struphy-plots-integration

Conversation

@max-models

@max-models max-models commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Merge after #406

Integrate the optional plasma-plots package with Output, so creating an output handle automatically enables whole-run plots and diagnostics through out.plot and out.analysis, plus the .plasma accessors on xarray products. Also enable automatic post-processing under MPI and direct selection of particle products by their full catalog keys.

Install plasma-plots with: pip install plasma-plots or pip install "struphy[pproc]".

Solves the following issue(s):

Makes plasma-plots available directly from the Struphy output API and removes the need for a separate pproc() call before first accessing unprocessed products under MPI.

Core changes:

  • Add the optional struphy[plots] extra, which installs plasma-plots. Output loads the package when installed; output reading remains available without it. Accessing plotting or analysis without the package gives installation guidance.
  • Let evaluate() and pproc() choose parallel processing automatically when the current MPI job has the same number of ranks as the saved simulation, and more than one rank. Otherwise, rank 0 processes the run while the remaining ranks wait. An explicit parallel=True or False overrides the selection.
  • Synchronize ranks before they read newly written products and serialize serial processing with a filesystem lock to avoid competing writers. Use POSIX record locks where available, with an exclusive-file fallback.
  • Accept full particle-product keys such as out.evaluate("kinetic_ions/e1_v1_density/delta_f"), including coordinate selections. Reject combining a full key with dataset=.

Model-specific changes:

None.

Documentation changes:

Update the README, quickstart, user guide, and output API documentation with plasma-plots installation, accessor examples, and MPI processing behavior.

@max-models max-models mentioned this pull request Sep 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants