GRALE is a library to model gravitational lenses and invert gravitational lens systems based on the observed images. It is written in C++ and is primarily intended to be used on a unix-like system (Linux, OS X, ...) but should work (in a limited way) on MS-Windows systems as well. The CMake build system is used to create the library. Also available is the program GRALESHELL, which is an interactive environment that provides easy access to many procedures of the GRALE library.


The following articles involve the use of GRALE:

  1. The Frontier Fields Lens Modeling Comparison Project
  2. Lens Models Under the Microscope: Comparison of Hubble Frontier Field Cluster Magnification Maps
  3. Testing light-traces-mass in Hubble Frontier Fields Cluster MACS-J0416.1-2403
  4. Quantifying substructures in Hubble Frontier Field clusters: comparison with Lambda-CDM simulations
  5. The behaviour of dark matter associated with four bright cluster galaxies in the 10 kpc core of Abell 3827
  6. Lensing time delays as a substructure constraint: a case study with the cluster SDSS J1004+4112
  7. Mass-Galaxy offsets in Abell 3827, 2218 and 1689: intrinsic properties or line-of-sight substructures?
  8. Lensing degeneracies and mass substructure
  9. Strong-Lensing Analysis of MS 1358.4+6245: New Multiple Images and Implications for the Well-Resolved z=4.92 Galaxy
  10. Full Lensing Analysis of Abell 1703: Comparison of Independent Lens-Modelling Techniques
  11. Non-parametric strong lens inversion of SDSS J1004+4112
  12. The search for dark matter via strong lens inversions of galaxy clusters using genetic algorithms
  13. Non-parametric strong lens inversion of Cl 0024+1654: illustrating the monopole degeneracy
  14. A generalisation of the mass-sheet degeneracy producing ring-like artefacts in the lens mass distribution
  15. Non-parametric inversion of gravitational lensing systems with few images using a multi-objective genetic algorithm
  16. A genetic algorithm for the non-parametric inversion of strong lensing systems


To be able to build GRALE and GRALESHELL, you need to have GSL, the GNU Scientific Library, installed. Having Qt installed may also be useful (creating PNG files, having a nicer user interface). To speed up certain calculations, having an MPI implementation available or having an OpenCL library installed is useful.

Not absolutely required, but definitely recommended (not for the MS-Windows platform) is CFITSIO

To compile GRALE and GRALESHELL, several other libraries need to be installed (in this order):

Afterwards, you should first compile GRALE, and then GRALESHELL. Below you can find the links to the source code.



GRALE Lens inversion modules

Note that these have never been used or tested in an MS-Windows environment, so I'm not sure if they'll work that way.

Here are some lens inversion examples. The README file and the comments in the individual files explain what's being done:


This is a small application I once wrote to demonstrate the gravitational lens effect:


The source code (depends on GRALE):

A precompiled MS-Windows version (32 bit):

This contains both a version that simply uses the CPU to perform its calculations, and a version that uses OpenCL. The last one will need an installed version of OpenCL.dll. Note that it has only been tested with NVidia GPUs.


This is a tool to help create input for lens inversions. You can load FITS files, even overlay a color image if you like, select points in different images, create null space maps, add time delay info, etc. No documentation currently, so mail me if you'd like to use this and can't figure out how.


The source code (depends on GRALE):

Some screencasts which show how to use the program, and documents describing what happens:

  1. graleeditor_backgrounds.m4v - graleeditor_backgrounds.txt
  2. graleeditor_imagepoints.m4v - graleeditor_imagepoints.txt


This is another (older) tool to help create input for lens inversions. The main idea here is that you also get to see a backprojected version of an image, which may make it easier to identify corresponding features in images. No documentation currently, so mail me if you'd like to use this and can't figure out how.


The source code (depends on GRALE):


Doxygen based documentation is included in both the GRALE and GRALESHELL packages. At this moment, unfortunately the documentation of GRALE itself is far from complete. The documentation of GRALESHELL will probably be of more use and can also be found on-line:


For questions, remarks, suggestions, please send your e-mails to: