IMAS-Python (formerly known as IMASPy its for versions < 2) is a pure-python library to handle arbitrarily nested data structures. It is designed for, but not necessarily bound to, interacting with Interface Data Structures (IDSs) as defined by the Integrated Modelling & Analysis Suite (IMAS) Data Model.
Simply install IMAS-Python with pip
:
pip install imas-python
or with optional dependencies for netCDF and xarray support:
pip install imas-python[netcdf,xarray]
More details are described in the documentation generated from /docs/source/installing.rst
.
The documentation is autogenerated from the source using Sphinx
and can be found at the readthedocs
To generated the documentation yourself, install the docs
optional dependencies and do:
make -C docs html
import imas
factory = imas.IDSFactory()
equilibrium = factory.equilibrium()
print(equilibrium)
equilibrium.ids_properties.homogeneous_time = imas.ids_defs.IDS_TIME_MODE_HOMOGENEOUS
equilibrium.ids_properties.comment = "testing"
equilibrium.time = [0.01]
with imas.DBEntry("imas:hdf5?path=./testdb", "w") as dbentry:
dbentry.put(equilibrium)
# or without imas_core dependency
with imas.DBEntry("./test.nc", "w") as dbentry:
dbentry.put(equilibrium)
A quick 5 minutes introduction is available in the documentation generated from /docs/sources/intro.rst
.
IMAS-Python is Copyright 2020-2025 ITER Organization, Copyright 2020-2023 Karel Lucas van de Plassche karelvandeplassche@gmail.com, Copyright 2020-2022 Daan van Vugt dvanvugt@ignitioncomputing.com, and Copyright 2020 Dutch Institute for Fundamental Energy Research info@differ.nl. It is licensed under LGPL 3.0.
Inspired and bootstrapped by existing tools, notably the IMAS Python HLI, IMAS Python workflows, and OMAS.