Load class#
- class pyPLUTO.Load[source]#
The Load class loads the data (fluid) from the output files.
The initialization corresponds to the loading, if wanted, of one or more datafiles for the fluid. The data are loaded in a memory mapped numpy multidimensional array. Such approach does not load the full data until needed. Basic operations (i.e. no numpy) are possible, as well as slicing the arrays, without fully loading the data.
- Parameters:
- - alone: bool | None, default False
If the files are standalone. If False, the code will look for the grid file in the folder. If True, the code will look for the grid information within the data files. Should be used only for non-binary files.
- - code: str | None, default None
The code from which the data are loaded. If None, the code assumes PLUTO/gPLUTO. If a different code is provided, the corresponding loading method is used (if implemented).
- - datatype: str | None, default None
The format of the data file. If not specified, the code will look for the format from the list of possible formats. HDF5 (AMR) formats have not been implemented yet.
- - defh: bool | str | None, default None
The path to the definitions header file. If True, the code will look for the default definitions header file. If a string is provided, it will be used as the path to the definitions header file. If False, the code will not attempt to read the definitions header file.
- - endian: str | None, default None
Endianess of the datafiles. Should be used only if specific architectures are used, since the code computes it by itself. Valid values are ‘big’ and ‘little’ (or ‘<’ and ‘>’).
- - full3d: bool, default True
If disabled, the 3D meshgrids for the grid in non-cartesian coordinates are not used. Instead, a combination of an external loop and2D meshgrid is employed. The aim is to allow for cartesian meshes from non-cartesian geometries without saturating the computer memory (suited for laptops).
- - level: int, default 0
The refinement level of the grid. Should be used only if the grid is refined through AMR.
- - multiple: bool, default False
If the files are multiple. If False, the code will look for the single files, otherwise for the multiple files each corresponding to the loaded variables. Should be used only if both single files and multiple files are present in the same format for the same datatype.
- - nout: int | str | list | None, default ‘last’
The files to be loaded. Possible choices are int values (which correspond to the number of the output file), strings (‘last’, which corresponds to the last file, ‘all’, which corresponds to all files) or a list of the aforementioned types. Note that the ‘all’ value should be used carefully, e.g. only when the data need to be shown interactively.
- - path: str, default ‘./’
The path of the folder where the files should be loaded.
- - plini: bool | str | None, default None
The path to the pluto.ini file. If True, the code will look for the default pluto.ini file. If a string is provided, it will be used as the path to the pluto.ini file. If False, the code will not attempt to read the pluto.ini file.
- - text: bool | None, default None
Controls output verbosity. None (default) prints standard load info at INFO level. False silences all output. True enables full DEBUG logging.
- - var: str | list[str] | bool | None, default True
The variables to be loaded. The default value, True, corresponds to all the variables.
- Returns:
- None
Examples
Example #1: Load the data from the default folder and output
>>> D = pp.Load() Loading folder ./, output [0]
Example #2: Load the data from the default folder but output 0
>>> D = pp.Load(nout=0) Loading folder ./, output [0]
- Example #3: Load the data from the default folder but last output is
specified
>>> D = pp.Load(nout="last") Loading folder ./, output [1]
Example #4: Load the data from the default folder and all outputs
>>> D = pp.Load(nout="all") Loading folder ./, output [0, 1, 2, 3, 4]
- Example #5: Load the data from the default folder and multiple
selected outputs
>>> D = pp.Load(nout=[0, 1, 2]) Loading folder ./, output [0, 1, 2]
- Example #6: Load the data from the default folder and multiple selected
outputs and variables
>>> D = pp.Load(nout=[0, 1, 2], var=["rho", "vel1"]) Loading folder ./, output [0, 1, 2]
- Example #7: Load the data from the default folder, multiple selected
outputs and variables, without text
>>> D = pp.Load(nout=[0, 1, 2], vars=["rho", "vel1"], text=False)
- Example #8: Load the data from the default format with selected output
and format
>>> D = pp.Load(data="vtk", nout=0) Loading folder ./, output [0]
- Example #9: Load the data from the default folder with selected output,
variables and format
>>> D = pp.Load(data="vtk", nout=0, vars=["rho", "vel1"]) Loading folder ./, output [0]
Example #10: Load the data from a specific folder with selected output
>>> D = pp.Load(path="./data/", nout=0) Loading folder ./data/, output [0]
Initialize the Load class.