Skip to content
Rishabh Sarin

May 2022

Gravitational lensing research

Detecting gravitational lensing in deep-sky survey images with Fourier transforms, pattern recognition and machine learning.

A grid of stars on black, bent around a small mass into a red Einstein ring.
Role
Researcher
For
California Lutheran University
When
May 2022
Built with
Python, Astropy, scikit-learn, NumPy

Overview

Faced with terabytes of images from modern deep-sky surveys, this PHYS-400 capstone project at California Lutheran University presents an automated pipeline for detecting gravitational lensing. By harnessing Fourier transforms to move images into the frequency domain, applying Canny edge detection to isolate genuine contours, and using radial projection to quantify circular patterns, the system rapidly filters out noise and non-lensing objects. This framework not only accelerates analysis of bulk survey data but also lays the foundation for a CNN-based lens detector capable of learning from thousands of labeled examples.

Technologies Used

  • Java & JavaFX (initial prototype with Scene Builder for GUI)
  • OpenCV (real-time Canny edge detection & image processing)
  • Python (astropy, NumPy, cv2, matplotlib, SciPy)
  • Discrete Fourier Transform (DFT) & Fast Fourier Transform (FFT)
  • Radial projection & exponential trendline fitting
  • Tkinter (file dialog for selecting .png/.jpg & future FITS support)
  • Machine learning frameworks (for forthcoming CNN training)

Key Features

  • Frequency-Domain Analysis: Converts grayscale images into their Fourier magnitude spectra to reveal the concentric ripples characteristic of Einstein rings and arcs.
  • Robust Edge Detection: Implements the full Canny workflow—Gaussian smoothing, gradient computation, non-maximum suppression, double thresholding, and hysteresis—to distinguish true lens edges from noise.
  • Radial Projection Metrics: Projects pixel intensities along concentric circles from the image center, generating radius-versus-intensity plots where smooth, periodic peaks signal potential lensing.
  • Interactive Visualization: JavaFX interface for live camera-based testing with a threshold slider; later ported to Python for file-based analysis and matplotlib plotting.
  • Trendline Subtraction: Fits an exponential decay curve to the radial projection and subtracts it, enhancing subtle lens signatures and suppressing background gradients.
  • Scalable ML Integration: Designed to train a convolutional neural network on 80% labeled survey images, with the remaining 20% reserved for validation—targeting >98% classification accuracy.

Challenges & Solutions

Manual inspection of thousands of telescope images is infeasible and prone to human error. Early Java prototypes grew unwieldy as classes multiplied and library support for FITS data was limited. Transitioning to Python streamlined development—astropy and NumPy handle astronomical formats and array math, OpenCV accelerates image transforms, and matplotlib/SciPy simplify analysis and visualization. Noise and false positives in raw edge maps were tamed by fine-tuning thresholds and applying trendline subtraction, ensuring robust detection of genuine gravitational lens patterns.