Skip to content

XinlongSBU/Pynucastro_weakrates

Repository files navigation

pynucastro

Build Status DOI DOI

Python interfaces to the nuclear reaction rate databases, including the JINA Reaclib nuclear reactions database. This project has 2 goals:

  • allow for an exploration of rates and collection of rates (networks) in Jupyter notebooks

  • allow for the easy creation of the righthand side routines for reaction network integration (the ODEs)

To do this, pynucastro provides a parser for the Reaclib format to produce either a callable python function for a rate or output the python code for a function that can be incorporated into a rate module.

pynucastro does not yet support nuclear partition functions for Reaclib reverse rates, as the implementation is currently under development. We recommend you consider what problem you wish to study using pynucastro to determine whether reverse rates and partition function corrections are significant at the temperatures of interest.

documentation

Documentation for pynucastro is available here:

http://pynucastro.github.io/pynucastro/

example

import pynucastro

r = pynucastro.Rate("c13-pg-n14-nacr")

# evaluate this rate at T = 1.e9 K
print(r.eval(1.0e9))

Also see the Jupyter notebooks:

install

To install the package, you can run:

python setup.py install

for a systemwide install, or

python setup.py install --user

for a single-user install. This will put the pynucastro modules and library in the default location python searches for packages.

requirements

This package requires Python 3 (release 3.4 or later) and the following Python packages:

  • numpy

  • sympy

  • scipy

  • matplotlib

  • networkx

  • ipywidgets

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

unit tests

We use py.test to do unit tests. In pynucastro/, do:

py.test -v .

to see coverage, do:

py.test --cov=pynucastro .

to test the notebooks, do:

py.test --nbval examples

If your OS has both Python 2 and Python 3 installed you may need to invoke pytest as py.test-3 when running the unit tests.