ler 0.2.7__tar.gz → 0.2.9__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ler
3
- Version: 0.2.7
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,17 +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>=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
12
23
 
13
24
  # LeR
14
25
  [![DOI](https://zenodo.org/badge/626733473.svg)](https://zenodo.org/badge/latestdoi/626733473) [![PyPI version](https://badge.fury.io/py/ler.svg)](https://badge.fury.io/py/ler) [![DOCS](https://readthedocs.org/projects/ler/badge/?version=latest)](https://ler.readthedocs.io/en/latest/)
15
26
 
16
- `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,
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,
17
28
 
18
29
  - Detectable merger rates:
19
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.
20
31
  * The merger rates of both the simulated unlensed and lensed events can be computed and subsequently compared.
21
32
  - Sampling GW sources:
22
- * The distribution of the source's red-shift is based on the merger rate density of compact binaries, including binary black hole (BBH), binary neutron star (BNS) etc. The code is meticulously structured to facilitate straightforward incorporation of future updates or additional distributions of such sources by users.
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.
23
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.
24
35
  - Sampling of lens galaxies:
25
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.
@@ -1,13 +1,13 @@
1
1
  # LeR
2
2
  [![DOI](https://zenodo.org/badge/626733473.svg)](https://zenodo.org/badge/latestdoi/626733473) [![PyPI version](https://badge.fury.io/py/ler.svg)](https://badge.fury.io/py/ler) [![DOCS](https://readthedocs.org/projects/ler/badge/?version=latest)](https://ler.readthedocs.io/en/latest/)
3
3
 
4
- `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,
4
+ `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,
5
5
 
6
6
  - Detectable merger rates:
7
7
  * 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.
8
8
  * The merger rates of both the simulated unlensed and lensed events can be computed and subsequently compared.
9
9
  - Sampling GW sources:
10
- * The distribution of the source's red-shift is based on the merger rate density of compact binaries, including binary black hole (BBH), binary neutron star (BNS) etc. The code is meticulously structured to facilitate straightforward incorporation of future updates or additional distributions of such sources by users.
10
+ * 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.
11
11
  * 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.
12
12
  - Sampling of lens galaxies:
13
13
  * 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.
@@ -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
@@ -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.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.strong_lensing_optical_depth(z)
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.strong_lensing_optical_depth(zs)
449
- tau_max = np.max(self.strong_lensing_optical_depth(z_max))
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 strong_lensing_optical_depth(self, zs):
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(
@@ -200,7 +200,7 @@ class LeR:
200
200
  self,
201
201
  nsamples=100000,
202
202
  npool=int(4),
203
- z_min=0.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": "popI_II",
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
- "spin_zero": False,
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 self._gw_param == "default":
312
- f = open("gw_params.json", "r", encoding="utf-8")
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 self._gw_param_detectable == "default":
329
- f = open("gw_params_detectable.json", "r", encoding="utf-8")
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 self._lensed_param == "default":
346
- f = open("lensed_params.json", "r", encoding="utf-8")
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 self._lensed_param_detectable == "default":
363
- f = open("lensed_params_detectable.json", "r", encoding="utf-8")
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
- spin_zero=self.gw_param_sampler_dict["spin_zero"],
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
- print(f"no json file found with name {json_file}. Set resume=False")
595
- return None
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 gw_param dict. Exiting...")
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
- # Below can be just one line with 3D numpy operation
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['unlensed_rate_ratio_step'] = rate_ratio
1255
+ data['rate_ratio_step'] = rate_ratio
1238
1256
  elif detectability_condition == "pdet":
1239
- data['unlensed_rate_ratio_pdet'] = rate_ratio
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")
@@ -132,9 +132,10 @@ class SourceGalaxyPopulationModel:
132
132
 
133
133
  def __init__(
134
134
  self,
135
- z_min=0.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_" + "popI_II")
162
+ self.merger_rate_density = getattr(self, "merger_rate_density_" + "popI_II_Oguri")
158
163
 
159
- merger_rate_density_detector_frame = lambda z: self.merger_rate_density(z) / (
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: merger_rate_density_detector_frame(
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 = "popI_II")
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
- merger_rate_density_detector_frame = lambda z: self.merger_rate_density(z) / (
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: merger_rate_density_detector_frame(
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 merger_rate_density_popI_II(self, zs, R0=23.9 * 1e-9, b2=1.6, b3=2.0, b4=30):
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 = "popI_II")
281
- >>> rate_density = pop.merger_rate_density_popI_II(zs=0.1)
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 merger_rate_density_popIII(self, zs, aIII=0.66, bIII=0.3, zIII=11.6):
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 merger_rate_density_primordial(self, zs, t0=13.786885302009708):
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=4.59,
556
- m_max=86.22,
557
- event_type="popI_II",
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
- spin_zero=False,
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
- super().__init__(z_min=z_min, z_max=z_max, event_type=event_type, merger_rate_density_fn=merger_rate_density_fn, merger_rate_density_param=merger_rate_density_param)
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
- elif event_type == "popIII":
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
- elif event_type == "BNS":
598
- # check the mass is for neutron stars
599
- if m_min < 1.4:
600
- print("WARNING: m_min is too low for neutron stars")
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
- elif event_type == "popI_II_Madau_Dickinson":
605
- self.source_binary_masses = getattr(self, "binary_masses_" + "popI_II")
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
- elif event_type == "primordial":
608
- pass
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
- print(f"Event Type: {event_type} is not recognised")
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
- try:
664
- kwargs["zs"]
665
- except:
666
- zs = self.sample_source_redshifts(size=nsamples, z_min=z_min, z_max=z_max)
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
- zs = kwargs["zs"]
669
- warning(zs)
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
- try:
674
- kwargs["mass_1"]
675
- kwargs["mass_2"]
676
- except:
677
- mass_1_source, mass_2_source = self.source_binary_masses(
678
- size=nsamples)
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
- mass_1 = kwargs["mass_1"]
681
- warning(mass_1)
682
- mass_2 = kwargs["mass_2"]
683
- warning(mass_1)
684
- mass_1_source, mass_2_source = self.source_binary_masses(
685
- size=nsamples)
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.spin_zero:
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 + 15811200, size=nsamples)
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 binary_masses_popI_II(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):
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 binary_masses_popIII(self, size, Mc=30.0, sigma=0.3, beta=1.1):
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
- m_min = self.m_min
804
- m_max = self.m_max
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 binary_masses_primordial(self, size, Mc=30.0, sigma=0.3, beta=1.1):
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
- m_min = self.m_min
854
- m_max = self.m_max
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 binary_masses_BNS(self, size, muL=1.35, sigmaL=0.08, muR=1.8, sigmaR=0.3):
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
- muL, sigmaL, muR, sigmaR : `float`
886
- Fitting parameters
887
- default: muL=1.35, sigmaL=0.08, muR=1.8, sigmaR=0.3
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(muL=muL, sigmaL=sigmaL, muR=muR, sigmaR=sigmaR)
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
- model = p.mass_prior("BNS", None)
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 binary_spin_popI_II(self, size):
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.binary_spin_popI_II(size=1000)
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.7
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,17 +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>=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
12
23
 
13
24
  # LeR
14
25
  [![DOI](https://zenodo.org/badge/626733473.svg)](https://zenodo.org/badge/latestdoi/626733473) [![PyPI version](https://badge.fury.io/py/ler.svg)](https://badge.fury.io/py/ler) [![DOCS](https://readthedocs.org/projects/ler/badge/?version=latest)](https://ler.readthedocs.io/en/latest/)
15
26
 
16
- `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,
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,
17
28
 
18
29
  - Detectable merger rates:
19
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.
20
31
  * The merger rates of both the simulated unlensed and lensed events can be computed and subsequently compared.
21
32
  - Sampling GW sources:
22
- * The distribution of the source's red-shift is based on the merger rate density of compact binaries, including binary black hole (BBH), binary neutron star (BNS) etc. The code is meticulously structured to facilitate straightforward incorporation of future updates or additional distributions of such sources by users.
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.
23
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.
24
35
  - Sampling of lens galaxies:
25
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.
@@ -1,4 +1,4 @@
1
- setuptools>=67.8.0
1
+ setuptools>=65.5.0
2
2
  numpy>=1.18
3
3
  numba>=0.57.1
4
4
  bilby>=1.0.2
@@ -13,7 +13,7 @@ if python_version < (3, 10):
13
13
 
14
14
  setup(
15
15
  name="ler",
16
- version="0.2.7",
16
+ version="0.2.9",
17
17
  description="Gravitational waves Lensing Rates",
18
18
  long_description=long_description,
19
19
  long_description_content_type='text/markdown',
@@ -24,7 +24,7 @@ setup(
24
24
  packages=find_packages(),
25
25
  python_requires='>=3.10',
26
26
  install_requires=[
27
- "setuptools>=67.8.0",
27
+ "setuptools>=65.5.0",
28
28
  "numpy>=1.18",
29
29
  "numba>=0.57.1",
30
30
  "bilby>=1.0.2",
@@ -35,6 +35,6 @@ setup(
35
35
  "tqdm>=4.64.1",
36
36
  "pointpats>=2.3",
37
37
  "shapely>=2.0.1",
38
- #"gwcosmo @ git+https://git.ligo.org/lscsoft/gwcosmo.git@v1.0.0",
38
+ #"gwcosmo@git+https://git.ligo.org/lscsoft/gwcosmo.git@v1.0.0",
39
39
  ],
40
40
  )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes