hemantaph / ler

Gravitational waves lensing rate calculator
MIT License
2 stars 2 forks source link

Move to lenstronomy solver #4

Closed ohannuks closed 4 months ago

ohannuks commented 9 months ago

@Jason had discovered there are times that the analytical lens equation solver fails. We should move to the more stable lenstronomy solver.

Ping @hemantaph

Tests I've done:

# %%
import ler
from ler.rates import LeR
import numpy as np

# %%
ler = LeR(verbose=False, npool=32)

# %%
unlensed_param = ler.unlensed_cbc_statistics(resume=False)

# %%
lensed_param = ler.lensed_cbc_statistics(size=100000, resume=False)

# %%
rate_ratio, unlensed_param_detectable, lensed_param_detectable =ler.rate_comparision_with_rate_calculation()

Output:

getting unlensed_params from json file [./unlensed_param.json...](https://file+.vscode-resource.vscode-cdn.net/home/user/git/student_projects/Leo_projects/SubThresholdTimeDelay/figure_illustrations/fig_2_gravitational_wave_time_delays/unlensed_param.json...)
total unlensed rate (yr^-1) (with step function): 443.07799732825265
storing detectable unlensed params in [./unlensed_param_detectable.json](https://file+.vscode-resource.vscode-cdn.net/home/user/git/student_projects/Leo_projects/SubThresholdTimeDelay/figure_illustrations/fig_2_gravitational_wave_time_delays/unlensed_param_detectable.json)
getting lensed_params from json file [./lensed_param.json...](https://file+.vscode-resource.vscode-cdn.net/home/user/git/student_projects/Leo_projects/SubThresholdTimeDelay/figure_illustrations/fig_2_gravitational_wave_time_delays/lensed_param.json...)
total lensed rate (yr^-1) (with step function): 1.207076054528862
storing detectable lensed params in [./lensed_param_detectable.json](https://file+.vscode-resource.vscode-cdn.net/home/user/git/student_projects/Leo_projects/SubThresholdTimeDelay/figure_illustrations/fig_2_gravitational_wave_time_delays/lensed_param_detectable.json)
unlensed_rate: 443.07799732825265
lensed_rate: 1.207076054528862
ratio: 367.0671749852514

The rate stays more or less the same.