pynucastro
pynucastro: an interface to nuclear reaction rates and code generator for reaction network equations - Published in JOSS (2018)
Science Score: 100.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 7 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
✓Committers with academic emails
5 of 20 committers (25.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords from Contributors
Scientific Fields
Repository
a python library for nuclear astrophysics
Basic Info
- Host: GitHub
- Owner: pynucastro
- License: bsd-3-clause
- Language: Python
- Default Branch: main
- Homepage: https://pynucastro.github.io/
- Size: 178 MB
Statistics
- Stars: 63
- Watchers: 2
- Forks: 38
- Open Issues: 74
- Releases: 19
Metadata Files
README.md
pynucastro

pynucastro is a python library for nuclear astrophysics. It provides access to nuclear data and reaction rates, and tools for building and interactively exploring nuclear reaction networks.
The main features are:
Easy access to nuclear properties, including T-dependent partition functions, spins, masses, etc.
The ability to create a reaction network based on a collection of rates, a set of nuclei, or an arbitrary filter applied to a library.
- Includes support for ReacLib rates and tabulated weak rates from a variety of sources.
Interactive exploration of rates and networks in Jupyter notebooks, including:
- Many different ways of visualizing a network.
- The ability to export a NetworkX graph (for instance, to find cycles).
Methods to determine which rates are important and which might be missing from a network, as well as analyze the stiffness of a network.
The ability to approximate rates and derive reverse rates via detailed balance.
An NSE solver to find the equilibrium abundance of a set of nuclei given a thermodynamic state.
The ability to write out python or C++ code needed to integrate the network.
Additional physics methods for thermal neutrino sources and Fermi-Dirac integrals.
Documentation
Documentation for pynucastro is available here:
https://pynucastro.github.io/pynucastro/
Examples
Exploring a reaction rate
The following example reads in the ReacLib rate database and gets the rate for C13(p,g)N14 and evaluates it at a temperature of 1.e9 K and makes a plot of the T dependence:
``` In 1: import pynucastro as pyna
In 2: rl = pyna.ReacLibLibrary()
In 3: c13pg = rl.getrateby_name("c13(p,g)n14")
In [4]: c13pg.eval(1.e9) Out[4]: 3883.4778216250666
In [5]: fig = c13pg.plot()
In [6]: fig.savefig("c13pg.png")
```
The resulting figure is:

Creating a network
The following builds a simple network that has carbon burning, outputs the value of the rates at a set of thermodynamic conditions, and plots the network:
``` In 1: import pynucastro as pyna
In 2: nuclei = ["p", "he4", "c12", "n13", "o16", "ne20", "na23", "mg24"]
In 3: net = pyna.networkhelper(nuclei, usetabular_rates=False) modifying N13 ⟶ p + C12 from C12 + p ⟶ N13 + 𝛾 modifying O16 ⟶ He4 + C12 from C12 + He4 ⟶ O16 + 𝛾 modifying Ne20 ⟶ He4 + O16 from O16 + He4 ⟶ Ne20 + 𝛾 modifying Mg24 ⟶ p + Na23 from Na23 + p ⟶ Mg24 + 𝛾 modifying Mg24 ⟶ He4 + Ne20 from Ne20 + He4 ⟶ Mg24 + 𝛾 modifying C12 ⟶ 3 He4 from 3 He4 ⟶ C12 + 𝛾 modifying O16 + p ⟶ He4 + N13 from N13 + He4 ⟶ p + O16 modifying Ne20 + He4 ⟶ p + Na23 from Na23 + p ⟶ He4 + Ne20 modifying Ne20 + He4 ⟶ C12 + C12 from C12 + C12 ⟶ He4 + Ne20 modifying Na23 + p ⟶ C12 + C12 from C12 + C12 ⟶ p + Na23 modifying Mg24 + He4 ⟶ C12 + O16 from O16 + C12 ⟶ He4 + Mg24
In [4]: rho = 1.e7
In [5]: T = 3.e9
In [6]: comp = pyna.Composition(nuclei)
In [7]: comp.set_equal()
In [8]: net.evaluate_rates(rho=rho, T=T, composition=comp) Out[8]: {C12 + p ⟶ N13 + 𝛾: 52860361.23712939, C12 + He4 ⟶ O16 + 𝛾: 231.46132999413808, O16 + He4 ⟶ Ne20 + 𝛾: 4660.126437920582, Ne20 + He4 ⟶ Mg24 + 𝛾: 53650.76987097864, Na23 + p ⟶ Mg24 + 𝛾: 71891152.99067408, C12 + C12 ⟶ p + Na23: 209.07753161235584, C12 + C12 ⟶ He4 + Ne20: 259.65215046037304, N13 + He4 ⟶ p + O16: 355698292.6571981, O16 + C12 ⟶ He4 + Mg24: 0.8082923986833515, Na23 + p ⟶ He4 + Ne20: 6840366554.79809, 3 He4 ⟶ C12 + 𝛾: 0.12389170353139083, N13 ⟶ p + C12: 984313528.3619095, O16 ⟶ He4 + C12: 0.00013799339351820605, Ne20 ⟶ He4 + O16: 39.38899256329942, Mg24 ⟶ p + Na23: 6.121492897494776e-07, Mg24 ⟶ He4 + Ne20: 9.835129431742516e-06, C12 ⟶ 3 He4: 0.008264918834094248, O16 + p ⟶ He4 + N13: 11.428884290229457, Ne20 + He4 ⟶ p + Na23: 317753.8001151714, Ne20 + He4 ⟶ C12 + C12: 1.929507593099608e-05, Na23 + p ⟶ C12 + C12: 0.33819870621531356, Mg24 + He4 ⟶ C12 + O16: 1.8802924022864885e-11}
In [9]: fig = net.plot(rotated=True, hide_xalpha=True)
In [10]: fig.savefig("c-net.png") ```
After the network is created, we see messages saying that a number of reverse rates were rederived using detailed balance.
The resulting figure is:

Interactive exploration
We can also interactively explore a reaction network. Here's an example of hot-CNO with breakout reactions:
by increasing the temperature, you can see the transition from CNO to hot-CNO (proton captures on C13 become faster than the beta decay) and then the breakout of hot-CNO when the alpha capture on O14 becomes faster than its decay.
Installation
pynucastro is available on PyPI and can be installed via:
pip install pynucastro
Alternately, to install via source, you can do:
pip install .
for a systemwide install, or
pip install --user .
for a single-user install. This will put the pynucastro modules and library in
the default location python searches for packages.
Requirements
pynucastro is supported on Python 3.10 or later and the following libraries:
numpysympyscipymatplotlibnetworkxipywidgetsnumba
To build the documentation or run the unit tests, sphinx and
pytest are additionally required along with some supporting
packages. See the included requirements.txt file for a list of these
packages and versions. To install the packages from the requirements
file, do:
pip install -r requirements.txt
Is important to stress out that all the dependencies should be
installed before pynucastro, otherwise the installation should be
repeated.
Contributing
We welcome contributions from anyone, including posting issues or submitting pull requests to the pynucastro github. For more details on how to contribute to pynucastro, please see CONTRIBUTING.md.
Core Developers
People who make a number of substantive contributions (new features, bug fixes, etc.) will be named "core developers" of pynucastro.
Core developers will be recognized in the following ways:
invited to the group's slack team
listed in the User's Guide and website as a core developer
listed in the author list on the Zenodo DOI for the project (as given in the .zenodo.json file)
invited to co-author general code papers / proceedings describing pynucastro. (Note: science papers that use pynucastro will always be left to the science paper lead author to determine authorship).
If a core developer is inactive for 3 years, we may reassess their status as a core developer.
Getting Help
We use our Github Discussions page for requesting help and interacting with the community.
Owner
- Name: pynucastro
- Login: pynucastro
- Kind: organization
- Repositories: 2
- Profile: https://github.com/pynucastro
a python library for nuclear astrophysics
JOSS Publication
pynucastro: an interface to nuclear reaction rates and code generator for reaction network equations
Authors
Tags
nuclear reactions astrophysics physics visualization code generation integration differential equationsCitation (CITATION.md)
If you use pynucastro, please CITE the "2.0" paper _and_ the latest
Zenodo DOI. You can also cite the JOSS paper.
## Astrophysical Journal ("2.0 paper")
https://iopscience.iop.org/article/10.3847/1538-4357/acbaff
```bibtex
@ARTICLE{pynucastro2,
doi = {10.3847/1538-4357/acbaff},
url = {https://dx.doi.org/10.3847/1538-4357/acbaff},
year = {2023},
month = {apr},
publisher = {The American Astronomical Society},
volume = {947},
number = {2},
pages = {65},
author = {Alexander I. Smith and Eric T. Johnson and Zhi Chen and
Kiran Eiden and Donald E. Willcox and Brendan Boyd and
Lyra Cao and Christopher J. DeGrendele and Michael Zingale},
title = {pynucastro: A Python Library for Nuclear Astrophysics},
journal = {The Astrophysical Journal},
abstract = {We describe pynucastro 2.0, an open-source library for
interactively creating and exploring astrophysical nuclear
reaction networks. We demonstrate new methods for
approximating rates and use detailed balance to create
reverse rates, show how to build networks and determine
whether they are appropriate for a particular science application,
and discuss the changes made to the library over the past few
years. Finally, we demonstrate the validity of the networks
produced and share how we use pynucastro networks in simulation
codes.}
}
```
## JOSS
https://joss.theoj.org/papers/10.21105/joss.00588
```bibtex
@article{pynucastro,
author = {{Willcox}, D.~E. and {Zingale}, M.},
title = "{pynucastro: an interface to nuclear reaction rates and code generator for reaction network equations}",
journal = {Journal of Open Source Software},
year = 2018,
volume = 3,
number = 23,
pages = 588,
url = {https://doi.org/10.21105/joss.00588},
doi = {10.21105/joss.00588},
subject = {nuclear astrophysics}
}
```
## Zenodo
The Zenodo record is:
https://doi.org/10.5281/zenodo.1202434
CodeMeta (codemeta.json)
{
"@context": "https://raw.githubusercontent.com/codemeta/codemeta/main/codemeta.jsonld",
"@type": "Code",
"author": [
{
"@id": " https://orcid.org/0000-0003-2300-5165",
"@type": "Person",
"email": "donald.willcox@stonybrook.edu",
"name": "Donald E. Willcox",
"affiliation": "Department of Physics and Astronomy, Stony Brook University"
},
{
"@id": "https://orcid.org/0000-0001-8401-030X",
"@type": "Person",
"email": "michael.zingale@stonybrook.edu",
"name": "Michael Zingale",
"affiliation": "Department of Physics and Astronomy, Stony Brook University"
}
],
"identifier": "",
"codeRepository": "https://github.com/pynucastro/pynucastro",
"datePublished": "2018-01-29",
"dateModified": "2018-01-29",
"dateCreated": "2018-01-29",
"description": "pynucastro is an interface to nuclear reaction rates and code generator for reaction network equations.",
"keywords": "nuclear, reactions, astrophysics, physics, visualization, code generation, integration, differential equations",
"license": "BSD",
"title": "pynucastro",
"version": "1.0.0"
}
GitHub Events
Total
- Create event: 18
- Release event: 2
- Issues event: 71
- Watch event: 8
- Delete event: 17
- Issue comment event: 247
- Push event: 332
- Pull request review comment event: 141
- Pull request event: 345
- Pull request review event: 297
- Fork event: 4
Last Year
- Create event: 19
- Release event: 2
- Issues event: 71
- Watch event: 8
- Delete event: 17
- Issue comment event: 247
- Push event: 332
- Pull request review comment event: 141
- Pull request event: 347
- Pull request review event: 297
- Fork event: 4
Committers
Last synced: 5 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Michael Zingale | m****e@s****u | 759 |
| Donald E. Willcox | e****x@g****m | 391 |
| Eric T. Johnson | e****n@s****u | 114 |
| Zhi Chen | 6****3 | 34 |
| Alexander Smith Clark | a****k@s****u | 26 |
| Kiran Eiden | k****n@g****m | 15 |
| Brendan Boyd | 4****d | 15 |
| SamG-01 | 1****1 | 7 |
| dependabot[bot] | 4****] | 5 |
| Max Katz | m****z@g****m | 5 |
| Adam M. Jacobs | a****s@p****u | 5 |
| Josiah Schwab | j****b@g****m | 4 |
| Travis CI User | t****s@e****g | 2 |
| Chris DeGrendele | 3****e | 2 |
| alecpwills | a****s@s****u | 1 |
| Abigail Bishop | m****p@g****m | 1 |
| Lyra Cao | c****a@g****m | 1 |
| Parker-T-Johnson | 1****n | 1 |
| XinlongSBU | 4****U | 1 |
| hansbdein | 1****n | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 4 months ago
All Time
- Total issues: 139
- Total pull requests: 764
- Average time to close issues: 10 months
- Average time to close pull requests: 11 days
- Total issue authors: 14
- Total pull request authors: 13
- Average comments per issue: 1.11
- Average comments per pull request: 0.96
- Merged pull requests: 615
- Bot issues: 0
- Bot pull requests: 13
Past Year
- Issues: 60
- Pull requests: 447
- Average time to close issues: 26 days
- Average time to close pull requests: 10 days
- Issue authors: 8
- Pull request authors: 7
- Average comments per issue: 0.7
- Average comments per pull request: 0.87
- Merged pull requests: 336
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
- zingale (111)
- dwillcox (7)
- hansbdein (3)
- yut23 (3)
- aisclark91 (3)
- rat1402 (3)
- arkabratagupta (2)
- zhichen3 (1)
- Chirashree-India (1)
- DHasenour (1)
- sameulleaf (1)
- SamG-01 (1)
- azniaa (1)
- qmichalski (1)
Pull Request Authors
- zingale (536)
- yut23 (116)
- aisclark91 (32)
- zhichen3 (30)
- dependabot[bot] (13)
- SamG-01 (12)
- KiranEiden (8)
- biboyd (7)
- ethanstony (3)
- maxpkatz (2)
- brady-ryan (2)
- Parker-T-Johnson (2)
- hansbdein (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 197 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 14
- Total maintainers: 2
pypi.org: pynucastro
A python library for nuclear astrophysics
- Homepage: https://github.com/pynucastro/pynucastro
- Documentation: https://pynucastro.github.io/pynucastro/
- License: BSD
-
Latest release: 2.7.1
published 5 months ago
Rankings
Dependencies
- Sphinx *
- ipywidgets >=7.1.2
- jinja2 ==3.0.3
- jupyter >=1.0.0
- matplotlib >=2.1.0
- nbsphinx >=0.3.1
- nbval >=0.9.0
- networkx >=2.1
- numba >=0.40
- numpy >=1.13.3
- pytest >=3.6
- pytest-cov >=2.6.0
- scipy >=1.0.0
- setuptools_scm >=6.2
- sphinx_rtd_theme *
- sympy >=1.1.1
- ipywidgets *
- matplotlib *
- networkx *
- numpy *
- scipy *
- sympy *
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- peaceiris/actions-gh-pages v3 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/cache v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
