Published: Jun 8, 2023 by Liam Pattinson
Project info
The Mega Ampere Spherical Tokamak Upgrade (MAST-U) project generates a lot of data. After each ‘shot’, the raw data from sensors within the tokamak is made available to researchers via the Universal Data Access (UDA) system, with each signal represented by a three letter code. For example, ‘RCC’ is the signal for Celeste-3, which measures emission spectra from impurities in the plasma. MAST-U data is processed further using a scheduler system that automatically processes raw data into more useful diagnostics once those signals become available. This processed data is itself made available via UDA as a three letter signal code, and this may, in turn, be used to generate higher level diagnostics via the scheduler.
ACT is the signal representing Charge Exchange Recombination Spectroscopy (CXRS) data, which is a technique used to measure properties such as the temperature and density of impurity ions within a plasma. This diagnostic is generated by combining raw data from the Celeste-3 camera with data from the neutral-beam injection system. A newer signal, ACU, represents similar data gleaned from the upgraded Celeste-4 sensor package, which features two cameras as opposed to one, both of which operate on variable sight lines.
The software used to create the ACT and ACU signals is a small Python library called
act
. The software is already in use and is both well documented and quite mature. Our
work on act
was focused on improvements to the packaging and testing systems.
Our first step was to reorganise the project to match a Cookiecutter project template developed by UKAEA software engineers for MAST-U scheduler codes. Historically, a lot of research software for MAST-U’s earlier incarnation, MAST, was written in IDL, and the development of this template is part of a wider push within CCFE/UKAEA to upgrade software to modern Python. This was a relatively straightforward process, as it only required updating the existing packaging methods to PEP 517/518/621 standards and moving/renaming some parts of the code. This was followed by some linting, with the aim of ensuring the project followed a consistent PEP 8 code style throughout.
Our next step was to rewrite the testing framework to make use of pytest.
act
provided its own testing functionality, but it required human input to run,
making it incompatible with the CCFE GitLab CI processes.
Finally, the docstrings throughout the project were updated to Numpy style,
and we set up the infrastructure for creating online Sphinx docs. We took this
opportunity to also introduce type hints throughout the project, and made
use of sphinx-autodoc-typehints
to carry this typing information
into the docs. This process took much longer than expected, despite the high quality of
the existing documentation, which is something to keep in mind for any future projects!
As act
is actively in use for tokamak experiments, the release schedule is tightly
coupled to the MAST-U experiment schedules, so we’re hoping that our work can be merged
in time for the MAST-U autumn campaign. There may be opportunities at that time to
further expand the test suite and perform some refactoring.
Updated 2024-08-02: An earlier version of this post stated that “Many of the MAST-U scheduler codes are still older scripts written in IDL”. Actually, this only true of the earlier MAST (pre-upgrade).