Git Product home page Git Product logo

stardate's Introduction

stardate

https://travis-ci.org/RuthAngus/stardate.svg?branch=master https://readthedocs.org/projects/stardate/badge/?version=latest

Checkout the documentation.

stardate currently only works with python3.

stardate is a tool for measuring precise stellar ages. it combines isochrone fitting with gyrochronology (rotation-based ages) to increase the precision of stellar ages on the main sequence. the best possible ages provided by stardate will be for stars with rotation periods, although ages can be predicted for stars without rotation periods too. if you don't have rotation periods for any of your stars, you might consider using isochrones as stardate is simply an extension to isochrones that incorporates gyrochronology. stardate reverts back to isochrones when no rotation period is provided.

If you would like to contribute to this project, feel free to raise issues or submit pull requests from the github repo.

Installation

Currently the best way to install stardate is from github.

git clone https://github.com/RuthAngus/stardate.git
cd stardate
python setup.py install

Dependencies

The dependencies of stardate are NumPy, pandas, h5py, numba, emcee3, tqdm and isochrones.

These can be installed using pip:

pip install numpy pandas h5py numba "emcee==3.0rc2" tqdm isochrones

You can check out the isochrones documentation if you run into difficulties installing that.

Example usage

import stardate as sd

# Create a dictionary of observables
iso_params = {"teff": (4386, 50),     # Teff with uncertainty.
              "logg": (4.66, .05),    # logg with uncertainty.
              "feh": (0.0, .02),      # Metallicity with uncertainty.
              "parallax": (1.48, .1),  # Parallax in milliarcseconds.
              "maxAV": .1}            # Maximum extinction

prot, prot_err = 29, 3

# Set up the star object.
star = sd.Star(iso_params, prot=prot, prot_err=prot_err)  # Here's where you add a rotation period

# Run the MCMC
star.fit(max_n=1000)

# max_n is the maximum number of MCMC samples. I recommend setting this
# much higher when running for real, or using the default value of 100000.

# Print the median age with the 16th and 84th percentile uncertainties.
age, errm, errp, samples = star.age_results()
print("stellar age = {0:.2f} + {1:.2f} - {2:.2f}".format(age, errp, errm))

>> stellar age = 2.97 + 0.55 - 0.60

If you want to just use a simple gyrochronology model without running MCMC, you can predict a stellar age from a rotation period like this:

import numpy as np
from stardate.lhf import age_model

bprp = .82  # Gaia BP - RP color.
log10_period = np.log10(26)
log10_age_yrs = age_model(log10_period, bprp)
print((10**log10_age_yrs)*1e-9, "Gyr")
>> 4.565055357152765 Gyr

Or a rotation period from an age like this:

from stardate.lhf import gyro_model_praesepe

bprp = .82  # Gaia BP - RP color.
log10_age_yrs = np.log10(4.56*1e9)
log10_period = gyro_model_praesepe(log10_age_yrs, bprp)
print(10**log10_period, "days")
>> 25.98136488222407 days

BUT be aware that these simple relations are only applicable to FGK and early M dwarfs on the main sequence, older than a few hundred Myrs. If you're not sure if gyrochronology is applicable to your star, want the best age possible, or would like proper uncertainty estimates, I recommend using the full MCMC approach.

stardate's People

Contributors

ruthangus avatar arfon avatar john-livingston avatar timothydmorton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.