ler 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ler might be problematic. Click here for more details.
- ler/__init__.py +12 -0
- ler/lens_galaxy_population.py +42 -7
- ler/ler.py +41 -18
- ler/source_population.py +216 -107
- {ler-0.2.7.dist-info → ler-0.2.9.dist-info}/METADATA +14 -14
- ler-0.2.9.dist-info/RECORD +11 -0
- {ler-0.2.7.dist-info → ler-0.2.9.dist-info}/WHEEL +1 -1
- ler-0.2.7.dist-info/RECORD +0 -11
- {ler-0.2.7.dist-info → ler-0.2.9.dist-info}/LICENSE +0 -0
- {ler-0.2.7.dist-info → ler-0.2.9.dist-info}/top_level.txt +0 -0
ler/__init__.py
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
"""
|
|
2
|
+
LeR
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import sys
|
|
6
|
+
import warnings
|
|
7
|
+
warnings.filterwarnings("ignore", "Wswiglal-redir-stdio")
|
|
8
|
+
|
|
9
|
+
__author__ = 'hemanta_ph <hemantaphurailatpam@gmail.com>'
|
|
10
|
+
|
|
11
|
+
__version__ = "0.2.7"
|
|
12
|
+
|
|
1
13
|
from .ler import LeR
|
|
2
14
|
from .lens_galaxy_population import LensGalaxyPopulation
|
|
3
15
|
from .source_population import SourceGalaxyPopulationModel, CompactBinaryPopulation
|
ler/lens_galaxy_population.py
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
This module contains the LensGalaxyPopulation class, which is used to sample lens galaxy parameters, source parameters conditioned on the source being strongly lensed, image properties, and lensed SNRs. \n
|
|
4
4
|
The class inherits from the CompactBinaryPopulation class, which is used to sample source parameters. \n
|
|
5
5
|
"""
|
|
6
|
+
import warnings
|
|
6
7
|
|
|
8
|
+
warnings.filterwarnings("ignore")
|
|
7
9
|
import numpy as np
|
|
8
10
|
from scipy.stats import gengamma, rayleigh, norm
|
|
9
11
|
from scipy.interpolate import interp1d
|
|
@@ -188,7 +190,7 @@ class LensGalaxyPopulation:
|
|
|
188
190
|
# initialization of clasess
|
|
189
191
|
# CompactBinaryPopulation already inherits from Source_Galaxy_Population_Model class form source_population.py
|
|
190
192
|
self.cbc_pop = CompactBinaryPopulation(
|
|
191
|
-
z_min=0.
|
|
193
|
+
z_min=0.0001,
|
|
192
194
|
z_max=10.0,
|
|
193
195
|
m_min=4.59,
|
|
194
196
|
m_max=86.22,
|
|
@@ -216,7 +218,7 @@ class LensGalaxyPopulation:
|
|
|
216
218
|
pdf_unnormalized = (
|
|
217
219
|
lambda z: merger_rate_density_detector_frame(z)
|
|
218
220
|
* self.differential_comoving_volume(z)
|
|
219
|
-
* self.
|
|
221
|
+
* self.strong_lensing_optical_depth_SIS(z)
|
|
220
222
|
)
|
|
221
223
|
# Normalize the pdf
|
|
222
224
|
# this normalization factor is common no matter what you choose for z_min and z_max
|
|
@@ -445,8 +447,8 @@ class LensGalaxyPopulation:
|
|
|
445
447
|
)
|
|
446
448
|
|
|
447
449
|
# put strong lensing condition with optical depth
|
|
448
|
-
tau = self.
|
|
449
|
-
tau_max = np.max(self.
|
|
450
|
+
tau = self.strong_lensing_optical_depth_SIS(zs)
|
|
451
|
+
tau_max = np.max(self.strong_lensing_optical_depth_SIS(z_max))
|
|
450
452
|
r = np.random.uniform(0, tau_max, size=len(zs))
|
|
451
453
|
pick_strongly_lensed = r < tau # pick strongly lensed sources
|
|
452
454
|
# Add the strongly lensed source redshifts to the list
|
|
@@ -557,7 +559,7 @@ class LensGalaxyPopulation:
|
|
|
557
559
|
Returns
|
|
558
560
|
-------
|
|
559
561
|
theta_E : `float`
|
|
560
|
-
Einstein radii of the lens galaxies
|
|
562
|
+
Einstein radii of the lens galaxies in radian
|
|
561
563
|
|
|
562
564
|
"""
|
|
563
565
|
# Compute the angular diameter distances
|
|
@@ -650,9 +652,9 @@ class LensGalaxyPopulation:
|
|
|
650
652
|
idx = u < theta_E**2
|
|
651
653
|
return idx
|
|
652
654
|
|
|
653
|
-
def
|
|
655
|
+
def strong_lensing_optical_depth_SIE(self, zs):
|
|
654
656
|
"""
|
|
655
|
-
Function to compute the strong lensing optical depth
|
|
657
|
+
Function to compute the strong lensing optical depth SIE
|
|
656
658
|
|
|
657
659
|
Parameters
|
|
658
660
|
----------
|
|
@@ -665,8 +667,41 @@ class LensGalaxyPopulation:
|
|
|
665
667
|
strong lensing optical depth
|
|
666
668
|
|
|
667
669
|
"""
|
|
670
|
+
# for SIE model
|
|
671
|
+
# dedine a function to calculate the cross section number
|
|
672
|
+
# here we already assume that we have initialized the crossection spline
|
|
673
|
+
def getcrosssect_num(theta_E, q):
|
|
674
|
+
fid_b_I = 10.0 # constant
|
|
675
|
+
idx = q > 0.999
|
|
676
|
+
q[idx] = 0.999
|
|
677
|
+
idx = q < 0.1
|
|
678
|
+
q[idx] = 0.1
|
|
679
|
+
b_I = theta_E * np.sqrt(q)
|
|
680
|
+
return self.cross_sect_spl(q)*(b_I/fid_b_I)**2
|
|
681
|
+
|
|
682
|
+
# theta_E=bsis=einstein_radius_SIS # refer to compute_einstein_radii
|
|
683
|
+
|
|
684
|
+
return getcrosssect_num(theta_E, q)/(4*np.pi)
|
|
685
|
+
|
|
686
|
+
def strong_lensing_optical_depth_SIS(self, zs):
|
|
687
|
+
"""
|
|
688
|
+
Function to compute the strong lensing optical depth (SIS)
|
|
689
|
+
|
|
690
|
+
Parameters
|
|
691
|
+
----------
|
|
692
|
+
zs : `float`
|
|
693
|
+
source redshifts
|
|
694
|
+
|
|
695
|
+
Returns
|
|
696
|
+
-------
|
|
697
|
+
tau : `float`
|
|
698
|
+
strong lensing optical depth
|
|
699
|
+
|
|
700
|
+
"""
|
|
701
|
+
# For SIS model
|
|
668
702
|
# z to luminosity_distance (luminosity_distance) conversion
|
|
669
703
|
Dc = self.z_to_Dc(zs) * 1e-3 # 1e-3 converts Mpc to Gpc
|
|
704
|
+
|
|
670
705
|
return (Dc / 62.2) ** 3
|
|
671
706
|
|
|
672
707
|
def get_image_properties(
|
ler/ler.py
CHANGED
|
@@ -200,7 +200,7 @@ class LeR:
|
|
|
200
200
|
self,
|
|
201
201
|
nsamples=100000,
|
|
202
202
|
npool=int(4),
|
|
203
|
-
z_min=0.
|
|
203
|
+
z_min=0.0001,
|
|
204
204
|
z_max=10.0,
|
|
205
205
|
batch_size=25000,
|
|
206
206
|
snr_finder="gwsnr",
|
|
@@ -230,11 +230,17 @@ class LeR:
|
|
|
230
230
|
"m_max": 86.22,
|
|
231
231
|
"z_min": z_min,
|
|
232
232
|
"z_max": z_max,
|
|
233
|
-
"event_type": "
|
|
233
|
+
"event_type": "BBH",
|
|
234
|
+
"category": "popI_II",
|
|
235
|
+
"sub_category": "gwcosmo",
|
|
236
|
+
"redshift_event_type": None,
|
|
237
|
+
"redshift_category": None,
|
|
234
238
|
"merger_rate_density_fn": None,
|
|
235
239
|
"merger_rate_density_param": None,
|
|
236
240
|
"src_model_params": None,
|
|
237
|
-
"
|
|
241
|
+
"mass_constant": False,
|
|
242
|
+
"redshift_constant": False,
|
|
243
|
+
"spin_constant": False,
|
|
238
244
|
}
|
|
239
245
|
# for lensed case
|
|
240
246
|
# set 'min_lensed_images' = 2 for double image lensed case
|
|
@@ -308,8 +314,9 @@ class LeR:
|
|
|
308
314
|
if unavailable, the unlensed parameters will be sampled when unlensed_rate() is called \n
|
|
309
315
|
gw_param.keys() = ['m1', 'm2', 'z', 'snr', 'theta_jn', 'ra', 'dec', 'psi', 'phase', 'geocent_time'] \n
|
|
310
316
|
"""
|
|
311
|
-
if
|
|
312
|
-
|
|
317
|
+
# if file name
|
|
318
|
+
if isinstance(self._gw_param, str):
|
|
319
|
+
f = open(self._gw_param, "r", encoding="utf-8")
|
|
313
320
|
self._gw_param = json.loads(f.read())
|
|
314
321
|
return self._gw_param
|
|
315
322
|
|
|
@@ -325,8 +332,9 @@ class LeR:
|
|
|
325
332
|
if unavailable, the unlensed parameters will be sampled when unlensed_rate() is called \n
|
|
326
333
|
gw_param_detectable.keys() = ['m1', 'm2', 'z', 'snr', 'theta_jn', 'ra', 'dec', 'psi', 'phase', 'geocent_time'] \n
|
|
327
334
|
"""
|
|
328
|
-
if
|
|
329
|
-
|
|
335
|
+
# if file name
|
|
336
|
+
if isinstance(self._gw_param_detectable, str):
|
|
337
|
+
f = open(self._gw_param_detectable, "r", encoding="utf-8")
|
|
330
338
|
self._gw_param_detectable = json.loads(f.read())
|
|
331
339
|
return self._gw_param_detectable
|
|
332
340
|
|
|
@@ -342,8 +350,9 @@ class LeR:
|
|
|
342
350
|
if unavailable, the lensed parameters will be sampled when lensed_rate() is called \n
|
|
343
351
|
lensed_param.keys() = ['m1', 'm2', 'z', 'snr', 'theta_jn', 'ra', 'dec', 'psi', 'phase', 'geocent_time', 'lensed_images'] \n
|
|
344
352
|
"""
|
|
345
|
-
if
|
|
346
|
-
|
|
353
|
+
# if file name
|
|
354
|
+
if isinstance(self._lensed_param, str):
|
|
355
|
+
f = open(self._lensed_param, "r", encoding="utf-8")
|
|
347
356
|
self._lensed_param = json.loads(f.read())
|
|
348
357
|
return self._lensed_param
|
|
349
358
|
|
|
@@ -359,8 +368,9 @@ class LeR:
|
|
|
359
368
|
if unavailable, the lensed parameters will be sampled when lensed_rate() is called \n
|
|
360
369
|
lensed_param_detectable.keys() = ['m1', 'm2', 'z', 'snr', 'theta_jn', 'ra', 'dec', 'psi', 'phase', 'geocent_time', 'lensed_images'] \n
|
|
361
370
|
"""
|
|
362
|
-
if
|
|
363
|
-
|
|
371
|
+
# if file name
|
|
372
|
+
if isinstance(self._lensed_param_detectable, str):
|
|
373
|
+
f = open(self._lensed_param_detectable, "r", encoding="utf-8")
|
|
364
374
|
self._lensed_param_detectable = json.loads(f.read())
|
|
365
375
|
return self._lensed_param_detectable
|
|
366
376
|
|
|
@@ -379,12 +389,18 @@ class LeR:
|
|
|
379
389
|
m_min=self.gw_param_sampler_dict["m_min"],
|
|
380
390
|
m_max=self.gw_param_sampler_dict["m_max"],
|
|
381
391
|
event_type=self.gw_param_sampler_dict["event_type"],
|
|
392
|
+
category=self.gw_param_sampler_dict["category"],
|
|
393
|
+
sub_category=self.gw_param_sampler_dict["sub_category"],
|
|
394
|
+
redshift_event_type=self.gw_param_sampler_dict["redshift_event_type"],
|
|
395
|
+
redshift_category=self.gw_param_sampler_dict["redshift_category"],
|
|
382
396
|
merger_rate_density_fn=self.gw_param_sampler_dict[
|
|
383
397
|
"merger_rate_density_fn"],
|
|
384
398
|
merger_rate_density_param=self.gw_param_sampler_dict[
|
|
385
399
|
"merger_rate_density_param"],
|
|
386
400
|
src_model_params=self.gw_param_sampler_dict["src_model_params"],
|
|
387
|
-
|
|
401
|
+
mass_constant=self.gw_param_sampler_dict["mass_constant"],
|
|
402
|
+
redshift_constant=self.gw_param_sampler_dict["redshift_constant"],
|
|
403
|
+
spin_constant=self.gw_param_sampler_dict["spin_constant"],
|
|
388
404
|
)
|
|
389
405
|
self.lens_galaxy_pop = LensGalaxyPopulation(self.compact_binary_pop)
|
|
390
406
|
|
|
@@ -591,8 +607,10 @@ class LeR:
|
|
|
591
607
|
data = json.load(f)
|
|
592
608
|
track_batches = (len(data["zs"]) - frac_batches) // batch_size + 1
|
|
593
609
|
except:
|
|
594
|
-
|
|
595
|
-
|
|
610
|
+
track_batches = track_batches + 1
|
|
611
|
+
print(f"Batch no. {track_batches}")
|
|
612
|
+
# new first batch with the frac_batches
|
|
613
|
+
sampling_routine(nsamples=frac_batches, file_name=json_file)
|
|
596
614
|
|
|
597
615
|
# ---------------------------------------------------#
|
|
598
616
|
min_, max_ = track_batches, num_batches
|
|
@@ -1010,11 +1028,11 @@ class LeR:
|
|
|
1010
1028
|
snr = lensed_param["opt_snr_net"]
|
|
1011
1029
|
except:
|
|
1012
1030
|
# snr not provided
|
|
1013
|
-
print("snr not provided in
|
|
1031
|
+
print("snr not provided in lensed_param dict. Exiting...")
|
|
1014
1032
|
return None
|
|
1015
1033
|
|
|
1016
1034
|
snr_hit = np.full(size, True) # boolean array to store the result of the threshold condition
|
|
1017
|
-
#
|
|
1035
|
+
# for each row: choose a threshold and check if the number of images above threshold. Sum over the images. If sum is greater than num_img, then snr_hit = True
|
|
1018
1036
|
for i in range(len(snr_threshold)):
|
|
1019
1037
|
snr_hit = snr_hit & (np.sum((snr > snr_threshold[i]), axis=1) >= num_img[i])
|
|
1020
1038
|
snr_hit = snr_hit & not_rejected
|
|
@@ -1234,9 +1252,9 @@ class LeR:
|
|
|
1234
1252
|
data = json.load(f)
|
|
1235
1253
|
# append the results
|
|
1236
1254
|
if detectability_condition == "step_function":
|
|
1237
|
-
data['
|
|
1255
|
+
data['rate_ratio_step'] = rate_ratio
|
|
1238
1256
|
elif detectability_condition == "pdet":
|
|
1239
|
-
data['
|
|
1257
|
+
data['rate_ratio_pdet'] = rate_ratio
|
|
1240
1258
|
# write the results
|
|
1241
1259
|
append_json(self.json_file_ler_param, data, replace=True)
|
|
1242
1260
|
|
|
@@ -1573,6 +1591,11 @@ class LeR:
|
|
|
1573
1591
|
extent=np.log10(extent),
|
|
1574
1592
|
)
|
|
1575
1593
|
|
|
1594
|
+
# labels
|
|
1595
|
+
ax.xlabel(r"$log_{10}\Delta t$ (days)")
|
|
1596
|
+
ax.ylabel(r"$\Delta log_{10}\mu$")
|
|
1597
|
+
ax.title(r"relative magnification vs relative time delay")
|
|
1598
|
+
|
|
1576
1599
|
# save figure
|
|
1577
1600
|
if savefig:
|
|
1578
1601
|
ax.savefig("mu_vs_dt.png", dpi=300, bbox_inches="tight")
|
ler/source_population.py
CHANGED
|
@@ -132,9 +132,10 @@ class SourceGalaxyPopulationModel:
|
|
|
132
132
|
|
|
133
133
|
def __init__(
|
|
134
134
|
self,
|
|
135
|
-
z_min=0.
|
|
135
|
+
z_min=0.0001,
|
|
136
136
|
z_max=10.0,
|
|
137
137
|
event_type="popI_II",
|
|
138
|
+
category="Oguri",
|
|
138
139
|
merger_rate_density_fn=None,
|
|
139
140
|
merger_rate_density_param=None):
|
|
140
141
|
|
|
@@ -150,18 +151,22 @@ class SourceGalaxyPopulationModel:
|
|
|
150
151
|
self.merger_rate_density = merger_rate_density_fn
|
|
151
152
|
else:
|
|
152
153
|
try:
|
|
154
|
+
if category == None:
|
|
155
|
+
category = ""
|
|
156
|
+
else:
|
|
157
|
+
category = "_" + category
|
|
153
158
|
self.merger_rate_density = getattr(
|
|
154
|
-
self, "merger_rate_density_" + event_type
|
|
159
|
+
self, "merger_rate_density_" + event_type + category
|
|
155
160
|
)
|
|
156
161
|
except:
|
|
157
|
-
self.merger_rate_density = getattr(self, "merger_rate_density_" + "
|
|
162
|
+
self.merger_rate_density = getattr(self, "merger_rate_density_" + "popI_II_Oguri")
|
|
158
163
|
|
|
159
|
-
|
|
164
|
+
merger_rate_density_source_frame = lambda z: self.merger_rate_density(z) / (
|
|
160
165
|
1 + z
|
|
161
166
|
)
|
|
162
167
|
|
|
163
168
|
# Define the pdf p(z)
|
|
164
|
-
pdf_unnormalized = lambda z:
|
|
169
|
+
pdf_unnormalized = lambda z: merger_rate_density_source_frame(
|
|
165
170
|
z
|
|
166
171
|
) * self.differential_comoving_volume(z)
|
|
167
172
|
# Normalize the pdf
|
|
@@ -226,7 +231,7 @@ class SourceGalaxyPopulationModel:
|
|
|
226
231
|
Examples
|
|
227
232
|
----------
|
|
228
233
|
>>> from ler import SourceGalaxyPopulationModel
|
|
229
|
-
>>> pop = SourceGalaxyPopulationModel(z_min=0.0001, z_max=10, event_type = "
|
|
234
|
+
>>> pop = SourceGalaxyPopulationModel(z_min=0.0001, z_max=10, event_type = "popI_II_Oguri")
|
|
230
235
|
>>> zs = pop.sample_source_redshifts(size=1000)
|
|
231
236
|
>>> zs
|
|
232
237
|
array([0.0001, 0.0001, 0.0001, ..., 9.9999, 9.9999, 9.9999])
|
|
@@ -234,11 +239,11 @@ class SourceGalaxyPopulationModel:
|
|
|
234
239
|
"""
|
|
235
240
|
# Define the merger-rate density function
|
|
236
241
|
# print(f"z_max = {z_max}")
|
|
237
|
-
|
|
242
|
+
merger_rate_density_source_frame = lambda z: self.merger_rate_density(z) / (
|
|
238
243
|
1 + z
|
|
239
244
|
)
|
|
240
245
|
# Define the pdf p(z)
|
|
241
|
-
pdf_unnormalized = lambda z:
|
|
246
|
+
pdf_unnormalized = lambda z: merger_rate_density_source_frame(
|
|
242
247
|
z
|
|
243
248
|
) * self.differential_comoving_volume(z)
|
|
244
249
|
# Normalize the pdf
|
|
@@ -248,7 +253,7 @@ class SourceGalaxyPopulationModel:
|
|
|
248
253
|
zs = rejection_sample(pdf, z_min, z_max, size=size)
|
|
249
254
|
return zs
|
|
250
255
|
|
|
251
|
-
def
|
|
256
|
+
def merger_rate_density_popI_II_Oguri(self, zs, R0=25.0 * 1e-9, b2=1.6, b3=2.0, b4=30):
|
|
252
257
|
"""
|
|
253
258
|
Function to compute the merger rate density (PopI/PopII)
|
|
254
259
|
|
|
@@ -277,12 +282,18 @@ class SourceGalaxyPopulationModel:
|
|
|
277
282
|
Examples
|
|
278
283
|
----------
|
|
279
284
|
>>> from ler import SourceGalaxyPopulationModel
|
|
280
|
-
>>> pop = SourceGalaxyPopulationModel(z_min=0.0001, z_max=10, event_type = "
|
|
281
|
-
>>> rate_density = pop.
|
|
285
|
+
>>> pop = SourceGalaxyPopulationModel(z_min=0.0001, z_max=10, event_type = "popI_II_Oguri")
|
|
286
|
+
>>> rate_density = pop.merger_rate_density_popI_II_Oguri(zs=0.1)
|
|
282
287
|
>>> rate_density
|
|
283
288
|
2.7848018586883885e-08
|
|
284
289
|
|
|
285
290
|
"""
|
|
291
|
+
# if self.event_type == "BNS":
|
|
292
|
+
# R0 = 170.0 * 1e-9
|
|
293
|
+
# if self.event_type == "NSBH":
|
|
294
|
+
# R0 = 27.0 * 1e-9
|
|
295
|
+
|
|
296
|
+
#print("\n merger_rate_density_popI_II_Oguri \n")
|
|
286
297
|
# replace values with self.merger_rate_density_param, if given
|
|
287
298
|
param = dict(R0=R0, b2=b2, b3=b3, b4=b4)
|
|
288
299
|
if self.merger_rate_density_param is not None:
|
|
@@ -331,6 +342,7 @@ class SourceGalaxyPopulationModel:
|
|
|
331
342
|
1.2355851838964846
|
|
332
343
|
|
|
333
344
|
"""
|
|
345
|
+
# print("\n merger_rate_density_popI_II_Madau_Dickinson \n")
|
|
334
346
|
# replace values with self.merger_rate_density_param, if given
|
|
335
347
|
param = dict(af=af, bf=bf, cf=cf)
|
|
336
348
|
if self.merger_rate_density_param is not None:
|
|
@@ -339,11 +351,11 @@ class SourceGalaxyPopulationModel:
|
|
|
339
351
|
if key in keys_:
|
|
340
352
|
param[key] = value
|
|
341
353
|
|
|
342
|
-
rate_density = (1 + zs) ** param["af"] / (1 + ((1 + zs) / param["cf"]) ** param["bf"])
|
|
354
|
+
rate_density = 0.015 * (1 + zs) ** param["af"] / (1 + ((1 + zs) / param["cf"]) ** param["bf"])
|
|
343
355
|
|
|
344
356
|
return rate_density
|
|
345
357
|
|
|
346
|
-
def
|
|
358
|
+
def merger_rate_density_popIII_Ken(self, zs, aIII=0.66, bIII=0.3, zIII=11.6):
|
|
347
359
|
"""
|
|
348
360
|
Function to compute the unnormalized merger rate density (PopIII)
|
|
349
361
|
|
|
@@ -374,6 +386,7 @@ class SourceGalaxyPopulationModel:
|
|
|
374
386
|
>>> rate_density
|
|
375
387
|
0.00010000000000000002
|
|
376
388
|
"""
|
|
389
|
+
#print("\n ken \n")
|
|
377
390
|
# replace values with self.merger_rate_density_param, if given
|
|
378
391
|
param = dict(aIII=aIII, bIII=bIII, zIII=zIII)
|
|
379
392
|
if self.merger_rate_density_param is not None:
|
|
@@ -387,7 +400,7 @@ class SourceGalaxyPopulationModel:
|
|
|
387
400
|
|
|
388
401
|
return rate_density
|
|
389
402
|
|
|
390
|
-
def
|
|
403
|
+
def merger_rate_density_primordial_Ken(self, zs, t0=13.786885302009708):
|
|
391
404
|
"""
|
|
392
405
|
Function to compute the merger rate density (Primordial)
|
|
393
406
|
|
|
@@ -552,63 +565,63 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
552
565
|
self,
|
|
553
566
|
z_min=0.0001,
|
|
554
567
|
z_max=10,
|
|
555
|
-
m_min=
|
|
556
|
-
m_max=
|
|
557
|
-
event_type="
|
|
568
|
+
m_min=None,
|
|
569
|
+
m_max=None,
|
|
570
|
+
event_type="BBH",
|
|
571
|
+
category=None,
|
|
572
|
+
sub_category=None,
|
|
573
|
+
redshift_event_type=None,
|
|
574
|
+
redshift_category=None,
|
|
558
575
|
merger_rate_density_fn=None,
|
|
559
576
|
merger_rate_density_param=None,
|
|
560
577
|
src_model_params=None,
|
|
561
|
-
|
|
578
|
+
redshift_constant = False,
|
|
579
|
+
mass_constant=False,
|
|
580
|
+
spin_constant=0.,
|
|
562
581
|
):
|
|
563
582
|
# initialized SourceGalaxyPopulationModel mother class
|
|
564
583
|
# self.z_min and self.z_max will inherit from SourceGalaxyPopulationModel
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
# self.z_min already defined in SourceGalaxyPopulationModel
|
|
568
|
-
# self.z_max already defined in SourceGalaxyPopulationModel
|
|
569
|
-
self.m_min = m_min
|
|
570
|
-
self.m_max = m_max
|
|
571
|
-
try:
|
|
572
|
-
self.source_binary_masses = getattr(self, "binary_masses_" + event_type)
|
|
573
|
-
except:
|
|
574
|
-
pass
|
|
575
|
-
|
|
576
|
-
# check spin_zero
|
|
577
|
-
self.spin_zero = spin_zero
|
|
578
|
-
if spin_zero:
|
|
579
|
-
self.binary_spin = None
|
|
580
|
-
else:
|
|
581
|
-
try:
|
|
582
|
-
self.binary_spin = getattr(self, "binary_spin_" + event_type)
|
|
583
|
-
except:
|
|
584
|
-
self.binary_spin = getattr(self, "binary_spin_" + event_type)
|
|
585
|
-
|
|
586
|
-
# check the src_model_params have required keys
|
|
587
|
-
# check mass range
|
|
588
|
-
if event_type == "popI_II":
|
|
589
|
-
if m_min < 4.59:
|
|
590
|
-
print("WARNING: m_min is too low for popI/II BBHs")
|
|
591
|
-
if m_max > 86.22:
|
|
592
|
-
print("WARNING: m_max is too high for popI/II BBHs")
|
|
584
|
+
if redshift_event_type is None:
|
|
585
|
+
redshift_event_type = category
|
|
593
586
|
|
|
594
|
-
|
|
595
|
-
pass
|
|
587
|
+
super().__init__(z_min=z_min, z_max=z_max, event_type=redshift_event_type, category=redshift_category, merger_rate_density_fn=merger_rate_density_fn, merger_rate_density_param=merger_rate_density_param)
|
|
596
588
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
if m_max > 3.0:
|
|
602
|
-
print("WARNING: m_max is too high for neutron stars")
|
|
589
|
+
# check redshift
|
|
590
|
+
self.redshift_constant = redshift_constant
|
|
591
|
+
if redshift_constant:
|
|
592
|
+
self.sample_source_redshifts = None
|
|
603
593
|
|
|
604
|
-
|
|
605
|
-
|
|
594
|
+
# checking for event-type, category, sub-categoru
|
|
595
|
+
# in BBH_popI_II_gwcosmo, "BBH": event type, "popI_II": category, "gwcosmo": sub-category
|
|
596
|
+
if category==None:
|
|
597
|
+
category = "_popI_II"
|
|
598
|
+
else:
|
|
599
|
+
category = "_"+category
|
|
600
|
+
if sub_category==None:
|
|
601
|
+
sub_category = "_gwcosmo"
|
|
602
|
+
else:
|
|
603
|
+
sub_category = "_"+sub_category
|
|
606
604
|
|
|
607
|
-
|
|
608
|
-
|
|
605
|
+
# check mass
|
|
606
|
+
self.mass_constant = mass_constant
|
|
607
|
+
if mass_constant:
|
|
608
|
+
self.source_binary_masses = None
|
|
609
|
+
else:
|
|
610
|
+
self.m_min = m_min
|
|
611
|
+
self.m_max = m_max
|
|
612
|
+
try:
|
|
613
|
+
self.source_binary_masses = getattr(self, "binary_masses_" + event_type + category + sub_category)
|
|
614
|
+
except:
|
|
615
|
+
pass
|
|
609
616
|
|
|
617
|
+
# check spin
|
|
618
|
+
if spin_constant or spin_constant==0.:
|
|
619
|
+
self.spin_constant = spin_constant
|
|
610
620
|
else:
|
|
611
|
-
|
|
621
|
+
try:
|
|
622
|
+
self.binary_spin = getattr(self, "binary_spin_" + event_type)
|
|
623
|
+
except:
|
|
624
|
+
self.binary_spin = getattr(self, "binary_spin_BBH")
|
|
612
625
|
|
|
613
626
|
# set attribute
|
|
614
627
|
self.src_model_params = src_model_params
|
|
@@ -648,10 +661,6 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
648
661
|
f"refer to https://arxiv.org/abs/1908.06068 for parameter definitions, priors and sampling methods"
|
|
649
662
|
)
|
|
650
663
|
|
|
651
|
-
# inherit attributes from SourceGalaxyPopulationModel
|
|
652
|
-
z_min = self.z_min
|
|
653
|
-
z_max = self.z_max
|
|
654
|
-
|
|
655
664
|
def warning(param_):
|
|
656
665
|
try:
|
|
657
666
|
len(param_) == nsamples
|
|
@@ -660,29 +669,44 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
660
669
|
return 0
|
|
661
670
|
|
|
662
671
|
# sampling redshifts and luminosity distances
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
672
|
+
if self.redshift_constant:
|
|
673
|
+
if type(self.redshift_constant)==float or type(self.redshift_constant)==int:
|
|
674
|
+
zs = self.redshift_constant*np.ones(nsamples)
|
|
675
|
+
else:
|
|
676
|
+
# warning
|
|
677
|
+
print("Error: redshift_constant should be a float or false")
|
|
667
678
|
else:
|
|
668
|
-
|
|
669
|
-
|
|
679
|
+
try:
|
|
680
|
+
zs = kwargs["zs"]
|
|
681
|
+
except:
|
|
682
|
+
zs = self.sample_source_redshifts(size=nsamples, z_min=self.z_min, z_max=self.z_max)
|
|
670
683
|
luminosity_distance = self.z_to_luminosity_distance(zs) # Mpc
|
|
671
684
|
|
|
672
685
|
# sampling mass1 and mass2
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
686
|
+
if self.mass_constant:
|
|
687
|
+
if type(self.mass_constant)==list:
|
|
688
|
+
mass_1_source = self.mass_constant[0]*np.ones(nsamples)
|
|
689
|
+
mass_2_source = self.mass_constant[1]*np.ones(nsamples)
|
|
690
|
+
elif type(self.mass_constant)==float or type(self.mass_constant)==int:
|
|
691
|
+
mass_1_source = self.mass_constant*np.ones(nsamples)
|
|
692
|
+
mass_2_source = self.mass_constant*np.ones(nsamples)
|
|
693
|
+
else:
|
|
694
|
+
# warning
|
|
695
|
+
print("Error: mass_constant should be a float/list or false")
|
|
679
696
|
else:
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
697
|
+
try:
|
|
698
|
+
kwargs["mass_1"]
|
|
699
|
+
kwargs["mass_2"]
|
|
700
|
+
except:
|
|
701
|
+
mass_1_source, mass_2_source = self.source_binary_masses(
|
|
702
|
+
size=nsamples)
|
|
703
|
+
else:
|
|
704
|
+
mass_1 = kwargs["mass_1"]
|
|
705
|
+
warning(mass_1)
|
|
706
|
+
mass_2 = kwargs["mass_2"]
|
|
707
|
+
warning(mass_1)
|
|
708
|
+
mass_1_source, mass_2_source = self.source_binary_masses(
|
|
709
|
+
size=nsamples)
|
|
686
710
|
|
|
687
711
|
# Sample all other parameters
|
|
688
712
|
# use bilby priors
|
|
@@ -695,18 +719,25 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
695
719
|
theta_jn = prior_default["theta_jn"].sample(nsamples)
|
|
696
720
|
phase = prior_default["phase"].sample(nsamples)
|
|
697
721
|
# sampling spin parameters
|
|
698
|
-
if self.
|
|
722
|
+
if self.spin_constant==0. or self.spin_constant==True:
|
|
699
723
|
a_1 = np.zeros(nsamples)
|
|
700
724
|
a_2 = np.zeros(nsamples)
|
|
701
725
|
tilt_1 = np.zeros(nsamples)
|
|
702
726
|
tilt_2 = np.zeros(nsamples)
|
|
703
727
|
phi_12 = np.zeros(nsamples)
|
|
704
728
|
phi_jl = np.zeros(nsamples)
|
|
729
|
+
elif type(self.spin_constant)==list:
|
|
730
|
+
a_1 = self.spin_constant[0]*np.ones(nsamples)
|
|
731
|
+
a_2 = self.spin_constant[1]*np.ones(nsamples)
|
|
732
|
+
tilt_1 = self.spin_constant[2]*np.ones(nsamples)
|
|
733
|
+
tilt_2 = self.spin_constant[3]*np.ones(nsamples)
|
|
734
|
+
phi_12 = self.spin_constant[4]*np.ones(nsamples)
|
|
735
|
+
phi_jl = self.spin_constant[5]*np.ones(nsamples)
|
|
705
736
|
else:
|
|
706
737
|
a_1, a_2, tilt_1, tilt_2, phi_12, phi_jl = self.binary_spin(nsamples)
|
|
707
738
|
|
|
708
739
|
# compute GPS time
|
|
709
|
-
geocent_time = randint.rvs(1238166018, 1238166018 +
|
|
740
|
+
geocent_time = randint.rvs(1238166018, 1238166018 + 31536000, size=nsamples)
|
|
710
741
|
mass_1, mass_2 = mass_1_source * (1 + zs), mass_2_source * (1 + zs)
|
|
711
742
|
|
|
712
743
|
gw_parameters = {
|
|
@@ -732,7 +763,7 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
732
763
|
|
|
733
764
|
return gw_parameters
|
|
734
765
|
|
|
735
|
-
def
|
|
766
|
+
def binary_masses_BBH_popI_II_gwcosmo(self, size, alpha=3.63, beta=1.26, delta_m=4.82, mmin=4.59, mmax=86.22, lambda_peak=0.08, mu_g=33.07, sigma_g=5.69):
|
|
736
767
|
"""
|
|
737
768
|
Function to calculate source mass1 and mass2 with PowerLaw+PEAK model
|
|
738
769
|
|
|
@@ -767,6 +798,11 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
767
798
|
if key in keys_:
|
|
768
799
|
param[key] = value
|
|
769
800
|
|
|
801
|
+
if self.m_min is not None:
|
|
802
|
+
param["mmin"] = self.m_min
|
|
803
|
+
if self.m_max is not None:
|
|
804
|
+
param["mmax"] = self.m_max
|
|
805
|
+
|
|
770
806
|
model = p.mass_prior("BBH-powerlaw-gaussian", param)
|
|
771
807
|
mass_1_source, mass_2_source = model.sample(Nsample=size)
|
|
772
808
|
while np.any(mass_2_source > mass_1_source):
|
|
@@ -774,7 +810,7 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
774
810
|
|
|
775
811
|
return (mass_1_source, mass_2_source)
|
|
776
812
|
|
|
777
|
-
def
|
|
813
|
+
def binary_masses_BBH_popIII_gwcosmo(self, size, Mc=30.0, sigma=0.3, beta=1.1):
|
|
778
814
|
"""
|
|
779
815
|
Function to calculate source mass1 and mass2 with pop III origin
|
|
780
816
|
|
|
@@ -800,8 +836,15 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
800
836
|
>>> mass_1_source, mass_2_source = pop.binary_masses_popIII(size=1000)
|
|
801
837
|
|
|
802
838
|
"""
|
|
803
|
-
|
|
804
|
-
|
|
839
|
+
if self.m_min is not None:
|
|
840
|
+
m_min = self.m_min
|
|
841
|
+
else:
|
|
842
|
+
m_min = 4.59
|
|
843
|
+
if self.m_max is not None:
|
|
844
|
+
m_max = self.m_max
|
|
845
|
+
else:
|
|
846
|
+
m_max = 86.22
|
|
847
|
+
|
|
805
848
|
# replace values with self.src_model_params, if given
|
|
806
849
|
param = dict(Mc=Mc, sigma=sigma, beta=beta)
|
|
807
850
|
if self.src_model_params is not None:
|
|
@@ -824,7 +867,7 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
824
867
|
|
|
825
868
|
return (mass_1_source, mass_2_source)
|
|
826
869
|
|
|
827
|
-
def
|
|
870
|
+
def binary_masses_BBH_primordial_lognormal(self, size, Mc=30.0, sigma=0.3, beta=1.1):
|
|
828
871
|
"""
|
|
829
872
|
Function to calculate source mass1 and mass2 for primordial BBHs
|
|
830
873
|
|
|
@@ -850,8 +893,15 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
850
893
|
>>> mass_1_source, mass_2_source = pop.binary_masses_primordial(size=1000)
|
|
851
894
|
|
|
852
895
|
"""
|
|
853
|
-
|
|
854
|
-
|
|
896
|
+
if self.m_min is not None:
|
|
897
|
+
m_min = self.m_min
|
|
898
|
+
else:
|
|
899
|
+
m_min = 4.59
|
|
900
|
+
if self.m_max is not None:
|
|
901
|
+
m_max = self.m_max
|
|
902
|
+
else:
|
|
903
|
+
m_max = 86.22
|
|
904
|
+
|
|
855
905
|
# replace values with self.src_model_params, if given
|
|
856
906
|
param = dict(Mc=Mc, sigma=sigma, beta=beta)
|
|
857
907
|
if self.src_model_params is not None:
|
|
@@ -874,17 +924,23 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
874
924
|
|
|
875
925
|
return (mass_1_source, mass_2_source)
|
|
876
926
|
|
|
877
|
-
def
|
|
927
|
+
def binary_masses_BNS_popI_II_gwcosmo(self, size, mminns=1.0, mmaxns=3.0, alphans=0.0):
|
|
878
928
|
"""
|
|
879
|
-
Function to calculate source mass1 and mass2 of BNS
|
|
929
|
+
Function to calculate source mass1 and mass2 of BNS (gwcosmo)
|
|
880
930
|
|
|
881
931
|
Parameters
|
|
882
932
|
----------
|
|
883
933
|
size : `int`
|
|
884
934
|
Number of samples to draw
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
default:
|
|
935
|
+
mminns : `float`
|
|
936
|
+
Minimum mass of the BNS
|
|
937
|
+
default: 1.0
|
|
938
|
+
mmaxns : `float`
|
|
939
|
+
Maximum mass of the BNS
|
|
940
|
+
default: 3.0
|
|
941
|
+
alphans : `float`
|
|
942
|
+
Power law index
|
|
943
|
+
default: 0.0
|
|
888
944
|
|
|
889
945
|
Returns
|
|
890
946
|
----------
|
|
@@ -892,29 +948,82 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
892
948
|
Array of mass1 in source frame
|
|
893
949
|
mass_2_source : `array`
|
|
894
950
|
Array of mass2 in source frame
|
|
895
|
-
|
|
896
|
-
Examples
|
|
897
|
-
----------
|
|
898
|
-
>>> from ler import CompactBinaryPopulation
|
|
899
|
-
>>> pop = CompactBinaryPopulation(z_min=0.0001, z_max=10, m_min=1.0, m_max=3.0, event_type = "BNS")
|
|
900
|
-
>>> mass_1_source, mass_2_source = pop.binary_masses_BNS(size=1000)
|
|
901
|
-
|
|
902
951
|
"""
|
|
952
|
+
|
|
903
953
|
# replace values with self.src_model_params, if given
|
|
904
|
-
param = dict(
|
|
954
|
+
param = dict(mminns=1.0, mmaxns=3.0, alphans=0.0)
|
|
905
955
|
if self.src_model_params is not None:
|
|
906
956
|
keys_ = param.keys()
|
|
907
957
|
for key, value in self.src_model_params.items():
|
|
908
958
|
if key in keys_:
|
|
909
959
|
param[key] = value
|
|
910
|
-
|
|
911
|
-
|
|
960
|
+
|
|
961
|
+
if self.m_min is not None:
|
|
962
|
+
param["mminns"] = self.m_min
|
|
963
|
+
if self.m_max is not None:
|
|
964
|
+
param["mmaxns"] = self.m_max
|
|
965
|
+
|
|
966
|
+
model = p.mass_prior("BNS", param)
|
|
912
967
|
mass_1_source, mass_2_source = model.sample(Nsample=size)
|
|
913
968
|
while np.any(mass_2_source > mass_1_source):
|
|
914
969
|
mass_1_source, mass_2_source = model.sample(Nsample=size)
|
|
915
970
|
|
|
916
971
|
return (mass_1_source, mass_2_source)
|
|
972
|
+
|
|
973
|
+
def binary_masses_BNS_popI_II_Alsing(self, size, w=0.643, muL=1.352, sigmaL=0.08, muR=1.88, sigmaR=0.3, mmin=1., mmax=2.3):
|
|
974
|
+
"""
|
|
975
|
+
Function to calculate source mass1 and mass2 of BNS (Alsing)
|
|
917
976
|
|
|
977
|
+
Parameters
|
|
978
|
+
----------
|
|
979
|
+
size : `int`
|
|
980
|
+
Number of samples to draw
|
|
981
|
+
w, muL, sigmaL, muR, sigmaR : `float`
|
|
982
|
+
Fitting parameters
|
|
983
|
+
default: w=0.643, muL=1.352, sigmaL=0.08, muR=1.88, sigmaR=0.3
|
|
984
|
+
mmin : `float`
|
|
985
|
+
Minimum mass of the BNS
|
|
986
|
+
default: 1.0
|
|
987
|
+
mmax : `float`
|
|
988
|
+
Maximum mass of the BNS
|
|
989
|
+
default: 3.0
|
|
990
|
+
|
|
991
|
+
Returns
|
|
992
|
+
----------
|
|
993
|
+
mass_1_source : `array`
|
|
994
|
+
Array of mass1 in source frame
|
|
995
|
+
mass_2_source : `array`
|
|
996
|
+
Array of mass2 in source frame
|
|
997
|
+
"""
|
|
998
|
+
# print("\n BNS alsing \n")
|
|
999
|
+
# replace values with self.src_model_params, if given
|
|
1000
|
+
param = dict(w=0.643, muL=1.352, sigmaL=0.08, muR=1.88, sigmaR=0.3, mmin=1., mmax=2.3)
|
|
1001
|
+
if self.src_model_params is not None:
|
|
1002
|
+
keys_ = param.keys()
|
|
1003
|
+
for key, value in self.src_model_params.items():
|
|
1004
|
+
if key in keys_:
|
|
1005
|
+
param[key] = value
|
|
1006
|
+
|
|
1007
|
+
if self.m_min is not None:
|
|
1008
|
+
param["mmin"] = self.m_min
|
|
1009
|
+
if self.m_max is not None:
|
|
1010
|
+
param["mmax"] = self.m_max
|
|
1011
|
+
|
|
1012
|
+
pdf_unnormL = lambda m: np.exp(-(m-muL)**2 / (2*sigmaL**2))
|
|
1013
|
+
normL = quad(pdf_unnormL, mmin, mmax)[0]
|
|
1014
|
+
pdf_unnormR = lambda m: np.exp(-(m-muR)**2 / (2*sigmaR**2))
|
|
1015
|
+
normR = quad(pdf_unnormR, mmin, mmax)[0]
|
|
1016
|
+
|
|
1017
|
+
pdf = lambda m: w*pdf_unnormL(m) / normL + (1-w)*pdf_unnormR(m) / normR
|
|
1018
|
+
|
|
1019
|
+
mass_1_source = rejection_sample(pdf, mmin, mmax, size=size)
|
|
1020
|
+
mass_2_source = rejection_sample(pdf, mmin, mmax, size=size)
|
|
1021
|
+
# swap mass_1_source and mass_2_source if mass_2_source > mass_1_source
|
|
1022
|
+
idx = mass_2_source>mass_1_source
|
|
1023
|
+
mass_1_source[idx], mass_2_source[idx] = mass_2_source[idx], mass_1_source[idx]
|
|
1024
|
+
|
|
1025
|
+
return(mass_1_source, mass_2_source)
|
|
1026
|
+
|
|
918
1027
|
def mass_ratio(self, size, beta=1.1):
|
|
919
1028
|
"""
|
|
920
1029
|
Function to calculate mass ratio with power law distribution
|
|
@@ -942,7 +1051,7 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
942
1051
|
q = rejection_sample(pdf, 0, 1, size=size)
|
|
943
1052
|
return q
|
|
944
1053
|
|
|
945
|
-
def
|
|
1054
|
+
def binary_spin_BBH(self, size):
|
|
946
1055
|
"""
|
|
947
1056
|
Function to calculate spin parameters with PowerLaw+PEAK model
|
|
948
1057
|
|
|
@@ -970,7 +1079,7 @@ class CompactBinaryPopulation(SourceGalaxyPopulationModel):
|
|
|
970
1079
|
----------
|
|
971
1080
|
>>> from ler import CompactBinaryPopulation
|
|
972
1081
|
>>> pop = CompactBinaryPopulation(z_min=0.0001, z_max=10, m_min=4.59, m_max=86.22, event_type = "popI_II")
|
|
973
|
-
>>> a_1, a_2, tilt_1, tilt_2, phi_12, phi_jl = pop.
|
|
1082
|
+
>>> a_1, a_2, tilt_1, tilt_2, phi_12, phi_jl = pop.binary_spin_BBH(size=1000)
|
|
974
1083
|
|
|
975
1084
|
"""
|
|
976
1085
|
bilby.core.utils.logger.disabled = True
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ler
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
4
4
|
Summary: Gravitational waves Lensing Rates
|
|
5
5
|
Home-page: https://github.com/hemantaph/ler
|
|
6
6
|
Author: Hemantakumar
|
|
@@ -9,28 +9,28 @@ License: MIT
|
|
|
9
9
|
Requires-Python: >=3.10
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
License-File: LICENSE
|
|
12
|
-
Requires-Dist: setuptools
|
|
13
|
-
Requires-Dist: numpy
|
|
14
|
-
Requires-Dist: numba
|
|
15
|
-
Requires-Dist: bilby
|
|
16
|
-
Requires-Dist: gwsnr
|
|
17
|
-
Requires-Dist: scipy
|
|
18
|
-
Requires-Dist: lenstronomy
|
|
19
|
-
Requires-Dist: astropy
|
|
20
|
-
Requires-Dist: tqdm
|
|
21
|
-
Requires-Dist: pointpats
|
|
22
|
-
Requires-Dist: shapely
|
|
12
|
+
Requires-Dist: setuptools >=65.5.0
|
|
13
|
+
Requires-Dist: numpy >=1.18
|
|
14
|
+
Requires-Dist: numba >=0.57.1
|
|
15
|
+
Requires-Dist: bilby >=1.0.2
|
|
16
|
+
Requires-Dist: gwsnr >=0.1
|
|
17
|
+
Requires-Dist: scipy >=1.9.0
|
|
18
|
+
Requires-Dist: lenstronomy >=1.10.4
|
|
19
|
+
Requires-Dist: astropy >=5.1
|
|
20
|
+
Requires-Dist: tqdm >=4.64.1
|
|
21
|
+
Requires-Dist: pointpats >=2.3
|
|
22
|
+
Requires-Dist: shapely >=2.0.1
|
|
23
23
|
|
|
24
24
|
# LeR
|
|
25
25
|
[](https://zenodo.org/badge/latestdoi/626733473) [](https://badge.fury.io/py/ler) [](https://ler.readthedocs.io/en/latest/)
|
|
26
26
|
|
|
27
|
-
`LeR` is a statistical-based python package whose core function is designed for the computation of detectable rates pertaining to both lensed and unlensed gravitational wave (GW) events. This calculation intricately hinges upon the interplay of various components within the package, which can be categorized into three primary segments: 1. Sampling the properties of compact-binary sources, 2. Sampling characteristics of lens galaxies, and 3. Solving the lens equation to derive image attributes of the source. The holistic functionality of the package is built upon leveraging array operations and linear algebra from the numpy library, interpolation from scipy
|
|
27
|
+
`LeR` is a statistical-based python package whose core function is designed for the computation of detectable rates pertaining to both lensed and unlensed gravitational wave (GW) events. This calculation intricately hinges upon the interplay of various components within the package, which can be categorized into three primary segments: 1. Sampling the properties of compact-binary sources, 2. Sampling characteristics of lens galaxies, and 3. Solving the lens equation to derive image attributes of the source. The holistic functionality of the package is built upon leveraging array operations and linear algebra from the `numpy` library, interpolation from `scipy`, and the `multiprocessing` capability inherent to Python. This design optimizes both speed and functionality while upholding user-friendliness. The architecture of the "LeR" API is deliberately organized such that each distinct functionality holds its own significance in scientific research. Simultaneously, these functionalities seamlessly integrate and can be employed collectively based on specific research requirements. Key features of `LeR` and its dependencies can be summarized as follows,
|
|
28
28
|
|
|
29
29
|
- Detectable merger rates:
|
|
30
30
|
* The calculation depends not only on simulated event properties but also on GW detector detectability. We compute optimal signal-to-noise ratios (SNRs) for simulated events, which can be computationally intensive. `LeR` mitigates this using [`gwsnr`](https://github.com/hemantaph/gwsnr) for efficient and rapid SNR calculation. `gwsnr` enables rate calculation for current and future detectors with customizable sensitivities.
|
|
31
31
|
* The merger rates of both the simulated unlensed and lensed events can be computed and subsequently compared.
|
|
32
32
|
- Sampling GW sources:
|
|
33
|
-
* The distribution of the source's red-shift is based on the merger rate density of compact binaries, including
|
|
33
|
+
* The distribution of the source's red-shift is based on the merger rate density of compact binaries, including BBHs, BNSs etc. The code is meticulously structured to facilitate straightforward incorporation of future updates or additional distributions of such sources by users.
|
|
34
34
|
* The sampling of intrinsic and extrinsic parameters of gravitational wave sources is conducted employing the prior distributions encompassed within the `gwcosmo` and `bilby` Python packages. Prior to parameterizing the rate calculation, users retain the flexibility to manually substitute any relevant parameters as needed.
|
|
35
35
|
- Sampling of lens galaxies:
|
|
36
36
|
* The Lens distribution follows [(Oguri et al. 2018](https://arxiv.org/abs/1807.02584). It depends on the sampled source red-shifts and also on the optical depth.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ler/__init__.py,sha256=AJAzME0UfCcFxMEanfGjDFvXJ8Fp2hZVqE3uJBzFKpo,494
|
|
2
|
+
ler/helperroutines.py,sha256=oWl0mnuKxyfVoQ-ovGnJueZPtOfrUyzuj2Fe5KxxBrk,6411
|
|
3
|
+
ler/lens_galaxy_population.py,sha256=RQi_w8TZoKW9FezT6eLkLumJIUr-r8GGzp6_0mO3MPQ,45456
|
|
4
|
+
ler/ler.py,sha256=kZevTjO7qs5Ab82C9GANmeKFfkkryPHbbMJJTJFHa3k,71133
|
|
5
|
+
ler/multiprocessing_routine.py,sha256=xazcM5V0w_ACiqo6DuBqP1DkX4-B-rCuTKSXRexxNxA,16064
|
|
6
|
+
ler/source_population.py,sha256=ziBVbk8Zaxr3-z8y1zpKk6e38sSpq0R-G-VjLKgLSQw,42112
|
|
7
|
+
ler-0.2.9.dist-info/LICENSE,sha256=9LeXXC3WaHBpiUGhLVgOVnz0F12olPma1RX5zgpfp8Q,1081
|
|
8
|
+
ler-0.2.9.dist-info/METADATA,sha256=_R340mtnYbn_ZBWXOfNxGPpuJXtlADE58HPgN69ZPvY,5086
|
|
9
|
+
ler-0.2.9.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
|
|
10
|
+
ler-0.2.9.dist-info/top_level.txt,sha256=VWeWLF_gNMjzquGmqrLXqp2J5WegY86apTUimMTh68I,4
|
|
11
|
+
ler-0.2.9.dist-info/RECORD,,
|
ler-0.2.7.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
ler/__init__.py,sha256=nUMMeFqWc6NR79ztnqptdyAVviJwuGUuWtXYmSSJ58I,313
|
|
2
|
-
ler/helperroutines.py,sha256=oWl0mnuKxyfVoQ-ovGnJueZPtOfrUyzuj2Fe5KxxBrk,6411
|
|
3
|
-
ler/lens_galaxy_population.py,sha256=bj0RR4EqWF5z6hcAjAKBfmZuz43aI-FxstJGBIC3lWo,44403
|
|
4
|
-
ler/ler.py,sha256=-QYE6jD72F_yjnqQPe-JbqX5jvMrh_-6Eqa8rOsVQ-M,69959
|
|
5
|
-
ler/multiprocessing_routine.py,sha256=xazcM5V0w_ACiqo6DuBqP1DkX4-B-rCuTKSXRexxNxA,16064
|
|
6
|
-
ler/source_population.py,sha256=MjjkJB_CgxLw7Dk4PR9zhZGy43ItwPaN84vnZrnedTU,37786
|
|
7
|
-
ler-0.2.7.dist-info/LICENSE,sha256=9LeXXC3WaHBpiUGhLVgOVnz0F12olPma1RX5zgpfp8Q,1081
|
|
8
|
-
ler-0.2.7.dist-info/METADATA,sha256=BJHMTmWPC5phG4iYfggGyc3GYjIxhFlJ8Hyc2Yz5uVM,5144
|
|
9
|
-
ler-0.2.7.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
10
|
-
ler-0.2.7.dist-info/top_level.txt,sha256=VWeWLF_gNMjzquGmqrLXqp2J5WegY86apTUimMTh68I,4
|
|
11
|
-
ler-0.2.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|