예제 #1
0
"""Kelt-9b secondary eclipse example."""
import starry
import matplotlib.pyplot as plt
import numpy as np
import astropy.units as u

# Config
starry.config.lazy = False

# Star
star_map = starry.Map(udeg=2, amp=1)
star_map[1:] = [0.5, 0.25]
star = starry.Primary(star_map,
                      m=2.50,
                      mass_unit=u.M_sun,
                      r=2.36,
                      length_unit=u.R_sun)

# Planet
kwargs = dict(
    m=0.0,
    mass_unit=u.earthMass,
    porb=1.481,
    r=21.1770214,
    length_unit=u.earthRad,
    inc=87.2,
    t0=-0.65625,
)

# Time arrays (secondary eclipse ingress / full phase curve)
t_ingress = np.linspace(0, 0.017, 1000)
예제 #2
0
def test_reflected_light():
    pri = starry.Primary(starry.Map(amp=0), r=1)
    sec = starry.Secondary(starry.Map(reflected=True), porb=1.0, r=1)
    sys = starry.System(pri, sec)
    t = np.concatenate((np.linspace(0.1, 0.4, 50), np.linspace(0.6, 0.9, 50)))
    flux = sys.flux(t)
예제 #3
0
def test_bodies():
    pri = starry.Primary(starry.Map())
    sec = starry.Secondary(starry.Map(ydeg=1), porb=1.0)
    sys = starry.System(pri, sec)
    assert sys.primary == pri
    assert sys.secondaries[0] == sec
예제 #4
0
def test_edge_on_eccentric():
    # Params
    ydeg = 10
    u = [0.5, 0.25]
    y = 0.1 * np.random.randn((ydeg + 1)**2 - 1)
    porb = 1.0
    prot = 1.0
    amp = 0.25
    r = 0.5
    m = 0.25
    ecc = 0.5
    w = 75
    t = np.linspace(-0.75, 0.75, 10000)

    # Beta version
    pri_beta = starry_beta.kepler.Primary(lmax=2)
    pri_beta[1], pri_beta[2] = u
    sec_beta = starry_beta.kepler.Secondary(lmax=ydeg)
    sec_beta[1:, :] = y
    sec_beta.porb = porb
    sec_beta.prot = prot
    sec_beta.L = amp
    sec_beta.r = r
    sec_beta.a = (G_grav * (1.0 + m) * porb**2 / (4 * np.pi**2))**(1.0 / 3)
    sec_beta.inc = 90
    sec_beta.Omega = 0
    sec_beta.ecc = ecc
    sec_beta.w = w
    sys_beta = starry_beta.kepler.System(pri_beta, sec_beta)
    sys_beta.compute(t)
    flux_beta = np.array(sys_beta.lightcurve)

    # Compute the time of transit
    M0 = 0.5 * np.pi - w * np.pi / 180.0
    f = M0
    E = np.arctan2(np.sqrt(1 - ecc**2) * np.sin(f), ecc + np.cos(f))
    M = E - ecc * np.sin(E)
    t0 = (M - M0) * porb / (2 * np.pi)

    # Compute the time of eclipse
    E = np.arctan2(
        np.sqrt(1 - ecc**2) * np.sin(f + np.pi), ecc + np.cos(f + np.pi))
    M = E - ecc * np.sin(E)
    t_ecl = (M - M0) * porb / (2 * np.pi)

    # This is the required phase offset such that the map coefficients
    # correspond to what the observer sees at secondary eclipse
    theta0 = -(t_ecl - t0) * 360

    # Version 1
    pri = starry.Primary(starry.Map(udeg=2))
    pri.map[1:] = u
    sec = starry.Secondary(
        starry.Map(ydeg=ydeg, amp=amp),
        porb=porb,
        r=r,
        m=m,
        inc=90,
        Omega=0,
        ecc=ecc,
        w=w,
        t0=t0,
        theta0=theta0,
    )
    sec.map[1:, :] = y
    sys = starry.System(pri, sec)
    flux = sys.flux(t)

    # Compare
    assert np.allclose(flux, flux_beta)
예제 #5
0
def test_default_system_units():
    pri = starry.Primary(starry.Map())
    sec = starry.Secondary(starry.Map(), porb=1.0)
    sys = starry.System(pri, sec)
    assert sys.time_unit == u.day
예제 #6
0
"""55 cancrie e secondary eclipse example."""
import starry
import matplotlib.pyplot as plt
import numpy as np
import astropy.units as u

# Config
starry.config.lazy = False

# Star
star_map = starry.Map(udeg=2, amp=1)
star_map[1:] = [0.5, 0.25]
star = starry.Primary(star_map,
                      m=0.905,
                      mass_unit=u.M_sun,
                      r=0.943,
                      length_unit=u.R_sun)

# Planet
kwargs = dict(
    m=7.99,
    mass_unit=u.earthMass,
    porb=0.73654737,
    r=1.875,
    length_unit=u.earthRad,
    inc=83.59,
    t0=0.400473685,
)

# Time arrays (secondary eclipse ingress / full phase curve)
t_ingress = np.linspace(0, 0.002, 1000)