This script simulates a gravitational lensing effect using the Lenstronomy package. Gravitational lensing is a phenomenon predicted by Einstein's theory of General Relativity where light from a distant source is bent by the gravitational field of a massive object, such as a galaxy or a cluster of galaxies.
Make sure you have the following Python libraries installed:
numpy
lenstronomy
matplotlib
You can install them using pip:
pip install numpy lenstronomy matplotlib
This script simulates the lensing effect caused by a point mass, using the Lenstronomy package. It creates a simulated lensed image of a point source (star or quasar) that is gravitationally lensed by a massive object acting as a gravitational lens.
-
Lensing Parameters:
- The script defines the mass of the lens and the distance to the source.
- It converts the lens mass from kilograms to solar masses and the source distance from parsecs to arcseconds.
-
Lens Model:
- The lens model is defined using a point mass.
-
Source Setup:
- A lensed point source is set up at the position where lensing occurs.
-
PSF and Image Data Setup:
- The script sets up a Gaussian PSF and creates a blank image with specified pixel and coordinate details.
-
Image Model:
- Components (image data, PSF, lens model, and point source) are combined to form an image model.
-
Image Simulation:
- A lensed image is simulated based on the lens model and point source parameters.
- Lens Mass: Mass of the lensing object in kilograms, converted to solar masses.
- Source Distance: Distance to the source in parsecs, converted to angular distance in arcseconds.
- PSF FWHM: Full Width at Half Maximum (FWHM) of the Gaussian PSF in arcseconds.
- Image Size: Number of pixels in the simulated image.
- Pixel Coordinates: RA and DEC coordinates at the position of the pixel edge.
- Transform Matrix: Linear translation matrix for converting pixel shifts to angular shifts.
-
Clone the repository:
git clone https://github.com/the-w00d/Specific-Test-VII.-Expanding-Strong-Gravitational-Lensing-Simulations.git cd Specific-Test-VII.-Expanding-Strong-Gravitational-Lensing-Simulations-main
-
Run the script:
Strong Gravitational Lensing Simulations.ipynb
-
View Results:
- The script will generate a simulated lensed image and display it using Matplotlib.
The simulated lensed image will demonstrate the gravitational lensing effect on the point source due to the lensing object's mass.
- Lenstronomy documentation: Lenstronomy GitHub
- Gravitational lensing: Wikipedia - Gravitational lens
- Dawood Khan
- GitHub: @the-w00d
- linkden: @Dawoodkhan