py-pluto 1.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_pluto-1.1.4/LICENSE +27 -0
- py_pluto-1.1.4/PKG-INFO +218 -0
- py_pluto-1.1.4/README.md +171 -0
- py_pluto-1.1.4/pyPLUTO/__init__.py +22 -0
- py_pluto-1.1.4/pyPLUTO/amr.py +745 -0
- py_pluto-1.1.4/pyPLUTO/baseloadmixin.py +258 -0
- py_pluto-1.1.4/pyPLUTO/baseloadstate.py +45 -0
- py_pluto-1.1.4/pyPLUTO/codes/echo_load.py +161 -0
- py_pluto-1.1.4/pyPLUTO/configure.py +261 -0
- py_pluto-1.1.4/pyPLUTO/gui/config.py +174 -0
- py_pluto-1.1.4/pyPLUTO/gui/custom_var.py +435 -0
- py_pluto-1.1.4/pyPLUTO/gui/globals.py +108 -0
- py_pluto-1.1.4/pyPLUTO/gui/main.py +17 -0
- py_pluto-1.1.4/pyPLUTO/gui/main_window.py +177 -0
- py_pluto-1.1.4/pyPLUTO/gui/panels.py +66 -0
- py_pluto-1.1.4/pyPLUTO/gui/utils.py +273 -0
- py_pluto-1.1.4/pyPLUTO/h_pypluto.py +84 -0
- py_pluto-1.1.4/pyPLUTO/image.py +302 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/colorbar.py +240 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/contour.py +254 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/create_axes.py +464 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/display.py +306 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/figure.py +395 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/imagetools.py +487 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/interactive.py +403 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/legend.py +250 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/plot.py +311 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/range.py +242 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/scatter.py +270 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/set_axis.py +497 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/streamplot.py +297 -0
- py_pluto-1.1.4/pyPLUTO/imagefuncs/zoom.py +428 -0
- py_pluto-1.1.4/pyPLUTO/imagemixin.py +259 -0
- py_pluto-1.1.4/pyPLUTO/imagestate.py +45 -0
- py_pluto-1.1.4/pyPLUTO/load.py +447 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/baseloadtools.py +71 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/codeselection.py +48 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/defpluto.py +123 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/descriptor.py +102 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/findfiles.py +182 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/findformat.py +245 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/initload.py +203 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/loadvars.py +227 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/offsetdata.py +87 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/offsetfluid.py +408 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/read_files.py +213 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readdata.py +619 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readdata_old.py +567 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readdefplini.py +101 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readfluid.py +479 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readformat.py +277 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readgridalone.py +224 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readgridfile.py +255 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readgridout.py +451 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readpart.py +419 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/readtab.py +105 -0
- py_pluto-1.1.4/pyPLUTO/loadfuncs/write_files.py +283 -0
- py_pluto-1.1.4/pyPLUTO/loadmixin.py +419 -0
- py_pluto-1.1.4/pyPLUTO/loadpart.py +233 -0
- py_pluto-1.1.4/pyPLUTO/loadstate.py +68 -0
- py_pluto-1.1.4/pyPLUTO/newload.py +81 -0
- py_pluto-1.1.4/pyPLUTO/pytools.py +145 -0
- py_pluto-1.1.4/pyPLUTO/toolfuncs/findlines.py +551 -0
- py_pluto-1.1.4/pyPLUTO/toolfuncs/fourier.py +149 -0
- py_pluto-1.1.4/pyPLUTO/toolfuncs/nabla.py +676 -0
- py_pluto-1.1.4/pyPLUTO/toolfuncs/parttools.py +152 -0
- py_pluto-1.1.4/pyPLUTO/toolfuncs/transform.py +638 -0
- py_pluto-1.1.4/pyPLUTO/utils/annotator.py +27 -0
- py_pluto-1.1.4/pyPLUTO/utils/inspector.py +145 -0
- py_pluto-1.1.4/pyPLUTO/utils/make_docstrings.py +3 -0
- py_pluto-1.1.4/py_pluto.egg-info/PKG-INFO +218 -0
- py_pluto-1.1.4/py_pluto.egg-info/SOURCES.txt +76 -0
- py_pluto-1.1.4/py_pluto.egg-info/dependency_links.txt +1 -0
- py_pluto-1.1.4/py_pluto.egg-info/entry_points.txt +2 -0
- py_pluto-1.1.4/py_pluto.egg-info/requires.txt +41 -0
- py_pluto-1.1.4/py_pluto.egg-info/top_level.txt +1 -0
- py_pluto-1.1.4/pyproject.toml +150 -0
- py_pluto-1.1.4/setup.cfg +4 -0
py_pluto-1.1.4/LICENSE
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2025 Giancarlo Mattia, Daniele Crocco, David Melon Fuksman, Matteo Bugli, Vittoria Berta, Eleonora Puzzoni, Andrea Mignone, Bhargav Vaidya
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its contributors
|
|
15
|
+
may be used to endorse or promote products derived from this software without
|
|
16
|
+
specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
19
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
20
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
py_pluto-1.1.4/PKG-INFO
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py-pluto
|
|
3
|
+
Version: 1.1.4
|
|
4
|
+
Summary: PyPLUTO: Plotting routines for PLUTO
|
|
5
|
+
Author: D. Crocco, D. Melon Fuksman, M. Bugli, V. Berta, E. Puzzoni, A. Mignone, B. Vaidya
|
|
6
|
+
Author-email: "G. Mattia" <mattia@mpia.de>
|
|
7
|
+
License: BSD-3-Clause
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: contourpy
|
|
12
|
+
Requires-Dist: numpy
|
|
13
|
+
Requires-Dist: matplotlib
|
|
14
|
+
Requires-Dist: scipy
|
|
15
|
+
Requires-Dist: numexpr
|
|
16
|
+
Requires-Dist: pandas
|
|
17
|
+
Requires-Dist: h5py
|
|
18
|
+
Requires-Dist: inifix>=5.1.0
|
|
19
|
+
Provides-Extra: extras
|
|
20
|
+
Requires-Dist: PySide6; extra == "extras"
|
|
21
|
+
Provides-Extra: docs
|
|
22
|
+
Requires-Dist: sphinx; extra == "docs"
|
|
23
|
+
Requires-Dist: sphinx-automodapi; extra == "docs"
|
|
24
|
+
Requires-Dist: numpydoc; extra == "docs"
|
|
25
|
+
Provides-Extra: test
|
|
26
|
+
Requires-Dist: pytest; extra == "test"
|
|
27
|
+
Requires-Dist: pytest-doctestplus; extra == "test"
|
|
28
|
+
Requires-Dist: coverage; extra == "test"
|
|
29
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
30
|
+
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: uv; extra == "dev"
|
|
33
|
+
Requires-Dist: pandas-stubs; extra == "dev"
|
|
34
|
+
Requires-Dist: h5py-stubs; extra == "dev"
|
|
35
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
36
|
+
Requires-Dist: pyright; extra == "dev"
|
|
37
|
+
Requires-Dist: pyrefly; extra == "dev"
|
|
38
|
+
Requires-Dist: ruff; extra == "dev"
|
|
39
|
+
Requires-Dist: ty>=0.0.17; extra == "dev"
|
|
40
|
+
Requires-Dist: radon; extra == "dev"
|
|
41
|
+
Requires-Dist: pydata-sphinx-theme; extra == "dev"
|
|
42
|
+
Provides-Extra: notebook
|
|
43
|
+
Requires-Dist: ipython; extra == "notebook"
|
|
44
|
+
Provides-Extra: pasta
|
|
45
|
+
Requires-Dist: pastamarkers; extra == "pasta"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# PyPLUTO: a data analysis Python package for the PLUTO code
|
|
49
|
+
|
|
50
|
+
| Category | Badges |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| Package |  [](https://github.com/GiMattia/PyPLUTO/releases) |
|
|
53
|
+
| Reliability | [](https://github.com/GiMattia/PyPLUTO/actions/workflows/test_windows.yml) [](https://github.com/GiMattia/PyPLUTO/actions/workflows/test_macos.yml) [](https://github.com/GiMattia/PyPLUTO/actions/workflows/test_linux.yml)  |
|
|
54
|
+
| Docs & Community | [](https://www.repostatus.org/#active) [](https://pypluto.readthedocs.io/en/latest/?badge=latest) [](https://discord.gg/YOUR_INVITE) [](https://opensource.org/licenses/BSD-3-Clause) |
|
|
55
|
+
| Citation | [](https://doi.org/10.21105/joss.08448) [](https://doi.org/10.48550/arXiv.2501.09748) [](https://doi.org/10.5281/zenodo.19650848) |
|
|
56
|
+
|
|
57
|
+
<!--  -->
|
|
58
|
+
|
|
59
|
+
PyPLUTO is a Python library which loads and plots the data obtain from the
|
|
60
|
+
PLUTO code simulations.
|
|
61
|
+
The aim of this package is to simplify some non-trivial python routines in order
|
|
62
|
+
to quickly recover effective plots that are suited for scientific publications.
|
|
63
|
+
|
|
64
|
+
The package is designed to be used in both an interactive environment like
|
|
65
|
+
ipython shell or Jupyter notebook and standard Python scripts.
|
|
66
|
+
|
|
67
|
+
The package is structured as follow:
|
|
68
|
+
|
|
69
|
+
- the Load class is used to load the data from the PLUTO simulation fluid files.
|
|
70
|
+
- the LoadPart class is used to load the data from the PLUTO simulation particle files.
|
|
71
|
+
- the Image class is used to visualize the loaded data.
|
|
72
|
+
- additional functions (e.g., to save the images) are included in the package.
|
|
73
|
+
|
|
74
|
+
The package includes a set of examples in the `Examples` directory.
|
|
75
|
+
|
|
76
|
+
The package is tested on Python 3.10 (and newer versions) and with the following dependencies:
|
|
77
|
+
|
|
78
|
+
- `numpy`
|
|
79
|
+
- `matplotlib`
|
|
80
|
+
- `scipy`
|
|
81
|
+
- `pandas`
|
|
82
|
+
- `h5py`
|
|
83
|
+
- `PySide6`
|
|
84
|
+
|
|
85
|
+
The package is provided with a `LICENSE` file which contains the license terms.
|
|
86
|
+
|
|
87
|
+
The package is provided with an extensive documentation in the `Docs` directory.
|
|
88
|
+
|
|
89
|
+
## Installation Instructions
|
|
90
|
+
|
|
91
|
+
To install the PyPLUTO package, you can use the following methods:
|
|
92
|
+
|
|
93
|
+
### Installation with pip
|
|
94
|
+
|
|
95
|
+
The easiest way to install PyPLUTO is through pip. Open your terminal and run the following command:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pip install ./
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Ensure that you are using Python 3.10 or newer, as the package is compatible from this version onwards.
|
|
102
|
+
Installation through pipenv or uv is also possible (see the documentation).
|
|
103
|
+
|
|
104
|
+
This method allows installation in a non-editable mode, and it is recommended to use a virtual environment to avoid conflicts with other packages.
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
import pyPLUTO as pp
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Simulations can be loaded by just providing the path to the simulation directory. The last output (if not specific
|
|
113
|
+
file is selected) is automatically found, as well as the available PLUTO file in the selected folder.
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
D = pp.Load()
|
|
117
|
+
print(D)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Relevant simulations attributes (such as the computational grid, the geometry and the variables to load) are found automatically.
|
|
121
|
+
The data can be plotted through the Image class, which acts as a simplified maptlotlib wrapper.
|
|
122
|
+
An example of 1D plot of the density can be:
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
D = pp.Load()
|
|
126
|
+
pp.Image().plot(D.x1, D.rho)
|
|
127
|
+
pp.show()
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
while 2D plots can be created with
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
D = pp.Load()
|
|
134
|
+
pp.Image().display(D.rho, x1=D.x1, x2=D.x2, cpos="right")
|
|
135
|
+
pp.show()
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Examples
|
|
139
|
+
|
|
140
|
+
In order to test PyPLUTO capabilities, even without the PLUTO code, we provide
|
|
141
|
+
an extensive tests suite with all the necessary data.
|
|
142
|
+
In this way, PyPLUTO can be explored without any knowledge of the PLUTO code.
|
|
143
|
+
All the tests are located in the `Examples` directory and are aimed at showing
|
|
144
|
+
how to exploit the package capabilities.
|
|
145
|
+
|
|
146
|
+
## The GUI
|
|
147
|
+
|
|
148
|
+
A Graphical User Interface has been implemented in order to simplify and enhance the visualization and analysis of simulation data.
|
|
149
|
+
The GUI is built with PyQt6 and allows users to load and visualize 1D and 2D fluid data (or slices) from PLUTO simulations.
|
|
150
|
+
To run the GUI after the package installation, one should simply run the command
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
pypluto-gui
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
from the terminal. More details on how to use the GUI can be found in the documentation.
|
|
157
|
+
|
|
158
|
+
## Documentation
|
|
159
|
+
|
|
160
|
+
For more detailed instructions and additional installation options, please refer to the PyPLUTO documentation where you can find comprehensive guides and examples.
|
|
161
|
+
|
|
162
|
+
## Cite This Repository
|
|
163
|
+
|
|
164
|
+
If you use this repository in your research or projects, please consider citing the arxiv paper.
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
@ARTICLE{PyPLUTO2025,
|
|
168
|
+
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},
|
|
169
|
+
title = "{PyPLUTO: a data analysis Python package for the PLUTO code}",
|
|
170
|
+
journal = {arXiv e-prints},
|
|
171
|
+
keywords = {Astrophysics - Instrumentation and Methods for Astrophysics},
|
|
172
|
+
year = 2025,
|
|
173
|
+
month = jan,
|
|
174
|
+
eid = {arXiv:2501.09748},
|
|
175
|
+
pages = {arXiv:2501.09748},
|
|
176
|
+
doi = {10.48550/arXiv.2501.09748},
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
We recommend to put one the following expressions in your manuscript:
|
|
181
|
+
|
|
182
|
+
"The figures presented in this paper were generated using the PyPLUTO package (citation to the paper)"
|
|
183
|
+
|
|
184
|
+
"This research has benefited from the PyPLUTO package for data visualization (citation to the paper)"
|
|
185
|
+
|
|
186
|
+
## Contributing
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
Any contribution aimed at helping the PLUTO code community to have better plots with less efforts will be greatly appreciated.
|
|
190
|
+
If you want to contribute to PyPLUTO please be sure to install it in the developer mode, through the command:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pip install -r requirements_dev.txt
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Rules for Contributing
|
|
197
|
+
|
|
198
|
+
We use pre-commit to ensure that the code is consistent with the code guidelines, through uv, ruff, pyrefly and ty.
|
|
199
|
+
You can either link the pre-commit to the repository through the command
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pre-commit install
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
or by enforcing the guide styles manually through the command
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pre-commit run --all-files
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Before opening a pull request,there is the possibility to run a deeper series of checks, including tests with coverage, pylint check, docstring coverage and so through the command
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pre-commit run --all-files --hook-stage manual
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
If one or more tests do not pass the automatic code checks anforced through github actions will not allow the pull request to pass, so is higly recommended to run the full pre-commit before every pull request.
|
|
218
|
+
For any question or enquiry, please contact one of the administrators.
|
py_pluto-1.1.4/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# PyPLUTO: a data analysis Python package for the PLUTO code
|
|
2
|
+
|
|
3
|
+
| Category | Badges |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| Package |  [](https://github.com/GiMattia/PyPLUTO/releases) |
|
|
6
|
+
| Reliability | [](https://github.com/GiMattia/PyPLUTO/actions/workflows/test_windows.yml) [](https://github.com/GiMattia/PyPLUTO/actions/workflows/test_macos.yml) [](https://github.com/GiMattia/PyPLUTO/actions/workflows/test_linux.yml)  |
|
|
7
|
+
| Docs & Community | [](https://www.repostatus.org/#active) [](https://pypluto.readthedocs.io/en/latest/?badge=latest) [](https://discord.gg/YOUR_INVITE) [](https://opensource.org/licenses/BSD-3-Clause) |
|
|
8
|
+
| Citation | [](https://doi.org/10.21105/joss.08448) [](https://doi.org/10.48550/arXiv.2501.09748) [](https://doi.org/10.5281/zenodo.19650848) |
|
|
9
|
+
|
|
10
|
+
<!--  -->
|
|
11
|
+
|
|
12
|
+
PyPLUTO is a Python library which loads and plots the data obtain from the
|
|
13
|
+
PLUTO code simulations.
|
|
14
|
+
The aim of this package is to simplify some non-trivial python routines in order
|
|
15
|
+
to quickly recover effective plots that are suited for scientific publications.
|
|
16
|
+
|
|
17
|
+
The package is designed to be used in both an interactive environment like
|
|
18
|
+
ipython shell or Jupyter notebook and standard Python scripts.
|
|
19
|
+
|
|
20
|
+
The package is structured as follow:
|
|
21
|
+
|
|
22
|
+
- the Load class is used to load the data from the PLUTO simulation fluid files.
|
|
23
|
+
- the LoadPart class is used to load the data from the PLUTO simulation particle files.
|
|
24
|
+
- the Image class is used to visualize the loaded data.
|
|
25
|
+
- additional functions (e.g., to save the images) are included in the package.
|
|
26
|
+
|
|
27
|
+
The package includes a set of examples in the `Examples` directory.
|
|
28
|
+
|
|
29
|
+
The package is tested on Python 3.10 (and newer versions) and with the following dependencies:
|
|
30
|
+
|
|
31
|
+
- `numpy`
|
|
32
|
+
- `matplotlib`
|
|
33
|
+
- `scipy`
|
|
34
|
+
- `pandas`
|
|
35
|
+
- `h5py`
|
|
36
|
+
- `PySide6`
|
|
37
|
+
|
|
38
|
+
The package is provided with a `LICENSE` file which contains the license terms.
|
|
39
|
+
|
|
40
|
+
The package is provided with an extensive documentation in the `Docs` directory.
|
|
41
|
+
|
|
42
|
+
## Installation Instructions
|
|
43
|
+
|
|
44
|
+
To install the PyPLUTO package, you can use the following methods:
|
|
45
|
+
|
|
46
|
+
### Installation with pip
|
|
47
|
+
|
|
48
|
+
The easiest way to install PyPLUTO is through pip. Open your terminal and run the following command:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install ./
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Ensure that you are using Python 3.10 or newer, as the package is compatible from this version onwards.
|
|
55
|
+
Installation through pipenv or uv is also possible (see the documentation).
|
|
56
|
+
|
|
57
|
+
This method allows installation in a non-editable mode, and it is recommended to use a virtual environment to avoid conflicts with other packages.
|
|
58
|
+
|
|
59
|
+
## Quick Start
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
import pyPLUTO as pp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Simulations can be loaded by just providing the path to the simulation directory. The last output (if not specific
|
|
66
|
+
file is selected) is automatically found, as well as the available PLUTO file in the selected folder.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
D = pp.Load()
|
|
70
|
+
print(D)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Relevant simulations attributes (such as the computational grid, the geometry and the variables to load) are found automatically.
|
|
74
|
+
The data can be plotted through the Image class, which acts as a simplified maptlotlib wrapper.
|
|
75
|
+
An example of 1D plot of the density can be:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
D = pp.Load()
|
|
79
|
+
pp.Image().plot(D.x1, D.rho)
|
|
80
|
+
pp.show()
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
while 2D plots can be created with
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
D = pp.Load()
|
|
87
|
+
pp.Image().display(D.rho, x1=D.x1, x2=D.x2, cpos="right")
|
|
88
|
+
pp.show()
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Examples
|
|
92
|
+
|
|
93
|
+
In order to test PyPLUTO capabilities, even without the PLUTO code, we provide
|
|
94
|
+
an extensive tests suite with all the necessary data.
|
|
95
|
+
In this way, PyPLUTO can be explored without any knowledge of the PLUTO code.
|
|
96
|
+
All the tests are located in the `Examples` directory and are aimed at showing
|
|
97
|
+
how to exploit the package capabilities.
|
|
98
|
+
|
|
99
|
+
## The GUI
|
|
100
|
+
|
|
101
|
+
A Graphical User Interface has been implemented in order to simplify and enhance the visualization and analysis of simulation data.
|
|
102
|
+
The GUI is built with PyQt6 and allows users to load and visualize 1D and 2D fluid data (or slices) from PLUTO simulations.
|
|
103
|
+
To run the GUI after the package installation, one should simply run the command
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pypluto-gui
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
from the terminal. More details on how to use the GUI can be found in the documentation.
|
|
110
|
+
|
|
111
|
+
## Documentation
|
|
112
|
+
|
|
113
|
+
For more detailed instructions and additional installation options, please refer to the PyPLUTO documentation where you can find comprehensive guides and examples.
|
|
114
|
+
|
|
115
|
+
## Cite This Repository
|
|
116
|
+
|
|
117
|
+
If you use this repository in your research or projects, please consider citing the arxiv paper.
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
@ARTICLE{PyPLUTO2025,
|
|
121
|
+
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},
|
|
122
|
+
title = "{PyPLUTO: a data analysis Python package for the PLUTO code}",
|
|
123
|
+
journal = {arXiv e-prints},
|
|
124
|
+
keywords = {Astrophysics - Instrumentation and Methods for Astrophysics},
|
|
125
|
+
year = 2025,
|
|
126
|
+
month = jan,
|
|
127
|
+
eid = {arXiv:2501.09748},
|
|
128
|
+
pages = {arXiv:2501.09748},
|
|
129
|
+
doi = {10.48550/arXiv.2501.09748},
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
We recommend to put one the following expressions in your manuscript:
|
|
134
|
+
|
|
135
|
+
"The figures presented in this paper were generated using the PyPLUTO package (citation to the paper)"
|
|
136
|
+
|
|
137
|
+
"This research has benefited from the PyPLUTO package for data visualization (citation to the paper)"
|
|
138
|
+
|
|
139
|
+
## Contributing
|
|
140
|
+
|
|
141
|
+
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.
|
|
142
|
+
Any contribution aimed at helping the PLUTO code community to have better plots with less efforts will be greatly appreciated.
|
|
143
|
+
If you want to contribute to PyPLUTO please be sure to install it in the developer mode, through the command:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pip install -r requirements_dev.txt
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Rules for Contributing
|
|
150
|
+
|
|
151
|
+
We use pre-commit to ensure that the code is consistent with the code guidelines, through uv, ruff, pyrefly and ty.
|
|
152
|
+
You can either link the pre-commit to the repository through the command
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
pre-commit install
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
or by enforcing the guide styles manually through the command
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
pre-commit run --all-files
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Before opening a pull request,there is the possibility to run a deeper series of checks, including tests with coverage, pylint check, docstring coverage and so through the command
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
pre-commit run --all-files --hook-stage manual
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
If one or more tests do not pass the automatic code checks anforced through github actions will not allow the pull request to pass, so is higly recommended to run the full pre-commit before every pull request.
|
|
171
|
+
For any question or enquiry, please contact one of the administrators.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""Top-level package for pyPLUTO."""
|
|
2
|
+
|
|
3
|
+
from pyPLUTO.configure import Configure
|
|
4
|
+
from pyPLUTO.image import Image
|
|
5
|
+
from pyPLUTO.load import Load as Oldload
|
|
6
|
+
from pyPLUTO.loadpart import LoadPart
|
|
7
|
+
from pyPLUTO.newload import Load
|
|
8
|
+
from pyPLUTO.pytools import find_example, ring, savefig, show
|
|
9
|
+
|
|
10
|
+
# Define the version and additional environment variables
|
|
11
|
+
Configure()
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"Image",
|
|
15
|
+
"Load",
|
|
16
|
+
"LoadPart",
|
|
17
|
+
"Oldload",
|
|
18
|
+
"find_example",
|
|
19
|
+
"ring",
|
|
20
|
+
"savefig",
|
|
21
|
+
"show",
|
|
22
|
+
]
|