Giter VIP home page Giter VIP logo

franpoz / ldtk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hpparvi/ldtk

0.0 0.0 0.0 1.95 MB

Python toolkit for calculating stellar limb darkening profiles and model-specific coefficients using the stellar atmosphere spectrum library by Husser et al. (2013). Described in Parviainen & Aigrain, MNRAS 453, 3821–3826 (2015).

License: GNU General Public License v2.0

Python 8.60% Jupyter Notebook 91.40%

ldtk's Introduction

PyLDTk

Licence MNRAS arXiv ASCL DOI astropy

Python Limb Darkening Toolkit - a Python toolkit for calculating stellar limb darkening profiles and model-specific coefficients for arbitrary passbands using the stellar spectrum model library by Husser et al (2013).

from ldtk import LDPSetCreator, BoxcarFilter

filters = [BoxcarFilter('a', 450, 550),  # Define your passbands
           BoxcarFilter('b', 650, 750),  # - Boxcar filters useful in
           BoxcarFilter('c', 850, 950)]  #   transmission spectroscopy

sc = LDPSetCreator(teff=(6400,   50),    # Define your star, and the code
                   logg=(4.50, 0.20),    # downloads the uncached stellar
                      z=(0.25, 0.05),    # spectra from the Husser et al.
                     filters=filters)    # FTP server automatically.

ps = sc.create_profiles()                # Create the limb darkening profiles
cq,eq = ps.coeffs_qd(do_mc=True)         # Estimate quadratic law coefficients

lnlike = ps.lnlike_qd([[0.45,0.15],      # Calculate the quadratic law log
                       [0.35,0.10],      # likelihood for a set of coefficients
                       [0.25,0.05]])     # (returns the joint likelihood)

lnlike = ps.lnlike_qd([0.25,0.05],flt=0) # Quad. law log L for the first filter

...and the same, but for 19 narrow passbands...

Overview

PyLDTk automates the calculation of custom stellar limb darkening (LD) profiles and model-specific limb darkening coefficients (LDC) using the library of PHOENIX-generated specific intensity spectra by Husser et al. (2013).

The aim of the package is to facilitate exoplanet transit light curve modeling, especially transmission spectroscopy where the modeling is carried out for custom narrow passbands. The package can be

  1. used to construct model-specific priors on the limb darkening coefficients prior to the transit light curve modeling
  2. directly integrated into the log posterior computation of any pre-existing transit modeling code with minimal modifications.

The second approach can be used to constrain the LD model parameter space directly by the LD profile, allowing for the marginalization over the whole parameter space that can explain the profile without the need to approximate this constraint by a prior distribution. This is useful when using a high-order limb darkening model where the coefficients are often correlated, and the priors estimated from the tabulated values usually fail to include these correlations.

News

  • Version 1.4

    • Added automatic detection and re-download of corrupted fits files (a highly welcome contribution by T. Fatahi).
  • Version 1.3

    • Changed to calculate the limb darkening models using numba. This should give a significant performance boost.
  • Version 1.2

    • Added an option to use low resolution version of the original specific intensity spectra. These spectra are binned to 5 nm resolution in wavelength and are kindly hosted by T. Husser at the same FTP server as the original spectra.
    • The behavior can be toggled with a new LDPSetCreator initialisation argument, lowres.
    • LDTk uses now low resolution spectra by default. This is because the wavelength resolution should be good enough for most broadband photometry analyses, and the this decreases the download times and file storage sizes significantly.

Requirements

Core requirements

  • Python 2.7 or Python 3
  • NumPy => 1.7
  • SciPy => 0.16
  • tqdm
  • astropy

Notebooks

  • IPython => 3.0

Installation

Use pip

pip install [--user] [--upgrade] ldtk

or clone the source from github and follow the basic Python package installation routine

 git clone https://github.com/hpparvi/ldtk.git
 cd ldtk
 python setup.py build install [--user]

Examples

Examples for basic and more advanced usage can be found from the notebooks directory.

Model coefficient estimation

Log likelihood evaluation

The LDPSet class offers methods to calculate log likelihoods for a set of limb darkening models.

  • lnlike_ln : Linear model
  • lnlike_qd : Quadratic model
  • lnlike_tq : Quadratic model with triangular parametrization (Kipping 2013)
  • lnlike_nl : Nonlinear model
  • lnlike_gn : General model
  • lnlike_p2 : Power-2 model

Resampling

The limb darkening profiles can be resampled to a desired sampling in mu using the resampling methods in the LDPSet.

  • resample_linear_z(nz=100): Resample the profiles to be linear in z
  • resample_linear_mu(nmu=100): Resample the profiles to be linear in mu
  • reset_sampling(): Reset back to native sampling in mu
  • resample():

Main classes

  • LDPSetCreator : Generates a set of limb darkening profiles given a set of filters and stellar TEff, logg, and z.
  • LDPSet : Encapsulates the limb darkening profiles and offers methods for model coefficient estimation and log likelihood evaluation.

Citing

If you use PyLDTk in your research, please cite the PyLDTk paper

Parviainen, H. & Aigrain, S. MNRAS 453, 3821–3826 (2015) (DOI:10.1093/mnras/stv1857).

and the paper describing the spectrum library without which PyLDTk would be rather useless

Husser, T.-O. et al. A&A 553, A6 (2013) (DOI:10.1051/0004-6361/201219058).

or use these ready made BibTeX entries

@article{Parviainen2015,
  author = {Parviainen, Hannu and Aigrain, Suzanne},
  doi = {10.1093/mnras/stv1857},
  journal = {MNRAS},
  month = nov,
  number = {4},
  pages = {3821--3826},
  title = {{ldtk: Limb Darkening Toolkit}},
  url = {http://mnras.oxfordjournals.org/lookup/doi/10.1093/mnras/stv1857},
  volume = {453},
  year = {2015}
}

@article{Husser2013,
  author = {Husser, T.-O. and {Wende-von Berg}, S and Dreizler, S and Homeier, D and
             Reiners, A and Barman, T. and Hauschildt, Peter H},
  doi = {10.1051/0004-6361/201219058},
  journal = {A{\&}A},
  pages = {A6},
  title = {{Astrophysics A new extensive library of PHOENIX stellar atmospheres}},
  volume = {553},
  year = {2013}
}

Author

Hannu Parviainen, University of Oxford

Contributors

  • Rainer Wichmann, Hamburger Sternwarte, Universität Hamburg
  • Tom Louden, University of Warwick
  • Ian Crossfield, University of Arizona

--

Copyright © 2016 Hannu Parviainen [email protected]

ldtk's People

Contributors

haykirstin avatar hpparvi avatar iancrossfield avatar tamimfatahi avatar tomlouden 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.