Since 18 of December 2019 uses Nucleus credentials. Visit our help pages for information on how to Register and Sign-in using Nucleus.
November 29, 2021 to December 6, 2021
Virtual event
Europe/Vienna timezone
30 Nov - 3 Dec, 2021 Abstract submission open NOW

tofu: an open-source python library for synthetic diagnostics, data analysis and inversions for fusion

Nov 29, 2021, 4:30 PM
Virtual event

Virtual event

Regular Oral Data analysis preparation for ITER and Software Tools for ITER diagnostics Monday 29 Nov




The fusion community and ITER need reliable software tools to be included in data reconstructions and validation chains. One way to provide such tools is via open-source solutions developed using industry-standard quality processes like version-control, continuous integration, unit testing etc.
Such open-source libraries, are usually developed jointly by communities of developers and users, and they are a response of the scientific communities to the more general replication crisis observed in many fields. For published results to be replicable and verifiable, the numerical tools must be transparent, version-controlled and freely accessible. Some already successful example exist in other communities, like the Astropy library for astrophysicists, the Numpy, Scipy and Matplotlib libraries for data scientists in general. The fusion community is relatively new to this way of working and despite a few notable exceptions, like the PlasmaPy library, there are only relatively few such open-source widespread tools for fusion.
Tofu is an attempt at providing the fusion community with one such tool, a specialized, transparent, free and community-driven python library for synthetic diagnostics, data analysis and inversions for fusion devices. It is relevant for diagnostics measuring light emitted by the plasma in wavelength ranges for which the plasma is transparent, like visible cameras, bolometers, soft and hard x-ray detectors and x-ray crystal spectrometers.
It is object-oriented, hosted on a public repository on Github and licensed with a very permissive MIT license. It can be used to easily:
• model a tokamak geometry using a quasi-axisymmetric approach (axisymmetric by parts)
• model 1d or 2d cameras as sets of lines of sight easily placed around the tokamak geometry, ray-tracing tools automatically compute the extent of rays in the chosen geometry
• model a spherically curved crystal for a 2D X-ray imaging spectrometer
• used the modelled cameras to compute synthetic data from an arbitrary user-provided emissivity function
• display specialized interactive plots to explore diagnostics geometry and experimental or synthetic data
• create a 2D mesh of the plasma cross-section to compute a geometry matrix for inversions
Furthermore it is natively compatible with IMAS, from/to which it read/write data (geometric data or experimental / synthetic data), and can integrate in a high-quality data reconstruction chain based on IMAS. It also provides ready-made interfaces to communicate with other open tools like Inkscape (for drawing an arbitrary tokamak geometry) openadas and the nist database (for spectral data).
The paper introduces tofu to the larger fusion community by:
• Introducing the methods and good practices behind its development and discussing how and why they are necessary for ensuring, on the long term, that data validation and reconstruction chains in which tofu is, or can be, inserted are robust, reproducible and transparent.
• presenting some of its key functionalities for synthetic diagnostics
• presenting an example of application for ITER, that will be easily replicable (the version of tofu used and the corresponding code lines will be provided)

Country or International Organisation France
Affiliation CEA

Primary author



Presentation materials