Skip to main content

A non-thermal electron deposition (Spencer-Fano equation) solver.

Project description

pynonthermal

DOI PyPI - Version License

Supported Python versions Build and test codecov

pynonthermal is a non-thermal energy deposition (Spencer-Fano equation) solver.

When high-energy leptons (electron and positrons) are injected into a plasma, they slow down by ionising and exciting atoms and ions, and Coulomb scattering with free (thermal) electrons. Keeping track of the rates of the processes is important for example, when modelling Type Ia supernovae at late times (>100 days). At late times, ionisation by high-energy non-thermal leptons (seeded by radioactive decay products) generally overtakes photoionisation, and the non-thermal contribution to ionisation is needed to obtain reasonable agreement with observed emission lines of singly- and doubly-ionised species.

The numerical details of the solver are similar to the Spencer-Fano solver in the ARTIS radiative transfer code (Shingles et al. 2020), which itself is an independent implementation of the Kozma & Fransson (1992) solution to the Spencer & Fano (1945) equation. A similar solver is also applied in the CMFGEN code.

The impact ionisation cross sections are formula fits from Arnaud & Rothenflug (1985) and Arnaud & Raymond (1992) for Z=1 to 28 (H to Ni). Heavier elements use the approximation of Axelrod (1980) Eq 3.38 (Lotz 1967).

If the internal set of levels and transitions are applied (e.g., using add_ion_ltepopexcitation()), these are imported from the CMFGEN atomic data compilation. See the individual source files for atomic data references.

Example output

The following plot shows the energy distribution of contributions to ionisation, excitation, and heating for a pure oxygen plasma (electron fraction 1e-2), reproducing figure 2 of KF92. The area under each curve gives the fraction of deposited energy going into that particular channel.

Emission plot

Installation

The latest released version can be installed from PyPI:

pip install pynonthermal

For development, pynonthermal can be installed into a uv project environment:

git clone https://github.com/lukeshingles/pynonthermal.git
cd pynonthermal
uv sync --frozen
source ./.venv/bin/activate
uv pip install --editable .
pre-commit install

Usage

See the quickstart notebook Binder for an example of how to set up the composition and use the solver to determine ionisation and heating rates.

Advanced Usage - Excitation cross sections

Advanced users will likely want to control the particular excitation cross sections that are included in the solver. Individual excitation transitions can be added with:

SpencerFanoSolver.add_excitation(Z, ion_stage, n_level, xs_vec, epsilon_trans_ev, transitionkey=(lower, upper))

Z is the atomic number. ion_stage is the one more than the ion charge (e.g., Fe I or ion stage 1 has charge zero). The argument xs_vec is a numpy array of cross sections [cm2] defined at every energy in the sf.engrid array [eV]. The transition key can be almost anything that is unique within the ion and is used to refer back to the level pair when requesting the excitation rate coefficient.

nt_exc = SpencerFanoSolver.get_excitation_ratecoeff(Z, ion_stage, transitionkey)

Meta

Distributed under the MIT license. See LICENSE for more information.

https://github.com/lukeshingles/pynonthermal

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

pynonthermal-2025.4.8.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

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

pynonthermal-2025.4.8-py3-none-any.whl (5.5 MB view details)

Uploaded Python 3

File details

Details for the file pynonthermal-2025.4.8.tar.gz.

File metadata

  • Download URL: pynonthermal-2025.4.8.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pynonthermal-2025.4.8.tar.gz
Algorithm Hash digest
SHA256 fd22a79dd832c9aeb2476d31d4b17e99e931e9f30533bffab84c5ce5bcdf158b
MD5 a6217f5bef8e16fb549565bbc0870b60
BLAKE2b-256 47f0b19f53b994c28f7bd00f189cd00d17fb2f51b14ae2a4fe0534c33b82a130

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynonthermal-2025.4.8.tar.gz:

Publisher: deploypypi.yml on lukeshingles/pynonthermal

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

File details

Details for the file pynonthermal-2025.4.8-py3-none-any.whl.

File metadata

File hashes

Hashes for pynonthermal-2025.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c4f2217313fb302fc21dc017cf37730e37e9d65c33cefeea8b1f1c330deed867
MD5 15d1ff59df3acf7b5439b54ff0c21c39
BLAKE2b-256 cb9d31488239a3eac9031d57bb39220d619ef877b28d0c7c761fead0095eef8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynonthermal-2025.4.8-py3-none-any.whl:

Publisher: deploypypi.yml on lukeshingles/pynonthermal

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