Skip to main content

Utilities for interacting and interpolating stellar evolution models

Project description

Kīauhōkū

ascl:2011.027 GitHub version PyPI version Paper

Python utilities for stellar model grid interpolation.

If you find this package useful, please cite Claytor et al. (2020).

Download the model grids from Zenodo.

(C) Zachary R. Claytor
Space Telescope Science Institute
2025 March 5

Kīauhōkū
From Hawaiian:

  1. vt. To sense the span of a star's existence (i.e., its age).
  2. n. The speed of a star (in this case, its rotational speed).

This name was created in partnership with Dr. Larry Kimura and Bruce Torres Fischer, a student participant in A Hua He Inoa, a program to bring Hawaiian naming practices to new astronomical discoveries. We are grateful for their collaboration.

Kīauhōkū is a suite of Python tools to interact with, manipulate, and interpolate between stellar evolutionary tracks in a model grid. It was designed to work with the model grid used in Claytor et al. (2020), which was generated using YREC with the magnetic braking law of van Saders et al. (2013), but other stellar evolution model grids are available.

Installation

Kīauhōkū requires the use of Python 3 and uses the following Python packages:

  • numpy
  • scipy
  • pandas
  • matplotlib
  • requests
  • pyarrow (or some package that supports parquet files)
  • numba
  • emcee

Personally, I create a conda environment for this. In this example I'll call it "stars".

conda create -n stars numpy scipy pandas matplotlib requests pyarrow numba emcee
conda activate stars
pip install git+https://github.com/zclaytor/kiauhoku

Kīauhōkū is also on PyPI! It requires Python 3, but you can do this:

pip install kiauhoku

Quickstart Guide

As of v.2.0, you no longer need to manually download and install model grids; kiauhoku will automatically download any missing grid from Zenodo when you try to load it!

import kiauhoku as kh
grid = kh.load_interpolator('fastlaunch')

After this, the fastlaunch grid will be installed in ~/.kiauhoku/grids. You shouldn't have to download it again after this. Note that download times will vary depending on the size of the model grid.

How it works

We start with output evolution tracks from your favorite stellar modeling software. For rotevol output, these are the *.out files. Each *.out file has, for one specific initial metallicity and alpha-abundance, a series of evolution tracks for a range of initial masses. The "fastlaunch" grid for kiauhoku has eight *.out files, corresponding to
[M/H] ~ [-1.0, -0.5, 0.0, 0.5] and
[alpha/M] ~ [0.0, 0.4].
Each file contains 171 evolution tracks for 0.30 <= M/Msun <= 2.00 in steps of 0.01*Msun.

  1. First we load the tracks into a pandas MultiIndexed DataFrame and save to a parquet file.

  2. Age is not an optimal dimension for comparing consecutive evolution tracks. For this reason we condense each evolution track in the time domain to a series of Equivalent Evolutionary Phases (EEPs) after the method of Dotter (2016). The EEP-based tracks are packaged into a MultiIndexed DataFrame and saved to parquet.

  3. We finally load the EEP-based tracks into a kiauhoku.stargrid.StarGridInterpolator object. The StarGridInterpolator is based on the DataFrameInterpolator (DFInterpolator) from Tim Morton's isochrones package. It performs linear interpolation between consecutive evolution tracks for an input mass, metallicity, alpha-abundance, and either age or EEP-index. We then pickle the interpolator so it can be accessed quickly and easily.

Basic Usage

Once you have everything running, try doing this:

import kiauhoku as kh
grid = kh.load_interpolator('fastlaunch')
star = grid.get_star_eep((1, 0, 0, 330))

If it works, you should get something close to the sun. The argument to get_star_eep is a tuple containing the model grid indices. In this case, those are mass (in solar units), metallicity, alpha-abundance, and EEP index. See the documentation for more details.

Kīauhōkū comes with MCMC functionality through emcee. See the jupyter notebook mcmc.ipynb for an example.

Installing Custom Model Grids

To install your own custom grid, you will want to create a setup script (see custom_install.py for an example). The only requirements are that your setup file contains (1) a function called setup that returns a pandas MultiIndexed DataFrame containing all your evolution tracks, (2) a variable name that is set to whatever you want your installed grid to be named, and (3) a variable raw_grids_path that sets the path to wherever your custom raw grid is downloaded.

The index for this DataFrame is what all the "get" functions will use to get and interpolate tracks and EEPs. Thus, if you want to access your grid using mass and metallicity, you'll want the DataFrame returned by setup to have mass and metallicity, as well as a column to represent the time/EEP step.

You can also use the setup file to define custom EEP functions (see custom_install.my_RGBump) for an example) and to tell kiauhoku which columns to use in its default EEP functions.

Once your setup file is ready, you can install your custom grid using

import kiauhoku as kh
kh.install_grid('custom_install')

If you create a setup file for your favorite model grid and you'd like it to be public, create a pull request and I'll add you as a contributor!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiauhoku-2.1.0.tar.gz (37.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiauhoku-2.1.0-py3-none-any.whl (36.3 kB view details)

Uploaded Python 3

File details

Details for the file kiauhoku-2.1.0.tar.gz.

File metadata

  • Download URL: kiauhoku-2.1.0.tar.gz
  • Upload date:
  • Size: 37.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for kiauhoku-2.1.0.tar.gz
Algorithm Hash digest
SHA256 249231024f60c78130e42e14d4ba14ecdb04638732b47c7a20dc992fc3222397
MD5 ea6ec4d8a4dcaf8e4aceae1a9a6655a9
BLAKE2b-256 36d6ec909c6a6baf707a7fbaf345e6458c17b5a50cd825a76983b790b77771fd

See more details on using hashes here.

File details

Details for the file kiauhoku-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: kiauhoku-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for kiauhoku-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1349d7e120637692fc56da3f35d7893b11e22e91d8a5633a565ae9ce9341b86c
MD5 5af322d3e5140dcb3b00e41de8aaaf8f
BLAKE2b-256 d66764178e4d214469f05704ddabd197c0b5e11c825b11d1e758a8e18abf6622

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page