microlux is a JAX-based package that can calculate the binary lensing light curve and its derivatives both efficiently and accurately. We use modified adaptive contour integration based on VBBinaryLensing.
With the access to the gradient, we can use more advanced algorithms for microlensing modeling, such as Hamiltonian Monte Carlo (HMC) in numpyro.
Installation
pip install microlux
or you can install this package from source for development.
git clone https://github.com/CoastEgo/microlux.git
cd microlux
pip install -e .
Quick Start
Compute a binary-lens light curve:
import jax.numpy as jnp
from microlux import binary_mag
# t0, u0, tE, rho, q, s, alpha in degrees
params = jnp.array([0.0, 0.1, 1.0, 0.01, 0.2, 0.9, 270.0])
times = jnp.linspace(-1.0, 1.0, 1000)
mag = binary_mag(*params, times, tol=1e-3, retol=1e-3)
Documentation
The documentation includes runnable examples for parallax, orbital motion, and real-event fitting.
Citation
microlux is open-source software licensed under the MIT license. 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 in AJ .
@article{ren2025microlux,
author = {{Ren}, Haibin and {Zhu}, Wei},
title = "{A Differentiable Binary Microlensing Model Using Adaptive Contour Integration Method}",
journal = {The Astronomical Journal},
year = 2025,
volume = {169},
number = {3},
eid = {170},
pages = {170},
doi = {10.3847/1538-3881/adb1b2},
adsurl = {https://ui.adsabs.harvard.edu/abs/2025AJ....169..170R},
}
Metadata
Release files for microlux 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| microlux-0.4.0.tar.gz | 56.3 kB | With provenance | Details for microlux-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| microlux-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for microlux-0.4.0-py3-none-any.whl |
Total release size: 98.1 kB
Release files / microlux-0.4.0.tar.gz
| Download URL | microlux-0.4.0.tar.gz |
|---|---|
| Size | 56.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
420e0d957e018e0ca60ba569e81b0ae75e11ef68941d78149f9c1d8065ba67ac
|
|
BLAKE2b-256 checksum How to use checksums |
a80387484915c9c6b7386f28422407d5acf91bd196524d745a8b8caad537d88e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / microlux-0.4.0-py3-none-any.whl
| Download URL | microlux-0.4.0-py3-none-any.whl |
|---|---|
| Size | 41.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd9dfbcfd97b267f704fa36c09be62eee5b6dfe2fd5ef2e4d37eb7946330ae86
|
|
BLAKE2b-256 checksum How to use checksums |
d274a2c03e4298e15ba4891c718c5124f1079217d1396820579a092a6d0758a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for microlux 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for microlux-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.