Welcome to microlux¤
microlux
is a Jax-based package that can calculate the binary lensing light curve and its derivatives both efficiently and accurately. We use the modified adaptive contour integratoin in VBBinaryLensing
to maximize the performance.
With the access to the gradient, we can use more advanced algorithms for microlensing modeling, such as Hamiltonian Monte Carlo (HMC) in numpyro
.
Features¤
- Adaptive contour integration with error control to calculate the binary lens microlensing light curve with finite source effect.
- Robust and accurate calculation: Widely test over the broad parameter space compared with
VBBinaryLensing
. - Fast speed: Fully compatible with JIT compilation to speed up calculation.
- Accurate gradient: Automatic differentiation with specially designed error estimator to ensure the convergence of gradient.
- Aberth–Ehrlich method to find the roots of the polynomial and Liner sum assignment algorithm to match the images.
- Application on the real event modeling.
Quick Start¤
Please make sure that you have known the basic usage of Jax
. Check the Jax documentation for more details.
import jax.numpy as jnp
from microlux import binary_mag
b = 0.1
t_0 = 0.
t_E = 1.
alphadeg = 270.
q = 0.2
s = 0.9
rho = 10 ** (-2)
trajectory_n = 1000
times = jnp.linspace(t_0 - 1.0 * t_E, t_0 + 1.0 * t_E, trajectory_n)
#calculate the binary lensing magnification
mag = binary_mag(t_0, b, t_E, rho, q, s, alphadeg, times, tol=1e-3, retol=1e-3)
More examples can be found in the test
folder.
Citation¤
If you use this package for your research, please cite our paper:
- A differentiable binary microlensing model using adaptive contour integration method: in arXiv
and consider starrring this repository on Github: