A non-thermal electron deposition (Spencer-Fano equation) solver.
Project description
pynonthermal
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.
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 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd22a79dd832c9aeb2476d31d4b17e99e931e9f30533bffab84c5ce5bcdf158b
|
|
| MD5 |
a6217f5bef8e16fb549565bbc0870b60
|
|
| BLAKE2b-256 |
47f0b19f53b994c28f7bd00f189cd00d17fb2f51b14ae2a4fe0534c33b82a130
|
Provenance
The following attestation bundles were made for pynonthermal-2025.4.8.tar.gz:
Publisher:
deploypypi.yml on lukeshingles/pynonthermal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynonthermal-2025.4.8.tar.gz -
Subject digest:
fd22a79dd832c9aeb2476d31d4b17e99e931e9f30533bffab84c5ce5bcdf158b - Sigstore transparency entry: 193834360
- Sigstore integration time:
-
Permalink:
lukeshingles/pynonthermal@47e35271a05071b591f44c175402e5c6c4300d1f -
Branch / Tag:
refs/tags/v2025.04.08 - Owner: https://github.com/lukeshingles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploypypi.yml@47e35271a05071b591f44c175402e5c6c4300d1f -
Trigger Event:
push
-
Statement type:
File details
Details for the file pynonthermal-2025.4.8-py3-none-any.whl.
File metadata
- Download URL: pynonthermal-2025.4.8-py3-none-any.whl
- Upload date:
- Size: 5.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4f2217313fb302fc21dc017cf37730e37e9d65c33cefeea8b1f1c330deed867
|
|
| MD5 |
15d1ff59df3acf7b5439b54ff0c21c39
|
|
| BLAKE2b-256 |
cb9d31488239a3eac9031d57bb39220d619ef877b28d0c7c761fead0095eef8d
|
Provenance
The following attestation bundles were made for pynonthermal-2025.4.8-py3-none-any.whl:
Publisher:
deploypypi.yml on lukeshingles/pynonthermal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynonthermal-2025.4.8-py3-none-any.whl -
Subject digest:
c4f2217313fb302fc21dc017cf37730e37e9d65c33cefeea8b1f1c330deed867 - Sigstore transparency entry: 193834354
- Sigstore integration time:
-
Permalink:
lukeshingles/pynonthermal@47e35271a05071b591f44c175402e5c6c4300d1f -
Branch / Tag:
refs/tags/v2025.04.08 - Owner: https://github.com/lukeshingles
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploypypi.yml@47e35271a05071b591f44c175402e5c6c4300d1f -
Trigger Event:
release
-
Statement type: