Skip to main content

MEIDEM logo

MEIDEM - Multi-grid Epic Interpolator for stellar limb DarkEning Models

PyPI version Python License: MIT Tests DOI

MEIDEM is a Python package that provides a unified interface for interpolating stellar limb darkening (LD) coefficients from multiple published grids. Instead of dealing with different table formats, column names, and interpolation strategies for each grid, you call a single function — get_ld_coefficients() — and MEIDEM handles the rest.

All grid tables are bundled with the package: no manual downloads, no VizieR visits, no path configuration.


What is Stellar Limb Darkening?

When a planet transits its host star, the transit light curve is not only shaped by the planet's size and orbital geometry — it is also strongly affected by how the stellar brightness varies across the disk. Stars are not uniformly bright: they are brighter at the center and dimmer toward the edge (the "limb"). This effect, called limb darkening, must be correctly accounted for to accurately determine the planetary radius and other transit parameters.

Limb darkening is typically described by a mathematical law parametrized by one or more coefficients that depend on the stellar type (Teff, logg, metallicity) and the photometric bandpass. These coefficients are computed from model stellar atmospheres and published as tabulated grids. MEIDEM interpolates those grids for any given set of stellar parameters.


Installation

pip install meidem

Quick Start

import meidem

# Get power-2 LD coefficients for a Sun-like star observed with TESS
result = meidem.get_ld_coefficients(
    teff=5778,        # effective temperature (K)
    logg=4.44,        # surface gravity (cgs)
    feh=0.0,          # metallicity [Fe/H] (dex)
    passband='TESS',
    grid='kostogryz2022',
    law='power2',
)

print(result['coefficients'])   # [c, alpha]
print(result['reference'])      # full bibliographic reference
print(result['doi'])            # DOI of the source paper

Solar Reference Example (IAU 2015 Values)

The example below uses the IAU 2015 nominal solar parameters as a sanity check. You can use it to verify the installation and compare results across grids.

import meidem

# IAU 2015 nominal solar parameters
# Teff = 5772 K  (Prša et al. 2016, AJ 152, 41)
# logg = 4.438   (log10 of GM_sun / R_sun^2 in cgs)
# [Fe/H] = 0.0   (by definition)
SUN = dict(teff=5772, logg=4.438, feh=0.0)

print("LD coefficients for the Sun (IAU 2015)\n")

# Kostogryz+2022 — power-2 for TESS (no xi — MPS-ATLAS grid)
r = meidem.get_ld_coefficients(**SUN, passband='TESS',
                                grid='kostogryz2022', law='power2')
print(f"Kostogryz+2022  power-2    TESS   : {r['coefficients']}")
# Expected: [c ≈ 0.65, alpha ≈ 0.60]

# Kostogryz+2022 — nonlinear (4-coeff) for TESS
r = meidem.get_ld_coefficients(**SUN, passband='TESS',
                                grid='kostogryz2022', law='nonlinear')
print(f"Kostogryz+2022  nonlinear  TESS   : {r['coefficients']}")

# Claret & Southworth 2022 — power-2 for TESS
# Sun is a FGK dwarf → xi=2.0 km/s (Valenti & Fischer 2005)
r = meidem.get_ld_coefficients(**SUN, passband='TESS', grid='claret2022',
                                xi=2.0)
print(f"Claret2022      power-2    TESS   : {r['coefficients']}")

# Claret 2017 — quadratic for TESS, ATLAS model, Least-Squares
# Sun is a FGK dwarf → xi=2.0 km/s (Valenti & Fischer 2005)
r = meidem.get_ld_coefficients(**SUN, passband='TESS',
                                grid='claret2017', law='quadratic',
                                mod='A', met='L', xi=2.0)
print(f"Claret2017      quadratic  TESS   : {r['coefficients']}")

# Claret & Bloemen 2011 — quadratic for Kepler
# Sun is a FGK dwarf → xi=2.0 km/s (Valenti & Fischer 2005)
r = meidem.get_ld_coefficients(**SUN, passband='Kp',
                                grid='claret2011', law='quadratic',
                                xi=2.0)
