Skip to main content

Tools for gravitational lensing and GW event analysis

Project description

GRaLE Gravitational-wave Lensing Explorer

IMG_3920

This package investigates whether gravitational wave events, such as GW170817 may have been gravitationally lensed by a foreground galaxy, by computing lensing-related quantities.


Requirements

  • Python 3.8+
  • numpy
  • matplotlib
  • astropy

What Problem the Project Aims to Solve

Gravitational wave signals, such as GW170817, may have been affected by gravitational lensing due to a nearby foreground galaxy (e.g., NGC 4993). Lensing could alter the apparent luminosity distance and energy signature of the event. This package aims to quantify and explore such effects and determine if the observed properties of GW170817 are consistent with a lensing scenario.


Expected Functionality

  • Calculate chirp mass from neutron star masses
  • Estimate true redshift from observed chirp mass
  • Compute luminosity distance from redshift using cosmology
  • Estimate magnification from true and observed distance
  • Compute Einstein radius from lens parameters
  • Estimate magnifying power of a galaxy
  • Provide visualizations for key lensing diagnostics

Why Each Piece of Functionality Is Needed

Function Purpose
chirp_mass() Calculates intrinsic property of the binary system
true_redshift() Infers redshift assuming lensing magnified the signal
luminosity_distance() Converts redshift to distance using cosmology
magnification() Determines how much brighter the event appears due to lensing
einstein_radius() Evaluates lens strength from velocity dispersion and geometry
magnifying_power() Calculates total lensing effect from galaxy-lens configuration

Expected Interfaces / Dependencies

GRaLE is a pure Python library that works in:

  • Jupyter notebooks
  • Python scripts
  • Scientific workflows or simulations

Dependencies:

  • numpy
  • matplotlib
  • astropy

🧑‍🚀 User Stories

Main Functionality

Story 1:
Will Robinson is lost in Space and needs to get to the origin of a Gravitational Wave Event, therefore he must calculate the true redshift of GW170817 using different combinations of neutron star masses, so he can explore if it was gravitationally lensed.

Story 2:
Robot is chasing after Will Robinson and to find him, he has to compute the Einstein radius and magnifying power of a potential lensing galaxy, so He can determine whether lensing is physically plausible in the case of GW170817 and find Will Robinson before he falls into a Wormhole._


⚠ Edge Cases

Story 3:
The Evil DR. Dofenschmirz also wants to catch Will and also calculates the lensing properties, but as he does encounter negative redshifts and infinite magnifications, the package raises a warning or an error, so he might get an advantage.

Story 4:
As a user, I want the lensing calculator to handle very small angular offsets and low velocity dispersions without crashing, so I can model weak lensing scenarios reliably.


Pseudocode Usage Examples

from grale import GWEvent, LensingCalculator
from astropy.cosmology import FlatLambdaCDM
import astropy.units as u

# SETUP
cosmo = FlatLambdaCDM(H0=67.9, Om0=0.3065)
z_lens = 0.0098
distance_mu1 = 40 * u.Mpc

# STEP 1: Create GWEvent with one m1, m2 pair (required)
event = GWEvent(m1=1.1, m2=1.5)

# Calculate chirp mass
chirp_mass = event.chirp_mass()
print(f"Chirp Mass: {chirp_mass:.3f} M_sun")

# Get M0 :
event.M0 


# Get redshift results over those mass ranges 
# Delta is the mass difference 
redshift_results = event.redshift_range(delta=0.5, step=0.01, z_lens=z_lens) 

z_lensed = redshift_results["plausible_redshifts_lensed"] #get an array of redshifts for later use

Documentation:

https://grale.readthedocs.io/en/main/index.html

License

This project is licensed under the MIT License. See the LICENSE file for more information.


Author

Shannon Schroeder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grale-1.0.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grale-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file grale-1.0.0.tar.gz.

File metadata

  • Download URL: grale-1.0.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for grale-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5db5a14e2d0ca6e9f145cc4ac8b41eb58cc58905fc17e96bd054dc75cd535e01
MD5 57a7016df83bd629e1716ca3472485df
BLAKE2b-256 c20ea62738d228eab384d539ea7cbb6714cf710a20ec36f2b5dd4c7a8e139c8c

See more details on using hashes here.

File details

Details for the file grale-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: grale-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for grale-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 661cde3946353bd40d2b59c56acc20fe6910f9edd1e12d645aadbaa4fc5dab90
MD5 9c4f7f32f568f1b06eb5f4a2c7c509f7
BLAKE2b-256 1a6d1f78c513ad630e9948cf4f028bfd78494b443164f26683115a757336905c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page