This Python library downloads atomic data from OpenADAS, performs simple calculations and stores the result as a NetCDF file for use in other programs.
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
).
If you want to develop radas
, excellent! For contributing to radas
, we ask that you
main
(mark work-in-progress with draft
in the title),pytest
tests for new functionality (ideally aiming to cover all new lines of code).poetry
packaging and dependency managerThe 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.
Once you have installed radas
, you should be able to run the following snippet
poetry run radas --species=hydrogen --plot
where --species
can be
hydrogen
or tungsten
all
which runs all species which have available datanone
which doesn't perform any analysis, but can be combined with --plot
to generate the output plots from existing NetCDF filesIf anything goes wrong, the script will drop into an ipdb
interpreter so you can debug any issues.
The above snippet executes run_radas_cli
in radas/cli.py
, which performs the following steps
radas/config.yaml
under species:hydrogen:data_files
(where the values are the years to download) and store them in radas/.data_files
.read_rate_coeffs.py
).coronal_equilibrium.py
).cli.py
for the mean charge and in radiated_power.py
for the radiated power).time_evolution.py
).output
folder and make a figure comparing the computed curves to data from Mavrin, J. Fus. Eng., 2017 (where available).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>
To make sure everything is working, run
poetry run pytest
to execute all of the tests in the tests
folder.
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.