print(f"Claret2011      quadratic  Kepler : {r['coefficients']}")

Loading your own star table

import pandas as pd
import meidem

# Load a table with stellar parameters
df = pd.read_csv('my_stars.csv')
# Required columns: Teff, logg, FeH

results = []
for _, row in df.iterrows():
    try:
        r = meidem.get_ld_coefficients(
            teff=row['Teff'],
            logg=row['logg'],
            feh=row['FeH'],
            passband='TESS',
            grid='kostogryz2022',
            law='power2',
        )
        results.append({
            'star' : row['hostname'],
            'LD_c1': r['coefficients'][0],
            'LD_c2': r['coefficients'][1],
            'status': 'OK',
        })
    except ValueError:
        results.append({'star': row['hostname'], 'status': 'OUT_OF_GRID'})

df_ld = pd.DataFrame(results)
print(df_ld)

Supported Grids

MEIDEM currently supports four published grids. Each covers a different combination of atmospheric models, LD laws, and photometric passbands.


1. kostogryz2022 — Kostogryz et al. (2022), MPS-ATLAS

Reference: Kostogryz, N. V. et al. (2022), A&A — doi:10.1051/0004-6361/202140376

Atmospheric model: MPS-ATLAS — a modern 1D plane-parallel model developed at the Max Planck Institute for Solar System Research. It covers a wide range of metallicities and is one of the most up-to-date grids available for exoplanet transit modeling.

Passbands: TESS, Kepler, CHEOPS, PLATO

Grid limits: Teff ≈ 3500–10000 K · logg ≈ 2.0–5.0 · [Fe/H] ≈ −5.0 to +1.0

Microturbulence (xi): Not applicable — this grid does not depend on xi.

Laws available:

Law key Coefficients Equation
power2 c, alpha I(μ)/I(1) = 1 − c(1 − μ^α)
nonlinear a1, a2, a3, a4 I(μ)/I(1) = 1 − Σ aₙ(1 − μ^(n/2))

When to use: This is the recommended grid for TESS and Kepler as of 2022. Use law='power2' for most transit fitting applications — the power-2 law shows the lowest residuals and the smallest bias in recovered Rp/R* compared to the quadratic law for TESS photometry (Maxted 2023). Note that stars cooler than ~3500 K (cool M dwarfs) fall outside this grid.

r = meidem.get_ld_coefficients(
    teff=5778, logg=4.44, feh=0.0,
    passband='TESS',
    grid='kostogryz2022',
    law='power2',       # or 'nonlinear'
)

2. claret2022 — Claret & Southworth (2022), A&A 664, A128

Reference: Claret, A. & Southworth, J. (2022), A&A 664, A128 — doi:10.1051/0004-6361/202244278

Atmospheric model: ATLAS (plane-parallel, 1D).

Passbands: TESS, Kepler, Gaia (G, BP, RP), SDSS (u, g, r, i, z), Johnson (U, B, V, R, I), 2MASS (J, H, K), Strömgren (u, v, b, y)

Grid limits: Teff ≈ 3500–50000 K · logg ≈ 0.0–5.0 · [Fe/H] ≈ −5.0 to +1.0

Laws available: Power-2 only

Microturbulence (xi): Available at ξ = 0, 1, 2, 4, 8 km/s. Always set xi explicitly — see the xi selection guide below.

When to use: Excellent choice when you need power-2 coefficients for a wide range of passbands beyond TESS and Kepler — especially Gaia, SDSS, or Johnson bands. Also useful for comparison with kostogryz2022 for TESS and Kepler.

r = meidem.get_ld_coefficients(
    teff=5778, logg=4.44, feh=0.0,
    passband='Gaia_G',   # or 'TESS', 'Kepler', 'SDSS_r', 'Johnson_V', ...
    grid='claret2022',
    xi=2.0,              # set explicitly: 0, 1, 2, 4, or 8 km/s
)

3. claret2017 — Claret (2017), A&A 600, A30

