PyPLUTO

From Arbeitsgruppe Kuiper
Jump to navigation Jump to search

... 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. For a list of all members see below.

Notes:

  • Upon import, there may be a warning about invalid escape sequence '\h', which can be ignored. (It stems from a $\hat{y}$ in the docstring of the function myfieldlines()).
  • Up to version 4.1 it used to be import pyPLUTO as pp rather than import pyPLUTO.pload as pp. You may encounter the old way in documentations.

Members of an object of type pyPLUTO.pload.pload (besides the physical fields listed in vars) are: DataScan(), DataScanHDF5(), DataScanVTK(), Dt, NStep, NStepStr, ReadDataFile(), ReadGridFile(), ReadMultipleFiles(), ReadSingleFile(), ReadTimeInfo(), ReadVarFile(), SimTime, Slice, datatype, dx1, dx2, dx3, endianess, filetype, geometry, irange, jrange, krange, level, n1, n1_tot, n2, n2_tot, n3, n3_tot, nshp, vars, wdir, x1, x1r, x1range, x2, x2r, x2range, x3, x3r, x3range