Skip to main content

PyPLUTO: Plotting routines for PLUTO

Project description

PyPLUTO: a data analysis Python package for the PLUTO code

Category Badges
Package Python Versions PyPI version
Reliability Windows Tests MacOS Tests Linux Tests Coverage Report
Docs & Community Project Status: Active Documentation Discord License: BSD-3-Clause
Citation DOI Arxiv Zenodo

PyPLUTO is a Python library which loads and plots the data obtain from the PLUTO code simulations. The aim of this package is to simplify some non-trivial python routines in order to quickly recover effective plots that are suited for scientific publications.

The package is designed to be used in both an interactive environment like ipython shell or Jupyter notebook and standard Python scripts.

The package is structured as follow:

  • the Load class is used to load the data from the PLUTO simulation fluid files.
  • the LoadPart class is used to load the data from the PLUTO simulation particle files.
  • the Image class is used to visualize the loaded data.
  • the GUI subpackage allows for a quic interactive script-free visualization.
  • additional functions (e.g., to show the images) are included in the package.

The package includes a set of examples in the Examples directory.

The package is tested on Python 3.13 (and newer versions) and with the following dependencies:

  • numpy
  • contourpy
  • matplotlib
  • numexpr
  • scipy
  • h5py
  • inifix
  • PySide6

The package is provided with a LICENSE file which contains the license terms.

The package is provided with an extensive documentation in the Docs directory.

Installation Instructions

To install the PyPLUTO package, you can use the following methods:

The easiest way to install PyPLUTO is through uv. Open your terminal and run the following command:

uv add py-pluto

Ensure that you are using Python 3.12 or newer, as the package is compatible from this version onwards. Installation through pip is also possible through the command:

pip install py-pluto

This method allows installation in a non-editable mode, and it is recommended to use a virtual environment to avoid conflicts with other packages.

Quick Start

import pyPLUTO as pp

Simulations can be loaded by just providing the path to the simulation directory. The last output (if not specific file is selected) is automatically found, as well as the available PLUTO file in the selected folder.

D = pp.Load()
print(D)

Relevant simulations attributes (such as the computational grid, the geometry and the variables to load) are found automatically. The data can be plotted through the Image class, which acts as a simplified maptlotlib wrapper. An example of 1D plot of the density can be:

D = pp.Load()
pp.Image().plot(D.x1, D.rho)
pp.show()

while 2D plots can be created with

D = pp.Load()
pp.Image().display(D.rho, x1=D.x1, x2=D.x2, cpos="right")
pp.show()

Examples

In order to test PyPLUTO capabilities, even without the PLUTO code, we provide an extensive tests suite with all the necessary data. In this way, PyPLUTO can be explored without any knowledge of the PLUTO code. All the tests are located in the Examples directory and are aimed at showing how to exploit the package capabilities.

The GUI

A Graphical User Interface has been implemented in order to simplify and enhance the visualization and analysis of simulation data. The GUI is built with PySide6 and allows users to load and visualize 1D and 2D fluid data (or slices) from PLUTO simulations. To run the GUI after the package installation, one should simply run the command

pypluto-gui

from the terminal. More details on how to use the GUI can be found in the documentation.

Documentation

For more detailed instructions and additional installation options, please refer to the PyPLUTO documentation where you can find comprehensive guides and examples.

Cite This Repository

If you use this repository in your research or projects, please consider citing the arxiv paper.

@ARTICLE{PyPLUTO2025,
       author = {{Mattia}, Giancarlo and {Crocco}, Daniele and {Melon Fuksman}, David and {Bugli}, Matteo and {Berta}, Vittoria and {Puzzoni}, Eleonora and {Mignone}, Andrea and {Vaidya}, Bhargav},
        title = "{PyPLUTO: a data analysis Python package for the PLUTO code}",
      journal = {arXiv e-prints},
     keywords = {Astrophysics - Instrumentation and Methods for Astrophysics},
         year = 2025,
        month = jan,
          eid = {arXiv:2501.09748},
        pages = {arXiv:2501.09748},
          doi = {10.48550/arXiv.2501.09748},
}

We recommend to put one the following expressions in your manuscript:

"The figures presented in this paper were generated using the PyPLUTO package (citation to the paper)"

"This research has benefited from the PyPLUTO package for data visualization (citation to the paper)"

Contributing

If you have any questions, suggestions or find a bug, feel free to open an issue or fork the repository and create a pull request. Any contribution aimed at helping the PLUTO code community to have better plots with less efforts will be greatly appreciated. If you want to contribute to PyPLUTO please follow the instruction present in the CONTRIBUTING.md file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_pluto-1.1.5.tar.gz (136.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_pluto-1.1.5-py3-none-any.whl (177.3 kB view details)

Uploaded Python 3

File details

Details for the file py_pluto-1.1.5.tar.gz.

File metadata

  • Download URL: py_pluto-1.1.5.tar.gz
  • Upload date:
  • Size: 136.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_pluto-1.1.5.tar.gz
Algorithm Hash digest
SHA256 1083aa0c4b5027247a81e371a18e46b6dd3ded5ff19cf5e65b3e1e24134b4b22
MD5 550e01f2783943eb537caa0d64f6cf79
BLAKE2b-256 6ac2f101046ed9d0352bfbd9137dfb4df61a1f54c2cf35d9bdf6275318255c44

See more details on using hashes here.

File details

Details for the file py_pluto-1.1.5-py3-none-any.whl.

File metadata

  • Download URL: py_pluto-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 177.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for py_pluto-1.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c2e45a45e268fcb333b3fcb914da105ab00306212401314606ba971746a789c3
MD5 b3f1eceb41fdf7889920127b66da8e55
BLAKE2b-256 974312f348a583beaa18abf672519e107d8ab798612f3f5862a2cd64c36c8222

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page