Reference: Claret, A. (2017), A&A 600, A30 — doi:10.1051/0004-6361/201629705

Atmospheric models: ATLAS and PHOENIX

Passbands: TESS only

Grid limits (ATLAS): Teff ≈ 3500–50000 K · logg ≈ 0.0–5.0 · [Fe/H] ≈ −5.0 to +1.0 · ξ = 0–8 km/s

Grid limits (PHOENIX): Teff ≈ 1500–12000 K · logg ≈ 2.5–6.0 · [Fe/H] = 0.0 only

Microturbulence (xi): Applies to ATLAS only (ignored for PHOENIX). Always set xi explicitly when using mod='A' — see the xi selection guide below.

Laws available:

Law key N coeff Notes
linear 1 Avoid — produces biases up to ~3% in Rp/R* (Espinoza & Jordán 2016)
quadratic 2 Most widely used; fast computation (Kopal 1950; Kreidberg 2015)
square-root 2 Better for hot stars
logarithmic 2 Better performance than quadratic (Espinoza & Jordán 2016)
4coeff 4 Most flexible; best physical description of intensity profile
y 1 Gravity darkening coefficient; ATLAS only

Fitting methods (met):

Key Method When to use
'L' LSM — Least-Squares Minimizes residuals to the intensity profile. Most common; default.
'F' PCM/CFM — Flux Conservation Ensures integrated flux is conserved. Preferred for generating synthetic light curves.

Atmospheric models (mod):

Key Model When to use
'A' ATLAS Covers all metallicities; default for most stars
'P' PHOENIX More realistic for cool stars (Teff < 5000 K); [Fe/H] = 0.0 only

When to use: This grid is ideal when you want to compare multiple LD laws for TESS — for example, to assess how much the choice of law affects the recovered Rp/R*. The 4coeff law provides the most accurate physical description; quadratic is most compatible with transit fitting codes like batman.

# ATLAS — quadratic, Least-Squares (most common setup)
r = meidem.get_ld_coefficients(
    teff=5778, logg=4.44, feh=0.0,
    passband='TESS',
    grid='claret2017',
    law='quadratic',
    mod='A',    # 'A' = ATLAS | 'P' = PHOENIX
    met='L',    # 'L' = Least-Squares | 'F' = Flux Conservation
    xi=2.0,     # set explicitly: 0, 1, 2, 4, or 8 km/s (ATLAS only)
)

# PHOENIX — better for cool stars (Teff < 5000 K), [Fe/H] = 0.0 only
# xi is not used for PHOENIX
r = meidem.get_ld_coefficients(
    teff=3800, logg=4.8, feh=0.0,
    passband='TESS',
    grid='claret2017',
    law='quadratic',
    mod='P',
)

4. claret2011 — Claret & Bloemen (2011), A&A 529, A75

Reference: Claret, A. & Bloemen, S. (2011), A&A 529, A75 — doi:10.1051/0004-6361/201116451

Atmospheric models: ATLAS and PHOENIX

Passbands: Kepler (Kp), CoRoT (C), Spitzer ch1 (S1), Spitzer ch2 (S2)

Laws available: quadratic, root-square, logarithmic, 4coeff, linear, y

Microturbulence (xi): Same as Claret 2017 — applies to ATLAS only. Always set xi explicitly when using mod='A'.

Fitting methods (met) and models (mod): Same as Claret 2017.

When to use: This is the standard reference grid for Kepler and CoRoT — one of the most cited LD grids in the exoplanet literature. If you are working with Kepler light curves, this is the grid to use for comparison with published results.

r = meidem.get_ld_coefficients(
    teff=5778, logg=4.44, feh=0.0,
    passband='Kp',          # 'Kp' = Kepler | 'C' = CoRoT | 'S1'/'S2' = Spitzer
    grid='claret2011',
    law='quadratic',
    mod='A',
    met='L',
    xi=2.0,                 # set explicitly: 0, 1, 2, 4, or 8 km/s (ATLAS only)
)

5. claret2025 — Claret et al. (2025), A&A 699, A97

