Skip to main content

Plasma radiated power calculated using OpenADAS

Project description

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).

Prerequisites

  • Python 3.10 or later
  • The poetry packaging and dependency manager

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 --plot

where --species can be

  • a specific species such as hydrogen or tungsten
  • all which runs all species which have available data
  • none which doesn't perform any analysis, but can be combined with --plot to generate the output plots from existing NetCDF files

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. Time-integrate equations for the abundance of each charge state to give the fractional abundance as a function of time $n_z(t)$ for different refuelling rates (characterized by $n_e \tau$ where $\tau$ is a particle residence time, in time_evolution.py).
  7. Calculate the equilibrium ($t \to \infty$) 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.

Pushing to PyPi

To update the version of radas at pypi.org/project/radas/, you should edit pyproject.toml and set version="YYYY.MM.V", where YYYY is the year, MM is the month and V is a version tag (reset at zero each month). Then, tag a new release and Github Actions will automatically push this to pypi.

Project details


Download files

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

Source Distribution

radas-2025.6.2.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

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

radas-2025.6.2-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file radas-2025.6.2.tar.gz.

File metadata

  • Download URL: radas-2025.6.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for radas-2025.6.2.tar.gz
Algorithm Hash digest
SHA256 e45f5d0ea579db7afdf3cd697d3486a4ccc7a54a89fb29617fc5bcf0c1960e52
MD5 16ff9e29ddb05f58a79d0447f3c8beaf
BLAKE2b-256 6cb8022c9895a879251cf90d8ba93fb6a4583ce676e24f375f4dc5683939b9bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for radas-2025.6.2.tar.gz:

Publisher: workflow_actions.yml on cfs-energy/radas

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

File details

Details for the file radas-2025.6.2-py3-none-any.whl.

File metadata

  • Download URL: radas-2025.6.2-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for radas-2025.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 732396b13234990083e6a984695fe55b46cbe77ae7e3c4f894f0c0217c8df3ca
MD5 1c0d5343609797d80a207fc4058df25f
BLAKE2b-256 1b85e466f0570628198942dadde91e1bc03c0c52c2c6598d29c32aef802a4b45

See more details on using hashes here.

Provenance

The following attestation bundles were made for radas-2025.6.2-py3-none-any.whl:

Publisher: workflow_actions.yml on cfs-energy/radas

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page