GCMicrolensing Documentation

Tools for simulating gravitational microlensing events with single, binary, and triple lens systems.

PyPI version CI status Documentation Status Python versions

Overview

GCMicrolensing is a Python package for simulating gravitational microlensing events. It provides comprehensive tools for modeling single lens, binary lens, and triple lens systems with both photometric (light curve) and astrometric (centroid shift) calculations.

Key Features

  • Single Lens Systems (1L1S): Point source and extended source light curves

  • Binary Lens Systems (2L1S): Complex caustic structures and light curves

  • Triple Lens Systems (3L1S): Advanced multi-lens simulations

  • Astrometric Calculations: Centroid shift predictions

  • Interactive Animations: Visualize lensing events in real-time

  • GIF Export: Save animations as GIF files for documentation and presentations

  • Multiple Backends: VBMicrolensing and TripleLensing support

Quick Start

Install the package:

pip install GCMicrolensing

Basic usage:

from GCMicrolensing.models import OneL1S

# Create a single lens model
model = OneL1S(t0=2450000, tE=20, rho=0.001, u0_list=[0.1, 0.5, 1.0])

# Plot the light curve
model.plot_light_curve()

# Create an animation
animation = model.animate()

# Display the animation (if you're running this in a Jupyter notebook)
display(animation)

# Write the animation to an html file
with open("microlensing_animation.html", "w") as f:
   f.write(animation.data)

# Save the animation as a GIF file
model.animate(save_gif="microlensing_animation.gif")
Example microlensing animation

Installation

API Reference

Indices and tables