PyPLUTO: Difference between revisions
Jump to navigation
Jump to search
m (→Usage: slash) |
m (→Usage: vx, x ,dx) |
||
Line 18: | Line 18: | ||
data=pp.pload(timestep, w_dir=wdir) # timestep = int, e.g. 1 | data=pp.pload(timestep, w_dir=wdir) # timestep = int, e.g. 1 | ||
Now, <code>data</code> contains all the information of the given timestep. To obtain a specific variable, e.g. <code> | (Unfortunately, <code>pload()</code>'s verbosity cannot be turned off.) | ||
Now, <code>data</code> contains all the information of the given timestep. To obtain a specific variable, e.g. <code>vx1</code>, you can use <code>data.vx1</code> to get a numpy array with all the values in that timestep. Moreover, <code>x1</code>, <code>x2</code> and <code>x3</code>, as well as <code>dx1</code>, <code>dx2</code> and <code>dx3</code>, contain the grid. | |||
Note: Up to version 4.1 it used to be not <code>import pyPLUTO.pload as pp</code> but <code>import pyPLUTO as pp</code>, which still may appear in documentations. | Note: Up to version 4.1 it used to be not <code>import pyPLUTO.pload as pp</code> but <code>import pyPLUTO as pp</code>, which still may appear in documentations. |
Latest revision as of 12:31, 1 December 2024
... exists in different versions from different sources:
- https://github.com/bellatrics/pyPLUTO, alpha state from 2011, don't use
- https://github.com/coolastro/pyPLUTO, version 1.0 from 2012, don't use
- https://gitlab.mpcdf.mpg.de/sdoetsch/pypluto, modified version 4.4, maintained until 2022 ← use this
Installation
(... as non-administrator)
- Grab the files off of gitlab e.g. in ZIP format and unzip them into a local folder.
- Inside the extracted folder, enter your python environment (e.g. conda) and run
python3 setup.py install
.
Usage
import pyPLUTO.pload as pp wdir="/path/to/data/files/" # trailing slash! data=pp.pload(timestep, w_dir=wdir) # timestep = int, e.g. 1
(Unfortunately, pload()
's verbosity cannot be turned off.)
Now, data
contains all the information of the given timestep. To obtain a specific variable, e.g. vx1
, you can use data.vx1
to get a numpy array with all the values in that timestep. Moreover, x1
, x2
and x3
, as well as dx1
, dx2
and dx3
, contain the grid.
Note: Up to version 4.1 it used to be not import pyPLUTO.pload as pp
but import pyPLUTO as pp
, which still may appear in documentations.