nugridpy.mesa

MESA output data loading and plotting

v0.2, 15OCT2012: NuGrid collaboration (Sam Jones, Michael Bennett, Daniel Conti, William Hillary, Falk Herwig, Christian Ritter)

v0.1, 23JUN2010: Falk Herwig

mesa.py provides tools to get MESA stellar evolution data output into your favourite python session. In the LOGS directory MESA outputs two types of files: history.data or star.log is a time evolution output, printing one line per so many cycles (e.g. each cycle) of all sorts of things. profilennn.data or lognnn.data files are profile data files. nnn is the number of profile.data or log.data files that is translated into model cycles in the profiles.index file.

MESA allows users to freely define what should go into these two types of outputs, which means that column numbers can and do change. mesa.py reads in both types of files and present them (as well as any header attributes) as arrays that can be referenced by the actual column name as defined in the header section of the files. mesa.py then defines a (hopefully growing) set of standard plots that make use of the data just obtained.

mesa.py is organised as a module that can be imported into any python or ipython session. It is related to nugridse.py which is a similar module to deal with ‘se’ output, used by the NuGrid collaboration. mesa.py does not need se libraries. The ‘se’ output files that can be written with MESA can be read and processed with the nugridse.py tool.

mesa.py is providing two class objects, mesa_profile and history_data. The first makes profile data available, the second reads and plots the history.data or star.log file. Note that several instances of these can be initiated within one session and data from different instances (i.e. models, tracks etc) can be overplotted.

Here is how a simple session could look like that is plotting an HRD (We prefer to load ipython with matplotlib and numpy support via the alias:

alias mpython=’ipython –pylab’)

>>> import mesa as ms
>>> help ms
------> help(ms)
>>> s=ms.history_data('.')
>>> s.hrd()

In order to find out what header attributes and columns are available in history.data or star.log use:

>>> s.header_attr
{'burn_min1': 50.0,
 'burn_min2': 1000.0,
 'c12_boundary_limit': 0.0001,
 'h1_boundary_limit': 0.0001,
 'he4_boundary_limit': 0.0001,
 'initial_mass': 2.0,
 'initial_z': 0.01}
