Skip to main content

VAFT - Versatile Analysis Framework for Tokamak

English | 한국어

PyPI Python License

VAFT is an open-source Python library that functions both as a dedicated data platform for the VEST (Versatile Experiment Spherical Torus) tokamak at Seoul National University and as a machine- and code-generic data analysis framework built upon the IMAS data model, providing an IMAS-compliant data interface built on the OMAS interface library and an HSDS remote HDF5 database.

Hong-Sik Yun, Sunjae Lee et al 2025 Plasma Phys. Control. Fusion 67 115021 (doi:10.1088/1361-6587/ae1b6a)

Key Features

Capability Description
Remote Database Access Load per-shot OMAS ODS data from the VEST HSDS server with a single function call
Machine Mapping Convert native VEST diagnostic signals into standardized IMAS IDS (magnetics, Thomson scattering, barometry, PF active, TF, spectrometer UV, charge exchange, etc.)
Equilibrium & Stability Interfaces for EFIT, CHEASE, GPEC(DCON/RDCON) — read/write code I/O in IDS format
Physics Formulas Equilibrium quantities (poloidal/toroidal flux, safety factor), stability metrics (beta limits, ballooning), confinement scaling laws (ITER89P, H98y2), Green's functions
Signal Processing Smoothing, baseline subtraction, noise reduction, electromagnetic field calculations, eddy current modeling
Profile Fitting Map kinetic diagnostics (Thomson scattering, CES) onto equilibrium flux surfaces; fit with GP, polynomial, or exponential models
Visualization Time traces, 1D/2D profiles, flux surface contours, top-view, and operational-space maps
IMAS Interoperability Convert between OMAS ODS and IMAS-Python (AL5) data structures; export to NetCDF

Architecture

VEST Data Analysis Platform
├── Automated Pipeline (Snakemake)     ── experiment → postprocessing → simulation
├── Database (IMAS-HSDS)                ── per-shot HDF5 storage via REST API
└── Interface (VAFT)                    ── data access, mapping, processing, visualization

Available IMAS IDSs in the VEST Database

Experimental: dataset_description · magnetics · tf · pf_active · barometry · spectrometer_uv · thomson_scattering · charge_exchange

Modelling: wall · em_coupling · pf_passive · equilibrium (EFIT/CHEASE) · core_profiles · mhd_linear (DCON/RDCON)

Quick Start

Installation

Install from source (recommended):

git clone https://github.com/VEST-Tokamak/vaft.git
cd vaft
python -m pip install -e .
# Development tooling
python -m pip install -e ".[dev]"

Legacy NumPy 1 installation

Use this only for an external package that still requires NumPy 1. Because h5pyd==0.20.0 declares a NumPy 2 requirement, install it with --no-deps after replacing NumPy:

python -m pip install -e .
python -m pip install --force-reinstall --no-deps "numpy>=1.26.4,<2"
python -m pip install --force-reinstall --no-deps h5pyd==0.20.0

This is a legacy compatibility option; pip check may report the intentionally bypassed NumPy requirement.

Install from PyPI (obsolete):

pip install vaft

Supported Python: 3.10 -- 3.13 Numerical stack default: NumPy 2.x (numpy>=2.0.0,<3)

Connect to the VEST Database

If you will use the remote VEST HSDS database, configure your HSDS credentials:

hsconfigure

Enter the following when prompted:

Field Value
Server endpoint http://147.46.36.244:5101
Username contact peppertonic18@snu.ac.kr
Password contact peppertonic18@snu.ac.kr

A connection ok message confirms you are connected. See the detailed guide for more information.

Basic Usage

import vaft

# Load a shot from the remote database
ods = vaft.database.load(39915)

# Access IMAS-structured data directly
time = ods['magnetics.time']
ip = ods['magnetics.ip.0.data']

load is the eager path for complete ODS exports and workflows that need a local IMAS staging set. Without paths it stages the complete shot; with paths=["equilibrium"] it stages only that IDS plus dataset_description and uses a validated local domain cache by default. For exploratory access to selected leaves, use the direct lazy path, which opens only the requested IDS domain and transfers only the dataset selections that are read:

When byte-exact per-IDS images are available, eager loads use them by default to avoid the many requests made by hsget. Use transport="canonical" to bypass derived images or transport="h5image" to require them. Direct lazy open() always keeps canonical selection-based access.

with vaft.database.open(39915, source="public", paths="equilibrium") as ods:
    psi = ods["equilibrium.time_slice.0.profiles_2d.0.psi"]

The lazy API supports occurrence 0 in this first version. Native IDS use the explicit remote representation:

equilibrium = vaft.database.load(
    39915, source="public", representation="imas", paths="equilibrium"
)

Remote saves keep canonical IMAS images authoritative and can publish derived caches alongside them. derived_cache="auto" creates per-IDS images; the historical full-ODS cache remains readable but is only created explicitly. The choices are "none", "imas-images", "omas", and "both".

For experimental native lazy access without a local staging directory, open an IMAS handle. It returns a read-only, lazy IDSToplevel; each requested leaf is read directly from the corresponding HSDS IDS domain. This first version supports occurrence 0 and an exact stored IMAS DD version.

with vaft.database.open(
    39915, source="public", representation="imas", paths="equilibrium"
) as handle:
    psi = handle.get().time_slice[0].profiles_2d[0].psi

