Evolutionary tracks (Baraffe et al. 98)¶
- class PyAstronomy.pyasl.Baraffe98Tracks¶
Provide access to the evolutionary tracks of Baraffe et al. 98.
Downloads the table (tab1-3.dat) pertaining to the paper Baraffe et al. 98, A&A 337, 403 and offers some helper method to access the individual tracks.
Methods
findModels
([Met, Y, Lmix, Mass])Find models with given parameters.
getModelData
(model[, columns])Find data for a specific model.
getUniqueValues
(colName)Find unique values in a column.
- findModels(Met=None, Y=None, Lmix=None, Mass=None)¶
Find models with given parameters.
- Parameters
- Metfloat, optional
The metallicity.
- Yfloat, optional
The initial helium mass fraction.
- Lmixfloat, optional
The initial mixing length parameter.
- Massfloat, optional
The mass [solar masses]
- Returns
- Modelslist of tuples
A list of models specified as tuples defining: metallicity, Y, Lmix, and mass.
- getModelData(model, columns=None)¶
Find data for a specific model.
- Parameters
- modeltuple of float
Specifies the model as a tuple containing four entries, which define: metallicity, initial helium mass fraction (Y), initial mixing length parameter (Lmix), and mass.
- columnslist of strings, optional
A list of column names, which shall be included in the result. The default is including all columns.
- Returns
- Modelrecarray
The data pertaining to that particular model as a numpy recarray.
- getUniqueValues(colName)¶
Find unique values in a column.
- Parameters
- colNamestring, {“Met”,”Y”,”Lmix”,”Mass”,”Age”,”Teff”,”logg”,”Mbol”,”MV”,”MR”,”MI”,”MJ”,”MH”,”MK”}
The name of the column.
- Returns
- Unique valuesarray
All unique values in that column.
Example of usage¶
from __future__ import print_function, division
from PyAstronomy.pyasl import resBased as rb
import matplotlib.pylab as plt
import numpy as np
bt = rb.Baraffe98Tracks()
print("Unique metallicity values: ", bt.getUniqueValues("Met"))
print("Unique Y values: ", bt.getUniqueValues("Y"))
print("Unique Lmix values: ", bt.getUniqueValues("Lmix"))
print("Unique mass values: ", bt.getUniqueValues("Mass"))
# Get model data and plot log10(age) versus effective temperature
m = bt.getModelData((0.0, 0.275, 1.0, 0.3))
plt.plot(np.log10(m.Age*1e9), m.Teff, 'b.-')
# Find all models with metallicity 0.0, Y 0.275, Lmix 0.0,
# and any mass.
models = bt.findModels(Met=0.0, Mass=None, Y=0.275, Lmix=1.0)
# Print out the model parameters.
print()
print("Number of models found: ", len(models))
for i, model in enumerate(models):
print("Model no. %3d : Met = %3.1f, Y = %5.3f, Lmix = %3.1f, Mass = %4.2f"
% ((i+1,) + model))
# Finally, show the plot
plt.show()