← geetpurohit.com

Watch a Star Bend Starlight

When a foreground star drifts almost exactly in front of a distant one, its gravity acts like a lens: the background star's light bends around it, splits into arcs, and for a moment flares into a ring of light. From Earth we cannot resolve the ring, we only see the star briefly brighten and fade. That single bump, the Paczynski light curve, is enough to weigh an invisible object halfway across the galaxy. Below is a live lens you can drag. Everything renders on your GPU in real time, and you can load three real events I fit for my thesis.

General Relativity WebGL Shader Paczynski Model MCMC OGLE Survey Real Data
Gravitational lens · live
Drag anywhere to move the lens

Light curve

Sandbox · drag the lens or press play

Brighter is up. The dot marks where the lens is right now.

Three real events I fit

These are genuine microlensing events from the OGLE survey (Optical Gravitational Lensing Experiment), watching millions of stars toward the galactic bulge. For each one I fit the Paczynski model to the raw photometry and used Markov Chain Monte Carlo to pin down the parameters and their uncertainty. Load one and the simulator snaps to my best-fit values, with the real observations dropped on top of the model curve.

The physics on screen

The view above is not a video, it is a fragment shader solving the lens equation for every pixel, every frame. A point mass deflects a light ray by an amount that grows as the ray passes closer to it, so the shader traces each pixel back to where that light truly came from on the sky behind the lens. Line the lens up with the background star and its light wraps all the way around into an Einstein ring; nudge it aside and the ring breaks into two warped images.

A(u) = u² + 2 u √(u² + 4)
u(t) = √( u₀² + ((t − t₀) / tE)² )

The magnification A depends only on u, the lens-source separation in units of the Einstein radius. As the lens crosses, u dips to its minimum u₀ and back, and A traces the symmetric bump you see in the light curve.

Fitting real data means the reverse: given a noisy light curve, find the parameters that produced it. I sampled the posterior with MCMC, which walks thousands of trial fits through parameter space and settles into the region the data prefer, giving both the best-fit values and honest error bars. The full notebook, the write-up, and the corner plots live on GitHub.