Пример #1
0
def generate(x, tstart=1, tend=5.3, npts=100, ning=100, neg=100):
    """Generate a synthetic light curve."""
    # Instantiate the star (params known exactly)
    star = Primary()
    star[1] = 0.4
    star[2] = 0.26

    # Instantiate the planet
    planet = Secondary(lmax=1)
    planet.lambda0 = 270
    planet.r = 0.0916
    planet.L = 5e-3
    planet.inc = 87
    planet.a = 11.12799
    planet.prot = 4.3
    planet.porb = 4.3
    planet.tref = 2.0

    # Instantiate the system
    system = System(star, planet)

    # Set the map coeffs
    set_coeffs(x, planet)

    # Time array w/ extra resolution at ingress/egress
    ingress = (1.94, 1.96)
    egress = (2.04, 2.06)
    time = np.linspace(tstart, tend, npts)
    if ingress is not None:
        t = np.linspace(ingress[0], ingress[1], ning)
        time = np.append(time, t)
    if egress is not None:
        t = np.linspace(egress[0], egress[1], neg)
        time = np.append(time, t)
    time = time[np.argsort(time)]

    # Compute and plot the starry flux
    system.compute(time)
    flux = np.array(system.lightcurve)

    # Noise it
    yerr = 1e-4 * np.nanmedian(flux)
    y = flux + yerr * np.random.randn(len(flux))

    # Compute the flux at hi res for plotting
    time_hires = np.linspace(tstart, tend, npts * 100)
    system.compute(time_hires)
    flux_hires = np.array(system.lightcurve)

    return time, y, yerr, star, planet, system, time_hires, flux_hires
Пример #2
0
star = Primary()

# Give the star a quadratic limb darkening profile
star[1] = 0.4
star[2] = 0.26

# Instantiate planet b
b = Secondary()
b.r = 0.091679
b.L = 5e-3
b.inc = 90
b.porb = 4.3
b.prot = 4.3
b.a = 11.127991
b.lambda0 = 90
b.tref = 2
b.axis = [0, 1, 0]

# Give the planet a simple dipole map
b[1, 0] = 0.5

# Rotate the planet map to produce a hotspot offset of 15 degrees
b.rotate(theta=15)

# Compute and plot the starry flux
time = np.linspace(0, 20, 10000)
system = System(star, b)
system.compute(time)
sF = np.array(system.lightcurve)
ax[0].plot(time, sF, '-', color='C0')