Reference: Claret, A. et al. (2025), A&A 699, A97 — doi:10.1051/0004-6361/202554578

Atmospheric model: PHOENIX (spherical symmetry, NewEra grid) — high spectral resolution (~10⁶ wavelengths, 0.1–6.0 μm). Solar abundance only, fixed ξ = 1.0 km/s.

Passbands: JWST (F210M, F277W, F322W2, F444W, G235H, G235M, G395H, G395M, PRISM, SOSS1, SOSS2)

Laws available: power2, 4coeff

Microturbulence (xi): Not applicable — this grid uses a fixed internal value.

When to use: This is the recommended grid for JWST photometry. Covers the main NIRSpec and NIRISS/SOSS modes used in atmospheric characterization.

r = meidem.get_ld_coefficients(
    teff=5778, logg=4.44, feh=0.0,
    passband='F277W',   # or 'PRISM', 'SOSS1', 'G395H', ...
    grid='claret2025',
    law='power2',       # or '4coeff'
)

6. magic2013 — Magic et al. (2015), A&A 573, A90

Reference: Magic, Z. et al. (2015), A&A 573, A90 — doi:10.1051/0004-6361/201423804

Atmospheric model: 3D radiation-hydrodynamic (RHD) STAGGER-grid. No microturbulence parameter — xi is not applicable to 3D models.

Passbands: Kepler, CoRoT, Bessell (H, J, K), Johnson (U, B, V, R, I, J, K), SDSS (u, g, r, i, z), Strömgren (u, v, b, y), MK (J, K, L, Lp, M), WFC3 grism

Grid limits: Teff ≈ 3935–7053 K · logg ≈ 1.5–5.0 · [Fe/H] ≈ −3.0 to 0.0

Laws available:

Law key Coefficients
linear u
quadratic a, b
square-root c, d
4coeff a1, a2, a3, a4

When to use: This grid is based on 3D RHD models, which are more physically realistic than 1D ATLAS/PHOENIX models — especially for FGK stars near the main sequence. Use it when you want to compare 1D vs 3D predictions or when working with Kepler data and want an independent cross-check. Note the limited [Fe/H] coverage (only down to −3.0) and the irregular grid coverage in 3D parameter space — points in sparse regions may fall in interpolation gaps.

r = meidem.get_ld_coefficients(
    teff=5778, logg=4.44, feh=0.0,
    passband='Kepler',    # or 'SDSS_r', 'Johnson_V', 'Stromgren_y', ...
    grid='magic2013',
    law='quadratic',      # or 'linear', 'square-root', '4coeff'
)

Choosing the Right Grid and Law

Which grid?

Situation Recommended
TESS photometry, modern analysis kostogryz2022
Kepler photometry claret2011 or kostogryz2022
Gaia, SDSS, Johnson, 2MASS passbands claret2022
Cool stars (Teff < 3500 K) with TESS claret2017 with mod='P'
Comparing grids (e.g. for a paper) kostogryz2022 + claret2022
JWST photometry claret2025
3D RHD comparison / Kepler cross-check magic2013

Which law?

The power-2 law shows the lowest residuals and the smallest bias in recovered transit parameters for TESS and Kepler photometry. The quadratic law is the most widely used in the exoplanet literature because it enables fast and efficient light curve computation in popular codes such as batman (Kreidberg 2015). Laws such as logarithmic, square-root, and 3-parameter do a better job than quadratic and linear when deriving transit parameters (Espinoza & Jordán 2016).

Law Recommendation
power2 Best overall for TESS/Kepler. 2 parameters, excellent accuracy (Maxted 2023).
quadratic Most compatible with transit codes. Fast, 2 parameters, widely tabulated.
nonlinear / 4coeff Best physical description. Ideal when fixing coefficients rather than fitting them.
logarithmic / square-root Better than quadratic, less widely supported by transit codes.
linear Avoid — biases up to ~3% in Rp/R* (Espinoza & Jordán 2016).

Which microturbulence (xi)?

