:py:mod:`ler.gw_source_population.cbc_source_parameter_distribution` ==================================================================== .. py:module:: ler.gw_source_population.cbc_source_parameter_distribution .. autoapi-nested-parse:: Module for sampling compact binary coalescence (CBC) source parameters. This module provides the ``CBCSourceParameterDistribution`` class for generating complete sets of intrinsic and extrinsic gravitational wave parameters for compact binary sources (BBH, BNS, NSBH). It includes mass distributions, spin parameters, sky positions, and other parameters needed for GW analysis. Inheritance hierarchy: - :class:`~ler.gw_source_population.CBCSourceRedshiftDistribution` Usage: Basic workflow example: >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution(event_type='BBH') >>> params = cbc.sample_gw_parameters(size=1000) >>> print(list(params.keys())) .. !! processed by numpydoc !! Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: ler.gw_source_population.cbc_source_parameter_distribution.CBCSourceParameterDistribution Attributes ~~~~~~~~~~ .. autoapisummary:: ler.gw_source_population.cbc_source_parameter_distribution.chunk_size .. py:data:: chunk_size :value: '10000' .. py:class:: CBCSourceParameterDistribution(z_min=0.0, z_max=10.0, event_type='BBH', source_priors=None, source_priors_params=None, cosmology=None, spin_zero=False, spin_precession=False, directory='./interpolator_json', create_new_interpolator=False) Bases: :py:obj:`ler.gw_source_population.cbc_source_redshift_distribution.CBCSourceRedshiftDistribution` Class for sampling compact binary coalescence source parameters. This class generates complete sets of intrinsic and extrinsic gravitational wave parameters for compact binary sources including masses, spins, sky positions, and orbital parameters. It supports BBH, BNS, NSBH, and primordial black hole populations with configurable prior distributions. Key Features: - Multiple mass distribution models (PowerLaw+Gaussian, lognormal, bimodal) - Configurable spin priors (zero, aligned, precessing) - Isotropic sky position and orientation sampling - Built-in support for population III and primordial black holes :Parameters: **z_min** : ``float`` Minimum redshift of the source population. default: 0.0 **z_max** : ``float`` Maximum redshift of the source population. default: 10.0 **event_type** : ``str`` Type of compact binary event to generate. Options: - 'BBH': Binary black hole (Population I/II) - 'BNS': Binary neutron star - 'NSBH': Neutron star-black hole - 'BBH_popIII': Population III binary black hole - 'BBH_primordial': Primordial binary black hole default: 'BBH' **source_priors** : ``dict`` or ``None`` Dictionary of prior sampler functions for each parameter. If None, uses default priors based on event_type. default: None **source_priors_params** : ``dict`` or ``None`` Dictionary of parameters for each prior sampler function. If None, uses default parameters based on event_type. default: None **cosmology** : ``astropy.cosmology`` or ``None`` Cosmology to use for distance calculations. default: LambdaCDM(H0=70, Om0=0.3, Ode0=0.7, Tcmb0=0.0, Neff=3.04, m_nu=None, Ob0=0.0) **spin_zero** : ``bool`` If True, spin parameters are set to zero (no spin sampling). default: False **spin_precession** : ``bool`` If True (and spin_zero=False), sample precessing spin parameters. If False (and spin_zero=False), sample aligned/anti-aligned spins. default: False **directory** : ``str`` Directory to store interpolator JSON files. default: './interpolator_json' **create_new_interpolator** : ``dict`` or ``bool`` Configuration for creating new interpolators. If bool, applies to all interpolators. default: False .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution(event_type='BBH') >>> params = cbc.sample_gw_parameters(size=1000) >>> print(list(params.keys())) Instance Methods ---------- CBCSourceParameterDistribution has the following methods: +-----------------------------------------------------+------------------------------------------------+ | Method | Description | +=====================================================+================================================+ | :meth:`~sample_gw_parameters` | Sample all GW parameters for compact binaries | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~binary_masses_BBH_powerlaw_gaussian`| Sample BBH masses with PowerLaw+PEAK model | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~binary_masses_BBH_popIII_lognormal` | Sample pop III BBH masses from lognormal | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~binary_masses_BBH_primordial_lognormal` | Sample primordial BBH masses from lognormal | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~binary_masses_NSBH_broken_powerlaw` | Sample NSBH masses from broken powerlaw | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~binary_masses_uniform` | Sample masses from uniform distribution | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~binary_masses_BNS_bimodal` | Sample BNS masses from bimodal distribution | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~constant_values_n_size` | Return array of constant values | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~sampler_uniform` | Sample from uniform distribution | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~sampler_cosine` | Sample from cosine distribution | +-----------------------------------------------------+------------------------------------------------+ | :meth:`~sampler_sine` | Sample from sine distribution | +-----------------------------------------------------+------------------------------------------------+ Instance Attributes ---------- CBCSourceParameterDistribution has the following attributes: +------------------------------------------------+------------------------+-------+------------------------------------------------+ | Attribute | Type | Unit | Description | +================================================+========================+=======+================================================+ | :attr:`~z_min` | ``float`` | | Minimum redshift of source population | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~z_max` | ``float`` | | Maximum redshift of source population | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~cosmo` | ``astropy.cosmology`` | | Cosmology for distance calculations | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~spin_zero` | ``bool`` | | Whether to ignore spin parameters | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~spin_precession` | ``bool`` | | Whether to use precessing spins | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~directory` | ``str`` | | Directory for interpolator files | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~gw_param_samplers` | ``dict`` | | Dictionary of parameter sampler functions | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~gw_param_samplers_params` | ``dict`` | | Dictionary of sampler function parameters | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~available_gw_prior` | ``dict`` | | Available prior distributions | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~source_frame_masses` | ``callable`` | | Sampler for source frame masses | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~zs` | ``callable`` | | Sampler for source redshift | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~geocent_time` | ``callable`` | | Sampler for geocentric time | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~ra` | ``callable`` | | Sampler for right ascension | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~dec` | ``callable`` | | Sampler for declination | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~phase` | ``callable`` | | Sampler for coalescence phase | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~psi` | ``callable`` | | Sampler for polarization angle | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~theta_jn` | ``callable`` | | Sampler for inclination angle | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~a_1` | ``callable`` | | Sampler for spin1 magnitude | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~a_2` | ``callable`` | | Sampler for spin2 magnitude | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~tilt_1` | ``callable`` | | Sampler for tilt1 angle | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~tilt_2` | ``callable`` | | Sampler for tilt2 angle | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~phi_12` | ``callable`` | | Sampler for phi_12 angle | +------------------------------------------------+------------------------+-------+------------------------------------------------+ | :attr:`~phi_jl` | ``callable`` | | Sampler for phi_jl angle | +------------------------------------------------+------------------------+-------+------------------------------------------------+ .. !! processed by numpydoc !! .. py:property:: zs Class object (of FunctionConditioning) for source redshift, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the redshift distribution - `pdf`: returns the probability density function of the redshift distribution - `function`: returns the redshift distribution function. :Returns: **zs** : ``numpy.ndarray`` Array of redshift values. .. !! processed by numpydoc !! .. py:property:: source_frame_masses Class object (of FunctionConditioning) for source frame masses, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the density profile slope distribution :Returns: **mass_1_source** : ``numpy.ndarray`` Array of mass_1_source values in solar masses. **mass_2_source** : ``numpy.ndarray`` Array of mass_2_source values in solar masses. .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc_source_param_dist = CBCSourceParameterDistribution() >>> cbc_source_param_dist.source_frame_masses(size=10) .. !! processed by numpydoc !! .. py:property:: geocent_time Class object (of FunctionConditioning) for geocentric time, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the geocentric time distribution - `pdf`: returns the probability density function of the geocentric time distribution - `function`: returns the geocentric time distribution function. :Returns: **geocent_time** : ``numpy.ndarray`` Array of geocentric time values. .. !! processed by numpydoc !! .. py:property:: ra Class object (of FunctionConditioning) for right ascension, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the right ascension distribution - `pdf`: returns the probability density function of the right ascension distribution - `function`: returns the right ascension distribution function. :Returns: **ra** : ``numpy.ndarray`` Array of right ascension values. .. !! processed by numpydoc !! .. py:property:: dec Class object (of FunctionConditioning) for declination, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the declination distribution - `pdf`: returns the probability density function of the declination distribution - `function`: returns the declination distribution function. :Returns: **dec** : ``numpy.ndarray`` Array of declination values. .. !! processed by numpydoc !! .. py:property:: phase Class object (of FunctionConditioning) for coalescence phase, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the coalescence phase distribution - `pdf`: returns the probability density function of the coalescence phase distribution - `function`: returns the coalescence phase distribution function. :Returns: **phase** : ``numpy.ndarray`` Array of coalescence phase values. .. !! processed by numpydoc !! .. py:property:: psi Class object (of FunctionConditioning) for polarization angle, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the polarization angle distribution - `pdf`: returns the probability density function of the polarization angle distribution - `function`: returns the polarization angle distribution function. :Returns: **geocent_time** : ``numpy.ndarray`` Array of polarization angle values. .. !! processed by numpydoc !! .. py:property:: theta_jn Class object (of FunctionConditioning) for inclination angle, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the inclination angle distribution - `pdf`: returns the probability density function of the inclination angle distribution - `function`: returns the inclination angle distribution function. :Returns: **theta_jn** : ``numpy.ndarray`` Array of inclination angle values, i.e. the angle between the line of sight and the orbital angular momentum (rad). .. !! processed by numpydoc !! .. py:property:: a_1 Class object (of FunctionConditioning) for spin1 magnitude, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the spin1 magnitude distribution - `pdf`: returns the probability density function of the spin1 magnitude distribution - `function`: returns the spin1 magnitude distribution function. :Returns: **a_1** : ``numpy.ndarray`` Array of spin magnitude values for the primary body. .. !! processed by numpydoc !! .. py:property:: a_2 Class object (of FunctionConditioning) for spin2 magnitude, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the spin2 magnitude distribution - `pdf`: returns the probability density function of the spin2 magnitude distribution - `function`: returns the spin2 magnitude distribution function. :Returns: **a_2** : ``numpy.ndarray`` Array of spin magnitude values for the secondary body. .. !! processed by numpydoc !! .. py:property:: tilt_1 Class object (of FunctionConditioning) for tilt1 angle, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the tilt1 angle distribution - `pdf`: returns the probability density function of the tilt1 angle distribution - `function`: returns the tilt1 angle distribution function. :Returns: **tilt_1** : ``numpy.ndarray`` Array of the spin tilt angle of the primary body, i.e. the angle between the spin vector and the orbital angular momentum for the primary body (rad). .. !! processed by numpydoc !! .. py:property:: tilt_2 Class object (of FunctionConditioning) for tilt2 angle, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the tilt2 angle distribution - `pdf`: returns the probability density function of the tilt2 angle distribution - `function`: returns the tilt2 angle distribution function. :Returns: **tilt_2** : ``numpy.ndarray`` Array of the spin tilt angle of the secondary body, i.e. the angle between the spin vector and the orbital angular momentum for the secondary body (rad). .. !! processed by numpydoc !! .. py:property:: phi_12 Class object (of FunctionConditioning) for phi_12 angle, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the phi_12 angle distribution - `pdf`: returns the probability density function of the phi_12 angle distribution - `function`: returns the phi_12 angle distribution function. :Returns: **phi_12** : ``numpy.ndarray`` Array of the spin tilt angle between the two spins, i.e., angle between the projections of the two spins onto the orbital plane (rad). .. !! processed by numpydoc !! .. py:property:: phi_jl Class object (of FunctionConditioning) for phi_jl angle, with rvs/sampler as callback. Can also be a user defined callable sampler. The class object contains the following attribute methods: - `rvs`: returns random samples from the phi_jl angle distribution - `pdf`: returns the probability density function of the phi_jl angle distribution - `function`: returns the phi_jl angle distribution function. :Returns: **phi_jl** : ``numpy.ndarray`` Array of the angle values between the orientation of the total angular momentum around the orbital angular momentum (rad). .. !! processed by numpydoc !! .. py:property:: available_gw_prior Dictionary of all available prior distributions and their parameters. This is a dynamically generated dictionary containing available samplers for each GW parameter type and their default parameter values. :Returns: **available_gw_prior** : ``dict`` Nested dictionary organized by parameter type (e.g., 'source_frame_masses', 'geocent_time', etc.) with sampler names and default parameters. .. !! processed by numpydoc !! .. py:attribute:: z_min :value: 'None' ``float`` Minimum redshift of the source population .. !! processed by numpydoc !! .. py:attribute:: z_max :value: 'None' ``float`` Maximum redshift of the source population .. !! processed by numpydoc !! .. py:attribute:: event_type :value: 'None' ``str`` Type of event to generate. e.g. 'BBH', 'BNS', 'NSBH' .. !! processed by numpydoc !! .. py:attribute:: source_priors :value: 'None' ``dict`` Dictionary of prior sampler functions. .. !! processed by numpydoc !! .. py:attribute:: source_priors_params :value: 'None' ``dict`` Dictionary of prior sampler functions' input parameters. .. !! processed by numpydoc !! .. py:attribute:: cosmo ``astropy.cosmology`` Cosmology to use. .. !! processed by numpydoc !! .. py:attribute:: spin_zero :value: 'None' ``bool`` If True, spin prior is set to zero. .. !! processed by numpydoc !! .. py:attribute:: spin_precession :value: 'False' .. py:attribute:: directory :value: "'./interpolator_json'" Directory path for storing interpolator JSON files. :Returns: **directory** : ``str`` Path to the interpolator storage directory. default: './interpolator_json' .. !! processed by numpydoc !! .. py:method:: sample_gw_parameters(size=1000, param=None) Sample all gravitational wave parameters for compact binaries. Generates a complete set of intrinsic and extrinsic parameters including masses, redshift, luminosity distance, sky position, orientation, and optionally spin parameters. :Parameters: **size** : ``int`` Number of samples to draw. default: 1000 **param** : ``dict`` or ``None`` Dictionary of fixed parameter values. Parameters in this dict will not be sampled. default: None :Returns: **gw_parameters** : ``dict`` Dictionary of sampled GW parameters. The included parameters and their units are as follows (for default settings): +--------------------+--------------+--------------------------------------+ | Parameter | Units | Description | +====================+==============+======================================+ | zs | | redshift of the source | +--------------------+--------------+--------------------------------------+ | geocent_time | s | GPS time of coalescence | +--------------------+--------------+--------------------------------------+ | ra | rad | right ascension | +--------------------+--------------+--------------------------------------+ | dec | rad | declination | +--------------------+--------------+--------------------------------------+ | phase | rad | phase of GW at reference frequency | +--------------------+--------------+--------------------------------------+ | psi | rad | polarization angle | +--------------------+--------------+--------------------------------------+ | theta_jn | rad | inclination angle | +--------------------+--------------+--------------------------------------+ | a_1 | | spin_1 of the compact binary | +--------------------+--------------+--------------------------------------+ | a_2 | | spin_2 of the compact binary | +--------------------+--------------+--------------------------------------+ | luminosity_distance| Mpc | luminosity distance | +--------------------+--------------+--------------------------------------+ | mass_1_source | Msun | mass_1 of the compact binary | | | | (source frame) | +--------------------+--------------+--------------------------------------+ | mass_2_source | Msun | mass_2 of the compact binary | | | | (source frame) | +--------------------+--------------+--------------------------------------+ | mass_1 | Msun | mass_1 of the compact binary | | | | (detector frame) | +--------------------+--------------+--------------------------------------+ | mass_2 | Msun | mass_2 of the compact binary | | | | (detector frame) | +--------------------+--------------+--------------------------------------+ .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> params = cbc.sample_gw_parameters(size=1000) >>> print(list(params.keys())) .. !! processed by numpydoc !! .. py:method:: binary_masses_BBH_powerlaw_gaussian(size, get_attribute=False, **kwargs) Sample source masses with PowerLaw+PEAK model for Population I/II BBH. Implements the mass distribution model from LIGO-Virgo population analyses combining a power-law with a Gaussian peak component. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - mminbh: Minimum BH mass (Msun), default: 4.98 - mmaxbh: Maximum BH mass (Msun), default: 112.5 - alpha: Power-law spectral index, default: 3.78 - mu_g: Gaussian peak mean (Msun), default: 32.27 - sigma_g: Gaussian peak width (Msun), default: 3.88 - lambda_peak: Fraction in Gaussian component, default: 0.03 - delta_m: Low-mass tapering range (Msun), default: 4.8 - beta: Mass ratio power-law index, default: 0.81 :Returns: **mass_1_source** : ``numpy.ndarray`` Array of primary masses in source frame (Msun). **mass_2_source** : ``numpy.ndarray`` Array of secondary masses in source frame (Msun). .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_BBH_powerlaw_gaussian(size=1000) .. !! processed by numpydoc !! .. py:method:: binary_masses_BBH_popIII_lognormal(size, get_attribute=False, **kwargs) Sample source masses for Population III BBH from lognormal distribution. Based on Eqn. 1 and 4 of Ng et al. 2022 for Population III black holes. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - m_min: Minimum BH mass (Msun), default: 5.0 - m_max: Maximum BH mass (Msun), default: 150.0 - Mc: Central mass scale (Msun), default: 30.0 - sigma: Distribution width, default: 0.3 :Returns: **mass_1_source** : ``numpy.ndarray`` Array of primary masses in source frame (Msun). **mass_2_source** : ``numpy.ndarray`` Array of secondary masses in source frame (Msun). .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution(event_type='BBH_popIII') >>> m1_src, m2_src = cbc.binary_masses_BBH_popIII_lognormal(size=1000) .. !! processed by numpydoc !! .. py:method:: binary_masses_BBH_primordial_lognormal(size, get_attribute=False, **kwargs) Sample source masses for primordial BBH from lognormal distribution. Based on Eqn. 1 and 4 of Ng et al. 2022 for primordial black holes. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - m_min: Minimum BH mass (Msun), default: 1.0 - m_max: Maximum BH mass (Msun), default: 100.0 - Mc: Central mass scale (Msun), default: 20.0 - sigma: Distribution width, default: 0.3 :Returns: **mass_1_source** : ``numpy.ndarray`` Array of primary masses in source frame (Msun). **mass_2_source** : ``numpy.ndarray`` Array of secondary masses in source frame (Msun). .. !! processed by numpydoc !! .. py:method:: binary_masses_NSBH_broken_powerlaw(size, get_attribute=False, **kwargs) Sample source masses for NSBH from broken power-law distribution. Uses gwcosmo-style broken power-law for black hole mass and power-law for neutron star mass. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - mminbh: Minimum BH mass (Msun), default: 26 - mmaxbh: Maximum BH mass (Msun), default: 125 - alpha_1: Primary power-law index, default: 6.75 - alpha_2: Secondary power-law index, default: 6.75 - b: Break point, default: 0.5 - delta_m: Tapering range (Msun), default: 5 - mminns: Minimum NS mass (Msun), default: 1.0 - mmaxns: Maximum NS mass (Msun), default: 3.0 - alphans: NS mass power-law index, default: 0.0 :Returns: **mass_1_source** : ``numpy.ndarray`` Array of BH masses in source frame (Msun). **mass_2_source** : ``numpy.ndarray`` Array of NS masses in source frame (Msun). .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution(event_type='NSBH') >>> m1_src, m2_src = cbc.binary_masses_NSBH_broken_powerlaw(size=1000) .. !! processed by numpydoc !! .. py:method:: binary_masses_uniform(size, get_attribute=False, **kwargs) Sample source masses from uniform distribution. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - m_min: Minimum mass (Msun), default: 1.0 - m_max: Maximum mass (Msun), default: 3.0 :Returns: **mass_1_source** : ``numpy.ndarray`` Array of primary masses in source frame (Msun). **mass_2_source** : ``numpy.ndarray`` Array of secondary masses in source frame (Msun). .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution() >>> m1_src, m2_src = cbc.binary_masses_uniform(size=1000) .. !! processed by numpydoc !! .. py:method:: binary_masses_BNS_bimodal(size, get_attribute=False, **kwargs) Sample BNS masses from bimodal Gaussian distribution. Based on Will M. Farr et al. 2020 Eqn. 6 for neutron star mass distribution combining two Gaussian peaks. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - w: Weight of left peak, default: 0.643 - muL: Mean of left peak (Msun), default: 1.352 - sigmaL: Width of left peak (Msun), default: 0.08 - muR: Mean of right peak (Msun), default: 1.88 - sigmaR: Width of right peak (Msun), default: 0.3 - mmin: Minimum mass (Msun), default: 1.0 - mmax: Maximum mass (Msun), default: 2.3 :Returns: **mass_1_source** : ``numpy.ndarray`` Array of primary masses in source frame (Msun). **mass_2_source** : ``numpy.ndarray`` Array of secondary masses in source frame (Msun). .. rubric:: Examples >>> from ler.gw_source_population import CBCSourceParameterDistribution >>> cbc = CBCSourceParameterDistribution(event_type='BNS') >>> m1_src, m2_src = cbc.binary_masses_BNS_bimodal(size=1000) .. !! processed by numpydoc !! .. py:method:: constant_values_n_size(size=100, get_attribute=False, **kwargs) Return array of constant values. :Parameters: **size** : ``int`` Number of values to return. default: 100 **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - value: Constant value to return, default: 0.0 :Returns: **values** : ``numpy.ndarray`` Array of constant values. .. !! processed by numpydoc !! .. py:method:: sampler_uniform(size, get_attribute=False, **kwargs) Sample values from uniform distribution. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False **\*\*kwargs** : ``dict`` Model parameters: - xmin: Minimum value, default: 0.0 - xmax: Maximum value, default: 1.0 :Returns: **values** : ``numpy.ndarray`` Array of uniformly distributed values in range [xmin, xmax]. .. !! processed by numpydoc !! .. py:method:: sampler_cosine(size, get_attribute=False, **kwargs) Sample from cosine distribution for declination. Samples values in range [-pi/2, pi/2] following a cosine distribution, appropriate for isotropic sky position declination. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False :Returns: **values** : ``numpy.ndarray`` Array of values in range [-pi/2, pi/2] (rad). .. !! processed by numpydoc !! .. py:method:: sampler_sine(size, get_attribute=False, **kwargs) Sample from sine distribution for inclination angles. Samples values in range [0, pi] following a sine distribution, appropriate for isotropic orientation angles. :Parameters: **size** : ``int`` Number of samples to draw. **get_attribute** : ``bool`` If True, return the sampler object instead of samples. default: False :Returns: **values** : ``numpy.ndarray`` Array of values in range [0, pi] (rad). .. !! processed by numpydoc !!