injection_utils module¶
- injection_utils.draw_mass_distinct_normal_imf(mass_dict, alpha_salpeter=-2.35)[source]¶
Yields a random mass pair (m1, m2) where mass1 is drawn from a normal distribution of mean mean_mass and standard deviation sigma_mass and mass2 is drawn from a Salpeter initial mass function distribution.
Requires mean_mass, sigma_mass, min_mass{1,2}, max_mass{1,2}, max_mtotal keys
- injection_utils.draw_mass_distinct_uniform(mass_dict)[source]¶
Yields a random mass pair (m1, m2) where each mass is drawn from a separate uniform distribution so that min_mass1 <= m1 < max_mass1 and min_mass2 <= m2 <= max_mass2 and m1+m2 <= max_mass.
Requires max_mass{1,2}, min_mass{1,2}, max_mtotal keys
- injection_utils.draw_mass_distinct_uniform_imf(mass_dict, alpha_salpeter=-2.35)[source]¶
Yields a random mass pair (m1, m2) where mass1 is drawn from a uniform distribution so that min_mass1 <= m1 < max_mass1 and mass2 is drawn from a Salpeter initial mass function distribution.
Requires min_mass{1,2}, max_mass{1,2} keys
- injection_utils.draw_mass_distinct_uniform_in_log_mass(mass_dict)[source]¶
Yields a random mass pair (m1, m2) where each mass is drawn from a separate uniform-in-log distribution so that min_mass1 <= m1 < max_mass1 and min_mass2 <= m2 <= max_mass2 and m1+m2 <= max_mass.
Requires max_mass{1,2}, min_mass{1,2}, max_mtotal keys
- injection_utils.draw_mass_distinct_uniform_uniforminlog(mass_dict)[source]¶
Yields a random mass pair (m1, m2) where mass1 is drawn from a uniform distribution so that min_mass1 <= m1 < max_mass1 and mass2 is drawn from a uniform_in_log_mass distribution so that min_mass2 <= m2 < max_mass2
Requires max_mass{1,2}, min_mass{1,2} keys
- injection_utils.draw_mass_pair_imf(mass_dict, alpha_salpeter=-2.35)[source]¶
Yields random masses, with the first component drawn from the Salpeter initial mass function distribution and the second mass drawn uniformly between min_mass and the mass of the first component. Note: max_mtotal has very little effect on the resulting distribution.
Requires max_mass, min_mass, max_mtotal keys
- injection_utils.draw_mass_pair_normal(mass_dict)[source]¶
Yields a random mass pair (m1, m2) where each mass is drawn from a normal distribution of mean mean_mass and standard deviation sigma_mass, clipped so that min_mass <= m1,m2 < max_mass.
Requires mean_mass, sigma_mass, max_mass, min_mass keys
- injection_utils.draw_mass_pair_power(mass_dict, alpha=-2.35, beta=2.0)[source]¶
Yields mass pairs with the primary mass drawn from the Salpeter power law distribution and the secondary drawn from a distribution proportional to the square of mass between min_mass and the primary mass. (Or any other power laws, if the default kwargs are overridden.)
Requires max_mass, min_mass keys
- injection_utils.draw_mass_pair_uniform(mass_dict, alpha=-2.35, beta=2.0)[source]¶
Yields a random mass pair (m1, m2) where each mass is drawn from a uniform distribution so that min_mass <= m1,m2 < max_mass.
Requires max_mass, min_mass keys
- injection_utils.draw_mass_pair_uniform_in_log_mass(mass_dict)[source]¶
Yields random masses drawn uniformly-in-log between min_mass and max_mass, discarding those with a total mass exceeding max_mtotal.
Requires max_mass, min_mass, max_mtotal keys
- injection_utils.draw_redshift(zmax, omega, sfrpower=0.0)[source]¶
Yields a random redshift from a cosmologically-correct distribution. Uses Metropolis algorithm to draw from the desired pdf.
zmax : maximum redshift omega : cosmology params sfrpower : power of (1+z) to multiply the constant-comoving-rate
distribution by. Ex. 2.7 -> * (1+z)**2.7 (Madau SFR factor)
- injection_utils.draw_sim_inspiral_row(paramdict, h1_psd, l1_psd, v1_psd, omega)[source]¶
Yields sim_inspiral rows drawn using the distributions described above, and with increasing random GPS times, until gps_end_time is reached.
- injection_utils.draw_spin_aligned(spin_dict)[source]¶
Yields a random spin tuple (s_x, s_y, s_z) where s_x = s_y = 0 and s_z is uniformly random in (-max_spin,+max_spin).
- injection_utils.draw_spin_aligned_aligned(spin_dict)[source]¶
Yields random spin tuples (s1_x, s1_y, s1_z) and (s2_x, s2_y, s2_z) where s1_x = s1_y = s2_x = s2_y = 0, s1_z is uniformly random in (-max_spin1, +max_spin1) and s2_z is uniformly random in (-max_spin2,+max_spin2).
- injection_utils.draw_spin_isotropic(spin_dict)[source]¶
Yields a random spin tuple (s_x, s_y, s_z) isotropically distributed with uniform magnitude distribution.
- injection_utils.draw_spin_isotropic_aligned(spin_dict)[source]¶
Yields a random spin tuple (s2_x, s2_y, s2_z) where s2_x = s2_y = 0 and s2_z is uniformly random in (-max_spin2,+max_spin2). Yields a random spin tuple (s1_x, s1_y, s1_z) isotropically distributed with uniform magnitude distribution.
- injection_utils.draw_spin_isotropic_isotropic(spin_dict)[source]¶
Yields distinct random spin tuples (s1_x, s1_y, s1_z) and (s2_x, s2_y, s2_z) isotropically distributed with uniform magnitude distribution.
- injection_utils.draw_spin_salpeter_primary(spin_dict)[source]¶
Yields spins that are (1/2 chi_max) ln(chi_max/s1z), and same for s2z
- injection_utils.imf_m2squared_pdf(row, mass_dict, omega, zmax, alpha=-2.35, beta=2.0, zpower=0, zinterp=None)[source]¶
Returns the normalized density p(m1_source, m2_source, z, s1z, s2z) for the power_pair distribution.
- Parameters:
row – injection XML row filled with injected values incl. redshift in alpha3
mass_dict – dict storing min and max mass and mass power law indices
omega – cosmology parameters
zmax – maximum redshift
alpha – (default -2.35) m1 marginal powerlaw
beta – (default 2) m2 conditional powerlaw p(m2 | m1)
zpower – merger rate is (1+z)**zpower in the comoving frame.
zinterp – scipy.interpolate object giving redshift PDF
- Returns:
Normalized density in m1_source, m2_source, s1z, s2z, z space.
- injection_utils.is_hopeless_generic(row, paramdict, h1_psd, l1_psd, v1_psd, fph, fch, fpl, fcl, fpv, fcv)[source]¶
Determines if an injection cannot possibly be found.
- injection_utils.is_hopeless_hp(row, paramdict, h1_psd, l1_psd, v1_psd, fph, fch, fpl, fcl, fpv, fcv)[source]¶
Determines if an injection cannot possibly be found. This is done in a very crude manner. It uses a static PSD and computes the SNR at 1 Mpc. Inclination is set to zero.
- injection_utils.is_hopeless_hp_hc(row, paramdict, h1_psd, l1_psd, v1_psd, fph, fch, fpl, fcl, fpv, fcv)[source]¶
Determines if an injection cannot possibly be found. This is done in a crude manner but uses more information than is_hopelss_hp(). It uses a static PSD as well as distance and inclination information.