Quickstart

This quickstart tutorial gets you from installing kiauhoku to interpolating a model from a grid.

1. Installation

If necessary, uncomment the next cell and run it to install kiauhoku.

[1]:
# %pip install kiauhoku

2. Import kiauhoku and load the Dartmouth grid

If you don’t have the Dartmouth grid downloaded, this will perform a one-time download from Zenodo.

[2]:
import kiauhoku as kh

dart = kh.load_eep_grid("dartmouth")

3. Get models from the grid

3a. Defined models and tracks

The EEP grid contains stellar evolution tracks re-sampled to Equivalent Evolutionary Phases. Each EEP represents a model of dependent parameters—temperature, luminosity, surface gravity, etc.—given the dependent parameters of mass, initial metallicity, and EEP or time step. We can access a Solar-like track by asking for the model at (mass, initial_metallicity) = (1.0, 0.0):

[3]:
dart.loc[1, 0]
[3]:
Age (yrs) Log T Log g Log L Log R Y_core Z_core (Z/X)_surf L_H L_He M_He_core M_CO_core X_core
eep
0 1.419635e+03 3.629170 2.417850 1.490190 1.010010 0.274020 0.018850 0.026658 0.000000 0.000000 0.000000 0.0 7.071300e-01
1 2.487531e+03 3.630041 2.438774 1.472737 0.999544 0.274020 0.018850 0.026658 0.000000 0.000000 0.000000 0.0 7.071300e-01
2 3.633402e+03 3.630903 2.459858 1.455103 0.989002 0.274020 0.018850 0.026658 0.000000 0.000000 0.000000 0.0 7.071300e-01
3 4.860224e+03 3.631758 2.481066 1.437324 0.978402 0.274020 0.018850 0.026658 0.000000 0.000000 0.000000 0.0 7.071300e-01
4 6.185908e+03 3.632602 2.502417 1.419349 0.967724 0.274020 0.018850 0.026658 0.000000 0.000000 0.000000 0.0 7.071300e-01
... ... ... ... ... ... ... ... ... ... ... ... ... ...
947 1.218217e+10 3.493549 -0.026360 3.391891 2.232111 0.979210 0.020793 0.026674 2443.097698 2.713918 0.469409 0.0 -2.861621e-06
948 1.218219e+10 3.493250 -0.030035 3.394368 2.233946 0.979210 0.020793 0.026674 2457.025602 3.488003 0.470038 0.0 -3.355518e-06
949 1.218221e+10 3.492951 -0.033710 3.396845 2.235781 0.979210 0.020794 0.026674 2470.953506 4.262088 0.470668 0.0 -3.849415e-06
950 1.218223e+10 3.492655 -0.037491 3.399445 2.237673 0.979206 0.020795 0.026674 2485.656718 56.807075 0.471590 0.0 -7.194609e-07
951 1.218226e+10 3.492360 -0.041320 3.402100 2.239590 0.979200 0.020796 0.026674 2500.700000 132.060000 0.472640 0.0 4.000000e-06

952 rows × 13 columns

You can get a specific time step or EEP by adding an extra indexer:

[4]:
dart.loc[1, 0, 250]
[4]:
Age (yrs)     2.258148e+09
Log T         3.758194e+00
Log g         4.501619e+00
Log L        -7.750308e-02
Log R        -3.187953e-02
Y_core        4.443106e-01
Z_core        1.930241e-02
(Z/X)_surf    2.469866e-02
L_H           8.369097e-01
L_He          0.000000e+00
M_He_core     0.000000e+00
M_CO_core     0.000000e+00
X_core        5.363870e-01
Name: (1.0, 0.0, 250), dtype: float64

3b. Interpolating models and tracks

kiauhoku contains tools for interpolating new tracks and models from existing model grids. Do do this, you must either load an existing interpolator or cast an EEP grid to a StarGridInterpolator.

[5]:
# dart_interp = kh.load_interpolator("dartmouth") # loads from file, or
dart_interp = dart.to_interpolator() # creates the interpolator from the model grid
[6]:
# Interpolate a track at M/Msun = 0.755, [Z/H]_0 = 0.15
dart_interp.get_track((0.755, 0.15))
[6]:
Age (yrs) Log T Log g Log L Log R Y_core Z_core (Z/X)_surf L_H L_He M_He_core M_CO_core X_core
0 1.137909e+03 3.608212 2.337426 1.364635 0.989153 0.286420 0.025583 0.037186 0.000000 0.000000 0.000000 0.0 6.879970e-01
1 1.937412e+03 3.608988 2.356955 1.348203 0.979386 0.286420 0.025583 0.037186 0.000000 0.000000 0.000000 0.0 6.879970e-01
2 2.786553e+03 3.609757 2.376593 1.331638 0.969570 0.286420 0.025583 0.037186 0.000000 0.000000 0.000000 0.0 6.879970e-01
3 3.700308e+03 3.610515 2.396380 1.314888 0.959674 0.286420 0.025583 0.037186 0.000000 0.000000 0.000000 0.0 6.879970e-01
4 4.674406e+03 3.611266 2.416286 1.298003 0.949723 0.286420 0.025583 0.037186 0.000000 0.000000 0.000000 0.0 6.879970e-01
... ... ... ... ... ... ... ... ... ... ... ... ... ...
947 3.427606e+10 3.459313 -0.290026 3.396490 2.302879 0.966712 0.033285 0.034437 2468.977715 2.063772 0.469954 0.0 2.876900e-06
948 3.427608e+10 3.458979 -0.293919 3.399049 2.304824 0.966712 0.033286 0.034437 2483.585941 3.708047 0.470642 0.0 2.130430e-06
949 3.427610e+10 3.458647 -0.297875 3.401675 2.306799 0.966712 0.033287 0.034437 2498.640684 11.196025 0.471376 0.0 1.290611e-06
950 3.427612e+10 3.458315 -0.301867 3.404340 2.308792 0.966712 0.033288 0.034437 2513.917624 28.864201 0.472144 0.0 4.258629e-07
951 3.427615e+10 3.457985 -0.305937 3.407079 2.310834 0.966712 0.033289 0.034437 2529.530000 171.385000 0.473376 0.0 -1.100000e-06

952 rows × 13 columns

Finally, you can interpolate specific EEPs from the grid as well:

[7]:
dart_interp.get_star_eep((0.755, 0.15, 303.3))
[7]:
Age (yrs)     1.051701e+10
Log T         3.667182e+00
Log g         4.576931e+00
Log L        -6.389981e-01
Log R        -1.306025e-01
Y_core        5.673465e-01
Z_core        2.817389e-02
(Z/X)_surf    3.108779e-02
L_H           2.306751e-01
L_He          0.000000e+00
M_He_core     0.000000e+00
M_CO_core     0.000000e+00
X_core        4.044796e-01
dtype: float64

4. Summary

Congratulations! You’ve installed kiauhoku, loaded a model grid, and interpolated new models from the grid. Try it out with other grids, like yrec, mist, or garstec. For scientific use, you might want to check out the StarGridInterpolator fitting and sampling functions fit_star, gridsearch_fit, and mcmc_star. See the documentation and the demo notebooks.