PyPLUTO: Difference between revisions

From Arbeitsgruppe Kuiper
Jump to navigation Jump to search
m (+spacing)
m (→‎Usage: %%capture)
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


(Unfortunately, <code>pload()</code>'s verbosity cannot be turned off.)
(Unfortunately, <code>pload()</code>'s verbosity cannot be turned off, but in JupyterLab you can put <code>%%capture --no-display</code> as the first line of the cell.)


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 and its spacings, respectively.
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 and its spacings, respectively.


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.

Revision as of 09:46, 21 May 2025

... exists in different versions from different sources:

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, but in JupyterLab you can put %%capture --no-display as the first line of the cell.)

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 and its spacings, respectively.

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.