ler.gw_source_population
Submodules
Package Contents
Classes
Class to generate a population of source galaxies. |
|
Class to generate a population of source galaxies. |
|
Class to generate a population of compact binaries. It helps sample all the intrinsic and extrinsic parameters of compact binaries. This daughter class inherits from |
Functions
|
Function to decide which interpolator to use. |
|
Function to interpolate using cubic spline. |
|
Function to sample from the inverse transform method. |
|
Function to compute the merger rate density (PopI/PopII). Reference: Oguri et al. (2018). The output is in detector frame and is unnormalized. |
|
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014). The output is in detector frame and is unnormalized. |
|
Function to compute the unnormalized merger rate density (PopIII). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized. |
|
Function to compute the merger rate density (Primordial). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized. |
|
Function to decide which interpolator to use. |
|
Function to interpolate using cubic spline. |
|
Function to sample from a lognormal distribution in 2D space. Reference: Ng et al. 2022. This a helper function for popIII BBH and primordial BBH merger rate density distribution functions. |
|
Function to sample from a distribution using inverse transform sampling. This is a helper function BNS Alsing mass distribution function. |
|
Function to sample from the inverse transform method. |
|
Function to compute the merger rate density (PopI/PopII). Reference: Oguri et al. (2018). The output is in detector frame and is unnormalized. |
|
Function to compute the unnormalized merger rate density (PopIII). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized. |
|
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014). The output is in detector frame and is unnormalized. |
|
Function to compute the merger rate density (Primordial). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized. |
|
Function to sample from a lognormal distribution in 2D space. Reference: Ng et al. 2022. This a helper function for popIII BBH and primordial BBH merger rate density distribution functions. |
|
Function to sample from a distribution using inverse transform sampling. This is a helper function BNS Alsing mass distribution function. |
- ler.gw_source_population.interpolator_from_pickle(param_dict_given, directory, sub_directory, name, x, pdf_func=None, y=None, conditioned_y=None, dimension=1, category='pdf', create_new=False)[source]
Function to decide which interpolator to use.
- Parameters:
- param_dict_givendict
dictionary of parameters.
- directorystr
directory to store the interpolator.
- sub_directorystr
sub-directory to store the interpolator.
- namestr
name of the interpolator.
- xnumpy.ndarray
x values.
- pdf_funcfunction
function to calculate the pdf of x given y.
- ynumpy.ndarray
y values.
- conditioned_ynumpy.ndarray
conditioned y values.
- dimensionint
dimension of the interpolator. Default is 1.
- categorystr
category of the function. Default is “pdf”.
- create_newbool
if True, create a new interpolator. Default is False.
- Returns:
- interpolatorfunction
interpolator function.
- ler.gw_source_population.cubic_spline_interpolator(xnew, coefficients, x)[source]
Function to interpolate using cubic spline.
- Parameters:
- xnewnumpy.ndarray
new x values.
- coefficientsnumpy.ndarray
coefficients of the cubic spline.
- xnumpy.ndarray
x values.
- Returns:
- resultnumpy.ndarray
interpolated values.
- ler.gw_source_population.inverse_transform_sampler(size, cdf, x)[source]
Function to sample from the inverse transform method.
- Parameters:
- sizeint
number of samples.
- cdfnumpy.ndarray
cdf values.
- xnumpy.ndarray
x values.
- Returns:
- samplesnumpy.ndarray
samples from the cdf.
- ler.gw_source_population.merger_rate_density_bbh_popI_II_oguri2018(zs, R0=23.9 * 1e-09, b2=1.6, b3=2.0, b4=30)[source]
Function to compute the merger rate density (PopI/PopII). Reference: Oguri et al. (2018). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- R0float
local merger rate density at low redshift default: 23.9*1e-9 Mpc^-3 yr^-1
- b2float
Fitting paramters default: 1.6
- b3float
Fitting paramters default: 2.0
- b4float
Fitting paramters default: 30
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import merger_rate_density_bbh_popI_II_oguri2018 >>> rate_density = merger_rate_density_bbh_popI_II_oguri2018(zs=0.1)
- ler.gw_source_population.star_formation_rate_madau_dickinson2014(zs, af=2.7, bf=5.6, cf=2.9)[source]
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- affloat
Fitting paramters default: 2.7
- bffloat
Fitting paramters default: 5.6
- cffloat
Fitting paramters default: 2.9
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import star_formation_rate_madau_dickinson2014 >>> rate_density = star_formation_rate_madau_dickinson2014(zs=0.1)
- ler.gw_source_population.merger_rate_density_bbh_popIII_ken2022(zs, n0=19.2 * 1e-09, aIII=0.66, bIII=0.3, zIII=11.6)[source]
Function to compute the unnormalized merger rate density (PopIII). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- n0float
normalization constant default: 19.2*1e-9
- aIIIfloat
Fitting paramters default: 0.66
- bIIIfloat
Fitting paramters default: 0.3
- zIIIfloat
Fitting paramters default: 11.6
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import merger_rate_density_bbh_popIII_ken2022 >>> rate_density = merger_rate_density_bbh_popIII_ken2022(zs=0.1)
- ler.gw_source_population.merger_rate_density_bbh_primordial_ken2022(zs, cosmology=cosmo, n0=0.044 * 1e-09, t0=13.786885302009708)[source]
Function to compute the merger rate density (Primordial). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat
Source redshifts
- n0float
normalization constant default: 0.044*1e-9
- t0float
Present age of the Universe in Gyr default: 13.786885302009708
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(t0=13.786885302009708)
- Returns:
- rate_densityfloat
merger rate density
- class ler.gw_source_population.CBCSourceRedshiftDistribution(z_min=0.001, z_max=10.0, event_type='BBH', merger_rate_density='merger_rate_density_bbh_popI_II_oguri2018', merger_rate_density_param=None, cosmology=None, directory='./interpolator_pickle', create_new_interpolator=False)[source]
Bases:
object
Class to generate a population of source galaxies. This class is inherited by
CompactBinaryPopulation
andLensGalaxyParameterDistribution
class.- Parameters:
- z_minfloat
Minimum redshift of the source population default: 0.
- z_maxfloat
Maximum redshift of the source population default: 10.
- event_typestr
Type of event to generate. e.g. ‘BBH’, ‘BNS’, ‘NSBH’
- cosmologyastropy.cosmology
Cosmology to use default: None/astropy.cosmology.FlatLambdaCDM(H0=70, Om0=0.3)
- merger_rate_densitystr or function
Type of merger rate density function to use default: ‘merger_rate_density_popI_II_oguri2018’ for others see instance method in
merger_rate_density_model_list
- merger_rate_density_paramdict
Dictionary of merger rate density function parameters default: None/dict(R0=25 * 1e-9, b2=1.6, b3=2.0, b4=30)
- directorystr
Directory to store the interpolator pickle files default: ‘./interpolator_pickle’
- create_new_interpolatordict
Dictionary of interpolator creation parameters default: None/dict(redshift_distribution=dict(create_new=False, resolution=500), z_to_luminosity_distance=dict(create_new=False, resolution=500), differential_comoving_volume=dict(create_new=False, resolution=500))
Examples
>>> from ler.gw_source_population import CBCSourceRedshiftDistribution >>> cbc = CBCSourceRedshiftDistribution(z_min=0.001, z_max=10, merger_rate_density="merger_rate_density_bbh_popI_II_oguri2018") >>> cbc.merger_rate_density(zs=0.0001) # local merger rate density at low redshift
Instance Attributes
SourceGalaxyPopulationModel has the following instance attributes:
Atrributes
Type
float
float
str
astropy.cosmology
dict
float
List of available merger rate density functions and its parameters
Function to sample source redshifts (source frame)
Instance Methods
SourceGalaxyPopulationModel has the following instance methods:
Methods
Type
function
function
function
Function to compute the pdf p(z)
Function to compute the merger rate density (source frame)
Function to create a lookup table for the differential comoving volume and luminosity distance wrt redshift
Function to compute the merger rate density (PopI/PopII) from Oguri et al. (2018)
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014)
Function to compute the merger rate density (PopIII)
Function to compute the merger rate density (Primordial)
- property sample_source_redshift
Function to sample source redshifts (source frame) between z_min and z_max from the source galaxy population
- Parameters:
- sizeint
Number of samples to generate
- Returns:
- zs
Source redshifts
- property merger_rate_density
Function to get the merger rate density function wrt redshift. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat
1D array of floats Source redshifts
- Returns:
- merger_rate_densityfloat
merger rate density in detector frame (Mpc^-3 yr^-1)
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> cbc = SourceGalaxyPopulationModel() >>> merger_rate_density = cbc.merger_rate_density(zs=0.1)
- property merger_rate_density_model_list
Dictionary of available merger rate density functions and its parameters.
- z_min
float
Minimum redshift of the source population
- z_max
float
Maximum redshift of the source population
- event_type
str
Type of event to generate.
e.g. ‘BBH’, ‘BNS’, ‘NSBH’
- cosmo
astropy.cosmology
Cosmology to use for the redshift distribution.
e.g. Planck18, WMAP9, FlatLambdaCDM(H0=70, Om0=0.3) etc.
- merger_rate_density_param
dict
Dictionary of merger rate density function input parameters
- c_n_i
dict
c_n_i stands for ‘create new interpolator’. Dictionary of interpolator creation parameters.
e.g. dict(redshift_distribution=dict(create_new=False, resolution=500), z_to_luminosity_distance=dict(create_new=False, resolution=500), differential_comoving_volume=dict(create_new=False, resolution=500))
- normalization_pdf_z
float
Normalization constant of the pdf p(z)
- z_to_luminosity_distance
scipy.interpolate.interpolate
Function to convert redshift to luminosity distance
- differential_comoving_volume
scipy.interpolate.interpolate
Function to calculate the differential comoving volume
- pdf_z(zs, param=None)[source]
Function to compute the pdf p(z). The output is in source frame and is normalized.
- Parameters:
- zsfloat or numpy.ndarray (1D array of floats)
Source redshifts
- paramdict
Allows to pass in above parameters as dict. e.g. if the merger_rate_density is merger_rate_density_bbh_popI_II_oguri2018 param = dict(R0=23.9*1e-9, b2=1.6, b3=2.0, b4=30)
- Returns:
- pdfnumpy.ndarray
1D array of floats pdf p(z)
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> cbc = SourceGalaxyPopulationModel() >>> pdf = cbc.pdf_z(zs=0.1)
- merger_rate_density_src_frame(zs, param=None)[source]
Function to compute the merger rate density (source frame). The output is in source frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (1D array of floats)
Source redshifts
- paramdict
Allows to pass in above parameters as dict. e.g. if the merger_rate_density is merger_rate_density_bbh_popI_II_oguri2018 param = dict(R0=23.9*1e-9, b2=1.6, b3=2.0, b4=30)
- Returns:
- rate_densitynumpy.ndarray
1D array of floats merger rate density (source frame) (Mpc^-3 yr^-1)
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> cbc = SourceGalaxyPopulationModel() >>> rate_density = cbc.merger_rate_density_src_frame(zs=0.1)
- merger_rate_density_bbh_popI_II_oguri2018(zs, R0=23.9 * 1e-09, b2=1.6, b3=2.0, b4=30, param=None)[source]
Function to compute the merger rate density (PopI/PopII). Reference: Oguri et al. (2018). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- R0float
local merger rate density at low redshift default: 23.9*1e-9 Mpc^-3 yr^-1
- b2float
Fitting paramters default: 1.6
- b3float
Fitting paramters default: 2.0
- b4float
Fitting paramters default: 30
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(R0=23.9*1e-9, b2=1.6, b3=2.0, b4=30) default: None
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=0.0, z_max=10, event_type = "BBH", merger_rate_density="merger_rate_density_bbh_popI_II_oguri2018") >>> rate_density = pop.merger_rate_density(zs=0.1)
- star_formation_rate_madau_dickinson2014(zs, af=2.7, bf=5.6, cf=2.9, param=None)[source]
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- affloat
Fitting paramters default: 2.7
- bffloat
Fitting paramters default: 5.6
- cffloat
Fitting paramters default: 2.9
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(af=2.7, bf=5.6, cf=2.9) default: None
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=5., z_max=40., event_type = "BBH", merger_rate_density="star_formation_rate_madau_dickinson2014") >>> rate_density = pop.merger_rate_density(zs=10)
- merger_rate_density_bbh_popIII_ken2022(zs, n0=19.2 * 1e-09, aIII=0.66, bIII=0.3, zIII=11.6, param=None)[source]
Function to compute the unnormalized merger rate density (PopIII). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- n0float
normalization constant default: 19.2*1e-9
- aIIIfloat
Fitting paramters default: 0.66
- bIIIfloat
Fitting paramters default: 0.3
- zIIIfloat
Fitting paramters default: 11.6
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(aIII=0.66, bIII=0.3, zIII=11.6) default: None
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=5, z_max=40, event_type = "BBH", merger_rate_density="merger_rate_density_popIII_ken2022") >>> rate_density = pop.merger_rate_density(zs=10) >>> rate_density # Mpc^-3 yr^-1 1.5107979464621443e-08
- merger_rate_density_bbh_primordial_ken2022(zs, n0=0.044 * 1e-09, t0=13.786885302009708, param=None)[source]
Function to compute the merger rate density (Primordial). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat
Source redshifts
- n0float
normalization constant default: 0.044*1e-9
- t0float
Present age of the Universe in Gyr default: 13.786885302009708
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(t0=13.786885302009708)
- Returns:
- rate_densityfloat
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=5, z_max=40, event_type = "BBH", merger_rate_density="merger_rate_density_bbh_primordial_ken2022") >>> rate_density = pop.merger_rate_density(zs=10) >>> rate_density # Mpc^-3 yr^-1 9.78691173794454e-10
- create_lookup_table(z_min, z_max, directory)[source]
Function to create a lookup table for the differential comoving volume and luminosity distance wrt redshift.
- Parameters:
- z_minfloat
Minimum redshift of the source population
- z_maxfloat
Maximum redshift of the source population
- Attributes:
- z_to_luminosity_distancescipy.interpolate.interpolate
Function to convert redshift to luminosity distance
- differential_comoving_volumescipy.interpolate.interpolate
Function to calculate the differential comoving volume
- ler.gw_source_population.interpolator_from_pickle(param_dict_given, directory, sub_directory, name, x, pdf_func=None, y=None, conditioned_y=None, dimension=1, category='pdf', create_new=False)[source]
Function to decide which interpolator to use.
- Parameters:
- param_dict_givendict
dictionary of parameters.
- directorystr
directory to store the interpolator.
- sub_directorystr
sub-directory to store the interpolator.
- namestr
name of the interpolator.
- xnumpy.ndarray
x values.
- pdf_funcfunction
function to calculate the pdf of x given y.
- ynumpy.ndarray
y values.
- conditioned_ynumpy.ndarray
conditioned y values.
- dimensionint
dimension of the interpolator. Default is 1.
- categorystr
category of the function. Default is “pdf”.
- create_newbool
if True, create a new interpolator. Default is False.
- Returns:
- interpolatorfunction
interpolator function.
- ler.gw_source_population.cubic_spline_interpolator(xnew, coefficients, x)[source]
Function to interpolate using cubic spline.
- Parameters:
- xnewnumpy.ndarray
new x values.
- coefficientsnumpy.ndarray
coefficients of the cubic spline.
- xnumpy.ndarray
x values.
- Returns:
- resultnumpy.ndarray
interpolated values.
- class ler.gw_source_population.CBCSourceRedshiftDistribution(z_min=0.001, z_max=10.0, event_type='BBH', merger_rate_density='merger_rate_density_bbh_popI_II_oguri2018', merger_rate_density_param=None, cosmology=None, directory='./interpolator_pickle', create_new_interpolator=False)[source]
Bases:
object
Class to generate a population of source galaxies. This class is inherited by
CompactBinaryPopulation
andLensGalaxyParameterDistribution
class.- Parameters:
- z_minfloat
Minimum redshift of the source population default: 0.
- z_maxfloat
Maximum redshift of the source population default: 10.
- event_typestr
Type of event to generate. e.g. ‘BBH’, ‘BNS’, ‘NSBH’
- cosmologyastropy.cosmology
Cosmology to use default: None/astropy.cosmology.FlatLambdaCDM(H0=70, Om0=0.3)
- merger_rate_densitystr or function
Type of merger rate density function to use default: ‘merger_rate_density_popI_II_oguri2018’ for others see instance method in
merger_rate_density_model_list
- merger_rate_density_paramdict
Dictionary of merger rate density function parameters default: None/dict(R0=25 * 1e-9, b2=1.6, b3=2.0, b4=30)
- directorystr
Directory to store the interpolator pickle files default: ‘./interpolator_pickle’
- create_new_interpolatordict
Dictionary of interpolator creation parameters default: None/dict(redshift_distribution=dict(create_new=False, resolution=500), z_to_luminosity_distance=dict(create_new=False, resolution=500), differential_comoving_volume=dict(create_new=False, resolution=500))
Examples
>>> from ler.gw_source_population import CBCSourceRedshiftDistribution >>> cbc = CBCSourceRedshiftDistribution(z_min=0.001, z_max=10, merger_rate_density="merger_rate_density_bbh_popI_II_oguri2018") >>> cbc.merger_rate_density(zs=0.0001) # local merger rate density at low redshift
Instance Attributes
SourceGalaxyPopulationModel has the following instance attributes:
Atrributes
Type
float
float
str
astropy.cosmology
dict
float
List of available merger rate density functions and its parameters
Function to sample source redshifts (source frame)
Instance Methods
SourceGalaxyPopulationModel has the following instance methods:
Methods
Type
function
function
function
Function to compute the pdf p(z)
Function to compute the merger rate density (source frame)
Function to create a lookup table for the differential comoving volume and luminosity distance wrt redshift
Function to compute the merger rate density (PopI/PopII) from Oguri et al. (2018)
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014)
Function to compute the merger rate density (PopIII)
Function to compute the merger rate density (Primordial)
- property sample_source_redshift
Function to sample source redshifts (source frame) between z_min and z_max from the source galaxy population
- Parameters:
- sizeint
Number of samples to generate
- Returns:
- zs
Source redshifts
- property merger_rate_density
Function to get the merger rate density function wrt redshift. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat
1D array of floats Source redshifts
- Returns:
- merger_rate_densityfloat
merger rate density in detector frame (Mpc^-3 yr^-1)
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> cbc = SourceGalaxyPopulationModel() >>> merger_rate_density = cbc.merger_rate_density(zs=0.1)
- property merger_rate_density_model_list
Dictionary of available merger rate density functions and its parameters.
- z_min
float
Minimum redshift of the source population
- z_max
float
Maximum redshift of the source population
- event_type
str
Type of event to generate.
e.g. ‘BBH’, ‘BNS’, ‘NSBH’
- cosmo
astropy.cosmology
Cosmology to use for the redshift distribution.
e.g. Planck18, WMAP9, FlatLambdaCDM(H0=70, Om0=0.3) etc.
- merger_rate_density_param
dict
Dictionary of merger rate density function input parameters
- c_n_i
dict
c_n_i stands for ‘create new interpolator’. Dictionary of interpolator creation parameters.
e.g. dict(redshift_distribution=dict(create_new=False, resolution=500), z_to_luminosity_distance=dict(create_new=False, resolution=500), differential_comoving_volume=dict(create_new=False, resolution=500))
- normalization_pdf_z
float
Normalization constant of the pdf p(z)
- z_to_luminosity_distance
scipy.interpolate.interpolate
Function to convert redshift to luminosity distance
- differential_comoving_volume
scipy.interpolate.interpolate
Function to calculate the differential comoving volume
- pdf_z(zs, param=None)[source]
Function to compute the pdf p(z). The output is in source frame and is normalized.
- Parameters:
- zsfloat or numpy.ndarray (1D array of floats)
Source redshifts
- paramdict
Allows to pass in above parameters as dict. e.g. if the merger_rate_density is merger_rate_density_bbh_popI_II_oguri2018 param = dict(R0=23.9*1e-9, b2=1.6, b3=2.0, b4=30)
- Returns:
- pdfnumpy.ndarray
1D array of floats pdf p(z)
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> cbc = SourceGalaxyPopulationModel() >>> pdf = cbc.pdf_z(zs=0.1)
- merger_rate_density_src_frame(zs, param=None)[source]
Function to compute the merger rate density (source frame). The output is in source frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (1D array of floats)
Source redshifts
- paramdict
Allows to pass in above parameters as dict. e.g. if the merger_rate_density is merger_rate_density_bbh_popI_II_oguri2018 param = dict(R0=23.9*1e-9, b2=1.6, b3=2.0, b4=30)
- Returns:
- rate_densitynumpy.ndarray
1D array of floats merger rate density (source frame) (Mpc^-3 yr^-1)
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> cbc = SourceGalaxyPopulationModel() >>> rate_density = cbc.merger_rate_density_src_frame(zs=0.1)
- merger_rate_density_bbh_popI_II_oguri2018(zs, R0=23.9 * 1e-09, b2=1.6, b3=2.0, b4=30, param=None)[source]
Function to compute the merger rate density (PopI/PopII). Reference: Oguri et al. (2018). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- R0float
local merger rate density at low redshift default: 23.9*1e-9 Mpc^-3 yr^-1
- b2float
Fitting paramters default: 1.6
- b3float
Fitting paramters default: 2.0
- b4float
Fitting paramters default: 30
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(R0=23.9*1e-9, b2=1.6, b3=2.0, b4=30) default: None
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=0.0, z_max=10, event_type = "BBH", merger_rate_density="merger_rate_density_bbh_popI_II_oguri2018") >>> rate_density = pop.merger_rate_density(zs=0.1)
- star_formation_rate_madau_dickinson2014(zs, af=2.7, bf=5.6, cf=2.9, param=None)[source]
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- affloat
Fitting paramters default: 2.7
- bffloat
Fitting paramters default: 5.6
- cffloat
Fitting paramters default: 2.9
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(af=2.7, bf=5.6, cf=2.9) default: None
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=5., z_max=40., event_type = "BBH", merger_rate_density="star_formation_rate_madau_dickinson2014") >>> rate_density = pop.merger_rate_density(zs=10)
- merger_rate_density_bbh_popIII_ken2022(zs, n0=19.2 * 1e-09, aIII=0.66, bIII=0.3, zIII=11.6, param=None)[source]
Function to compute the unnormalized merger rate density (PopIII). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- n0float
normalization constant default: 19.2*1e-9
- aIIIfloat
Fitting paramters default: 0.66
- bIIIfloat
Fitting paramters default: 0.3
- zIIIfloat
Fitting paramters default: 11.6
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(aIII=0.66, bIII=0.3, zIII=11.6) default: None
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=5, z_max=40, event_type = "BBH", merger_rate_density="merger_rate_density_popIII_ken2022") >>> rate_density = pop.merger_rate_density(zs=10) >>> rate_density # Mpc^-3 yr^-1 1.5107979464621443e-08
- merger_rate_density_bbh_primordial_ken2022(zs, n0=0.044 * 1e-09, t0=13.786885302009708, param=None)[source]
Function to compute the merger rate density (Primordial). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat
Source redshifts
- n0float
normalization constant default: 0.044*1e-9
- t0float
Present age of the Universe in Gyr default: 13.786885302009708
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(t0=13.786885302009708)
- Returns:
- rate_densityfloat
merger rate density
Examples
>>> from ler.gw_source_population import SourceGalaxyPopulationModel >>> pop = SourceGalaxyPopulationModel(z_min=5, z_max=40, event_type = "BBH", merger_rate_density="merger_rate_density_bbh_primordial_ken2022") >>> rate_density = pop.merger_rate_density(zs=10) >>> rate_density # Mpc^-3 yr^-1 9.78691173794454e-10
- create_lookup_table(z_min, z_max, directory)[source]
Function to create a lookup table for the differential comoving volume and luminosity distance wrt redshift.
- Parameters:
- z_minfloat
Minimum redshift of the source population
- z_maxfloat
Maximum redshift of the source population
- Attributes:
- z_to_luminosity_distancescipy.interpolate.interpolate
Function to convert redshift to luminosity distance
- differential_comoving_volumescipy.interpolate.interpolate
Function to calculate the differential comoving volume
- ler.gw_source_population.lognormal_distribution_2D(size, m_min=1.0, m_max=100.0, Mc=20.0, sigma=0.3, chunk_size=10000)[source]
Function to sample from a lognormal distribution in 2D space. Reference: Ng et al. 2022. This a helper function for popIII BBH and primordial BBH merger rate density distribution functions.
- Parameters:
- sizeint
Number of samples to draw
- m_minfloat
Minimum mass default: 1.0
- m_maxfloat
Maximum mass default: 100.0
- Mcfloat
Mass scale default: 20.0
- sigmafloat
width of the distribution default: 0.3
- chunk_sizeint
Number of samples to draw in each chunk default: 10000
- Returns:
- m1_samplenumpy.ndarray (1D array of floats)
Mass of the primary
- m2_samplenumpy.ndarray (1D array of floats)
Mass of the secondary
Examples
>>> from ler.gw_source_population import lognormal_distribution_2D >>> m1_sample, m2_sample = lognormal_distribution_2D(size=1000)
- ler.gw_source_population.inverse_transform_sampler_m1m2(size, inv_cdf, x)[source]
Function to sample from a distribution using inverse transform sampling. This is a helper function BNS Alsing mass distribution function.
- Parameters:
- sizeint
Number of samples to draw
- inv_cdfnumpy.ndarray (1D array of floats)
Inverse cumulative distribution function
- xnumpy.ndarray (1D array of floats)
array of mass values for which the inverse cumulative distribution function is computed
- Returns:
- m1numpy.ndarray (1D array of floats)
Mass of the primary
- m2numpy.ndarray (1D array of floats)
Mass of the secondary
Examples
>>> from ler.gw_source_population import inverse_transform_sampler_m1m2 >>> m1, m2 = inverse_transform_sampler_m1m2(size=1000, inv_cdf=inv_cdf, x=x)
- class ler.gw_source_population.CBCSourceParameterDistribution(z_min=0.0, z_max=10.0, event_type='BBH', source_priors=None, source_priors_params=None, cosmology=None, spin_zero=True, spin_precession=False, directory='./interpolator_pickle', create_new_interpolator=False)[source]
Bases:
ler.gw_source_population.cbc_source_redshift_distribution.CBCSourceRedshiftDistribution
Class to generate a population of compact binaries. It helps sample all the intrinsic and extrinsic parameters of compact binaries. This daughter class inherits from
CBCSourceRedshiftDistribution
class.- Parameters:
- z_minfloat
Minimum redshift of the source population default: 0.001
- z_maxfloat
Maximum redshift of the source population default: 10.
- event_typestr
Type of event to generate. e.g. ‘BBH’, ‘BNS’, ‘NSBH’
- source_priors, source_priors_paramsdict, dict
Dictionary of prior sampler functions and its input parameters. Check for available priors and corresponding input parameters by running, >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CompactBinaryPopulation() >>> cbc.available_gw_prior_list_and_its_params() # To check the current chosen priors and its parameters, run, >>> print(“default priors=”,cbc.gw_param_samplers) >>> print(“default priors’s parameters=”,cbc.gw_param_samplers_params)
- cosmologyastropy.cosmology
Cosmology to use default: None/astropy.cosmology.FlatLambdaCDM(H0=70, Om0=0.3)
- spin_zerobool
If True, spin parameters are completely ignore in the sampling. default: True
- spin_precessionbool
If spin_zero=True and spin_precession=True, spin parameters are sampled for precessing binaries. if spin_zero=True and spin_precession=False, spin parameters are sampled for aligned/anti-aligned spin binaries. default: False
- directorystr
Directory to store the interpolator pickle files default: ‘./interpolator_pickle’
- create_new_interpolatordict
Dictionary of boolean values and resolution to create new interpolator. default: dict(redshift_distribution=dict(create_new=False, resolution=500), z_to_luminosity_distance=dict(create_new=False, resolution=500), differential_comoving_volume=dict(create_new=False, resolution=500))
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> params = cbc.sample_gw_parameters(size=1000) >>> print("sampled parameters=",list(params.keys()))
Instance Attributes
CompactBinaryPopulation has the following instance attributes:
Instance Methods
CompactBinaryPopulation has the following instance methods:
Methods
Type
Function to categorize the event priors and its parameters
lookup_table_luminosity_distance()
- Function to create a lookuptable for converting redshiftto luminosity distance
Function to sample all the intrinsic and extrinsic parameters of compact binaries
Function to sample source mass1 and mass2
Function to sample geocent time
Function to sample source redshift
Function to sample right ascension (sky position)
Function to sample declination (sky position)
Function to sample coalescence phase
Function to sample polarization angle
Function to sample inclination angle
sample_a1()
Function to sample spin1 magnitude
sample_a2()
Function to sample spin2 magnitude
Function to sample tilt1 angle
Function to sample tilt2 angle
Function to sample phi12 angle
Function to sample phi_jl angle
Function to sample source mass1 and mass2 with PowerLaw+PEAK model
Function to sample source mass1 and mass2 with popIII orgin from lognormal distribution. Refer to Ng et al. 2022. Eqn. 1 and 4
Function to sample source mass1 and mass2 with primordial orgin from lognormal distribution. Refer to Ng et al. 2022. Eqn. 1 and 4
Function to sample source mass1 and mass2 from powerlaw distribution.
Function to sample source mass1 and mass2 from bimodal distribution. Refer to Will M. Farr et al. 2020 Eqn. 6
Function to return array of constant values of size n
Function to sample from uniform distribution
- property available_gw_prior_list_and_its_params
Dictionary with list all the available priors and it’s corresponding parameters. This is an immutable instance attribute.
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CompactBinaryPopulation() >>> priors = cbc.available_gw_prior_list_and_its_params >>> priors.keys() # type of priors dict_keys(['merger_rate_density', 'source_frame_masses', 'spin', 'geocent_time', 'ra', 'phase', 'psi', 'theta_jn']) >>> priors['source_frame_masses'].keys() # type of source_frame_masses priors dict_keys(['binary_masses_BBH_popI_II_powerlaw_gaussian', 'binary_masses_BBH_popIII_lognormal', 'binary_masses_BBH_primordial_lognormal', 'binary_masses_BNS_gwcosmo', 'binary_masses_BNS_bimodal']) >>> priors['source_frame_masses']['binary_masses_BBH_popI_II_powerlaw_gaussian'].keys() # parameters of binary_masses_BBH_popI_II_powerlaw_gaussian dict_keys(['mminbh', 'mmaxbh', 'alpha', 'mu_g', 'sigma_g', 'lambda_peak', 'delta_m', 'beta'])
- property sample_zs
Function to sample redshifts with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- zsnumpy.ndarray (1D array of floats)
Array of redshifts
- property sample_source_frame_masses
Function to sample source frame masses (mass1_source, mass2_source) with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame
- property sample_geocent_time
Function to sample geocent time with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- geocent_timenumpy.ndarray (1D array of floats)
Array of geocent_time or time of coalescence
- property sample_ra
Function to sample right ascension of sky position with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- ranumpy.ndarray (1D array of floats)
Array of right ascension of sky position
- property sample_dec
Function to sample declination of sky position with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- decnumpy.ndarray (1D array of floats)
Array of declination of sky position
- property sample_phase
Function to sample coalescence phase with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- phasenumpy.ndarray (1D array of floats)
Array of coalescence phase
- property sample_psi
Function to sample polarization angle with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- psinumpy.ndarray (1D array of floats)
Array of polarization angle
- property sample_theta_jn
Function to sample theta_jn with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- theta_jnnumpy.ndarray (1D array of floats)
Array of theta_jn
- property sample_a_1
Function to sample spin magnitude of the compact binaries (body1) with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- a_1numpy.ndarray (1D array of floats)
Array of spin magnitude of the compact binaries (body1)
- property sample_a_2
Function to sample spin magnitude of the compact binaries (body2) with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- a_2numpy.ndarray (1D array of floats)
Array of spin magnitude of the compact binaries (body2)
- property sample_tilt_1
Function to sample tilt angle of the compact binaries (body1) with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- tilt_1numpy.ndarray (1D array of floats)
Array of tilt angle of the compact binaries (body1)
- property sample_tilt_2
Function to sample tilt angle of the compact binaries (body2) with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- tilt_2numpy.ndarray (1D array of floats)
Array of tilt angle of the compact binaries (body2)
- property sample_phi_12
Function to sample azimuthal angle between the two spins with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- phi_12numpy.ndarray (1D array of floats)
Array of azimuthal angle between the two spins
- property sample_phi_jl
Function to sample azimuthal angle between the total angular momentum and the orbital angular momentum with the initialized prior.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- phi_jlnumpy.ndarray (1D array of floats)
Array of azimuthal angle between the total angular momentum and the orbital angular momentum
- z_min
float
Minimum redshift of the source population
- z_max
float
Maximum redshift of the source population
- event_type
str
Type of event to generate.
e.g. ‘BBH’, ‘BNS’, ‘NSBH’
- source_priors
dict
Dictionary of prior sampler functions.
- source_priors_params
dict
Dictionary of prior sampler functions’ input parameters.
- cosmo
astropy.cosmology
Cosmology to use.
- spin_zero
bool
If True, spin prior is set to zero.
- lookup_table_luminosity_distance(z_min, z_max, directory)[source]
Function to create a lookup table for the differential comoving volume and luminosity distance wrt redshift.
- Parameters:
- z_minfloat
Minimum redshift of the source population
- z_maxfloat
Maximum redshift of the source population
- Attributes:
- z_to_luminosity_distancescipy.interpolate.interpolate
Function to convert redshift to luminosity distance
- differential_comoving_volumescipy.interpolate.interpolate
Function to calculate the differential comoving volume
- sample_gw_parameters(size=1000, param=None)[source]
Function to sample BBH/BNS/NSBH intrinsic and extrinsics parameters.
- Parameters:
- sizeint
Number of samples to draw
- Returns:
- gw_parametersdict
Dictionary of sampled parameters gw_parameters.keys() = [‘mass_1’, ‘mass_2’, ‘mass_1_source’, ‘mass_2_source’, ‘zs’, ‘luminosity_distance’, ‘theta_jn’, ‘psi’, ‘phase’, ‘geocent_time’, ‘ra’, ‘dec’, ‘a_1’, ‘a_2’, ‘tilt_1’, ‘tilt_2’, ‘phi_12’, ‘phi_jl’]
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> params = cbc.sample_gw_parameters(size=1000) >>> print("sampled parameters=",list(params.keys()))
- binary_masses_BBH_popI_II_powerlaw_gaussian(size, mminbh=4.98, mmaxbh=112.5, alpha=3.78, mu_g=32.27, sigma_g=3.88, lambda_peak=0.03, delta_m=4.8, beta=0.81, get_attribute=False, param=None)[source]
Function to sample source mass1 and mass2 with PowerLaw+PEAK model
- Parameters:
- sizeint
Number of samples to draw
- mminbhfloat
Minimum mass of the black hole (Msun) default: 4.98
- mmaxbhfloat
Maximum mass of the black hole (Msun) default: 86.22
- alphafloat
Spectral index for the powerlaw of the primary mass distribution default: 2.63
- mu_gfloat
Mean of the Gaussian component in the primary mass distribution default: 33.07
- sigma_gfloat
Width of the Gaussian component in the primary mass distribution default: 5.69
- lambda_peakfloat
Fraction of the model in the Gaussian component default: 0.10
- delta_mfloat
Range of mass tapering on the lower end of the mass distribution default: 4.82
- betafloat
Spectral index for the powerlaw of the mass ratio distribution
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(mminbh=4.98, mmaxbh=86.22, alpha=2.63, mu_g=33.07, sigma_g=5.69, lambda_peak=0.10, delta_m=4.82, beta=1.26)
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_BBH_popI_II_powerlaw_gaussian(size=1000)
- binary_masses_BBH_popIII_lognormal(size, m_min=5.0, m_max=150.0, Mc=30.0, sigma=0.3, chunk_size=10000, get_attribute=False, param=None)[source]
Function to sample source mass1 and mass2 with pop III origin. Refer to Eqn. 1 and 4 of Ng et al. 2022
- Parameters:
- sizeint
Number of samples to draw
- m_minfloat
Minimum mass of the black hole (popIII) (Msun) default: 10.
- m_maxfloat
Maximum mass of the black hole (popIII) (Msun) default: 100.
- Mcfloat
Mass scale; the distribution is centered around Mc default: 30.0
- sigmafloat
Width of the distribution default: 0.3
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(m_min=10., m_max=100., Mc=30.0, sigma=0.3)
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_BBH_popIII_lognormal(size=1000)
- binary_masses_BBH_primordial_lognormal(size, m_min=1.0, m_max=100.0, Mc=20.0, sigma=0.3, chunk_size=10000, get_attribute=False, param=None)[source]
Function to sample source mass1 and mass2 with primordial origin. Refer to Eqn. 1 and 4 of Ng et al. 2022
- Parameters:
- sizeint
Number of samples to draw
- m_minfloat
Minimum mass of the black hole (primordial) (Msun) default: 10.
- m_maxfloat
Maximum mass of the black hole (primordial) (Msun) default: 100.
- Mc, sigmafloat
Fitting parameters default: Mc=30.0, sigma=0.3
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(m_min=10., m_max=100., Mc=30.0, sigma=0.3)
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
- binary_masses_BNS_gwcosmo(size, mminns=1.0, mmaxns=3.0, alphans=0.0, get_attribute=False, param=None)[source]
Function to calculate source mass1 and mass2 of BNS from powerlaw distribution (gwcosmo)
- Parameters:
- sizeint
Number of samples to draw
- mminnsfloat
Minimum mass of the BNS (Msun) default: 1.0
- mmaxnsfloat
Maximum mass of the BNS (Msun) default: 3.0
- alphansfloat
Power law index default: 0.0
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_BNS_gwcosmo(size=1000)
- binary_masses_NSBH_broken_powerlaw(size, mminbh=26, mmaxbh=125, alpha_1=6.75, alpha_2=6.75, b=0.5, delta_m=5, mminns=1.0, mmaxns=3.0, alphans=0.0, get_attribute=False, param=None)[source]
Function to calculate source mass1 and mass2 of NSBH from powerlaw distribution (gwcosmo). Parameters are mminbh=26,mmaxbh=125,alpha_1=6.75,alpha_2=6.75,b=0.5,delta_m=5,mminns=1.0,mmaxns=3.0,alphans=0.0.
- Parameters:
- sizeint
Number of samples to draw
- mminbhfloat
Minimum mass of the black hole (Msun) default: 26
- mmaxbhfloat
Maximum mass of the black hole (Msun) default: 125
- alpha_1float
Power law index for the primary mass distribution default: 6.75
- alpha_2float
Power law index for the secondary mass distribution default: 6.75
- bfloat
Break point of the power law default: 0.5
- delta_mfloat
Range of mass tapering on default: 5
- mminnsfloat
Minimum mass of the neutron star (Msun) default: 1.0
- mmaxnsfloat
Maximum mass of the neutron star (Msun) default: 3.0
- alphansfloat
Power law index for the neutron star mass distribution default: 0.0
- get_attributebool
If True, return a sampler function with size as the only input where parameters are fixed to the given values.
- paramdict
Allows to pass in above parameters as dict.
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_NSBH_broken_powerlaw(size=1000)
- binary_masses_uniform(size, m_min=1.0, m_max=3.0, get_attribute=False, param=None)[source]
Function to sample source mass1 and mass2 from uniform distribution.
- Parameters:
- sizeint
Number of samples to draw
- m_minfloat
Minimum mass of the BNS default: 1.0
- m_maxfloat
Maximum mass of the BNS default: 3.0
- get_attributebool
If True, return a sampler function with size as the only input where parameters are fixed to the given values.
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(m_min=1.0, m_max=3.0)
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_uniform(size=1000)
- binary_masses_BNS_bimodal(size, w=0.643, muL=1.352, sigmaL=0.08, muR=1.88, sigmaR=0.3, mmin=1.0, mmax=2.3, resolution=500, create_new=False, get_attribute=False, param=None)[source]
Function to sample source mass1 and mass2 from bimodal distribution. Refer to Will M. Farr et al. 2020 Eqn. 6, https://arxiv.org/pdf/2005.00032.pdf .
- Parameters:
- sizeint
Number of samples to draw
- wfloat
Weight of the left peak default: 0.643
- muLfloat
Mean of the left peak default: 1.352
- sigmaLfloat
Width of the left peak default: 0.08
- muRfloat
Mean of the right peak default: 1.88
- sigmaRfloat
Width of the right peak default: 0.3
- mminfloat
Minimum mass of the BNS default: 1.0
- mmaxfloat
Maximum mass of the BNS default: 2.3
- resolutionint
Number of points to sample default: 500
- create_newbool
If True, create new interpolator default: False
- get_attributebool
If True, return a sampler function with size as the only input where parameters are fixed to the given values.
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(w=0.643, muL=1.352, sigmaL=0.08, muR=1.88, sigmaR=0.3, mmin=1.0, mmax=2.3, resolution=500)
- Returns:
- mass_1_sourcenumpy.ndarray (1D array of floats)
Array of mass1 in source frame (Msun)
- mass_2_sourcenumpy.ndarray (1D array of floats)
Array of mass2 in source frame (Msun)
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_BNS_bimodal(size=1000)
- constant_values_n_size(size=100, value=0.0, get_attribute=False, param=None)[source]
Function to sample constant values of size n.
- Parameters:
- sizeint
Number of samples to draw
- valuefloat
Constant value default: 0.0
- get_attributebool
If True, return the njitted sampler function with size as the only input where parameters are fixed to the given values.
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(value=0.0)
- Returns:
- valuesnumpy.ndarray (1D array of floats)
Array of constant values
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> value = cbc.constant_values_n_size(size=1000)
- sampler_uniform(size, min_=0, max_=np.pi, get_attribute=False, param=None)[source]
Function to sample values from uniform distribution.
- Parameters:
- sizeint
Number of samples to draw
- start_timefloat
Start time of the uniform distribution default: 1238166018
- end_timefloat
End time of the uniform distribution default: 1238166018 + 31536000
- get_attributebool
If True, return the njitted sampler function with size as the only input where parameters are fixed to the given values.
- paramdict
Allows to pass in above parameters as dict.
- Returns:
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> value = cbc.sampler_uniform(size=1000)
- sampler_cosine(size, get_attribute=False, param=None)[source]
Function to sample from sine distribution at the limit of [-np.pi/2, np.pi/2]
- Parameters:
- sizeint
Number of samples to draw
- get_attributebool
If True, return the njitted sampler function with size as the only input where parameters are fixed to the given values.
- paramNone
This parameter is not used. It is only here to make the function signature consistent with other samplers.
- Returns:
- sinenumpy.ndarray (1D array of floats)
Array of values in the range of [-np.pi/2, np.pi/2]
- sampler_sine(size, get_attribute=False, param=None)[source]
Function to sample from sine distribution at the limit of [0, np.pi]
- Parameters:
- sizeint
Number of samples to draw
- get_attributebool
If True, return the njitted sampler function with size as the only input where parameters are fixed to the given values.
- paramNone
This parameter is not used. It is only here to make the function signature consistent with other samplers.
- Returns:
- sinenumpy.ndarray (1D array of floats)
Array of values in the range of [0, np.pi]
- source_priors_categorization(event_type, source_priors, event_prior_params)[source]
Function to categorize the event priors and its parameters.
- Parameters:
- event_typestr
Type of event to generate. e.g. ‘BBH’, ‘BNS’, ‘BBH_popIII’, ‘BBH_primordial’, ‘NSBH’
- source_priorsdict
Dictionary of prior sampler functions for each parameter
- event_prior_paramsdict
Dictionary of sampler parameters for each GW parameter
- Returns:
- source_priors_dict
Dictionary of prior sampler functions for each parameter
- event_prior_params_dict
Dictionary of sampler parameters for each parameter
- sampler_names_dict
Dictionary of sampler names with description
Examples
>>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> source_priors, event_prior_params, sampler_names = cbc.source_priors_categorization(event_type='BBH', source_priors=None, event_prior_params=None) >>> print(source_priors.keys()) >>> print(event_prior_params.keys()) >>> print(sampler_names.keys())
- ler.gw_source_population.inverse_transform_sampler(size, cdf, x)[source]
Function to sample from the inverse transform method.
- Parameters:
- sizeint
number of samples.
- cdfnumpy.ndarray
cdf values.
- xnumpy.ndarray
x values.
- Returns:
- samplesnumpy.ndarray
samples from the cdf.
- ler.gw_source_population.merger_rate_density_bbh_popI_II_oguri2018(zs, R0=23.9 * 1e-09, b2=1.6, b3=2.0, b4=30)[source]
Function to compute the merger rate density (PopI/PopII). Reference: Oguri et al. (2018). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- R0float
local merger rate density at low redshift default: 23.9*1e-9 Mpc^-3 yr^-1
- b2float
Fitting paramters default: 1.6
- b3float
Fitting paramters default: 2.0
- b4float
Fitting paramters default: 30
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import merger_rate_density_bbh_popI_II_oguri2018 >>> rate_density = merger_rate_density_bbh_popI_II_oguri2018(zs=0.1)
- ler.gw_source_population.merger_rate_density_bbh_popIII_ken2022(zs, n0=19.2 * 1e-09, aIII=0.66, bIII=0.3, zIII=11.6)[source]
Function to compute the unnormalized merger rate density (PopIII). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- n0float
normalization constant default: 19.2*1e-9
- aIIIfloat
Fitting paramters default: 0.66
- bIIIfloat
Fitting paramters default: 0.3
- zIIIfloat
Fitting paramters default: 11.6
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import merger_rate_density_bbh_popIII_ken2022 >>> rate_density = merger_rate_density_bbh_popIII_ken2022(zs=0.1)
- ler.gw_source_population.star_formation_rate_madau_dickinson2014(zs, af=2.7, bf=5.6, cf=2.9)[source]
Function to compute star formation rate as given in Eqn. 15 Madau & Dickinson (2014). The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat or numpy.ndarray (nD array of floats)
Source redshifts
- affloat
Fitting paramters default: 2.7
- bffloat
Fitting paramters default: 5.6
- cffloat
Fitting paramters default: 2.9
- Returns:
- rate_densityfloat or numpy.ndarray (nD array of floats)
merger rate density
Examples
>>> from ler.gw_source_population import star_formation_rate_madau_dickinson2014 >>> rate_density = star_formation_rate_madau_dickinson2014(zs=0.1)
- ler.gw_source_population.merger_rate_density_bbh_primordial_ken2022(zs, cosmology=cosmo, n0=0.044 * 1e-09, t0=13.786885302009708)[source]
Function to compute the merger rate density (Primordial). Reference: Ng et al. 2022. The output is in detector frame and is unnormalized.
- Parameters:
- zsfloat
Source redshifts
- n0float
normalization constant default: 0.044*1e-9
- t0float
Present age of the Universe in Gyr default: 13.786885302009708
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(t0=13.786885302009708)
- Returns:
- rate_densityfloat
merger rate density
- ler.gw_source_population.lognormal_distribution_2D(size, m_min=1.0, m_max=100.0, Mc=20.0, sigma=0.3, chunk_size=10000)[source]
Function to sample from a lognormal distribution in 2D space. Reference: Ng et al. 2022. This a helper function for popIII BBH and primordial BBH merger rate density distribution functions.
- Parameters:
- sizeint
Number of samples to draw
- m_minfloat
Minimum mass default: 1.0
- m_maxfloat
Maximum mass default: 100.0
- Mcfloat
Mass scale default: 20.0
- sigmafloat
width of the distribution default: 0.3
- chunk_sizeint
Number of samples to draw in each chunk default: 10000
- Returns:
- m1_samplenumpy.ndarray (1D array of floats)
Mass of the primary
- m2_samplenumpy.ndarray (1D array of floats)
Mass of the secondary
Examples
>>> from ler.gw_source_population import lognormal_distribution_2D >>> m1_sample, m2_sample = lognormal_distribution_2D(size=1000)
- ler.gw_source_population.inverse_transform_sampler_m1m2(size, inv_cdf, x)[source]
Function to sample from a distribution using inverse transform sampling. This is a helper function BNS Alsing mass distribution function.
- Parameters:
- sizeint
Number of samples to draw
- inv_cdfnumpy.ndarray (1D array of floats)
Inverse cumulative distribution function
- xnumpy.ndarray (1D array of floats)
array of mass values for which the inverse cumulative distribution function is computed
- Returns:
- m1numpy.ndarray (1D array of floats)
Mass of the primary
- m2numpy.ndarray (1D array of floats)
Mass of the secondary
Examples
>>> from ler.gw_source_population import inverse_transform_sampler_m1m2 >>> m1, m2 = inverse_transform_sampler_m1m2(size=1000, inv_cdf=inv_cdf, x=x)