pynucastro.mesa_utils module#

A collection of methods for accessing data from a MESA models as read by py_mesa_reader, and putting them into a form that pynucastro can use.

class pynucastro.mesa_utils.MesaModel(model)[source]#

Bases: object

Read data from a MESA model and store the thermodynamic state for each zone in a pynucastro-compatible format.

Parameters:

model (mesa_reader.MesaData) – The MESA model as read by mesa_reader.MesaData

get_data_array(var='T')[source]#

Return an array of a single variable indexed by zone

Parameters:

var (str) – The name of the variable to access. This must be a member of MesaZoneState.

Return type:

numpy.ndarray

get_peak_index(var)[source]#

Return the index in the MESA model with the highest value of var.

Parameters:

var (str) – The name of the variable to access. This must be a member of MesaZoneState.

Return type:

int

get_zone_data(i)[source]#

Return the thermodynamic state for a single zone in the MESA model

Parameters:

i (int) – The index into the MESA model

Return type:

MesaZoneState

class pynucastro.mesa_utils.MesaZoneState(r, m, rho, T, comp)[source]#

Bases: object

A container for a single MESA zone’s data

r#

radius (cm)

Type:

float

m#

mass shell (g)

Type:

float

rho#

density (CGS)

Type:

float

T#

temperature (K)

Type:

float

comp#

the composition of the zone

Type:

Composition

pynucastro.mesa_utils.get_nuclei(model)[source]#

Return a list of nuclei contained in the MESA model.

Parameters:

model (mesa_reader.MesaData) – The MESA model as read by mesa_reader.MesaData

Return type:

list(Nucleus)

pynucastro.mesa_utils.get_zone_data(model, i, *, nuclei=None)[source]#

Return a tuple of (rho, T, composition) for a single zone from the MESA model. These are the thermodynamic conditions needed to evaluate a pynucastro network’s rates.

Parameters:
  • model (mesa_reader.MesaData) – The MESA model as read by mesa_reader.MesaData

  • i (int) – The MESA zone index

  • nuclei (list(Nucleus)) – The list of nuclei in the MESA model. This will be read from the model if not provided, but if you are looping over multiple zones in succession, passing a cached list in can speed up the reading.

Return type:

MesaZoneState