artistools
Artistools is a collection of tools that plot data, analyse data, and convert files for the ARTIS radiative transfer code.
The documentation is at artistools.readthedocs.io. It gives:
- each command;
- some example outputs;
- the columns and the units of the data;
- how to plot observed spectra and light curves;
- the caches and the common problems.
Installation
Requires Python >= 3.13. A free-threaded Python requires version 3.15 or later, e.g. Python 3.15t.
Use one of these ways to get the artistools command:
uvx artistoolsruns it with no installation. It needs uv.uv tool install artistoolsinstalls it for your user.pip install artistoolsinstalls it into the active Python environment.
Some features need the optional packages of artistools[extras]:
- the windows of
--interactiveneed PySide6; plotviewinganglesneeds plotly;spencerfanoneeds pynonthermal;- the 3D view of
plotinitialcompositionneeds pyvista.
To install them, run uv tool install 'artistools[extras]' or pip install 'artistools[extras]'. Keep the quotes. Without them, zsh reads the square brackets as a pattern.
A free-threaded Python cannot install artistools[extras], because PySide6 has no wheels for it. On such a Python, install each other package that you need, e.g. pip install plotly. The windows of --interactive then do not work.
To enable tab completion, run artistools completions. The command detects your shell and gives the steps for it.
Get started
These steps use a model folder mymodel, which holds input.txt and the output files of ARTIS:
artistools describe mymodelgives a summary of the model:- the cells;
- the timesteps;
- the output files;
- the ions;
- the direction bins.
artistools check mymodeltests the output files, e.g. for a run that stopped early.artistools plotspectra -t 300 mymodelwrites the spectrum at 300 days to the fileplotspectra_<timemin>d-<timemax>d.pdfin the working folder.-ogives a different file name.- Give
--showto show the figure in a window. - Give
--interactiveto change the options of the plot in a window. - Give
--print-datato print the plotted data as a table (see The plotted data as text). - Give
--explainto see what the arguments select, e.g. the timesteps of a time range. The command then stops and reads no data.
Development (editable installation)
For development, you will need a rust compiler and a clone of the repository:
git clone https://github.com/artis-mcrt/artistools.git
cd artistools
To make a uv virtual environment in the clone, with the development tools, run:
uv sync --all-extras
uv run -- prek install
uv run -- artistools then runs the command of the clone. To make the artistools command available outside the clone, also run uv tool install --editable '.[extras]'.
Alternatively, to avoid uv and install into the system environment with pip:
pip install --group dev --editable '.[extras]'
prek install
Citing artistools
If you use artistools for a paper or a presentation, please cite it with the DOI 10.5281/zenodo.6418832. This DOI names all the versions of artistools, and it always resolves to the latest version. CITATION.cff gives the authors.
To get the BibTeX entry, use one of these ways:
- On the GitHub page of artistools, click "Cite this repository" in the "About" section. GitHub makes the BibTeX entry from
CITATION.cff. - Run this command. doi.org then gives the BibTeX entry of the DOI.
curl -LH "Accept: application/x-bibtex" https://doi.org/10.5281/zenodo.6418832
Usage
Run "artistools" (or the short alias "at") at the command-line to get a full list of subcommands, and "artistools --version" to check the installed version. Some common commands are:
- artistools plotspectra (alias: at spec)
- artistools plotlightcurves (alias: at lc)
- artistools plotestimators (alias: at estimators)
- artistools plotnltepops
- artistools describe (a summary of a model: its cells, timesteps, output files, and ions)
- artistools inputmodel describe
Give -h to a command for a summary of its arguments, or --help for the full help and the examples. Set ARTISTOOLS_TRACEBACK=1 to get the full traceback of an error. Run a command in a model folder, or give the path of the model folder. A command that reads a model takes the model path with --modelpath, e.g. artistools timesteps --modelpath mymodel. Most of these commands also take the model path as the last positional argument, e.g. artistools plotspectra -t 300 mymodel.
The plotted data as text
Each plot command gives the plotted data as a table with a header row and a space between the values. --print-data prints the table to the standard output. The progress messages go to the standard error, thus a pipe or a redirect gets the table alone. --output-format json or --output-format csv gives the table in that format. --write-data writes the same table to a .txt file beside the figure. A value that is not available is nan, and a value or a column name that contains a space has quotes. A written file starts with comment lines that give the artistools version, the time, the working folder, and the command. Thus the file tells how the command made each value. Read it with pl.read_csv(path, separator=" ", comment_prefix="#", null_values="nan"), or with comment="#" in pandas. For example, this command writes the electron temperature against the velocity at 300 days to a file:
artistools plotestimators Te -t 300 mymodel --print-data > te.txt
A plot can give more than one table, because a series with its own grid needs its own table. Examples are a reference spectrum in <figure>_references.txt, a model with a different wavelength grid in <figure>_grid2.txt, and the statistics and the curves of a residual panel in <figure>_residuals.txt and <figure>_residualcurves.txt. On the standard output, an empty line separates two tables. With --output-format json, the standard output holds one JSON object, with the rows of each table under its name, e.g. data and residuals. With --write-data, --output-format also gives the format and the suffix of each file, e.g. <figure>.json.
A model on a different host
These commands accept a model path of the form host:path, where host is a name that ssh knows:
- plotestimators and its
--interactiveviewer; - plotlightcurves and its
--interactiveviewer; - plotspectra and its
--interactiveviewer.
In a Python script, give such a path as Path("host:path"). Many readers then read the model on its host, e.g.:
- the estimators and the times:
at.scan_estimators;at.get_timestep_times;at.get_timestep_of_timedays;at.misc.get_time_range;
- the input model and the parameters:
at.scan_modeldata;at.get_inputparams;at.get_composition_data;at.scan_deposition;
at.nltepops.read_nltepops, which needs atimestepor amodelgridindexfor a remote model;at.spectra.scan_spectraandat.spectra.scan_spectra_from_packets;at.lightcurve.find_lightcurve_file,at.lightcurve.scan_lightcurve, andat.lightcurve.scan_lightcurve_from_packets;at.packets.get_packets_column_names,at.misc.get_artis_options, andat.misc.get_artis_option.
A reader with no support for a remote model stops with an error.
artistools plotspectra -t 300 vae26:~/scratch/mymodel
The rule of rsync decides whether a path is remote: a colon before the first slash makes a remote path. A local folder with such a colon in its name needs "./" at the start, e.g. ./model:2.
artistools starts the server on that host through ssh, and it prints the command and the reason for it. A release of artistools starts uvx artistools@<version> server, with the versions of the local artistools and polars. Thus the host needs only uv.
The server and the client must have the same server protocol, which is a number. It changes when a reader changes its arguments or its results, or when the format of a message changes. A clone with the server protocol of the release also starts the release. A clone with a different server protocol starts its git commit with uvx. The host then also needs git and Rust. The host cannot get a commit that is only in the clone, thus such a commit must have the server protocol of the release.
The server protocol does not change when the code of a reader changes. Thus a release on the host can give a different result from the clone. If the package files of the clone differ from the release, artistools prints a warning with the number of these files and the name of one file. The warning also gives the command that starts the git commit on the host.
The command sets POLARS_MAX_THREADS=16, because a login node can have hundreds of cores, and other users share them. The server reads the files and makes the data of each plot, e.g. it puts the packets into bins. Only the data to draw comes back, and the parquet caches stay beside the data on the host. A script sends the filter and the columns of each query to the host, and only the rows of the query come back.
An option that reads its files on the local host stops with an error. To start the server with a different command on the host, e.g. an artistools in a clone, set ARTISTOOLS_REMOTE_COMMAND:
export ARTISTOOLS_REMOTE_COMMAND='POLARS_MAX_THREADS=16 ~/artistools/.venv/bin/artistools server'
The environment of such a command must have the same version of polars as the client. The filter of a query goes to the host as a polars expression, and the format of an expression changes between two versions. If the versions differ, the client stops with an error that gives the uvx option.
Use from Python
artistools is mainly a set of commands, but a script or a notebook can call the same functions. import artistools as at gives a small set of names at the top level. Each package holds the other names, e.g. at.spectra and at.inputmodel.
uv tool install artistools puts artistools in an environment of its own, thus the Python of a different environment cannot import it. artistools python prints the path of the Python of that environment. Run a script with that Python, e.g. "$(artistools python)" myscript.py. As an alternative, install artistools with pip into the environment of the script.
from pathlib import Path
import artistools as at
import polars as pl
modelpath = Path("mymodel")
dfmodel, modelmeta = at.scan_modeldata(modelpath)
times_days = at.get_timestep_times(modelpath, loc="mid")
dftemperature = at.scan_estimators(modelpath).filter(pl.col("timestep") == 40).select("modelgridindex", "Te").collect()
# get_time_range converts days to timesteps, and a range outside the model raises an error. Direction bin -1 is the
# average over all directions, thus scan_spectra reads no spec_res.out
timestepmin, timestepmax, _, _ = at.misc.get_time_range(modelpath, timedays_range_str="300-320")
dfspectrum = at.spectra.scan_spectra(modelpath, timestepmin, timestepmax, directionbins=[-1])[-1].collect()
# scan_lightcurve takes a file and not a model folder, thus find_lightcurve_file finds the file, e.g. a
# compressed light_curve.out.zst
dflightcurve = at.lightcurve.scan_lightcurve(at.lightcurve.find_lightcurve_file(modelpath))[-1].collect()
The data reference gives the columns and the units of the main readers.
A function with the prefix scan_ returns a polars LazyFrame, or a result that holds LazyFrames and sometimes other values. For example, scan_modeldata returns a LazyFrame and a dictionary of the model parameters, and at.packets.scan_packets returns the number of ranks and a LazyFrame. at.spectra.scan_spectra returns a dictionary with one LazyFrame for each direction bin. Call .collect() on a LazyFrame to get the data.
A function with the prefix read_ returns the data at once, e.g. a DataFrame or a dictionary. Each function with the prefix get_ in the tables below returns its value at once, e.g. a number, a dictionary, or a DataFrame. The direction bin -1 is the average over all directions.
Some of these functions had an older name, e.g. get_modeldata in place of scan_modeldata, and read_spec in place of scan_spec. A script can still call the old name, but each call gives a DeprecationWarning that names the new function. A later release will delete the old names.
Names at the top level
| Name | Purpose |
|---|---|
at.scan_modeldata |
Read model.txt. Return the cells as a LazyFrame, and the model parameters as a dictionary. |
at.add_derived_cols_to_modeldata |
Add columns that follow from the model file, e.g. the volume and the mass of each cell. |
at.get_inputparams |
Return the parameters of input.txt. |
at.get_model_name |
Return the name of the model that holds a path. |
at.get_nprocs |
Return the number of MPI processes of the model. |
at.get_timestep_times |
Return the time in days of each timestep (loc is "start", "mid", "end", or "delta"). |
at.get_timestep_of_timedays |
Return the timestep that holds a time in days. |
at.scan_estimators |
Read the estimators of all the run folders of a model as a LazyFrame, with a row for each timestep and cell. |
at.scan_deposition |
Return deposition.out as a LazyFrame. |
at.get_composition_data |
Return the elements and the ion stages of compositiondata.txt as a DataFrame. |
at.get_ionstring |
Return a text such as Fe II for an atomic number and an ion stage. |
at.get_ion_tuple |
Return (26, 2) for a text such as FeII, Fe II, or 26_2. |
at.get_elsymbol |
Return the element symbol of an atomic number. |
at.get_atomic_number |
Return the atomic number of an element symbol. |
at.get_z_a_nucname |
Return the atomic number and the mass number of a text such as Pb208. |
at.decode_roman_numeral |
Return the integer of a Roman numeral. |
at.get_path |
Return a known path by name, e.g. the package folder. |
at.firstexisting |
Return the first file of a list that exists, with a compressed copy as an alternative. |
at.zopen |
Open a file, or its .zst, .gz, or .xz copy. |
Main readers in the packages
| Name | Purpose |
|---|---|
at.estimators.read_estimators |
Read the estimators of a few cells into a dictionary. This is slow for many cells, thus prefer at.scan_estimators. |
at.spectra.scan_spectra |
Return a dictionary with a LazyFrame of the spectrum of each direction bin, as an average over a range of timesteps. |
at.spectra.scan_spectra_from_packets |
Return a dictionary with a LazyFrame of the spectrum of each direction bin from the packets files, for a range of arrival times. |
at.lightcurve.scan_lightcurve |
Read a light curve file. Return one LazyFrame for each direction bin. |
at.lightcurve.scan_lightcurve_from_packets |
Return a dictionary with a LazyFrame of the luminosity against time of each direction bin, from the packets files. |
at.packets.scan_packets |
Return the number of ranks and a LazyFrame of the packets of a model. |
at.nltepops.read_nltepops |
Read the NLTE populations of a timestep and of one or more cells. |
at.atomic.get_levels |
Return the energy levels of each ion, with the transitions as an option. |
at.inputmodel.save_modeldata |
Write model.txt.zst from a dataframe of the cells. |
at.plottools.set_mpl_style |
Apply the matplotlib style of artistools. |
The command of a package
Some packages give their plot command as the function plot. This function is the command itself. These packages have a plot function:
at.spectra;at.lightcurve;at.estimators;at.nltepops;at.packets;at.nonthermal;at.gsinetwork;at.radfield;at.logs.
Each keyword is one command-line argument, and argsraw gives more arguments as text, e.g. argsraw=["-t", "300"]:
at.spectra.plot(argsraw=[], specpath=[modelpath], timedays="300", outputfile="spectrum.pdf")
Use with an LLM agent
artistools contains a skill for a large language model (LLM) agent, e.g. Claude Code. The skill tells the agent how to use artistools to answer a question about a model. An example is "What is the range of Te at 10 days?". This command installs the skill for Claude Code:
artistools installskill
The command makes a link in ~/.claude/skills to the skill in the installed package. Thus an update of artistools also updates the skill. If the environment variable CLAUDE_CONFIG_DIR has a value, the command uses $CLAUDE_CONFIG_DIR/skills. If artistools runs from the uv cache, e.g. with uvx, the command stops and makes no link, because uv can delete its cache. In that case, install artistools with uv tool install artistools, or give --copy.
For Codex, Cursor, or OpenCode, give --layout agents. The command then makes the link in ~/.agents/skills. For a different agent, give its skills folder with --skillsdir.
Start a new session of the agent after the installation. Then ask a question about a model. In Claude Code, you can also type /artis-data. In Codex, you can also type $artis-data.
Example output
License
Distributed under the MIT license. See LICENSE for more information.
Metadata
Release files for artistools 2026.11.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| artistools-2026.11.23.tar.gz | 9.3 MB | With provenance | Details for artistools-2026.11.23.tar.gz |
Built distributions (wheels)
Total release size: 102.5 MB
Release files / artistools-2026.11.23.tar.gz
| Download URL | artistools-2026.11.23.tar.gz |
|---|---|
| Size | 9.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7065617d939acf9f0cc9467deb246903482ad9d8b78f4291a6a0844210011647
|
|
BLAKE2b-256 checksum How to use checksums |
da71510aad6f8d940bcbee04eb9835725baab3a7188a418b9cb05e27e1d6dcc3
|
| 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 23, 2026.
Transparency logRelease files / artistools-2026.11.23-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl
| Download URL | artistools-2026.11.23-cp315-abi3.abi3t-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.15 Linux glibc 2.28+ x86-64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
360ecb80948f95c4187a33f1a0db608549127a18d18bd3df991444d25455b722
|
|
BLAKE2b-256 checksum How to use checksums |
81e22cc274010c20cdb6ae3967dd800c3b6c3a827eae3723a4dd4980aecfd1e5
|
| 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 23, 2026.
Transparency logRelease files / artistools-2026.11.23-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl
| Download URL | artistools-2026.11.23-cp315-abi3.abi3t-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 16.3 MB |
| Tags | CPython 3.15 Linux glibc 2.28+ ARM64 abi3 abi3t |
|
SHA-256 checksum How to use checksums |
041630d23c9ee98d0625d7767fab89bdf610585c65067f68fee520ffb239fbeb
|
|
BLAKE2b-256 checksum How to use checksums |
40423a51129afd2176aa223b2d17426c9cfa46b0a7c88e3beb58874159da424f
|
| 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 23, 2026.
Transparency logRelease files / artistools-2026.11.23-cp315-abi3.abi3t-macosx_14_0_arm64.whl
| Download URL | artistools-2026.11.23-cp315-abi3.abi3t-macosx_14_0_arm64.whl |
|---|---|
| Size | 14.1 MB |
| Tags | CPython 3.15 abi3 abi3t macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
016ea7e42770b3de7e7b4d478a88b3c61ba59729c0587d091e2c626ab915be03
|
|
BLAKE2b-256 checksum How to use checksums |
9c2aa28fd82923399e75e432d942f8f3cdf2a20b74357023958553a3eda4c8bd
|
| 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 23, 2026.
Transparency logRelease files / artistools-2026.11.23-cp313-abi3-manylinux_2_28_x86_64.whl
| Download URL | artistools-2026.11.23-cp313-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.2 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
987758d534d74551c1735db45add514d2bb10b1cf028e27e79ecdcc79e018666
|
|
BLAKE2b-256 checksum How to use checksums |
dc3c0ff9bbe4e7e26c4981303371efe5dfa934362e38cbcd7bdf7aa88c34dd55
|
| 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 23, 2026.
Transparency logRelease files / artistools-2026.11.23-cp313-abi3-manylinux_2_28_aarch64.whl
| Download URL | artistools-2026.11.23-cp313-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 16.3 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
ff47d84955531f7bbe2765901c15cdcdfa25d99f0fd87b2a22c94521b23fe81d
|
|
BLAKE2b-256 checksum How to use checksums |
1d1e7692fb9a1de0ea3d334358c6edef60a69572a6bfd204dba0c895a15c3a8b
|
| 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 23, 2026.
Transparency logRelease files / artistools-2026.11.23-cp313-abi3-macosx_14_0_arm64.whl
| Download URL | artistools-2026.11.23-cp313-abi3-macosx_14_0_arm64.whl |
|---|---|
| Size | 14.1 MB |
| Tags | CPython 3.13 abi3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
fb9082a0e06c38d895e9c927975da736829ec49c3613d681d0c4e252a948580f
|
|
BLAKE2b-256 checksum How to use checksums |
d8a1817baf634a793bbf25ecf4a0faef4a57061b2b70b0add0b560ed0c6722a8
|
| 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 23, 2026.
Transparency logSecurity for artistools 2026.11.23
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
All 7 files in this release have been uploaded with provenance metadata.
Attestation for artistools-2026.11.23.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 23, 2026.
Transparency logA 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.