GPU-accelerated, differentiable microlensing modeling in JAX
Project description
microJAX is a GPU-accelerated, differentiable microlensing modeling library written in JAX.
microjax
microJAX is a fully‑differentiable, GPU‑accelerated software for modelling gravitational microlensing light curves produced by binary, and triple lens systems, using the image-centered ray shooting (ICRS) method (e.g., Bennett 2010). Written entirely in JAX, it delivers millisecond‑level evaluations of extended-source magnifications and exact gradients for every model parameter through the use of automatic differentiation, enabling gradient‑based Bayesian inference workflows such as Hamiltonian Monte Carlo (HMC) and variational inference.
This software is under active development and not yet feature complete.
✨ Key Features
| Category | Description |
|---|---|
| Lens Systems | Supports point-source and finite-source magnification calculations for binary and triple lens systems |
| Extended Sources | Models uniform and limb-darkened source profiles |
| Computational Core | Implements the Image-Centered Ray Shooting (ICRS) algorithm in JAX, fully optimized for GPU acceleration |
| Root-Finding Engine | Uses a differentiable Ehrlich-Aberth method for complex polynomial roots with implicit gradients for stable optimization |
| Bayesian Inference | Provides a ready-to-use likelihood function compatible with NumPyro's HMC and variational inference frameworks |
📦 Installation
From PyPI (recommended):
pip install microjaxx
Import name remains:
import microjax
Development install (from source):
# clone the repository
git clone https://github.com/ShotaMiyazaki94/microjax.git
cd microjax
pip install -e ".[dev]"
GPU support: JAX/JAXLIB with CUDA/ROCm depends on your environment. Please follow the official JAX installation guide to install the appropriate jaxlib for your accelerator.
Example output
| Visualization of the ICRS method (binary-lens) | Triple-lens magnification and its gradients |
|---|---|
Refer to the example directory for code that creates these plots.
📚 References
- Miyazaki & Kawahara (in prep.):
microjaxpaper (expected within 2025!) - Bennett (2010): Image-centred ray shooting (ICRS) method
- Cassan (2017): Hexadecapole approximations
- Sugiyama (2022): Fast FFT-based magnification evaluation with a single-lens extended source model
🤝 Contributing
Pull requests are welcome! Please see CONTRIBUTING.md for coding style, test suite, and CI guidelines. Bug reports can be filed via GitHub Issues.
Running Tests
CPU-only tests:
pytest -q
GPU-only (A100) tests are opt-in and skipped by default. To run them on an A100 machine:
export MICROJAX_GPU_TESTS=1
pytest -m gpu -q
These tests require JAX to detect an NVIDIA A100 (CUDA) device. If not available or the env var is not set, they are skipped.
📜 License
This project is licensed under the MIT License. If you use microJAX in academic work, please cite the upcoming Miyazaki et al. (2025) methods paper.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microjaxx-0.1.0.tar.gz.
File metadata
- Download URL: microjaxx-0.1.0.tar.gz
- Upload date:
- Size: 947.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f77b2b27d67e4489cd85b4a642a0c92bc5d02e1a3488114a5e5ce6e886d7981
|
|
| MD5 |
7e706e955570d581a1c513fef21e54bc
|
|
| BLAKE2b-256 |
9de93bfd97e54e1ede9e7ea570e6ef1618be42d75babd1535b65ee67219439a7
|
File details
Details for the file microjaxx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: microjaxx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 87.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4368f8b01423ee604bd598e03a0020e4b5ad9bea5425275f4a8c92c994facfe8
|
|
| MD5 |
8d260bc17fa27492f4189f0b916cd788
|
|
| BLAKE2b-256 |
402f3eb5e1fce2e55c7c1b02a0aaf5e3ad04e637d18cd1d40ef9cc26a0ad7791
|