Bending Light: Tools for Visualizing Strong Gravitational Lensing

View project on GitHub

Introduction

Strong gravitational lensing is a remarkable phenomenon that produces some of the most striking images ever recorded by telescopes. The software tools that you can download here visually demonstrate what gravitational lensing is. By using a combination of mouse and keystrokes, you can build and explore a wide range of strong lensing scenarios. Extensive control of both the background sources and foreground lenses is offered. The software visualizes both the background sources and their strongly lensed images. Moreover, the caustic and critical curves of the lensing system are shown by default (Figure 1). The tool can visualize the properties of lenses (Figure 2), and the simulated observation of the lensing system (Figure 3).

Figure 1: Figure 1 Figure 2:
Figure 2 Figure 3: Figure 3

Usage

  1. Sources:
    Sources are represented as 2D Gaussian distributions, and can be altered in size, shape, orientation, and placement. Multiple sources can also be placed (up to 9). Sources are controlled with the left mouse button, with a number key (1-9) to select the particular source. Here, "1" stands for the first source enabled by default, "2-9" stand for additional sources that may be added. The control details are listed below: as an example, to move the position of source 1, click and hold "1" and "w" and click the left mouse key to drag and place that source.

    • Hold the NUM key to pick the source you want to manipulate.
    • Hold "w" and the left mouse button to move the position of the source.
    • Hold "s" and the left mouse button and move the mouse vertically to change the size of the source.
    • Hold "e" and the left mouse button and move the mouse vertically to change the ellipticity of the source, or move the mouse horizontally to change the orientation of the source.
    • To add a new source (up to 9 total) hold "=" and left mouse click at the desired source location
  2. Lenses:
    Lenses are modeled as non-singular isothermal ellipsoids (NIEs). For simplicity, lenses are visualized as 2D Gaussian light distributions. Lenses can be altered in "size" (see below), projected shape, orientation, and placement. Like sources, up to 9 lenses may be placed, and individually controlled. Lenses are controlled using the right mouse button, rather than the left as for sources. Controls are identical, except for the "size" control. Because we are using an NIE model in this code, when you press "s" to change the size of the lens, there are two sizes: one is the Einstein radius (move the mouse vertically), the other one is the core radius (move the mouse horizontally).

  3. Visualization Toggles:
    Try "f" and "g". :-)

  4. If you are interested in installing it on you computer, please scroll down to the bottom of this page to read the instruction.

Todo List

Many of the features listed below have been developed, but not yet released in the basic toolkit. The next version of this software will include these many additional tools.
  1. Sources

    • [DONE] More sources.
    • [DONE] More models of sources (Sersic, Moffat, Disk+Bulge...).
    • [DONE] Real galaxies images.
    • [DONE] Arbitrary pictures (for fun).
  2. Lenses

    • [DONE] More models of lenses (PIEMD, GNFW, NFW+Hernquist, Burkert...).
    • [DONE] Directly input mass sheet.
    • [DONE] More satellite galaxies?
    • [..........] Realistic images of satellite galaxies.
  3. Algorithm

    • [..........] Anti-Aliasing.
    • [..........] Better caustic rendering.
  4. Time Delays

    • [DONE] Implement full time delay calculations (for varying sources).
    • [DONE] Animate varying sources, with time delays, in output visualizations.
  5. Competitive Lensing - Modeling and Reconstruction!

    • [..........] Input lensed images by one person.
    • [..........] Reconstruct it by a second person.
    • [..........] Score the match.
  6. Inputs and Outputs

    • [..........] Save the parameters of current lensing system, including lenses and sources, in multiple formats.
    • [..........] Input the system configuration - lenses and sources - as a catalog control file.
    • [..........] Show all the parameters of current lensing system in real time.

Installation

  1. Dependences:

    • Python2.7, Numpy, Pygame, Cython and SDL.
    • If you are using Linux, you can install all these packages using the default package manager, for example, apt-get for Debian and Ubuntu, yum for Fedora and Redhat, pacman for Archlinux and so on.
    • If you are using Mac, I would recommend Macports or Homebrew to install these packages.
    • My favorite way to install all the dependences is using Anaconda. Once you have installed Anaconda, the environment of python2.7 is ready.

    THEN, For Mac

    $ conda install -c
    https://conda.anaconda.org/quasiben pygame

    Or, For Linux64

    $ conda install -c https://conda.anaconda.org/tlatorre pygame

    If your SDL is not installed in /usr/local/lib, you need to link it to the default directory.

    $ sudo ln /opt/local/lib/libSDL-1.2.0.dylib /usr/local/lib/libSDL-1.2.0.dylib
    • I have got the first version of a standalone APP for Mac using py2app. You can find it here: Bending Light.
  2. Installation:

    • Clone it or download it,

    THEN

    $ cd libs
    $ python2.7 setup.py build_ext --inplace

    OR

    $ cd libs
    $ ./make_so
  3. Code Running:

    $ cd ../
    $ python2.7 bending_light.py