The xi parameter applies only to ATLAS-based grids (claret2022, claret2017 with mod='A', claret2011 with mod='A'). It has no effect on MPS-ATLAS (kostogryz2022) or PHOENIX models. Always set xi explicitly — if omitted, MEIDEM defaults to 2.0 km/s and will emit a UserWarning.

Microturbulence correlates primarily with Teff and logg (Bruntt et al. 2010; Valenti & Fischer 2005). The table below gives recommended values for the discrete grid points available in the Claret grids:

Stellar type logg range Recommended xi Reference
FGK main-sequence dwarfs 4.0 – 5.0 2.0 km/s Valenti & Fischer (2005)
Subgiants / metal-poor stars 3.5 – 4.0 1.0 km/s Bruntt et al. (2010)
Giants 2.0 – 3.5 4.0 km/s Bruntt et al. (2010)
Supergiants < 2.0 8.0 km/s Gray (2008)
Cool M dwarfs — use PHOENIX (mod='P') —

Available values in the grids: 0, 1, 2, 4, 8 km/s.

Note: These are guidelines based on typical values in the literature. For precision work, determine xi from a spectroscopic analysis of your target star (e.g. by requiring no trend between Fe i line abundance and equivalent width).

Grid coverage and known limitations

Each grid covers a finite region of stellar parameter space. Stars outside the grid raise a ValueError — MEIDEM never extrapolates silently.

Grid Teff range (K) logg range [Fe/H] range Model
kostogryz2022 3500 – 10000 2.0 – 5.0 −5.0 to +1.5 MPS-ATLAS
claret2022 3500 – 50000 0.0 – 5.0 −5.0 to +1.0 ATLAS
claret2017 (ATLAS) 3500 – 50000 0.0 – 5.0 −5.0 to +1.0 ATLAS
claret2017 (PHOENIX) 2300 – 12000 2.5 – 6.0 0.0 only PHOENIX
claret2011 (ATLAS) 3500 – 50000 0.0 – 5.0 −5.0 to +1.0 ATLAS
claret2011 (PHOENIX) 2300 – 12000 2.5 – 6.0 0.0 only PHOENIX
claret2025 2400 – 7800 3.0 – 5.5 solar only (ξ = 1 km/s fixed) PHOENIX (spherical)
magic2013 3935 – 7053 1.5 – 5.0 −3.0 to 0.0 3D RHD STAGGER

Notes on specific grids:

  • kostogryz2022: The MPS-ATLAS code cannot be used for Teff < 3500 K — mixing-length theory starts to fail for cool M dwarfs at 1D level. For these stars, use claret2017 or claret2011 with mod='P'.

  • claret2025: Based on spherically symmetric PHOENIX NewEra models computed at very high spectral resolution (~10⁶ wavelength points, 0.1–6.0 μm). Solar abundance only, fixed microturbulence ξ = 1.0 km/s. Covers only 11 JWST passbands (NIRCam, NIRISS, NIRSpec). Not suitable for optical photometry.

  • magic2013: Based on 3D RHD STAGGER-grid models — more physically realistic than 1D ATLAS/PHOENIX for FGK dwarfs near the main sequence, but with irregular coverage in parameter space. Points in sparse regions (particularly at low metallicity or extreme logg) may fall in interpolation gaps and raise ValueError. Limited to [Fe/H] ≥ −3.0 and Teff ≤ 7053 K.

Note for cool M dwarfs (Teff < 5000 K): Significant deviations between measured and theoretical LDCs (Δu₁, Δu₂ ≈ 0.2) have been observed in TESS light curves for stars cooler than ~5000 K (Patel & Espinoza 2022). For very cool stars (Teff < 3500 K), no grid in MEIDEM provides reliable 1D predictions — 3D MHD simulations are needed (Bhatia et al. 2025). Treat results with extra caution for these objects.

API Reference

meidem.get_ld_coefficients()