Local artifacts are deliberately separate from the HSDS API. They are content-detected rather than selected by a format flag:

ods = vaft.omas.load("./shot/master.h5")
with vaft.imas.load("./equilibrium.nc") as entry:
    equilibrium = entry.get("equilibrium")

See the HSDS lazy and per-IDS h5image report for the architecture, cache policy, and shot 39915 benchmark results.

Profile Fitting

# Map Thomson scattering data onto equilibrium flux coordinates, then fit profiles
mapped_rho = vaft.process.equilibrium_mapping_thomson_scattering(ods, geq)
vaft.process.profile_fitting_thomson_scattering(
    ods, time_ms, mapped_rho, fitting_function_te='gp', fitting_function_ne='gp'
)

IMAS Conversion

# Write an OMAS ODS as an IMAS HDF5 image set or a native IMAS NetCDF file
vaft.imas.save(ods, "./shot")
vaft.imas.save(ods, "./shot.nc")

Library Modules

vaft/
├── database/          # Remote database access (HSDS, raw SQL)
├── machine_mapping/   # Native-to-IDS diagnostic conversion (70+ functions)
├── formula/           # Physics formulas (equilibrium, stability, Green's functions)
├── process/           # Signal processing, EM modeling, profile fitting
├── plot/              # Visualization (time, 1D, 2D, top-view, analysis)
├── omas/              # ODS utilities (shot metadata, sample data)
├── imas/              # IMAS-Python (AL5) interoperability
├── code/              # Code interfaces (EFIT, CHEASE, GPEC, Snakemake)
└── data/              # Sample data, geometry assets, calibration tables

Example Notebooks

Notebook Description
database_initialization_and_load Core data loading and framework basics
plotting_sample_using_vaft_plot_module Visualization examples with the plot module
profile_fitting_using_equilibrium_and_kinetic_diagnostics Thomson/CES mapping and profile fitting
read_and_convert_data_structure ODS/IMAS data structure conversion
imas_omas_data_conversion IMAS ↔ OMAS interoperability
vest_experimental_data_list Browse the VEST shot database
confinement_time_scaling Energy confinement time scaling analysis
vest_daily_monitoring Daily experiment monitoring dashboard
publication_figures Reproduce figures from publications
verify_exist_shot_and_load Verify shot availability and load TS/CX data
tokamak_power_balance Tokamak power balance and radiation decomposition
verification_and_validation Verification and validation examples
soft_x_ray_signal_analysis Soft X-ray signal analysis
equilibrium_refinement_using_chease Equilibrium refinement with CHEASE
forward_equilibrium_using_TES Forward equilibrium reconstruction with TES
kinetic_efit_end_to_end End-to-end kinetic-EFIT workflow

Related Resources

Contributing

Contributions are welcome. Please open an issue or submit a pull request.

For database write access, contact peppertonic18@snu.ac.kr, satelite2517@snu.ac.kr.

Acknowledgements

The authors would like to thank O Meneghini and J McClenaghan at General Atomics for their technical advice. Some parts of the data processing were performed using the code API in the OMFIT integrated modeling framework [1]. This research was supported by the National Research Foundation of Korea (NRF) grant funded by the Korean Government (MSIT) (RS-2021-NR057187, RS-2023-00281276, RS-2024-00409564, and RS-2025-02304810).

Third-party Notices

OPEN-ADAS atomic routines

Parts of VAFT's OPEN-ADAS ADF11 parsing, interpolation, default-file selection, and ionization-equilibrium logic are adapted from software distributed under the following license.

MIT License

Copyright (c) 2021 Francesco Sciortino

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

OMFIT classes compatibility port

VAFT's native EQDSK compatibility and interoperability paths include behavior ported or adapted from omfit_classes. VAFT also provides compatibility shims for the corresponding legacy NumPy, SciPy, and xarray interfaces. The original OMFIT classes software is distributed under the following license.

Copyright 2013-2021 the OMFIT contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vaft-0.5.0.tar.gz (19.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vaft-0.5.0-py3-none-any.whl (19.7 MB view details)

Uploaded Python 3

File details

Details for the file vaft-0.5.0.tar.gz.

File metadata

  • Download URL: vaft-0.5.0.tar.gz
  • Upload date:
  • Size: 19.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vaft-0.5.0.tar.gz
Algorithm Hash digest
SHA256 2ac3526ada5a9737a477f7a2603c2e3852fa07297b5f4a4265047c928ac9fc43
MD5 01d57b6abdf7d941b78cb1962224ffca
BLAKE2b-256 c249d2d34a8077ff644b58c649e552e82c086f48745d7e00db76747a577f43ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for vaft-0.5.0.tar.gz:

Publisher: release-pypi.yml on VEST-Tokamak/vaft

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vaft-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: vaft-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 19.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for vaft-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd29ec380521d42b9d9f5d4b9a527ea74c5c879bbe7770421a9dcae1239e8a51
MD5 5f88139daecf5b0298f95b6cde2ff6c6
BLAKE2b-256 9f1c431870a7576de7ecfbeaefd9336f4d1a870a71f4d32fde0d02a5ac05df54

See more details on using hashes here.

Provenance

The following attestation bundles were made for vaft-0.5.0-py3-none-any.whl:

Publisher: release-pypi.yml on VEST-Tokamak/vaft

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.6.2

2 files

0.6.0

2 files

This release

0.5.0 This release

2 files

0.1

2 files

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