Skip to content

Latest commit

 

History

History
67 lines (52 loc) · 2.15 KB

File metadata and controls

67 lines (52 loc) · 2.15 KB

lcbinint

Documentation

Corresponding VBMicrolensing page: Python documentation home. This guide keeps the same worked-example progression and translates each calculation to the lcbinint API.

This guide describes the supported Python workflows through examples that can be copied directly into a program. Calculation and visualization are kept in separate code blocks so each result is easy to inspect.

Quick start

import numpy as np
import lcbinint

s = 0.9       # Separation between the lenses
q = 0.1       # Mass ratio
u0 = 0.0      # Impact parameter with respect to center of mass
alpha = 1.0   # Angle of the source trajectory
rho = 0.01    # Source radius
tE = 30.0     # Einstein time in days
t0 = 7500     # Time of closest approach to center of mass

params = {
    "s": s, "q": q, "u0": u0, "alpha": alpha,
    "rho": rho, "tE": tE, "t0": t0,
}
t = np.linspace(t0 - tE, t0 + tE, 300)

curve = lcbinint.LightCurve(options=lcbinint.Options(tol=1e-3, reltol=1e-3))
magnifications = curve(t, params)
trajectory = curve.source_trajectory(t, params)

Plot the light curve in its own block:

import matplotlib.pyplot as plt

plt.plot(t, magnifications)
plt.xlabel("Time")
plt.ylabel("Magnification")
plt.show()

Binary-lens light curve

Contents

lcbinint currently supports binary and triple lenses. Single-lens-only and arbitrary four-or-more-lens examples are not represented by a different model.