How to use the starry.kepler.System function in starry

To help you get started, we’ve selected a few starry examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rodluger / starry / tests / test_system_gradients2.py View on Github external
c.r = 0.12
    c.a = 80
    c.inc = 89.95
    c.porb = 100
    c.prot = 7.83
    c.lambda0 = 85
    c.ecc = 0.29
    c.w = 87.4
    c.L = 1.5e-3
    c[1, 0] = 0.4

    # Instantiate the system
    # We're adding a ton of light travel delay
    # and a finite exposure time: this is a
    # comprehensive test of the main `starry` features
    system = System(A, b, c)
    system.exposure_time = 0.02

    # Light curves and gradients of this object
    object = system

    # Let's plot transit, eclipse, and a PPO
    for t1, t2, figname in zip([-0.425, 25.1, -2.6], [0.0, 25.75, -2.0],
                               ["gradients_transit.png",
                                "gradients_eclipse.png",
                                "gradients_ppo.png"]):

        # Time arrays
        time = np.linspace(t1, t2, 500)
        time_num = np.linspace(t1, t2, 50)

        # Set up the plot
github rodluger / starry / tests / test_system_gradients.py View on Github external
elif name == "b.Y_{1,0}":
                star_grad[i] = star.gradient["b.y"][1]
                b_grad[i] = b.gradient["b.y"][1]
            elif name == "b.Y_{1,1}":
                star_grad[i] = star.gradient["b.y"][2]
                b_grad[i] = b.gradient["b.y"][2]
            elif name == "b.u_{1}":
                star_grad[i] = star.gradient["b.u"][0]
                b_grad[i] = b.gradient["b.u"][0]
            else:
                star_grad[i] = star.gradient[name]
                b_grad[i] = b.gradient[name]
        return star.lightcurve[0], star_grad, \
               b.lightcurve[0], b_grad
    else:
        sys = starry.kepler.System(star, b)
        sys.compute(time)
        return star.lightcurve[0], b.lightcurve[0]
github rodluger / starry / docs / tutorials / orbit_good.py View on Github external
R[1, 2] = uy * uz * (1 - cost) - ux * sint
    R[2, 0] = uz * ux * (1 - cost) - uy * sint
    R[2, 1] = uz * uy * (1 - cost) + ux * sint
    R[2, 2] = cost + uz ** 2 * (1 - cost)
    return R


star = starry.kepler.Primary()
planet = starry.kepler.Secondary()
planet.inc=60
planet.Omega=30
planet.porb=1
planet.prot=1
planet.a=50
planet[1, 0] = 0.5
system = starry.kepler.System(star, planet)
nt = 1000
system.compute(np.linspace(0, 1, nt))

fig, ax = pl.subplots(1, figsize=(8, 6.5))
fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
ax.plot(planet.X, planet.Y, color='k')
asini = 50 * np.sin(planet.inc * np.pi / 180)
acosi = 50 * np.cos(planet.inc * np.pi / 180)
ax.plot(np.array([-asini, asini]), np.array([-acosi, acosi]), 'k--', alpha=0.5)
ax.plot(0, 0, marker="*", color='k', ms=30)
ax.set_xlim(-50, 50)
ax.set_ylim(-40, 40)
ax.axis('off')

res = 100
nim = 16
github rodluger / starry / tex / figures / hd189733b.py View on Github external
# Instantiate the star
    star = starry.kepler.Primary()

    # Instantiate the planet
    planet = starry.kepler.Secondary(lmax=lmax)
    planet.lambda0 = lambda0
    planet.r = r
    planet.L = L
    planet.inc = inc
    planet.a = a
    planet.prot = prot
    planet.porb = porb
    planet.tref = tref

    # Instantiate the system
    system = starry.kepler.System(star, planet)

    return star, planet, system
github rodluger / starry / tex / figures / autodiff.py View on Github external
# Dipole-map hot jupiter
planet = Secondary()
planet.r = 0.1
planet.a = 60
planet.inc = 89.5
planet.porb = 50
planet.prot = 2.49
planet.lambda0 = 89.9
planet.ecc = 0.3
planet.w = 89
planet.L = 1e-3
planet[1, 0] = 0.5

# Instantiate the system
system = System(star, planet)
system.exposure_time = 0

# Set up the plot
fig = pl.figure(figsize=(8, 8))
fig.subplots_adjust(hspace=0, bottom=0.05, top=0.95)

# Compute the flux during transit and during secondary eclipse
titles = ['Transit', 'Secondary Eclipse']
for i, time in enumerate([time_transit, time_secondary]):

    # Run!
    system.compute(time, gradient=True)
    flux = np.array(system.lightcurve)
    grad = dict(system.gradient)

    # Plot it
github rodluger / starry / docs / tutorials / orbit_bad.py View on Github external
import starry
import numpy as np
import matplotlib.pyplot as pl

star = starry.kepler.Primary()
planet = starry.kepler.Secondary()
planet.inc=60
planet.Omega=30
planet.porb=1
planet.prot=1
planet.a=50
planet[1, 0] = 0.5
system = starry.kepler.System(star, planet)
nt = 1000
system.compute(np.linspace(0, 1, nt))

fig, ax = pl.subplots(1, figsize=(8, 6.5))
fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
ax.plot(planet.X, planet.Y, color='k')
asini = 50 * np.sin(planet.inc * np.pi / 180)
acosi = 50 * np.cos(planet.inc * np.pi / 180)
ax.plot(np.array([-asini, asini]), np.array([-acosi, acosi]), 'k--', alpha=0.5)
ax.plot(0, 0, marker="*", color='k', ms=30)
ax.set_xlim(-50, 50)
ax.set_ylim(-40, 40)
ax.axis('off')

res = 100
nim = 16
github rodluger / starry / docs / tutorials / orbit_edgeon.py View on Github external
import starry
import numpy as np
import matplotlib.pyplot as pl

star = starry.kepler.Primary()
planet = starry.kepler.Secondary()
planet.porb=1
planet.prot=1
planet.a=50
planet[1, 0] = 0.5
system = starry.kepler.System(star, planet)
nt = 1000
system.compute(np.linspace(0, 1, nt))

fig, ax = pl.subplots(1, figsize=(8, 3.5))
fig.subplots_adjust(left=0, right=1, bottom=0, top=1)
ax.plot(planet.X, planet.Y, color='k')
asini = 50 * np.sin(planet.inc * np.pi / 180)
acosi = 50 * np.cos(planet.inc * np.pi / 180)
ax.plot(np.array([-asini, asini]), np.array([-acosi, acosi]), 'k--', alpha=0.5)
ax.plot(0, 0, marker="*", color='k', ms=30)
ax.set_xlim(-50, 50)
ax.set_ylim(-40, 40)
ax.axis('off')

res = 100
nim = 15