meidem.get_ld_coefficients(
    teff,                       # float — effective temperature (K)
    logg,                       # float — surface gravity log g (cgs)
    feh,                        # float — metallicity [Fe/H] (dex)
    passband,                   # str   — photometric passband
    grid    = 'kostogryz2022',  # str   — grid key
    law     = None,             # str   — LD law (None = grid default)
    xi      = 2.0,              # float — microturbulence km/s (ATLAS only; set explicitly)
    met     = 'L',              # str   — fitting method: 'L' or 'F'
    mod     = 'A',              # str   — atmospheric model: 'A' or 'P'
    verbose = False,            # bool  — print grid info
)

Note on xi: If you use an ATLAS-based grid and do not set xi explicitly, MEIDEM defaults to 2.0 km/s and emits a UserWarning. Always pass xi explicitly to suppress the warning and ensure physically correct results. Available values: 0, 1, 2, 4, 8 km/s. See the xi selection guide for recommendations by stellar type.

Returns:

{
    'coefficients': [c, alpha],       # interpolated LD coefficients
    'n_coeffs'    : 2,                # number of coefficients
    'law'         : 'power2',         # LD law used
    'passband'    : 'TESS',           # passband used
    'grid'        : 'kostogryz2022',  # grid used
    'reference'   : 'Kostogryz et al. (2022)',
    'doi'         : '10.1051/0004-6361/202140376',
    'teff_input'  : 5778.0,
    'logg_input'  : 4.44,
    'feh_input'   : 0.0,
    'xi'          : None,               # float if Claret ATLAS, else None
    'met'         : None,               # str if Claret 2017/2011, else None
    'mod'         : None,               # str if Claret 2017/2011, else None
}

Raises ValueError if parameters are outside grid limits.

Discovery functions

meidem.available_grids()                  # all grids with details
meidem.available_laws('claret2017')       # laws for a grid
meidem.available_passbands('claret2022')  # passbands for a grid

Citation

If you use MEIDEM in your research, please cite the package and the grid(s) you used:

@software{meidem,
  author  = {Meidem, Icaro and Emilio, Marcelo},
  title   = {{MEIDEM}: Multi-grid Epic Interpolator for limb DarkEning Models},
  year    = {2026},
  version = {1.0.8},
  doi     = {10.5281/zenodo.20189894},
  url     = {https://github.com/icaromeidem/meidem},
}

Grid references:

Key references used in this documentation:

  • Bruntt, H. et al. (2010), MNRAS 405, 1907 — doi:10.1111/j.1365-2966.2010.16545.x
  • Espinoza & Jordán (2015), MNRAS 450, 1879
  • Espinoza & Jordán (2016), MNRAS 457, 3573
  • Gray, D. F. (2008), The Observation and Analysis of Stellar Photospheres, 3rd ed., Cambridge University Press
  • Maxted (2023), MNRAS 519, 3723
  • Patel & Espinoza (2022), AJ 163, 228
  • Valenti, J. A. & Fischer, D. A. (2005), ApJS 159, 141 — doi:10.1086/430500

License

MIT © Icaro Meidem

Metadata

Release files for meidem 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meidem 2.0.0
File Size Uploaded
meidem-2.0.0.tar.gz 19.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for meidem 2.0.0
File Interpreter ABI Platform
meidem-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 38.3 MB

Release files / meidem-2.0.0.tar.gz

Download URL meidem-2.0.0.tar.gz
Size 19.1 MB
Tags Source
SHA-256 checksum
How to use checksums
246a3eda733ebb0fff2366fc11b74c3c47eb6301285761a2e6f0c658241be451
BLAKE2b-256 checksum
How to use checksums
fade21815b1301a538f30efe57970fa0b98f063c373067f25067e69b8e55dcaf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / meidem-2.0.0-py3-none-any.whl

Download URL meidem-2.0.0-py3-none-any.whl
Size 19.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
c804a8f8ffc7b1fe8af2460f6a0b4d1d67fe52bdded8036f23a596ef5effc25f
BLAKE2b-256 checksum
How to use checksums
e4aaaeece8f878f1d01b2f36beb63ee66266399398c0b122b3237fbde3187e40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page