Skip to main content

GPU-accelerated, differentiable microlensing modeling in JAX

Project description

microJAX is a GPU-accelerated, differentiable microlensing modeling library written in JAX.

microjax

Python JAX PyPI Status License

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
ICRS Triple-lens

Refer to the example directory for code that creates these plots.

📚 References

🤝 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microjaxx-0.1.0.tar.gz (947.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microjaxx-0.1.0-py3-none-any.whl (87.2 kB view details)

Uploaded Python 3

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

Hashes for microjaxx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f77b2b27d67e4489cd85b4a642a0c92bc5d02e1a3488114a5e5ce6e886d7981
MD5 7e706e955570d581a1c513fef21e54bc
BLAKE2b-256 9de93bfd97e54e1ede9e7ea570e6ef1618be42d75babd1535b65ee67219439a7

See more details on using hashes here.

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

Hashes for microjaxx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4368f8b01423ee604bd598e03a0020e4b5ad9bea5425275f4a8c92c994facfe8
MD5 8d260bc17fa27492f4189f0b916cd788
BLAKE2b-256 402f3eb5e1fce2e55c7c1b02a0aaf5e3ad04e637d18cd1d40ef9cc26a0ad7791

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page