Python tools to access and analyse NuGrid output data (including from MESA)
Clone or download
Latest commit 2c1a286 Jan 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Adding index button to docs Nov 10, 2017
nugridpy added flux_solo Jan 18, 2019
scripts Create Jun 16, 2017
.gitignore typo in .gitignore Jun 7, 2016
.travis.yml update lowercase nugridpy in travis Aug 26, 2017
AUTHORS Update AUTHORS Nov 19, 2017
LICENSE update Nov 19, 2017 add pipy badge May 31, 2018 update Nov 19, 2017

Build Status PyPI version


NuGridPy is the NuGrid Python package providing tools to access and analyse (e.g. plot) various output formats (including the NuGrid hdf5-based se format) from NuGrid codes (mppnp and ppn) and from the MESA stellar evolution code using the NuGrid mesa_h5 MESA extension. In principle the NuGridPy package can be used on any stellar evolution code output if the NuGrid se libraries are used for output.
The module will work with MESA ASCII output in the LOGS directory.

Using NuGridPy

The NuGridPy modules were written with an interactive work mode in mind, either

  • taking advantage of the interactive ipython session, or
  • inside a jupyter ipython notebooks. Once your session starts import modules, such as mesa, nugridse or ppn (depending on which type of data you are working with) from the NuGridPy package, for example:
    from nugridpy import mesa as ms

Example session

A typical example session in a jupyter notebook that can be performed at the Web-Exploration of NuGrid Data Interactive (WENDI) server would look like this:

  1. Go to and sign-in with your github ID (sessions will be culled at regular intervals > a few hours, if you want to use this service beyond this trial period send a message to fherwig at
  2. Start a Python 3 ipython notebooks
  3. Load NuGridPy packages and initialise data source:
# loading packages
from nugridpy import nugridse as nuse
from nugridpy import mesa
#setting data path for mesa and nuse
# data_dir='/data/nugrid_apod2/' # alternative data store
# do ! ls /data/nug* to check for other alternative data stores
  1. Creating see and ppd instances
# see: Stellar Evolution and Explosion data
# ppd: Post-Processing Data,Z=0.02)
  1. Plot Hertzsprung-Russel diagram or Kippenhahn diagram
  1. Inquire doc string, plot abundance profiles from ppd data_dir
               linewidth=2,limits=[0.5882, 0.5889,-7.8, -3.2])
m2z02_ppd.abu_profile(isos=species, ifig=ifig, fname=45500, logy=True, colourblind=True)
title("Formation of the $^\mathsf{13}\mathsf{C}$ pocket: the partial H-$^\mathsf{12}\mathsf{C}$ zone")


Each module, class, function has (or should have!) reasonable doc strings in the modules. Read the docstring: help(ms), m2z02_see.plot?

The docstrings are also available on the Documentation web page.

If you have made tested and debugged improvements we are happy to know about them. Make a pull request on github. Such improvements include the documentation.

The tools provided here are useful to us, but of course there are still many things that need attention and improvement. Please add submit an issue on the github repo for ideas of improvements and to report bugs. Let us know if you want to help with these. Pull requests and new issues are most welcome!


There are several ways you can install NuGridPy.


Major release from PyPI:

pip install nugridpy

Release from github:

Sometimes you want to install a specific release. Go to the NuGridPy Release page and determine the tag of the release you want. If the tag is v0.7.2 install that release with pip using the following (you could choose something else for the egg name):

pip install -e git://

If you just want to install whatever the latest commit is on github using github you can do:

pip install git+


Especially for developing NuGridPy you may want to use pip but have more control of where the installation goes, to change the repo and commit back. In that case you can clone this repo, e.g.:

cd ; mkdir src; cd src
git clone

and point the PYTHONPATH variable to the NuGridPy repo directory.

Inside a jupyter notebook you can set the path the following way:

import sys

Required packages

All modules should work with the python distribution recommended NuGridDoc python distribution, with one additional package, the future package that needs to be installed additionally.

NuGridPy has the following python dependencies: numpy scipy matplotlib h5py xlrd future

For additional details on required packages, dependencies and manual installation please consult the Wiki.