>>> s.cols
{'center_c12': 38,
 'center_h1': 36,
 'center_he4': 37,
 ...

In order to read the profile data from the first profile.data file in profiles.index, and then get the mass and temperature out and finally plot them try. Typically you will have already a Kippenhahn diagram as a function of model number in front of you, and you want to access profile information for a given cycle number. Typically you do not have profiles for all cycle numbers. The best way to start a profile instance is with num_type=’nearest_model’ (check the docstring for other ways to select profiles for a profile instance):

>>> a1=ms.mesa_profile('LOGS',59070)
2001 in profiles.index file ...
Found and load nearest profile for cycle 59000
reading LOGS/profile1801.data ...
Closing profile tool ...
>>> T=a1.get('temperature')
>>> mass=a1.get('mmid')
>>> plot(mass,T)
[<matplotlib.lines.Line2D object at 0x8456ed0>]

Or, you could have had it easier in the following way:

>>> a1.plot('mass','c12',logy=True,shape='-',legend='$^{12}\mathrm{C}$')

where the superclass plot method interprets data column headers correctly and does all the work for you.

Of course, a1.cols etc are available here as well and many other things. E.g. a.model contains an array with all the models for which profile.data or log.data are available. You may initiate a profile object with a model number:

>>> a2=ms.mesa_profile('.',55000,num_type='model')
100 in profiles.index file ...
reading ./profile87.data ...

a1.log_ind (for any profile instance) provides a map of model number to profile file number. a1.cols and a1.header_attr gives the column names and header attributes.

Functions

set_nice_params()
set_nugrid_path(path) This function sets the path to the NuGrid VOSpace directory as a global variable, so that it need only be set once during an inter- active session.

Classes

history_data([sldir, slname, clean_starlog, …]) read history.data or star.log MESA output and plot various things,
mesa_profile([sldir, num, num_type, …]) read profiles.index and prepare reading MESA profile files
star_log([sldir, slname, clean_starlog, …]) Class derived from history_data class (copy).
class nugridpy.mesa.history_data(sldir='./LOGS', slname='history.data', clean_starlog=False, mass=None, Z=None, data_set='set1ext')

read history.data or star.log MESA output and plot various things, including HRD, Kippenhahn etc

Parameters:
  • sldir (string) – which LOGS directory.
  • slname (string, optional) – If star.log is available instead, star.log file is read, this is an optional argument if history.data or star.log file has an alternative name. The default is “history.data”.
  • clean_starlog (boolean, optional) – Request new cleaning of history.data or star.log, makes history.datasa or star.logsa which is the file that is actually read and plotted. The default is False.
  • mass (integer or float, optional) – The user may select a mass and metallicity instead of providing the sldir explicitly, if they are using the VOSpace data. If mass is provided then Z should also be provided. The default is None (i.e. user gives sldir explicitly)
  • Z (float, optional) – See ‘mass’ above. The default is None (i.e. user gives sldir explicitly)
  • data_set (string, optional) – Coose your data of ‘set1’ or ‘set1ext’. The default is ‘set1ext’.

Examples

use like this:

>>> another=ms.history_data('LOGS',slname='anothername')

or this:

>>> ms.set_nugrid_path('/tmp/NuGrid')
>>> anotherone=ms.history_data(mass=2,Z=0.01)
CO_ratio(ifig, ixaxis)

plot surface C/O ratio in Figure ifig with x-axis quantity ixaxis

Parameters:
  • ifig (integer) – Figure number in which to plot
  • ixaxis (string) – what quantity is to be on the x-axis, either ‘time’ or ‘model’ The default is ‘model’
TPAGB_properties()

Temporary, use for now same function in nugrid_set.py! Returns many TPAGB parameters which are TPstart,TPmods,TP_max_env,TPend,min_m_TP,max_m_TP,DUPmods,DUPm_min_h Same function in nugrid_set.py.

calc_DUP_parameter(modeln, label, fig=10, color='r', marker_type='*', h_core_mass=False)

Method to calculate the DUP parameter evolution for different TPs specified specified by their model number.

Parameters:
  • fig (integer) – Figure number to plot.
  • modeln (list) – Array containing pairs of models each corresponding to a TP. First model where h boundary mass will be taken before DUP, second model where DUP reaches lowest mass.
  • leg (string) – Plot label.
  • color (string) – Color of the plot.
  • marker_type (string) – marker type.
  • h_core_mass (boolean, optional) – If True: plot dependence from h free core , else star mass. The default is False.
find_TP_attributes(t0_model=0, fig=10, color='k', marker_type='*', h_core_mass=False, no_fig=False)

Function which finds TPs and uses the calc_DUP_parameter function. To calculate DUP parameter evolution dependent of the star or core mass.

Parameters:
  • fig (integer) –
  • number to plot. (Figure) –
  • t0_model (integer) –
  • he-shell lum peak (First) –
  • color (string) –
  • of the plot. (Color) –
  • marker_type (string) –
  • type. (marker) –
  • h_core_mass (boolean, optional) –
  • True (If) –
  • default is False. (The) –
  • no_fig (boolean, optional) –
  • default is False.
find_TPs_and_DUPs(percent=5.0, makefig=False)

Function which finds TPs and uses the calc_DUP_parameter function. To calculate DUP parameter evolution dependent of the star or core mass.

Parameters:
  • fig (integer) – Figure number to plot.
  • t0_model (integer) – First he-shell lum peak.
  • percent (float) – dredge-up is defined as when the mass dredged up is a certain percent of the total mass dredged up during that event, which is set by the user in this variable. The default is 5.
  • makefig – do you want a figure to be made?
Returns:

  • TPmods (array) – model numbers at the peak of each thermal pulse
  • DUPmods (array) – model numbers at the dredge-up, where dredge-up is defined as when the mass dredged up is a certain percent of the total mass dredged up during that event, which is set by the user
  • TPend (array) – model numbers at the end of the PDCZ for each TP
  • lambda (array) – DUP efficiency for each pulse

find_first_TP()

Find first TP of the TPAGB phase and returns the model number at its LHe maximum.

get(str_name)

return a column of data with the name str_name.

Parameters:str_name (string) – The name of the column as printed in history.data or star.log get the available columns from self.cols (where you replace self with the name of your instance
hrd(ifig=None, label=None, colour=None, s2ms=False, dashes=None, **kwargs)

Plot an HR diagram

Parameters:
  • ifig (integer or string) – Figure label, if None the current figure is used The default value is None.
  • lims (list [x_lower, x_upper, y_lower, y_upper]) –
  • label (string) – Label for the model The default value is None
  • colour (string) – The colour of the line The default value is None
  • s2ms (boolean, optional) – “Skip to Main Sequence”? The default is False.
  • dashes (list, optional) – Custom dashing style. If None, ignore. The default is None.
hrd_key(key_str)

plot an HR diagram

Parameters:key_str (string) – A label string
hrd_new(input_label='', skip=0)

plot an HR diagram with options to skip the first N lines and add a label string

Parameters:
  • input_label (string, optional) – Diagram label. The default is “”.
  • skip (integer, optional) – Skip the first n lines. The default is 0.
kip_cont(ifig=110, modstart=0, modstop=-1, t0_model=0, outfile='out.png', xlims=[0.0, 0.0], ylims=[0.0, 0.0], xres=1000, yres=1000, ixaxis='model_number', mix_zones=20, burn_zones=20, plot_radius=False, engenPlus=True, engenMinus=False, landscape_plot=False, rad_lines=False, profiles=[], showfig=True, outlines=True, boundaries=True, c12_boundary=False, rasterise=False, yscale='1.', engenlevels=None, CBM=False)

This function creates a Kippenhahn plot with energy flux using contours.

This plot uses mixing_regions and burning_regions written to your history.data or star.log. Set both variables in the log_columns.list file to 20 as a start.

The output log file should then contain columns called “mix_type_n”, “mix_qtop_n”, “burn_type_n” and “burn_qtop_n”. The number of columns (i.e. the biggest value of n) is what goes in the arguments as mix_zones and burn_zones. DO NOT WORRY! if you do not have these columns, just leave the default values alone and the script should recognise that you do not have these columns and make the most detailed plot that is available to you.

Defaults are set to get some plot, that may not look great if you zoom in interactively. Play with xres and yres as well as setting the xlims to ylims to the region you are interested in.

Parameters:
  • ifig (integer, optional) – Figure frame number. The default is 110.
  • modstart (integer, optional) – Model from which you want to plot (be careful if your history.data or star.log output is sparse…). If it is 0 then it starts from the beginning, works even if log_cnt > 1. The default is 0.
  • modstop (integer, optional) – Model to which you wish to plot, -1 corresponds to end [if log_cnt>1, devide modstart and modstop by log_cnt, this needs to be improved! SJ: this should be ficed now]. The defalut is -1.
  • t0_model (integer, optional) – Model number from which to reset the time to 0. Typically, if modstart!=0, t0_model=modstart is a good choice, but we leave the choice to the user in case the time is wished to start from 0 at a different key point of the evolution. The default value is 0.
  • outfile (sting, optional) – ‘filename + extension’ where you want to save the figure. The defalut is “out.png”.
  • ylims (xlims,) – Plot limits, however these are somewhat obsolete now that we have modstart and modstop. Leaving them as 0. is probably no slower, and you can always zoom in afterwards in mpl. ylims is important for well resolved thermal pulse etc plots; it’s best to get the upper and lower limits of he-intershell using s.kippenhahn_CO(1,’model’) first. The default is [0., 0.].
  • yres (xres,) – plot resolution. Needless to say that increasing these values will yield a nicer plot with some slow-down in plotting time. You will most commonly change xres. For a prelim plot, try xres~200, then bump it up to anywhere from 1000-10000 for real nicely resolved, publication quality plots. The default is 1000.
  • ixaxis (string, optional) – Either ‘log_time_left’, ‘age’, or ‘model_number’. The default is “model_number”.
  • burn_zones (mix_zones,) – As described above, if you have more detailed output about your convection and energy generation boundaries in columns mix_type_n, mix_qtop_n, burn_type_n and burn_qtop_n, you need to specify the total number of columns for mixing zones and burning zones that you have. Can’t work this out from your history.data or star.log file? Check the history_columns.list that you used, it’ll be the number after “mixing regions” and “burning regions”. Can’t see these columns? leave it and 2 conv zones and 2 burn zones will be drawn using other data that you certainly should have in your history.data or star.log file. The defalut for both is 20.
  • plot_radius (boolean, optional) – Whether on a second y-axis you want to plot the radius of the surface and the he-free core. The default is False.
  • engenPlus (boolean) – Plot energy generation contours for eps_nuc>0. The default is True.
  • endgenMinus (boolean, optional) – Plot energy generation contours for eos_nuc<0. The default is True.
  • landscape_plot (boolean, optionla) – The default is False.
  • rad_lines (boolean, optional) – The deafault is False.
  • profiles (list, optional) – The default is [].
  • showfig (boolean, optional) – The default is True.
  • outlines (boolean, optional) – Whether or not to plot outlines of conv zones in darker colour.
  • boundaries (boolean, optional) – Whether or not to plot H-, He- and C-free boundaries.
  • c12_boundary (boolean, optional) – The default is False.
  • rasterise (boolean, optional) – Whether or not to rasterise the contour regions to make smaller vector graphics figures. The default is False.
  • yscale (string, optional) – Re-scale the y-axis by this amount
  • engenlevels (list) – Give cusstom levels to the engenPlus contour. If None, the levels are chosen automatically. The default is None.
  • CBM (boolean, optional) – plot contours for where CBM is active?

Notes

The parameter xlims is depricated.

kip_cont_COmdot(ifig=110, modstart=0, modstop=-1, t0_model=0, outfile='out.png', xlims=[0.0, 0.0], ylims=[0.0, 0.0], xres=1000, yres=1000, ixaxis='model_number', mix_zones=20, burn_zones=20, plot_radius=False, engenPlus=True, engenMinus=False, landscape_plot=False, rad_lines=False, profiles=[], showfig=True, outlines=True, boundaries=True, c12_boundary=False, rasterise=False, yscale='1.', engenlevels=None, CO_ratio=True)

This function creates a Kippenhahn plot with energy flux using contours.

This plot uses mixing_regions and burning_regions written to your history.data or star.log. Set both variables in the log_columns.list file to 20 as a start.

The output log file should then contain columns called “mix_type_n”, “mix_qtop_n”, “burn_type_n” and “burn_qtop_n”. The number of columns (i.e. the biggest value of n) is what goes in the arguments as mix_zones and burn_zones. DO NOT WORRY! if you do not have these columns, just leave the default values alone and the script should recognise that you do not have these columns and make the most detailed plot that is available to you.

Defaults are set to get some plot, that may not look great if you zoom in interactively. Play with xres and yres as well as setting the xlims to ylims to the region you are interested in.

Parameters:
  • ifig (integer, optional) – Figure frame number. The default is 110.
  • modstart (integer, optional) – Model from which you want to plot (be careful if your history.data or star.log output is sparse…). If it is 0 then it starts from the beginning, works even if log_cnt > 1. The default is 0.
  • modstop (integer, optional) – Model to which you wish to plot, -1 corresponds to end [if log_cnt>1, devide modstart and modstop by log_cnt, this needs to be improved! SJ: this should be ficed now]. The defalut is -1.
  • t0_model (integer, optional) – Model number from which to reset the time to 0. Typically, if modstart!=0, t0_model=modstart is a good choice, but we leave the choice to the user in case the time is wished to start from 0 at a different key point of the evolution. The default value is 0.
  • outfile (sting, optional) – ‘filename + extension’ where you want to save the figure. The defalut is “out.png”.
  • ylims (xlims,) – Plot limits, however these are somewhat obsolete now that we have modstart and modstop. Leaving them as 0. is probably no slower, and you can always zoom in afterwards in mpl. ylims is important for well resolved thermal pulse etc plots; it’s best to get the upper and lower limits of he-intershell using s.kippenhahn_CO(1,’model’) first. The default is [0., 0.].
  • yres (xres,) – plot resolution. Needless to say that increasing these values will yield a nicer plot with some slow-down in plotting time. You will most commonly change xres. For a prelim plot, try xres~200, then bump it up to anywhere from 1000-10000 for real nicely resolved, publication quality plots. The default is 1000.
  • ixaxis (string, optional) – Either ‘log_time_left’, ‘age’, or ‘model_number’. The default is “model_number”.
  • burn_zones (mix_zones,) – As described above, if you have more detailed output about your convection and energy generation boundaries in columns mix_type_n, mix_qtop_n, burn_type_n and burn_qtop_n, you need to specify the total number of columns for mixing zones and burning zones that you have. Can’t work this out from your history.data or star.log file? Check the history_columns.list that you used, it’ll be the number after “mixing regions” and “burning regions”. Can’t see these columns? leave it and 2 conv zones and 2 burn zones will be drawn using other data that you certainly should have in your history.data or star.log file. The defalut for both is 20.
  • plot_radius (boolean, optional) – Whether on a second y-axis you want to plot the radius of the surface and the he-free core. The default is False.
  • engenPlus (boolean) – Plot energy generation contours for eps_nuc>0. The default is True.
  • endgenMinus (boolean, optional) – Plot energy generation contours for eos_nuc<0. The default is True.
  • landscape_plot (boolean, optionla) – The default is False.
  • rad_lines (boolean, optional) – The deafault is False.
  • profiles (list, optional) – The default is [].
  • showfig (boolean, optional) – The default is True.
  • outlines (boolean, optional) – Whether or not to plot outlines of conv zones in darker colour.
  • boundaries (boolean, optional) – Whether or not to plot H-, He- and C-free boundaries.
  • c12_boundary (boolean, optional) – The default is False.
  • rasterise (boolean, optional) – Whether or not to rasterise the contour regions to make smaller vector graphics figures. The default is False.
  • yscale (string, optional) – Re-scale the y-axis by this amount
  • engenlevels (list) – Give cusstom levels to the engenPlus contour. If None, the levels are chosen automatically. The default is None.

Notes

The parameter xlims is depricated.

kippenhahn(num_frame, xax, t0_model=0, title='Kippenhahn diagram', tp_agb=0.0, t_eps=500.0, plot_star_mass=True, symbol_size=8, c12_bm=False, print_legend=True)

Kippenhahn plot as a function of time or model.

Parameters:
  • num_frame (integer) – Number of frame to plot this plot into, if <0 open no new figure.
  • xax (string) – Either ‘model’, ‘time’ or ‘logtimerev’ to indicate what is to be used on the x-axis.
  • t0_model (integer, optional) – If xax = ‘time’ then model for the zero point in time, for AGB plots this would be usually the model of the 1st TP, which can be found with the Kippenhahn plot. The default is 0.
  • title (string, optional) – The figure title. The default is “Kippenhahn diagram”.
  • tp_agb (float, optional) – If > 0. then, ylim=[h1_min*1.-tp_agb/100 : h1_max*1.+tp_agb/100] with h1_min, h1_max the min and max H-free core mass coordinate. The default is 0. .
  • t_eps (float, optional) – Final time for logtimerev. The default is ‘5.e2’.
  • plot_star_mass (boolean, optional) – If True, then plot the stellar mass as a line as well. The default is True.
  • symbol_size (integer, optional) – Size of convection boundary marker. The default is 8.
  • c12_bm (boolean, optional) – If we plot c12_boundary_mass or not. The default is False.
  • print_legend (boolean, optionla) – Show or do not show legend. The defalut is True.
kippenhahn_CO(num_frame, xax, t0_model=0, title='Kippenhahn diagram', tp_agb=0.0, ylim_CO=[0, 0])

Kippenhahn plot as a function of time or model with CO ratio

Parameters:
  • num_frame (integer) – Number of frame to plot this plot into.
  • xax (string) – Either model or time to indicate what is to be used on the x-axis.
  • t0_model (integer, optional) – Model for the zero point in time, for AGB plots this would be usually the model of the 1st TP, which can be found with the Kippenhahn plot. The default is 0.
  • title (string, optional) – Figure title. The defalut is “Kippenhahn diagram”.
  • tp_agb (float, optional) – If >= 0 then, ylim=[h1_min*1.-tp_agb/100 : h1_max*1.+tp_agb/100] with h1_min, h1_max the min and max H-free core mass coordinate. The defalut is 0.
  • ylim_CO (list) – if ylim_CO is [0,0], then it is automaticly set. The default is [0,0].
mcc_t(ifig=None, lims=[0, 15, 0, 25], label=None, colour=None, mask=False, s2ms=False, dashes=None)

Plot mass of convective core as a function of time.

Parameters:
  • ifig (integer or string) – Figure label, if None the current figure is used The default value is None.
  • lims (list [x_lower, x_upper, y_lower, y_upper]) –
  • label (string) – Label for the model The default value is None
  • colour (string) – The colour of the line The default value is None
  • mask (boolean, optional) – Do you want to try to hide numerical spikes in the plot? The default is False
  • s2ms (boolean, optional) – skip to main squence?
  • dashes (list, optional) – Custom dashing style. If None, ignore. The default is None.
mdot_t(ifig=None, lims=[7.4, 2.6, -8.5, -4.5], label=None, colour=None, s2ms=False, dashes=None)

Plot mass loss history as a function of log-time-left

Parameters:
  • ifig (integer or string) – Figure label, if None the current figure is used The default value is None.
  • lims (list [x_lower, x_upper, y_lower, y_upper]) –
  • label (string) – Label for the model The default value is None
  • colour (string) – The colour of the line The default value is None
  • s2ms (boolean, optional) – “skip to main sequence”
  • dashes (list, optional) – Custom dashing style. If None, ignore. The default is None.
t_lumi(num_frame, xax)

Luminosity evolution as a function of time or model.

Parameters:
  • num_frame (integer) – Number of frame to plot this plot into.
  • xax (string) – Either model or time to indicate what is to be used on the x-axis
t_surf_parameter(num_frame, xax)

Surface parameter evolution as a function of time or model.

Parameters:
  • num_frame (integer) – Number of frame to plot this plot into.
  • xax (string) – Either model or time to indicate what is to be used on the x-axis
t_surfabu(num_frame, xax, t0_model=0, title='surface abundance', t_eps=0.001, plot_CO_ratio=False)

t_surfabu plots surface abundance evolution as a function of time.

Parameters:
  • num_frame (integer) – Number of frame to plot this plot into, if <0 don’t open figure.
  • xax (string) – Either model, time or logrevtime to indicate what is to be used on the x-axis.
  • t0_model (integer, optional) – Model for the zero point in time, for AGB plots this would be usually the model of the 1st TP, which can be found with the Kippenhahn plot. The default is 0.
  • title (string, optional) – Figure title. The default is “surface abundance”.
  • t_eps (float, optional) – Time eps at end for logrevtime. The default is 1.e-3.
  • plot_CO_ratio (boolean, optional) – On second axis True/False. The default is False.
tcrhoc(ifig=None, lims=[3.0, 10.0, 8.0, 10.0], label=None, colour=None, dashes=None)

Central temperature again central density plot

Parameters:
  • ifig (integer or string) – Figure label, if None the current figure is used The default value is None.
  • lims (list [x_lower, x_upper, y_lower, y_upper]) –
  • label (string) – Label for the model The default value is None
  • colour (string) – The colour of the line The default value is None
  • dashes (list, optional) – Custom dashing style. If None, ignore. The default is None.
xche4_teff(ifig=None, lims=[1.0, 0.0, 3.4, 4.7], label=None, colour=None, s2ms=True, dashes=None)

Plot effective temperature against central helium abundance.

Parameters:
  • ifig (integer or string) – Figure label, if None the current figure is used The default value is None.
  • lims (list [x_lower, x_upper, y_lower, y_upper]) –
  • label (string) –
  • for the model (Label) – The default value is None
  • colour (string) – The colour of the line The default value is None
  • s2ms (boolean, optional) – “Skip to Main Sequence” The default is True
  • dashes (list, optional) – Custom dashing style. If None, ignore. The default is None.
class nugridpy.mesa.mesa_profile(sldir='./LOGS', num=1, num_type='nearest_model', prof_ind_name='profiles.index', profile_prefix='profile', data_suffix='.data', mass=None, Z=None, give_filename=None, data_set='set1ext')

read profiles.index and prepare reading MESA profile files

starts with reading profiles.index and creates hash array profile.data can then be accessed via prof_plot

Parameters:
  • sldir (string) – Directory path of LOGS.
  • num (integer) – by default this is the i. profile file (profile.data or log.data) available (e.g. num=1 is the 1. available profile file), however if you give
  • num_type (string, optional) –

    If ‘model’ (exact) or ‘nearest_model’: get the profile profile.data file for model (or cycle number) used by the stellar evolution code

    If ‘profile_num’: num will be interpreted as the profile.data or log.data number profile_num (profile_num is the number that appears in the file names of type profile23.data or log23.data)

    If ‘profiles_i’: the ith file in profiles.index file

    If ‘explicit’: the exact file path of the profile file should be given in the variable give_filename.

    The default is “nearest_model”.

  • prof_ind_name (string, optional) – Use this optional argument if the profiles.index file has an alternative name, for example, do superpro=ms.profile(‘LOGS’,1,prof_ind_name=’super.prof’)
  • profile_prefix (string, optional) – Prifix in the profile name. The default is “profile”.
  • data_suffix (string, optional) – Optional arguments that allow you to change the defaults for the profile.data profile files.
  • mass (integer or float, optional) – The user may select a mass and metallicity instead of providing the sldir explicitly, if they are using the VOSpace data. If mass is provided then Z should also be provided. The default is None (i.e. user gives sldir explicitly)
  • Z (float, optional) – See ‘mass’ above. The default is None (i.e. user gives sldir explicitly)
  • data_set (string, optional) – Coose your data of ‘set1’ or ‘set1ext’. The default is ‘set1ext’.

Examples

initialise a mesa_profile instance for cycle 2000 like this:

>>>my_profile1=ms.mesa_profile(‘LOGS’,2000)

or like this:

>>>my_profile2=ms.mesa_profile(mass=2,Z=0.01,num=2000)

energy_profile(ixaxis)

Plot radial profile of key energy generations eps_nuc, eps_neu etc.

Parameters:ixaxis ('mass' or 'radius') –
get(str_name)

return a column of data with the name str_name.

Parameters:str_name (string) – Is the name of the column as printed in the profilennn.data or lognnn.data file; get the available columns from self.cols (where you replace self with the name of your instance)
write_LEAFS_model(nzn=30000000, dr=50000.0, rhostrip=0.0005)

write an ascii file that will be read by Sam’s version of inimod.F90 in order to make an initial model for LEAFS

write_PROM_HOTB_progenitor(name, description)

Write a progenitor file for the PROMETHEUS/HBOT supernova code.

Parameters:
  • name (string) – File name for the progenitor file
  • description (string) – Information to be written into the file header.
write_STELLA_model(name)

Write an initial model in a format that may easily be read by the radiation hydrodynamics code STELLA.

Parameters:name (string) – an identifier for the model. There are two output files from this method, which will be <name>.hyd and <name>.abn, which contain the profiles for the hydro and abundance variables, respectively.
nugridpy.mesa.set_nugrid_path(path)

This function sets the path to the NuGrid VOSpace directory as a global variable, so that it need only be set once during an inter- active session.

class nugridpy.mesa.star_log(sldir='./LOGS', slname='history.data', clean_starlog=False, mass=None, Z=None, data_set='set1ext')

Class derived from history_data class (copy). Existing just (for compatibility reasons) for older mesa python scripts.