xHermes
xHermes is a post-processing package for Hermes-3 in 1D, 2D and 3D which provides automatic conversion to SI units and many useful plotting routines.
xHermes a wrapper around xBOUT to provide Hermes-3 specific features. At the moment, xHermes is used for loading in the Hermes-3 results, performing SI unit conversion and calculating some geometry terms. You may still want to use xBOUT, in particular if you are running 2D and 3D cases and want plotting routines for those.
There is also a collection of Mike Kryjak's personal post-processing scripts sdtools which have extensive additional functionality for 1D and 2D postprocessing. These scripts are not officially supported, but feel free to take a look. It is intended for all those additional features to be merged into xHermes over time.
Both xBOUT and xHermes use Xarray which provides a scalable and powerful framework for dealing with large amounts of data while preserving dimensional consistency. If you have ever used Pandas, you will find Xarray very familiar, as it is effectively Pandas in more dimensions.
While Xarray is based on Numpy arrays under the hood and the data can be accessed in this way, Xarray's main benefit comes in its powerful abilities to select, filter and operate on data. The syntax is similar to Pandas and the basics are explained in Xarray's excellent documentation. If you are new to Xarray, it may be useful to start with reviewing the selection syntax.
Installation
Hermes-3 is pip installable. In the terminal with your Python environment enabled, run:
pip install xhermes
However, you may not be able to get the latest version this way. For now, it is highly recommended you do an editable install instead:
git clone https://github.com/boutproject/xhermes
cd xhermes
pip install -e .
In this way, pip will install the Python package from the xHermes folder you cloned. If you use git to checkout branches or modify the contents in any way, it will be automatically work.
Loading simulations
The data from a Hermes-3 run can be loaded with just
import xhermes
ds = xhermes.open(hermes_simulation_path)
where the hermes_simulation_path directory is assumed to contain the BOUT.dmp.*.nc
files and a BOUT.settings file. open returns an instance of an
xarray.Dataset which contains BOUT- and Hermes-specific information
in the attrs, so represents a general structure for storing all of
the output of a simulation, including data, input options and (soon)
grid data.
When working with 2D or 3D simulations of tokamaks, it can be useful to load the grid along with the simulation file and pass the "toroidal" flag to xBOUT:
import xhermes
ds = xhermes.open(hermes_simulation_path, gridfilepath = grid_file_path, geometry = "toroidal")
This loads the metric tensor and grid corner coordinates from the grid which enables geometrical operations, polygonal plotting routines and additional metadata on topology.
Working with the data
Normalisation and geometry extraction
All variables within Hermes-3 are normalised. The normalisation factors, the units and variable names are provided in the Hermes-3 output for most variables. This information can be accessed for each variable DataArray:
ds["Pe"].attrs
xHermes automatically applies the unnormalisation when the simulation is loaded in.
When working with 1D and 2D tokamak simulations, it can be useful to extract cell lengths, volumes and cross-sectional areas as well as some additional metadata from the model:
ds = ds.hermes.extract_1D_tokamak_geometry()
or
ds = ds.hermes.extract_2D_tokamak_geometry()
The Dataset
The Dataset ds contains useful objects:
- A DataArray for each variable:
ds.data_varsshows a list.ds["Pe"]returns the Pe DataArray. - A DataArray for each coordinate:
ds.coordsshows a list.ds["t"]ords.coords["t"]returns the t DataArray. - A summary of dimensions in the model:
ds.dims - Model metadata:
ds.metadata - Model input settings:
ds.options
The DataArray
The DataArray (e.g. ds["Pe"]) contains the array with the variable data, its dimensionality and
attributes as well as metadata and options inherited from the parent dataset.
A visual summary of the DataArray contents and size can be obtained by simply:
ds["Pe"]
Note that this may be slow due to the Xarray overhead. To access the underlying data as a Numpy array, one can use:
ds["Pe"].values
or
ds["Pe"].data
Plotting
Xarray contains a lot of built-in plotting routines which can be used to prepare excellent 1D and 2D plots. Unfortunately, it is unable to deal with 2D plots in tokamak geometry. Routines to plot those are available in xBOUT which has some excellent example notebooks.
Metadata
Release files for xhermes 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xhermes-0.2.0.tar.gz | 29.2 kB | With provenance | Details for xhermes-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xhermes-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for xhermes-0.2.0-py3-none-any.whl |
Total release size: 55.3 kB
Release files / xhermes-0.2.0.tar.gz
| Download URL | xhermes-0.2.0.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad100be47af3570f2a9bffea3efcb50b4b304bdfe7700cc0453151ab3cd2148e
|
|
BLAKE2b-256 checksum How to use checksums |
4caf954d6c9ad457268ec5440c3b47cb3b4bd463ef31fdf4a504364de2c0406f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logRelease files / xhermes-0.2.0-py3-none-any.whl
| Download URL | xhermes-0.2.0-py3-none-any.whl |
|---|---|
| Size | 26.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
906e03410b2ce500b225f75fd09267ba1337bae6be8b793208325891be7878d9
|
|
BLAKE2b-256 checksum How to use checksums |
c2b7075c9f328df770e50f4d2990ed6b6de02e513d3edf15e8f0dfd04aec2528
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logSecurity for xhermes 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for xhermes-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.