ler.lens_galaxy_population
Submodules
Package Contents
Classes
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 |
|
Class to calculate the optical depth, velocity dispersion and axis-ratio of a lens galaxy population. |
|
Class to find the image properties of a lensed event. Image properties include image positions, magnifications, time delays, etc. |
|
Class to sample lens galaxy parameters, source parameters conditioned on the source being strongly lensed, and image properties |
|
Class to calculate the optical depth, velocity dispersion and axis-ratio of a lens galaxy population. |
Functions
|
Adds two dictionaries with the same keys together. |
|
Filters an event dictionary to only contain the size. |
|
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy. |
|
Function to sample velocity dispersion from the interpolator |
|
Function to sample lens redshift from the SDSS catalogue. |
|
Function to decide which interpolator to use. |
|
Function to interpolate using cubic spline. |
|
Function to sample from the inverse transform method. |
|
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy. |
|
Function to sample axis ratio from rayleigh distribution with given velocity dispersion. |
|
Function to sample axis ratio from the SIS distribution with given velocity dispersion. |
|
Function to calculate the lens galaxy velocity dispersion function at redshift z. |
|
Function to calculate the local universe velocity dispersion function. Bernardi et al. (2010). |
|
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy. |
|
Function to sample axis ratio from rayleigh distribution with given velocity dispersion. |
|
Function to sample from the inverse transform method. |
|
Function to interpolate using cubic spline. |
|
Function to calculate the optical depth for SIE lens with velocity dispersion distribution depending on redshift. |
|
Function to sample from the inverse transform method. |
|
Function to interpolate using cubic spline. |
|
Function to sample axis ratio from the SIS distribution with given velocity dispersion. |
|
Function to calculate the lens galaxy velocity dispersion function at redshift z. |
|
Function to calculate the local universe velocity dispersion function. Bernardi et al. (2010). |
|
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy. |
|
Function to sample axis ratio from rayleigh distribution with given velocity dispersion. |
|
Function to sample velocity dispersion from the interpolator |
|
Function to sample lens redshift from the SDSS catalogue. |
|
Function to sample from a normal distribution with bounds. |
- class ler.lens_galaxy_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())
- class ler.lens_galaxy_population.OpticalDepth(npool=4, z_min=0.001, z_max=10.0, optical_depth_function=None, sampler_priors=None, sampler_priors_params=None, cosmology=None, directory='./interpolator_pickle', create_new_interpolator=False)[source]
Class to calculate the optical depth, velocity dispersion and axis-ratio of a lens galaxy population.
- Parameters:
- npoolint
number of processors to use for multiprocessing
- z_minfloat
minimum redshift of the lens galaxy population
- z_maxfloat
maximum redshift of the lens galaxy population
- optical_depth_functionstr or callable
Function or function name to calculate optical depth. Check for default/available optical depth functions by running, >>> from ler.lens_galaxy_population import OpticalDepth >>> print(OpticalDepth().available_optical_depth_list_and_its_params)
- sampler_priors, sampler_priors_paramsdict, dict
dictionary of sampler functions and it’s parameters to sample velocity dispersion and axis-ratio. Check for default/available sampler priors and corresponding input parameters by running, >>> from ler.lens_galaxy_population import OpticalDepth >>> print(OpticalDepth().available_velocity_dispersion_list_and_its_params) >>> print(OpticalDepth().available_axis_ratio_list_and_its_params)
- cosmologyastropy.cosmology
Cosmology to use default: None/astropy.cosmology.FlatLambdaCDM(H0=70, Om0=0.3)
- directorystr
directory to store interpolator pickle files default: “./interpolator_pickle”
- create_new_interpolatordict
dictionary to create new interpolator for velocity dispersion and optical depth.
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.strong_lensing_optical_depth(0.5))
- property strong_lensing_optical_depth
Function to compute the strong lensing optical depth.
- Parameters:
- zsnumpy.ndarray (1D array of floats)
source redshifts
- Returns:
- taunumpy.ndarray (1D array of floats)
strong lensing optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.strong_lensing_optical_depth(np.array([0.1,0.2,0.3])))
- property sample_velocity_dispersion
Function to sample velocity dispersion. zl is required only if velocity dispersion sampler is redshift dependent.
- Parameters:
- sizeint
number of lens parameters to sample
- zlfloat
redshift of the lens galaxy
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.sample_velocity_dispersion(size=10))
- property sample_axis_ratio
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
- Returns:
- qnumpy.ndarray (1D array of floats)
axis ratio of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.sample_axis_ratio(sigma=200.))
- property available_velocity_dispersion_list_and_its_params
Function to list all available velocity dispersion sampler and its parameters.
- property available_axis_ratio_list_and_its_params
Function to list all available axis ratio sampler.
- property available_optical_depth_list_and_its_params
Function to list all available optical depth sampler.
- initialize_velocity_dispersion_sampler(vd_name)[source]
Function to initialize velocity dispersion sampler
- Parameters:
- vd_namestr
name of velocity dispersion sampler
- initialize_optical_depth_function(tau_name, vd_name)[source]
Function to initialize optical depth function.
- Parameters:
- tau_namestr
name of optical depth function
- vd_namestr
name of velocity dispersion sampler
- axis_ratio_rayleigh(sigma, q_min=0.2, q_max=1.0, get_attribute=False, param=None, **kwargs)[source]
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- q_min, q_maxfloat
minimum and maximum axis ratio
- get_attributebool
if True, returns a function that can be used to sample axis ratio
- Returns:
- qfloat: array
axis ratio of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(axis_ratio="axis_ratio_rayleigh")) >>> print(od.sample_axis_ratio(sigma=200.))
- axis_ratio_padilla_strauss(size=1000, q_min=0.2, q_max=1.0, get_attribute=False, param=None, **kwargs)[source]
Function to sample axis ratio using Padilla and Strauss 2008 distribution for axis ratio
- Parameters:
- sizeint
sample size
- q_min, q_maxfloat
minimum and maximum axis ratio
- get_attributebool
if True, returns a function that can be used to sample axis ratio
- Returns:
- qfloat: array
axis ratio of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(axis_ratio="axis_ratio_padilla_strauss")) >>> print(od.sample_axis_ratio(size=10))
- velocity_dispersion_gengamma(size, a=2.32 / 2.67, c=2.67, get_attribute=False, param=None, **kwargs)[source]
Function to sample velocity dispersion from gengamma distribution
- Parameters:
- sizeint
number of lens parameters to sample
- a,cfloat
parameters of gengamma distribution refer to https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gengamma.html
- get_attributebool
if True, returns a function that can be used to sample velocity dispersion
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(a=2.32 / 2.67, c=2.67)
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(velocity_dispersion="velocity_dispersion_gengamma"), sampler_priors_params=dict(velocity_dispersion=dict(a=2.32 / 2.67, c=2.67))) >>> print(od.sample_velocity_dispersion(size=10))
- velocity_dispersion_bernardi(size, get_attribute=False, **kwargs)[source]
Function to sample velocity dispersion from Bernardi et al. (2010). This uses inverse transform sampling.
- Parameters:
- sizeint
number of lens parameters to sample
- get_attributebool
if True, returns a function that can be used to sample velocity dispersion
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(velocity_dispersion="velocity_dispersion_bernardi")) >>> print(od.sample_velocity_dispersion(size=10))
- velocity_dispersion_ewoud(size, zl, get_attribute=False, **kwargs)[source]
Function to sample velocity dispersion (redshift dependent) from Wempe et al. (2022). This uses inverse transform sampling.
- Parameters:
- sizeint
number of lens parameters to sample
- zlfloat
redshift of the lens galaxy
- get_attributebool
if True, returns a function that can be used to sample velocity dispersion
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(velocity_dispersion="velocity_dispersion_ewoud")) >>> print(od.sample_velocity_dispersion(size=10, zl=0.5))
- cross_section_SIS(sigma, zl, zs)[source]
Function to compute the SIS cross-section
- Parameters:
- sigmafloat
velocity dispersion of the lens galaxy
- zlfloat
redshift of the lens galaxy
- zsfloat
redshift of the source galaxy
- Returns:
- cross_sectionfloat
SIS cross-section
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.cross_section_SIS(sigma=200., zl=0.5, zs=1.0))
- tau_zl_zs(zl, zs)[source]
Function to compute the optical depth for a given lens redshift and source redshift
- Parameters:
- zlfloat
redshift of the lens galaxy
- zsfloat
redshift of the source galaxy
- Returns:
- taufloat
optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.tau_zl_zs(zl=0.5, zs=1.0))
- optical_depth_calculator(zs)[source]
Function to compute the optical depth without multiprocessing. This is the integrated version of tau_zl_zs from z=0 to z=zs.
- Parameters:
- zsfloat
source redshifts
- Returns:
- taufloat
optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.optical_depth_calculator(zs=1.0))
- optical_depth_multiprocessing(zs)[source]
Function to compute the optical depth with multiprocessing. This is the integrated version of optical depth from z=0 to z=zs.
- Parameters:
- zsfloat
source redshifts
- Returns:
- taufloat
optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.optical_depth_multiprocessing(zs=1.0))
- optical_depth_SIS_haris(zs)[source]
Function to compute the strong lensing optical depth (SIS).
LambdaCDM(H0=70, Om0=0.3, Ode0=0.7) was used to derive the following equation. This is the analytic version of optical depth from z=0 to z=zs.
- Parameters:
- zsfloat
source redshifts
- Returns:
- taufloat
strong lensing optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.optical_depth_SIS_haris(zs=1.0))
- class ler.lens_galaxy_population.ImageProperties(npool=4, z_min=0.0, z_max=10, n_min_images=2, n_max_images=4, geocent_time_min=1126259462.4, geocent_time_max=1126259462.4 + 365 * 24 * 3600 * 20, lens_model_list=['EPL_NUMBA', 'SHEAR'], cosmology=None, spin_zero=True, spin_precession=False, directory='./interpolator_pickle', create_new_interpolator=False)[source]
Class to find the image properties of a lensed event. Image properties include image positions, magnifications, time delays, etc.
- Parameters:
- npoolint
number of processes to use default: 4
- z_minfloat
minimum redshift to consider default: 0.0
- z_maxfloat
maximum redshift to consider default: 10.0
- n_min_imagesint
minimum number of images to consider default: 2
- n_max_imagesint
maximum number of images to consider default: 4
- geocent_time_minfloat
minimum geocent time to consider default: 1126259462.4 , which is the GPS time of the first GW detection
- geocent_time_maxfloat
maximum geocent time to consider default: 1126259462.4+365*24*3600*100 , which is the GPS time of the first GW detection + 100 years. Some time delays can be very large.
- lens_model_listlist
list of lens models default: [‘EPL_NUMBA’, ‘SHEAR’]
- cosmologyastropy.cosmology
cosmology default: None/astropy.cosmology.LambdaCDM(H0=70, Om0=0.3, Ode0=0.7)
- spin_zerobool
whether to assume spin zero or not default: True
- spin_precessionbool
whether to assume spin precession or not default: False
- directorystr
directory to save the interpolator pickle files default: “./interpolator_pickle”
- create_new_interpolatordict
dictionary to create new interpolator pickle files default: dict(Dl_to_z=dict(create_new=False, resolution=500))
Examples
>>> from ler.image_properties import ImageProperties >>> image_properties = ImageProperties() >>> lens_parameters = dict(zs=2.0, zl=0.5, gamma1=0.0, gamma2=0.0, e1=0.0, e2=0.0, gamma=2.0, theta_E=1.0) >>> lens_parameters = image_properties.image_properties(lens_parameters) >>> print(lens_parameters.keys())
Instance Attributes
ImageProperties has the following instance attributes:
Atrributes
Type
npool
int
z_min
float
z_max
float
n_min_images
int
n_max_images
int
geocent_time_min
float
geocent_time_max
float
lens_model_list
list
cosmo
astropy.cosmology
spin_zero
bool
spin_precession
bool
directory
str
create_new_interpolator
dict
- image_properties(lens_parameters)[source]
Function to get the image properties e.g. image positions, magnifications, time delays, etc.
- Parameters:
- lens_parametersdict
dictionary of lens parameters e.g. lens_parameters.keys() = [‘zs’, ‘zl’, ‘gamma1’, ‘gamma2’, ‘e1’, ‘e2’, ‘gamma’, ‘theta_E’]
- Returns:
- lens_parametersdict
dictionary of lens parameters and image properties e.g. lens_parameters contains the following keys:
lens related=>[‘zs’: source redshift, ‘zl’: lens redshift, ‘gamma1’: shear component in the x-direction, ‘gamma2’: shear component in the y-direction, ‘e1’: ellipticity component in the x-direction, ‘e2’: ellipticity component in the y-direction, ‘gamma’: spectral index of the mass density distribution, ‘theta_E’: einstein radius in radian]
source related=>[‘mass_1’: mass in detector frame (mass1>mass2), ‘mass_2’: mass in detector frame, ‘mass_1_source’:mass in source frame, ‘mass_2_source’:mass source frame, ‘luminosity_distance’: luminosity distance, ‘theta_jn’: inclination angle, ‘psi’: polarization angle, ‘phase’: coalesence phase, ‘geocent_time’: coalensence GPS time at geocenter, ‘ra’: right ascension, ‘dec’: declination, ‘a_1’: spin magnitude of the more massive black hole, ‘a2’: spin magnitude of the less massive black hole, ‘tilt_1’: tilt angle of the more massive black hole, ‘tilt_2’: tilt angle of the less massive black hole, ‘phi_12’: azimuthal angle between the two spins, ‘phi_jl’: azimuthal angle between the total angular momentum and the orbital angular momentum]
image related=>[‘x_source’: source position in the x-direction, ‘y_source’: source position in the y-direction, ‘x0_image_position’: image position in the x-direction, ‘x1_image_position’: image position in the y-direction, ‘magnifications’: magnifications, ‘time_delays’: time delays, ‘n_images’: number of images formed, ‘determinant’: determinants, ‘trace’: traces, ‘iteration’: to keep track of the iteration number
- get_lensed_snrs(lensed_param, list_of_detectors=None, snr_calculator=None, pdet_calculator=None)[source]
Function to calculate the signal to noise ratio for each image in each event.
- Parameters:
- snr_calculatorfunction
snr function, as describe in the
GWRATES
class.- list_of_detectorslist
list of detectors e.g. [‘H1’, ‘L1’, ‘V1’]
- lensed_paramdict
dictionary containing the both already lensed source paramters and image parameters. e.g. lensed_param.keys() = [‘mass_1’, ‘mass_2’, ‘zs’, ‘luminosity_distance’, ‘theta_jn’, ‘psi’, ‘phi’, ‘ra’, ‘dec’, ‘geocent_time’, ‘phase’, ‘a_1’, ‘a2’, ‘tilt_1’, ‘tilt_2’, ‘phi_12’, ‘phi_jl’, ‘magnifications’, ‘time_delays’]
- n_max_imagesint
maximum number of images to consider default: 4
- Returns:
- snrsdict
signal to noise ratio for each image in each event. (dictionary containing ‘H1’, ‘L1’, …, and ‘optimal_snr_net’, which is the network snr, for each image as an array with dimensions (number_of_lensed_events,n_max_images) )
- ler.lens_galaxy_population.add_dictionaries_together(dictionary1, dictionary2)[source]
Adds two dictionaries with the same keys together.
- Parameters:
- dictionary1dict
dictionary to be added.
- dictionary2dict
dictionary to be added.
- Returns:
- dictionarydict
dictionary with added values.
- ler.lens_galaxy_population.trim_dictionary(dictionary, size)[source]
Filters an event dictionary to only contain the size.
- Parameters:
- dictionarydict
dictionary to be trimmed.
- sizeint
size to trim the dictionary to.
- Returns:
- dictionarydict
trimmed dictionary.
- ler.lens_galaxy_population.phi_cut_SIE(q)[source]
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy.
- Parameters:
- qfloat: array
axis ratio of the lens galaxy
- Returns:
- resultfloat: array
scaling factor
- ler.lens_galaxy_population.velocity_dispersion_z_dependent(size, zl, zl_list, vd_inv_cdf)[source]
Function to sample velocity dispersion from the interpolator
- Parameters:
- size: int
Number of samples to draw
- zl: `numpy.ndarray` (1D array of float of size=size)
Redshift of the lens galaxy
- Returns:
- samples: numpy.ndarray
Samples of velocity dispersion
- ler.lens_galaxy_population.lens_redshift_SDSS_catalogue(zs, splineDc, splineDcInv, u, cdf)[source]
Function to sample lens redshift from the SDSS catalogue.
- Parameters:
- zs: `numpy.ndarray` (1D array of float of size=size)
Redshift of the source galaxy
- splineDc: `list`
List of spline coefficients for the comoving distance and redshifts
- splineDcInv: `list`
List of spline coefficients for the inverse of comoving distance and redshifts
- u: `numpy.ndarray` (1D array of float of size=size)
e.g. u = np.linspace(0, 1, 500)
- cdf: `numpy.ndarray` (1D array of float of size=size)
Cumulative distribution function of the lens redshift distribution between 0 and 1
- Returns:
- zl: numpy.ndarray (1D array of float of size=size)
Redshift of the lens galaxy corresponding to the zs
- class ler.lens_galaxy_population.LensGalaxyParameterDistribution(npool=4, z_min=0.0, z_max=10.0, cosmology=None, event_type='BBH', lens_type='epl_galaxy', lens_functions=None, lens_priors=None, lens_priors_params=None, directory='./interpolator_pickle', create_new_interpolator=False, **kwargs)[source]
Bases:
ler.gw_source_population.CBCSourceParameterDistribution
,ler.image_properties.ImageProperties
,ler.lens_galaxy_population.optical_depth.OpticalDepth
Class to sample lens galaxy parameters, source parameters conditioned on the source being strongly lensed, and image properties
- Parameters:
- npoolint
number of processors to use
- z_minfloat
minimum redshift
- z_maxfloat
maximum redshift
- cosmologyastropy.cosmology
Cosmology to use default: None/astropy.cosmology.FlatLambdaCDM(H0=70, Om0=0.3)
- event_typestr
Type of event to generate. e.g. ‘BBH’, ‘BNS’, ‘NSBH’ default: ‘BBH’
- lens_typestr
Type of lens galaxy to generate. default: ‘epl_galaxy’
- lens_functions, lens_priors, lens_priors_paramsdict, dict, dict
dictionary of lens functions, priors, and priors parameters Check for default/available lens functions, priors and corresponding input parameters by running,
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> print(lens.lens_functions) >>> print(lens.lens_priors) >>> print(lens.lens_priors_params)
- directorystr
directory to store the interpolators default: ‘./interpolator_pickle’
- **kwargs
keyword arguments to pass to the parent classes
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lensed_params = lens.sample_lens_parameters(size=1000) >>> lensed_params.keys()
Instance Attributes
LensGalaxyPopulation class has the following instance attributes:
Atrributes
Type
npool
int
float
float
cosmo
astropy.cosmology
event_type
str
directory
str
create_new_interpolator
dict
lens_param_samplers
dict
lens_param_samplers_params
dict
lens_sampler_names
dict
lens_functions
dict
normalization_pdf_z_lensed
float
Instance Methods
LensGalaxyPopulation class has the following instance methods:
Methods
Type
Function to call the specific galaxy lens parameters sampler routine.
Function to sample galaxy lens parameters along with the source parameters.
Function to sample source redshifts conditioned on the source being strongly lensed
Function to sample gw source parameters
Function to sample lens redshifts, conditioned on the lens being strongly lensed
Function to sample the axis rotation angle of the elliptical lens galaxy from a uniform distribution
Function to sample the elliptical lens galaxy shear from a normal distribution
Function to sample the lens galaxy spectral index of the mass density profile from a normal distribution
Function to compute the Einstein radii of the lens galaxies
Function to conduct rejection sampling wrt einstein radius
Function to conduct rejection sampling wrt cross_section
rejection_sample_sl
Function to conduct rejection sampling with the given rejection sampling function
Function to sample source redshifts conditioned on the source being strongly lensed
Function to sample lens redshifts, conditioned on the lens being strongly lensed
Function to sample the axis rotation angle of the elliptical lens galaxy from a uniform distribution
Function to sample the elliptical lens galaxy shear from a normal distribution
Function to sample the lens galaxy spectral index of the mass density profile from a normal distribution
- property sample_source_redshift_sl
Function to sample source redshifts conditioned on the source being strongly lensed
- Parameters:
- sizeint
number samples to draw
- Returns:
- zsnumpy.ndarray (1D array of floats)
source redshifts conditioned on the source being strongly lensed
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.sample_source_redshift_sl(size=1000)
- property sample_source_parameters
Function to sample source parameters conditioned on the source being strongly lensed
- Parameters:
- sizeint
number of lens parameters to sample
- Returns:
- source_parametersdict
dictionary of source parameters conditioned on the source being strongly lensed
- property sample_lens_redshift
Function to sample lens redshifts, conditioned on the lens being strongly lensed
- Parameters:
- zsnumpy.ndarray (1D array of floats)
source redshifts
- Returns:
- zlnumpy.ndarray (1D array of floats)
lens redshifts corresponding to the source redshifts
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> zs = lens.sample_source_redshift_sl(size=1000) >>> lens.sample_lens_redshift(zs=zs)
- property sample_axis_rotation_angle
Function to sample the axis rotation angle of the elliptical lens galaxy from a uniform distribution
- Parameters:
- sizeint
number of lens parameters to sample
- Returns:
- phifloat
axis rotation angle of the elliptical lens galaxy
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.sample_axis_rotation_angle(size=1000)
- property sample_shear
Function to sample the elliptical lens galaxy shear from a normal distribution
- Parameters:
- sizeint
number of lens parameters to sample
- Returns:
- gamma_1float
shear component in the x-direction
- gamma_2float
shear component in the y-direction
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> gamma_1, gamma_2 = lens.shear_norm(size=1000)
- property sample_mass_density_spectral_index
Function to sample the lens galaxy spectral index of the mass density profile from a normal distribution
- Parameters:
- sizeint
number of lens parameters to sample
- Returns:
- gammafloat
spectral index of the density profile
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.mass_density_spectral_index_normal(size=1000)
- property sample_source_parameters
Function to sample source parameters conditioned on the source being strongly lensed
- Parameters:
- sizeint
number of lens parameters to sample
- Returns:
- source_parametersdict
dictionary of source parameters conditioned on the source being strongly lensed
- property available_lens_prior_list_and_its_params
Dictionary with list all the available priors and it’s corresponding parameters. This is an immutable instance attribute.
- property available_lens_functions
Dictionary with list all the available lens functions. This is an immutable instance attribute.
- cbc_pop
CompactBinaryPopulation
classThis is an already initialized class that contains a function (CompactBinaryPopulation.sample_gw_parameters) that actually samples the source parameters.
- z_min
float
minimum redshift
- z_max
float
maximum redshift
- m_min
float
minimum mass in detector frame
- m_max
float
maximum mass in detector frame
- normalization_pdf_z
float
normalization constant of the pdf p(z)
- class_initialization_lens(params=None)[source]
Function to initialize the parent classes
- Parameters:
- paramsdict
dictionary of parameters to initialize the parent classes
- lens_priors_categorization(lens_type, lens_priors=None, lens_priors_params=None, lens_functions=None)[source]
Function to categorize the lens priors/samplers
- Parameters:
- lens_typestr
lens type e.g. ‘epl_galaxy’ for elliptical power-law galaxy
- lens_priorsdict
dictionary of priors
- lens_priors_paramsdict
dictionary of priors parameters
- lens_functionsdict
dictionary of lens functions
- Returns:
- lens_priors_dict
dictionary of priors
- lens_priors_params_dict
dictionary of priors parameters
- lens_sampler_names_dict
dictionary of sampler names
- lens_functions_dict
dictionary of lens functions
- sample_lens_parameters(size=1000, lens_parameters_input=None)[source]
Function to call the specific galaxy lens parameters sampler routine.
- sample_all_routine(size=1000, lens_parameters_input=None)[source]
Function to sample galaxy lens parameters along with the source parameters.
- Parameters:
- sizeint
number of lens parameters to sample
- lens_parameters_inputdict
dictionary of lens parameters to sample
- Returns:
- lens_parametersdict
dictionary of lens parameters and source parameters (lens conditions applied):
zl: lens redshifts
zs: source redshifts, lensed condition applied
sigma: velocity dispersions
q: axis ratios
theta_E: Einstein radii
phi: axis rotation angle
e1: ellipticity component 1
e2: ellipticity component 2
gamma1: shear component 1
gamma2: shear component 2
gamma: spectral index of the mass density distribution
geocent_time: time of arrival of the unlensed signal
phase: phase of the unlensed signal
psi: polarization angle of the unlensed signal
theta_jn: inclination angle of the unlensed signal
luminosity_distance: luminosity distance of the source
mass_1_source: mass 1 (larger) of the source
mass_2_source: mass 2 (smaller) of the source
ra: right ascension of the source
dec: declination of the source
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.sample_all_routine(size=1000)
- strongly_lensed_source_redshifts(size=1000)[source]
Function to sample source redshifts and other parameters, conditioned on the source being strongly lensed.
- Parameters:
- sizeint
number of lens parameters to sample
- Returns:
- redshiftsfloat
source redshifts conditioned on the source being strongly lensed
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.strongly_lensed_source_redshifts(size=1000)
- source_parameters(size, get_attribute=False, param=None)[source]
Function to sample gw source parameters
- Parameters:
- sizeint
Number of samples to draw
- paramdict
Allows to pass in parameters as dict. param =
- Returns:
- source_parametersdict
Dictionary of source parameters source_parameters.keys() = [‘mass_1’, ‘mass_2’, ‘mass_1_source’, ‘mass_2_source’, ‘zs’, ‘luminosity_distance’, ‘inclination’, ‘polarization_angle’, ‘phase’, ‘geocent_time’, ‘ra’, ‘dec’, ‘a_1’, ‘a_2’, ‘tilt_1’, ‘tilt_2’, ‘phi_12’, ‘phi_jl’]
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.source_parameters(size=1000)
- lens_redshift_SDSS_catalogue(zs, get_attribute=False, param=None)[source]
Function to sample lens redshifts, conditioned on the lens being strongly lensed
- Parameters:
- zsfloat
source redshifts
- get_attributebool
If True, returns a function that can be called with zs as input
- Returns:
- zlfloat
lens redshifts
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.lens_redshift_SDSS_catalogue(zs=1.0)
- axis_rotation_angle_uniform(size=1000, phi_min=0.0, phi_max=2 * np.pi, get_attribute=False, param=None)[source]
Function to sample the axis rotation angle of the elliptical lens galaxy from a uniform distribution.
- Parameters:
- sizeint
number of lens parameters to sample
- phi_minfloat
minimum axis rotation angle of the elliptical lens galaxy
- phi_maxfloat
maximum axis rotation angle of the elliptical lens galaxy
- get_attributebool
If True, returns a function that can be called with size as input
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(phi_min=0.0, phi_max=2 * np.pi)
- Returns:
- phifloat
axis rotation angle of the elliptical lens galaxy
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.axis_rotation_angle_uniform(size=1000)
- shear_norm(size, scale=0.05, get_attribute=False, param=None)[source]
Function to sample the elliptical lens galaxy shear from a normal distribution
- Parameters:
- sizeint
number of lens parameters to sample
- scalefloat
standard deviation of the normal distribution
- get_attributebool
If True, returns a function that can be called with size as input
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(scale=0.05)
- Returns:
- gamma_1float
shear component in the x-direction
- gamma_2float
shear component in the y-direction
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> gamma_1, gamma_2 = lens.shear_norm(size=1000)
- mass_density_spectral_index_normal(size=1000, mean=2.0, std=0.2, get_attribute=False, param=None)[source]
Function to sample the lens galaxy spectral index of the mass density profile from a normal distribution
- Parameters:
- sizeint
number of lens parameters to sample
- meanfloat
mean of the normal distribution
- stdfloat
standard deviation of the normal distribution
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(mean=2.0, std=0.2)
- Returns:
- gammafloat
spectral index of the density profile
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> lens.mass_density_spectral_index_normal(size=1000)
- compute_einstein_radii(sigma, zl, zs)[source]
Function to compute the Einstein radii of the lens galaxies
- Parameters:
- sigmafloat
velocity dispersion of the lens galaxy
- zlfloat
lens redshifts
- zsfloat
source redshifts
- Returns:
- theta_Efloat
Einstein radii of the lens galaxies
Examples
>>> from ler.lens_galaxy_population import LensGalaxyParameterDistribution >>> lens = LensGalaxyParameterDistribution() >>> sigma = 200.0 >>> zl = 0.5 >>> zs = 1.0 >>> lens.compute_einstein_radii(sigma, zl, zs)
- ler.lens_galaxy_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.lens_galaxy_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.lens_galaxy_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.lens_galaxy_population.phi_cut_SIE(q)[source]
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy.
- Parameters:
- qfloat: array
axis ratio of the lens galaxy
- Returns:
- resultfloat: array
scaling factor
- ler.lens_galaxy_population.axis_ratio_rayleigh(sigma, q_min=0.2, q_max=1.0)[source]
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- Returns:
- qfloat: array
axis ratio of the lens galaxy
- ler.lens_galaxy_population.axis_ratio_SIS(sigma)[source]
Function to sample axis ratio from the SIS distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- Returns:
- qfloat: array
axis ratio of the lens galaxy
- ler.lens_galaxy_population.phi(s, z, cosmology_h=0.7)[source]
Function to calculate the lens galaxy velocity dispersion function at redshift z.
- Parameters:
- sfloat: array
velocity dispersion of the lens galaxy
- zfloat: array
redshift of the lens galaxy
- cosmology_hfloat
Hubble constant
- Returns:
- resultfloat: array
- ler.lens_galaxy_population.phi_loc_bernardi(sigma, alpha=0.94, beta=1.85, phistar=0.02099, sigmastar=113.78, cosmology_h=0.7)[source]
Function to calculate the local universe velocity dispersion function. Bernardi et al. (2010).
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- alpha, beta, phistar, sigmastarfloat
parameters of the velocity dispersion function
- cosmology_hfloat
Hubble constant with respect to 100 km/s/Mpc
- Returns:
- philoc_float: array
- class ler.lens_galaxy_population.OpticalDepth(npool=4, z_min=0.001, z_max=10.0, optical_depth_function=None, sampler_priors=None, sampler_priors_params=None, cosmology=None, directory='./interpolator_pickle', create_new_interpolator=False)[source]
Class to calculate the optical depth, velocity dispersion and axis-ratio of a lens galaxy population.
- Parameters:
- npoolint
number of processors to use for multiprocessing
- z_minfloat
minimum redshift of the lens galaxy population
- z_maxfloat
maximum redshift of the lens galaxy population
- optical_depth_functionstr or callable
Function or function name to calculate optical depth. Check for default/available optical depth functions by running, >>> from ler.lens_galaxy_population import OpticalDepth >>> print(OpticalDepth().available_optical_depth_list_and_its_params)
- sampler_priors, sampler_priors_paramsdict, dict
dictionary of sampler functions and it’s parameters to sample velocity dispersion and axis-ratio. Check for default/available sampler priors and corresponding input parameters by running, >>> from ler.lens_galaxy_population import OpticalDepth >>> print(OpticalDepth().available_velocity_dispersion_list_and_its_params) >>> print(OpticalDepth().available_axis_ratio_list_and_its_params)
- cosmologyastropy.cosmology
Cosmology to use default: None/astropy.cosmology.FlatLambdaCDM(H0=70, Om0=0.3)
- directorystr
directory to store interpolator pickle files default: “./interpolator_pickle”
- create_new_interpolatordict
dictionary to create new interpolator for velocity dispersion and optical depth.
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.strong_lensing_optical_depth(0.5))
- property strong_lensing_optical_depth
Function to compute the strong lensing optical depth.
- Parameters:
- zsnumpy.ndarray (1D array of floats)
source redshifts
- Returns:
- taunumpy.ndarray (1D array of floats)
strong lensing optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.strong_lensing_optical_depth(np.array([0.1,0.2,0.3])))
- property sample_velocity_dispersion
Function to sample velocity dispersion. zl is required only if velocity dispersion sampler is redshift dependent.
- Parameters:
- sizeint
number of lens parameters to sample
- zlfloat
redshift of the lens galaxy
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.sample_velocity_dispersion(size=10))
- property sample_axis_ratio
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
- Returns:
- qnumpy.ndarray (1D array of floats)
axis ratio of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.sample_axis_ratio(sigma=200.))
- property available_velocity_dispersion_list_and_its_params
Function to list all available velocity dispersion sampler and its parameters.
- property available_axis_ratio_list_and_its_params
Function to list all available axis ratio sampler.
- property available_optical_depth_list_and_its_params
Function to list all available optical depth sampler.
- initialize_velocity_dispersion_sampler(vd_name)[source]
Function to initialize velocity dispersion sampler
- Parameters:
- vd_namestr
name of velocity dispersion sampler
- initialize_optical_depth_function(tau_name, vd_name)[source]
Function to initialize optical depth function.
- Parameters:
- tau_namestr
name of optical depth function
- vd_namestr
name of velocity dispersion sampler
- axis_ratio_rayleigh(sigma, q_min=0.2, q_max=1.0, get_attribute=False, param=None, **kwargs)[source]
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- q_min, q_maxfloat
minimum and maximum axis ratio
- get_attributebool
if True, returns a function that can be used to sample axis ratio
- Returns:
- qfloat: array
axis ratio of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(axis_ratio="axis_ratio_rayleigh")) >>> print(od.sample_axis_ratio(sigma=200.))
- axis_ratio_padilla_strauss(size=1000, q_min=0.2, q_max=1.0, get_attribute=False, param=None, **kwargs)[source]
Function to sample axis ratio using Padilla and Strauss 2008 distribution for axis ratio
- Parameters:
- sizeint
sample size
- q_min, q_maxfloat
minimum and maximum axis ratio
- get_attributebool
if True, returns a function that can be used to sample axis ratio
- Returns:
- qfloat: array
axis ratio of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(axis_ratio="axis_ratio_padilla_strauss")) >>> print(od.sample_axis_ratio(size=10))
- velocity_dispersion_gengamma(size, a=2.32 / 2.67, c=2.67, get_attribute=False, param=None, **kwargs)[source]
Function to sample velocity dispersion from gengamma distribution
- Parameters:
- sizeint
number of lens parameters to sample
- a,cfloat
parameters of gengamma distribution refer to https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.gengamma.html
- get_attributebool
if True, returns a function that can be used to sample velocity dispersion
- paramdict
Allows to pass in above parameters as dict. e.g. param = dict(a=2.32 / 2.67, c=2.67)
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(velocity_dispersion="velocity_dispersion_gengamma"), sampler_priors_params=dict(velocity_dispersion=dict(a=2.32 / 2.67, c=2.67))) >>> print(od.sample_velocity_dispersion(size=10))
- velocity_dispersion_bernardi(size, get_attribute=False, **kwargs)[source]
Function to sample velocity dispersion from Bernardi et al. (2010). This uses inverse transform sampling.
- Parameters:
- sizeint
number of lens parameters to sample
- get_attributebool
if True, returns a function that can be used to sample velocity dispersion
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(velocity_dispersion="velocity_dispersion_bernardi")) >>> print(od.sample_velocity_dispersion(size=10))
- velocity_dispersion_ewoud(size, zl, get_attribute=False, **kwargs)[source]
Function to sample velocity dispersion (redshift dependent) from Wempe et al. (2022). This uses inverse transform sampling.
- Parameters:
- sizeint
number of lens parameters to sample
- zlfloat
redshift of the lens galaxy
- get_attributebool
if True, returns a function that can be used to sample velocity dispersion
- Returns:
- sigmanumpy.ndarray (1D array of floats)
velocity dispersion of the lens galaxy
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth(sampler_priors=dict(velocity_dispersion="velocity_dispersion_ewoud")) >>> print(od.sample_velocity_dispersion(size=10, zl=0.5))
- cross_section_SIS(sigma, zl, zs)[source]
Function to compute the SIS cross-section
- Parameters:
- sigmafloat
velocity dispersion of the lens galaxy
- zlfloat
redshift of the lens galaxy
- zsfloat
redshift of the source galaxy
- Returns:
- cross_sectionfloat
SIS cross-section
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.cross_section_SIS(sigma=200., zl=0.5, zs=1.0))
- tau_zl_zs(zl, zs)[source]
Function to compute the optical depth for a given lens redshift and source redshift
- Parameters:
- zlfloat
redshift of the lens galaxy
- zsfloat
redshift of the source galaxy
- Returns:
- taufloat
optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.tau_zl_zs(zl=0.5, zs=1.0))
- optical_depth_calculator(zs)[source]
Function to compute the optical depth without multiprocessing. This is the integrated version of tau_zl_zs from z=0 to z=zs.
- Parameters:
- zsfloat
source redshifts
- Returns:
- taufloat
optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.optical_depth_calculator(zs=1.0))
- optical_depth_multiprocessing(zs)[source]
Function to compute the optical depth with multiprocessing. This is the integrated version of optical depth from z=0 to z=zs.
- Parameters:
- zsfloat
source redshifts
- Returns:
- taufloat
optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.optical_depth_multiprocessing(zs=1.0))
- optical_depth_SIS_haris(zs)[source]
Function to compute the strong lensing optical depth (SIS).
LambdaCDM(H0=70, Om0=0.3, Ode0=0.7) was used to derive the following equation. This is the analytic version of optical depth from z=0 to z=zs.
- Parameters:
- zsfloat
source redshifts
- Returns:
- taufloat
strong lensing optical depth
Examples
>>> from ler.lens_galaxy_population import OpticalDepth >>> od = OpticalDepth() >>> print(od.optical_depth_SIS_haris(zs=1.0))
- ler.lens_galaxy_population.phi_cut_SIE(q)[source]
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy.
- Parameters:
- qfloat: array
axis ratio of the lens galaxy
- Returns:
- resultfloat: array
scaling factor
- ler.lens_galaxy_population.axis_ratio_rayleigh(sigma, q_min=0.2, q_max=1.0)[source]
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- Returns:
- qfloat: array
axis ratio of the lens galaxy
- ler.lens_galaxy_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.lens_galaxy_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.lens_galaxy_population.optical_depth_sie2_mp(params)[source]
Function to calculate the optical depth for SIE lens with velocity dispersion distribution depending on redshift.
- Parameters:
- paramslist
list of parameters params[0] = zs (source redshift, float) params[1] = no (number density of lens galaxies, float) params[2] = vd_inv_cdf (velocity dispersion inverse cdf coefficients and redshift list, list). This vd_inv_cdf(s) of each redshift. params[3] = splineVcdz (differential comoving volume spline interpolator coefficients, list) params[4] = splineDa (angular diameter distance spline interpolator coefficients and redshift list, list) params[5] = idx (index to keep track of the operation, int) params[6] = zl_list (list of lens redshifts, list). This use for choosing the right vd_inv_cdf(s) for each lens redshifts.
- ler.lens_galaxy_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.lens_galaxy_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.lens_galaxy_population.axis_ratio_SIS(sigma)[source]
Function to sample axis ratio from the SIS distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- Returns:
- qfloat: array
axis ratio of the lens galaxy
- ler.lens_galaxy_population.phi(s, z, cosmology_h=0.7)[source]
Function to calculate the lens galaxy velocity dispersion function at redshift z.
- Parameters:
- sfloat: array
velocity dispersion of the lens galaxy
- zfloat: array
redshift of the lens galaxy
- cosmology_hfloat
Hubble constant
- Returns:
- resultfloat: array
- ler.lens_galaxy_population.phi_loc_bernardi(sigma, alpha=0.94, beta=1.85, phistar=0.02099, sigmastar=113.78, cosmology_h=0.7)[source]
Function to calculate the local universe velocity dispersion function. Bernardi et al. (2010).
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- alpha, beta, phistar, sigmastarfloat
parameters of the velocity dispersion function
- cosmology_hfloat
Hubble constant with respect to 100 km/s/Mpc
- Returns:
- philoc_float: array
- ler.lens_galaxy_population.phi_cut_SIE(q)[source]
Function to calculate cross-section scaling factor for the SIE lens galaxy from SIS lens galaxy.
- Parameters:
- qfloat: array
axis ratio of the lens galaxy
- Returns:
- resultfloat: array
scaling factor
- ler.lens_galaxy_population.axis_ratio_rayleigh(sigma, q_min=0.2, q_max=1.0)[source]
Function to sample axis ratio from rayleigh distribution with given velocity dispersion.
- Parameters:
- sigmafloat: array
velocity dispersion of the lens galaxy
- Returns:
- qfloat: array
axis ratio of the lens galaxy
- ler.lens_galaxy_population.velocity_dispersion_z_dependent(size, zl, zl_list, vd_inv_cdf)[source]
Function to sample velocity dispersion from the interpolator
- Parameters:
- size: int
Number of samples to draw
- zl: `numpy.ndarray` (1D array of float of size=size)
Redshift of the lens galaxy
- Returns:
- samples: numpy.ndarray
Samples of velocity dispersion
- ler.lens_galaxy_population.lens_redshift_SDSS_catalogue(zs, splineDc, splineDcInv, u, cdf)[source]
Function to sample lens redshift from the SDSS catalogue.
- Parameters:
- zs: `numpy.ndarray` (1D array of float of size=size)
Redshift of the source galaxy
- splineDc: `list`
List of spline coefficients for the comoving distance and redshifts
- splineDcInv: `list`
List of spline coefficients for the inverse of comoving distance and redshifts
- u: `numpy.ndarray` (1D array of float of size=size)
e.g. u = np.linspace(0, 1, 500)
- cdf: `numpy.ndarray` (1D array of float of size=size)
Cumulative distribution function of the lens redshift distribution between 0 and 1
- Returns:
- zl: numpy.ndarray (1D array of float of size=size)
Redshift of the lens galaxy corresponding to the zs
- ler.lens_galaxy_population.bounded_normal_sample(size, mean, std, low, high)[source]
Function to sample from a normal distribution with bounds.
- Parameters:
- mean: `float`
Mean of the normal distribution
- std: `float`
Standard deviation of the normal distribution
- low: `float`
Lower bound
- high: `float`
Upper bound