Skip to main content

Build Status Travis-CI Conda Gitter PlamsaPy PlamsaPy asv

tofu

tofu stands for Tomography for Fusion, it is an IMAS-compatible open-source machine-independent python library.

tofu tries to take an active part in the plasma community open-source python environment, like PlasmaPy, with which some degree of interoperability is being implemented.

It aims at providing the fusion and plasma community with an object-oriented, transparent and documented tool for designing tomography diagnostics, computing synthetic signal (direct problem) as well as tomographic inversions (inverse problem). It gives access to a full 3D description of the diagnostic geometry, thus reducing the impact of geometrical approximations on the direct and, most importantly, on the inverse problem.

tofu is relevant for all diagnostics integrating, in a finitie field of view or along a set of lines of sight, a quantity (scalar or vector) for which the plasma can be considered transparent (e.g.: light in the visible, UV, soft and hard X-ray ranges, or electron density for interferometers).

tofu is command-line oriented, for maximum flexibility and scriptability. The absence of a GUI is compensated by built-in one-liners for interactive plots.

It has a sphinx-generated documentation, and the code itself is hosted on GitHub.

Examples Gallery

Here are some examples of what tofu can do

Built-in one-liners for interactive camera geometry visualization

Built-in one-liners for interactive camera geometry visualization

...both for 1D and 2D cameras, including the basics for multiple reflections handling

...both for 1D and 2D cameras, including the basics for multiple reflections handling

Built-in plotting of sinograms

Built-in plotting of sinograms

Basic magnetic field line tracing

Basic magnetic field line tracing

Multiple 1d profiles interactive plotting

Multiple 1d profiles interactive plotting

Built-in basic data treatment and interactive plotting: svd and spectrograms

Built-in basic data treatment and interactive plotting: svd and spectrograms

tofu provides the user with a series of python classes for creating, handling and visualizing a diagnostic geometry, meshes and basis functions, geometry matrices, pre-treating experimental data and computing tomographic inversions.

Each one of these main tasks is accomplished by a dedicated module in the larger tofu package.

The geometry module is sufficient for diagnostic designing and for a synthetic diagnostic approach (i.e.: computing the integrated signal from a simulated 2D or 3D emissivity). This geometry module allows in particular:

  • To handle linear and toroidal vaccum vessels
  • To define apertures and detectors as planar polygons of arbitrary shapes
  • To automatically compute the full Volume of Sight (VOS) in 3D of each {detector+aperture(s)} set
  • To discretise the VOS for a numerical 3D integration of a simulated emissivity in order to compute the associated signal

It is in this geometrical sense that tofu enables a synthetic diagnostic approach, it does not provide the tools for simulating the emissivity itself (that should be an input, provided by another code).

IMAS-compatibility

IMAS is a standardized data structure, it comes as an extra layer on the database of any Tokamak to provide a machine-independent way of accessing scientific data. tofu has built-in advanced classes for handling the interface with IMAS, hold in the imas2tofu sub-package. It pre-supposes, of course, that IMAS is installed and operational next to your python install, but tofu does not require IMAS to run in general. If IMAS is not available, tofu will simply display a warning stating that the imas2tofu sub-package is not usable.

tofu can thus easily load and handle multiple IDSs (IMAS data structure units) and provide command-line tools for exporting IMAS data to other general tofu classes (e.g.: Cameras, Plasma2D...) and for interactive plotting. All tofu objects have methods to facailitate in-python-console introspection, the __repr__ method is overloaded to display relevant information, an dthis is widely used to explore the data loaded from IMAS.

Do you want to use tofu on IMAS and don't know where to start? See our documetation.


Installing tofu

Tofu installation currently works with Python 3.10 & 3.11.

For Windows installations, make sure that you've installed Microsoft C++ Build Tools prior to proceeding. Select the "Desktop Development with C++" module.

From source (compiled on your system using pip, all platforms)

pip install tofu

From pre-compiled binaries (using conda, all platforms)

conda install -c conda-forge tofu

For Developers and other platforms

Clone the git repository from github See our documentation.

Licensing

It is distributed under the MIT license and aims at providing the fusion community with a transparent and modular tool for creating / designing diagnostics and using them for synthetic diagnostic (direct problem) and tomography (inverse problem).

History

It was first created at the Max-Planck Institute for Plasma Physics (IPP) in Garching, Germany, by Didier Vezinet, and is now maintained, debugged and updated by a team of contributors.


Warning This Pypi package focuses on tomography for fusion research. It uses the same name as a previous package dedicated to a testing framework coupling fixtures and tests loosely, now renamed reahl-tofu and developped by Iwan Vosloo since 2006. If you ended up here looking for a web-oriented library, you should probably redirect to the more recent reahl-tofu page.

Metadata

Release files for tofu 1.8.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tofu 1.8.18
File Size Uploaded
tofu-1.8.18.tar.gz 47.2 MB Details

Release files / tofu-1.8.18.tar.gz

Download URL tofu-1.8.18.tar.gz
Size 47.2 MB
Tags Source
SHA-256 checksum
How to use checksums
37df0d9716e5bfec39f7ea966798bdbfe7fcd24c2f65ed28e497dd7e3fc5735e
BLAKE2b-256 checksum
How to use checksums
6757ab3572b17db53c5c34aef39f85daeaa2a2cd298a495a70f451ae55d72673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

1.8.18 This release

1 release file

1.8.17

1 release file

1.8.16

1 release file

1.8.15

1 release file

1.8.14

1 release file

1.8.13

1 release file

1.8.12

1 release file

1.8.11

1 release file

1.8.10

1 release file

1.8.9

1 release file

1.8.8

1 release file

1.8.7

1 release file

1.8.6

1 release file

1.8.5

1 release file

1.8.4

1 release file

1.8.3

1 release file

1.8.2

1 release file

1.8.1

1 release file

1.8.0

1 release file

1.7.9

1 release file

1.7.8

1 release file

1.7.7

1 release file

1.7.6

1 release file

1.7.5

1 release file

1.7.4

1 release file

1.7.3

1 release file

1.7.2

1 release file

1.7.1

1 release file

1.7.0

5 release files

1.6.5

1 release file

1.6.4

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.6.0

1 release file

1.5.2

5 release files

1.5.1

5 release files

1.5.0

5 release files

1.4.10

1 release file

1.4.9

3 release files

1.4.8

3 release files

1.4.7

3 release files

1.4.6

3 release files

1.4.5

1.4.4

2 release files

1.4.3

3 release files

1.4.2

3 release files

1.4.1

1 release file

1.4.0

1 release file

1.3.23

1 release file

1.3.22

1 release file

1.3.21

1 release file

1.3.20

1 release file

1.3.19

1 release file

1.3.17

1 release file

1.3.16

1 release file

1.3.15

1 release file

1.3.14

1 release file

1.3.13

1 release file

1.3.12

1 release file

1.3.11

1 release file

1.3.10

1 release file

1.3.9

1 release file

1.3.7

1 release file

1.3.6

1 release file

1.3.5

1 release file

1.3.4

1 release file

1.3.3

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.36

1 release file

1.2.35

1 release file

1.2.33

1 release file

1.2.31

1 release file

1.2.30

1 release file

1.2.29

1 release file

1.2.27

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page