Skip to main content

RADAS: radiated power curves from OpenADAS

This Python library downloads atomic data from OpenADAS, performs simple calculations and stores the result as a NetCDF file for use in other programs.

Installing via PyPi (quick start)

radas is on PyPi. You should be able to install it using

pip install radas

Once you've installed radas into your environment, you should be able to run

radas --help

to get an overview of the CLI options. Every option has a sensible default, so you can just run radas at the command line and it will generate a processed NetCDF for every species that has data_files defined in config.yaml. This can take some time (especially for high-Z impurities such as tungsten). If you'd just like to run a few species, you can specify these on the command line like

radas -s hydrogen -s helium -s lithium

If you want to change the years of the databases downloaded, you will need to change the config.yaml file. To get a copy of this, run radas_config to get a copy of the config.yaml file in your current working directory. You can edit this file (see the configuration section below) and then use it by passing it as the -c or --config argument to radas (i.e. radas -s hydrogen -c ./config.yaml).

Development installation

If you want to develop radas, excellent! For contributing to radas, we ask that you

  1. use Issues to ask questions, request features and discuss planned improvements,
  2. use Pull Requests to merge code into main (mark work-in-progress with draft in the title),
  3. write pytest tests for new functionality (ideally aiming to cover all new lines of code).

Installation

The project is installed using poetry. If you haven't already installed poetry, the installation instructions can be found here.

Once you have poetry installed, you can install radas by running

poetry install

Because we've added in-project = true in poetry.toml, the project will install in the .venv in the repository directory.

Usage

Once you have installed radas, you should be able to run the following snippet

poetry run radas --species=hydrogen

where --species can be

  • a specific species such as hydrogen or tungsten
  • all which runs all species which have available data
  • none which only regenerates the output plots from existing NetCDF files

Add --time-evolution to also store the charge-state fractions as a function of time (charge_state_evolution, from evolution_start to evolution_stop). It is off by default because it is slow and the equilibrium does not need it.

If anything goes wrong, the script will drop into an ipdb interpreter so you can debug any issues.

What's going on under the hood?

The above snippet executes run_radas_cli in radas/cli.py, which performs the following steps

  1. Connect to OpenADAS
  2. Download the datasets listed in radas/config.yaml under species:hydrogen:data_files (where the values are the years to download) and store them in radas/.data_files.
  3. Process the downloaded data files and store them in xarray Dataset (in read_rate_coeffs.py).
  4. Calculate the fractional abundance of each charge state according to the coronal approximation (in coronal_equilibrium.py).
  5. Calculate the coronal mean charge ($\langle Z \rangle$) and radiated power coefficient ($L_z$) as a function of the plasma temperature and density (in cli.py for the mean charge and in radiated_power.py for the radiated power).
  6. Solve the rate equations for the abundance of each charge state directly for the equilibrium ($t \to \infty$) fractional abundance, for different refuelling rates (characterized by $n_e \tau$ where $\tau$ is a particle residence time, in steady_state.py; $n_e \tau = \infty$ gives the coronal limit). With --time-evolution, the same equations are also time-integrated to give $n_z(t)$ (in time_evolution.py).
  7. Calculate the equilibrium mean charge ($\langle Z \rangle$) and radiated power coefficient ($L_z$) as a function of the plasma temperature and density (reusing the same functions as for the coronal values).
  8. Store all of the results in a NetCDF in the output folder and make a figure comparing the computed curves to data from Mavrin, J. Fus. Eng., 2017 (where available).

Configuration

radas is configured using the config.yaml file provided in the radas source repository. You can edit this file directly, or can point the CLI to another configuration YAML file using the --config argument. Regardless of which approach you choose, the config.yaml file must have the following structure

globals:
  evolution_start:
    value: <Time to start time-evolution>
    units: "s"

  evolution_stop:
    value: <Time to stop time-evolution>
    units: "s"

  ne_tau:
    value: <Values of ne * tau to generate output for>
    units: "m^-3 s"

data_file_config:
  adf11: #or other reader class, but usually we want ADF11
    <what to call the dataset in the output>:
      prefix: <letters used to identify the dataset>
      code: <code used to identify the dataset for the ADAS reader>
      stored_units: "cm**3 / s"
      desired_units: "m**3 / s"

species:
  <species name>:
    atomic_symbol: <symbol>
    atomic_number: <atomic number>
    data_files:
      <dataset matching "what to call the dataset in the output" above>: <year to download>

Testing

To make sure everything is working, run

poetry run pytest

to execute all of the tests in the tests folder.

Checks before opening a PR

poetry run pytest --cov-fail-under=81  # tests plus coverage; CI enforces the 81% floor, so a plain `pytest` or a partial run does not fail on it
poetry run ty check           # type check (ty is pinned, since its diagnostics change between releases)
pre-commit run --all-files    # ruff check and ruff format; `pre-commit install` (once) also rejects AI-attribution trailers in commit messages

CI runs the same checks.

Pushing to PyPi

We have transitioned from a date-based versioning scheme (YYYY.MM.patch) to Semantic Versioning with an Epoch.

To update the version of radas at pypi.org/project/radas/, you should edit pyproject.toml and set version="1!major.minor.patch". You must include the 1! prefix (the epoch) so that any version takes precedence over the previous date-based versions. Use major versions to indicate breaking changes, such as changing the name of the CLI functions. Use minor versions to indicate non-breaking changes, such as adding new optional functionality. Use patches to make minor fixes.

Once you've merged a new version into main, make a new release on Github and tag it using the form v1!X.Y.Z. Github Actions will automatically push this to PyPI.

Metadata

Release files for radas 1!2.0.1

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

Source distribution (sdist)

Source distribution for radas 1!2.0.1
File Size Uploaded Provenance Actions
radas-1!2.0.1.tar.gz 29.0 kB With provenance Details for radas-1!2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for radas 1!2.0.1
File Interpreter ABI Platform Actions
radas-1!2.0.1-py3-none-any.whl Python 3 none any Details for radas-1!2.0.1-py3-none-any.whl

Total release size: 61.0 kB

Release files / radas-1!2.0.1.tar.gz

Download URL radas-1!2.0.1.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
da31e67a3586f0f03bbbb542ecf2ae329124daa115ddb5dce4971b25147e3d69
BLAKE2b-256 checksum
How to use checksums
f1dca9340c28a70f63e0eabb0fe166b5d7e735f3f307d415a39f2917f571624c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Release files / radas-1!2.0.1-py3-none-any.whl

Download URL radas-1!2.0.1-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99bb9e7ad104d354678dbab0ae2fe67190f7a55eb4787a3149eaeef0663968f0
BLAKE2b-256 checksum
How to use checksums
e81bf0c6708f89c95f8375008b76d9a374862214a6f1131b9df22dfcd70ddcd5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

Security for radas 1!2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for radas-1!2.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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