NuGridPy

General Overview
Python codes for plotting the data created by PPN or MPPNP.

Basic Information
When you want to change something in the code such as data_plot.py (for plot_iso_abund function) and omega.py (for plot_mass function), you don't need to recompile or anything like that. Just change the code, then the changes are reflected in your next calculations.

Installation
Download from the NuGrid github (or git clone). In the nugridpy directory, the package is made. For installation or running NuGridPy, you may need to fix some parts of these python codes.


 * 1) ppn.py (e.g., change from .data_plot import * --> from data_plot import *; from . import utils --> import utils)
 * 2) utils.py (e.g., change from . import ascii_table as att --> import ascii_table as att)
 * 3) data_plot.py (e.g., change from . import astronomy as ast --> import astronomy as ast)
 * 4) mesa.py (e.g., from . import astronomy as ast --> import astronomy as ast, from .data_plot import * --> from data_plot import *)

Plotting python scripts
Typically these code exist in "python scripts" directory of example codes. Some useful scripts are


 * 1) plot-x.py (plot whatever (typically time) vs abundance; made from x-time.dat)
 * 2) abu_chart.py (plot 2D (nuclear chart) abundance plot for one specific time; made from iso_massf****.DAT)
 * 3) plot_isoabund.py (plot 1D abundance plot for one specific time; made from iso_massf****.DAT)
 * 4) abu_evolution.py (plot time vs abundance; made from x-time.DAT)
 * 5) plot_ele_abund.py (made by me by modifying plot_isoabund.py. Use "elemental_abund" function in data_plot.py)

Below are memos to avoid running errors.

- Note, in the python codes above, for example "p=ppn.abu_vector('.')" means find specific files in "." (the current directory). Depending on class, file names to be searched are different. abu_vector class finds "iso_massf_***.DAT", while x class finds "x-time.DAT".

abu_chart.py
In data_plot.py, ahead of return self._classTest_data.get(c, ''), change c = '.'.join(str(self.__class__)[:-2].rsplit('.', 2)[-2:])

to something defined in _classTest_data. For example,

c = "ppn.abu_vector"

This is needed because plotType = _classTest function doesn't successfully read the string. '''NOTE! All of these above are unnecessary if you "python setup.py install" in NuGridPy (link all python codes in the directory?)'''

plot-x.py
In x.plot('t_y',thing,logy=True,logx=True,shape=symbs[i],legend=plot_species[i],show=False), change t_y to real variable name used in the x-time.DAT (like 'time').

Note this code also needs to change to c = ppn.xtime" in data_plot.py.

plot_ele_abund.py
"elemental_abund" function needs isotopedatabase.txt file with full 5274 species listed.

analysis.py
I made this for analyzing mppnp outputs (hdf5 format).

mppnp_iso_abund.py
This code (made by me) produces "iso_mass***.DAT" at specific mass radius (set in the code) and at specific cycle (set in the code). You can use this output file in plot_iso_abund.py to plot isotope distribution.

mppnp_iso_abund_surf.py
This is for surface output (surf.h5 files). You can do same thing as above with surface data.

star_log2ppn_trajectory.py
You can extract star's trajectory (i.e., time, Temp, density) from mesa's output. Run like "python star_log2ppn_trajectory.py .(<-current directory)". Note that this code seemingly first search "history.data", and if it doesn't exist, search "star.log". MESA outputs "history.data", so you can change the name to star.log or you can use "history.data" as it is.

star_log2ppn_trajectory_pluseHR.py (by SO)
This code calculates luminosity too so you can draw HR diagram.

star_log2_KippenhahnD.py (made by SO)
This is for making a Kippenhahn Diagram from MESA output (star.log file). Run like "python star_log2_KippenhahnD.py ." (. means the current directory).