Introduction
Some blabla which explains that simulations are handled by the
gbspy.Sim
class, and that quantities are usually passed around as
4D numpy arrays.
Opening a simulation
A GBS simulation usually consists in a collection of numerically indexed result
files (results_00.h5
, results_01.h5
, …), compagnion restart files
(restart_00.h5
, restart_01.h5
, …), as well as a number of log files.
The files with extension .h5
rely on the
HDF5 storage format.
The user may be familiar with storage conventions (such as
NetCDF or
CGNS) which also rely on the HDF5 format. The
internal structure of GBS results, however, uses a custom format which will not
be recognized by general purpose packages.
GBSpy provides a mechanism to read result files, typically by specifying a path to a directory containing a series of such files,
In [1]: import gbspy
In [2]: path = "/path/to/directory/containing/results"
In [3]: sim = gbspy.Sim(path)
In [4]: sim
Out[4]: <GBS simulation '/path/to/directory/containing/results' (0x14911a610b80)>
It is also possible to open individual result files if needed by passing a path to the relevant file instead of the simulation directory, as below,
In [5]: sim = gbspy.Sim("/path/to/directory/containing/results/results_43.h5")
In [6]: sim
Out[6]: <GBS simulation '/path/to/directory/containing/results' (0x14911a80fbe0)>
Loading tutorial datasets
If you want to start exploring the functionality of this toolbox but miss a
full simulation, gbspy.tutorial.Sim()
allows you to download and open
sample simulations.
An internet connection and about 50MB of disk space will be required for each
sample, as well as having the
pooch package installed.
You can thus start looking around by loading such a dataset, as will be done throughout this guide, with the snippet below.
In [7]: import gbspy.tutorial
In [8]: sim = gbspy.tutorial.Sim("tcv_neutrals")
In [9]: gbspy.plot2d(sim, "theta")