Likelihood package
Submodules
simple_pe.likelihood.likelihood module
- simple_pe.likelihood.likelihood.like(a_hat, f_plus, f_cross, d_max=1000.0)[source]
Return the likelihood marginalized over all 4 f-stat parameteras. Use uniform (1/2pi) prior on phi, psi, uniform (1/2)on cosi, uniform in volume prior over d out to d_max.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d_max – maximum distance for marginalization
- simple_pe.likelihood.likelihood.like_approx(a_hat, f_plus, f_cross, d_max=1000.0, correction=False)[source]
Calculate the approximate likelihood summed over left, right and coherent.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d_max – maximum distance for marginalization
correction – scale the approx likelihood to improve fit
- simple_pe.likelihood.likelihood.like_cosi(a_hat, f_plus, f_cross, x, d_max=1000.0)[source]
Return the likelihood marginalized over d, phi and psi. Use uniform (1/2pi) prior on phi, psi, uniform in volume prior over d out to d_max.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
d_max – maximum distance for marginalization
- simple_pe.likelihood.likelihood.like_cosi_psi(a_hat, f_plus, f_cross, x, psi, d_max=1000.0)[source]
Return the likelihood marginalized over d and phi, using flat (1/2pi prior on phi; uniform volume on d up to d_max.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
psi – polarization
d_max – maximum distance for marginalization
- simple_pe.likelihood.likelihood.like_d_cosi(a_hat, f_plus, f_cross, d, x)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood.like_d_cosi_psi(a_hat, f_plus, f_cross, d, x, psi, marg=True)[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood.like_equal(a_hat, f, d_max=1000)[source]
calculate the likelihood for network equally sensitive to plus and cross. Marginalized over the two phases, inclination and distance. We use uniform priors, specifically 1/2pi for psi,phi, 1/2 for cosi, 3 d^2dd/d_max^3 for distance d_max.
- simple_pe.likelihood.likelihood.like_equal_cosi(a_hat, f, x, d_max=1000.0, make_plot=False)[source]
For a network equally sensitive to plus and cross, calculate the likelihood marginalized over the distance and 2 phases. This a function of cosi. We use uniform priors, specifically 1/2pi for psi,phi, 1/2 for cosi, 3 d^2dd/d_max^3 for dist.
- Parameters:
a_hat – the f-stat parameters of the signal
f – the detector response (f = F+ = Fx)
x – cos(inclination) of template
d_max – maximum distance for marginalization
make_plot – plot the likelihood vs distance
- simple_pe.likelihood.likelihood.like_equal_d_cosi(a_hat, f, d, cosi)[source]
For a network equally sensitive to plus and cross, calculate the likelihood marginalized over the 2 phases. This a function of d and cosi. Note: we use uniform prior on phi, psi (=1/2pi)
- Parameters:
a_hat – the f-stat parameters of the signal
f – the detector response (f = F+ = Fx)
d – distance of template
cosi – cos(inclination) of template
- simple_pe.likelihood.likelihood.like_from_snr(zh, zl, sigh, sigl, dt, dt_ring, f_plus_cross)[source]
Calculate the likelihood from observed SNRs for a 2 detector network
Parameters
- zh: np.complex
The complex matched filter SNR for detector 1
- zl: np.complex
The complex matched filter SNR for detector 2
- sigh: float
sigma for detector 1
- sigl: float
sigma for detector 2
- dt: float
observed difference in merger time between the two detectors
- dt_ring: np.ndarray
array containing the difference in merger time for ring in the sky
- f_plus_cross: np.ndarray
array containing the detector sensitivity along the ring in the sky
- simple_pe.likelihood.likelihood.like_parts_d_cosi_psi(a_hat, f_plus, f_cross, x, psi)[source]
calculate the two dimensional likelihood, marginalized over phi log-likelihood can be written as: 1/2(ahat^2 - 2*d0/d * f(x, psi) * cos(2phi - phi0) + (d0/d)^2 g(x,psi)) return: ahat2, f, g
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
psi – polarization
- simple_pe.likelihood.likelihood.loglike_approx(a_hat, f_plus, f_cross, d_max=1000.0, method='coh', correction=False)[source]
Calculate the approximate likelihood. This works for three cases: left and right circularly polarized and the standard coherent analysis. This reproduces the equations (A.18) and (A.29) from “Localization of transient gravitational wave sources: beyond triangulation”, Class. Quantum Grav. 35 (2018) 105002
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d_max – maximum distance for marginalization
method – approximation for calculating likelihood, one of “coh”, “left”, “right”
correction – scale the approx likelihood to improve fit
simple_pe.likelihood.likelihood_hm module
- simple_pe.likelihood.likelihood_hm.l4422_d_cosi(a_hat, g_hat, f_plus, f_cross, d, x)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.l4422_d_cosi_psi(a_hat, g_hat, f_plus, f_cross, d, x, psi, marg=True)[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.l4422_parts_d_cosi_psi(a_hat, g_hat, f_plus, f_cross, d, x, psi, phi)[source]
calculate the two dimensional likelihood, marginalized over phi log-likelihood can be written as: 1/2(ahat^2 - 2*d0/d * f(x, psi) * cos(2phi - phi0) + (d0/d)^2 g(x,psi))
- Returns:
ahat2, f, g
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
psi – polarization
- simple_pe.likelihood.likelihood_hm.l_d_c_phi(a_hat, f_plus, f_cross, d, x, phi, numerical=False)[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.l_d_c_psi(a_hat, f_plus, f_cross, d, x, psi, numerical=False)[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.lhm_d_cosi(a_hat, f_plus, f_cross, d, x, g_hat=None, j_hat=None, k_hat=None, cross_term_alphas={})[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.lhm_d_cosi_phi(a_hat, f_plus, f_cross, d, x, phi, g_hat=None, j_hat=None, k_hat=None, cross_term_alphas={})[source]
Return the likelihood marginalized over psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.lhm_d_cosi_psi(a_hat, f_plus, f_cross, d, x, psi, g_hat=None, j_hat=None, k_hat=None, cross_term_alphas={})[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.lhm_parts_d_cosi_psi(a_hat, f_plus, f_cross, d, x, psi, phi, g_hat=None, j_hat=None, k_hat=None, cross_term_alphas={})[source]
calculate the two dimensional likelihood, marginalized over phi log-likelihood can be written as: 1/2(ahat^2 - 2*d0/d * f(x, psi) * cos(2phi - phi0) + (d0/d)^2 g(x,psi))
- Returns:
ahat2, f, g
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
psi – polarization
g_hat – the 44 mode G Params
j_hat – the 33 mode J Params
k_hat – the 21 mode K Params
cross_term_alphas – dictionary containing a tuple of the additional pair of
alpha values required for each mode (one each at 0 and pi/2. phase offset).
- simple_pe.likelihood.likelihood_hm.like_22_d_cosi_psi_phi(a_hat, f_plus, f_cross, d, x, psi, phi)[source]
Return the un-marginalized likelihood for a 2,2 waveform model.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
phi – coalescence phase
- simple_pe.likelihood.likelihood_hm.like_cosi_alpha_44(a_hat, g_hat, f_plus, f_cross, x, alpha_44_prime, d_max=1000)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_cosi_alpha_44_phi(a_hat, g_hat, f_plus, f_cross, x, phi, alpha_44_prime, d_max)[source]
Return the likelihood marginalized over d and psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_cosi_alpha_44_psi_phi(a_hat, g_hat, f_plus, f_cross, x, psi, phi, alpha_44_prime, d_max, k=256)[source]
Likelihood marginalized over distance using 3/d_max**3 d**2 dd prior. Currently no prior on alpha_44 (k exponential) is implemented.
- simple_pe.likelihood.likelihood_hm.like_d(a_hat, f_plus, f_cross, d)[source]
Return the likelihood marginalized over phi, psi, with a uniform (1/2pi) prior on both, and cosi with uniform 1/2 prior.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
- simple_pe.likelihood.likelihood_hm.like_d_alpha_33(a_hat, j_hat, f_plus, f_cross, d, alpha_33_prime)[source]
Return the likelihood marginalized over phi, psi, with a uniform (1/2pi) prior on both, and cosi with uniform 1/2 prior.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_d_alpha_33_alpha_44(a_hat, j_hat, g_hat, f_plus, f_cross, d, alpha_33_prime, alpha_44_prime)[source]
Return the likelihood marginalized over phi, psi, with a uniform (1/2pi) prior on both, and cosi with uniform 1/2 prior.
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
- simple_pe.likelihood.likelihood_hm.like_d_cosi(a_hat, f_plus, f_cross, d, x)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_d_cosi_2(a_hat, f_plus, f_cross, d, x)[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33(a_hat, j_hat, g_hat, f_plus, f_cross, d, x, alpha_33_prime, alpha_44_prime)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_alpha_44(a_hat, j_hat, g_hat, f_plus, f_cross, d, x, alpha_33_prime, alpha_44_prime)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_alpha_44_phi(a_hat, j_hat, g_hat, f_plus, f_cross, d, x, phi, alpha_33_prime, alpha_44_prime)[source]
Return the likelihood marginalized over psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_alpha_44_psi_phi(a_hat, j_hat, g_hat, f_plus, f_cross, d, x, psi, phi, alpha_33_prime, alpha_44_prime)[source]
unmarginalized likelihood over five dimensions for signal model containing 22, 33 and 44 modes.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_phi(a_hat, j_hat, f_plus, f_cross, d, x, phi, alpha_33_prime)[source]
Return the likelihood marginalized over psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_phi_with_noise(a_hat, j_hat, f_plus, f_cross, d, x, phi, alpha_33_prime)[source]
Return the likelihood marginalized over psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_psi_phi(a_hat, j_hat, f_plus, f_cross, d, x, psi, phi, alpha_33_prime)[source]
unmarginalized likelihood over five dimensions for signal model containing 22 and 33 modes.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_psi_phi_with_noise(a_hat, j_hat, f_plus, f_cross, d, x, psi, phi, alpha_33_prime)[source]
unmarginalized likelihood over five dimensions for signal model containing 22 and 33 modes. Containing gaussian noise in the matched filter SNR term that appears in the likelihood.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_33_with_noise(a_hat, j_hat, f_plus, f_cross, d, x, alpha_33_prime)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_d_cosi_alpha_44_psi_phi(a_hat, g_hat, f_plus, f_cross, d, x, psi, phi, alpha_44_prime, k=256)[source]
unmarginalized likelihood over five dimensions for signal model containing 22 and 44 modes.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_phi(a_hat, f_plus, f_cross, d, x, phi, marg=True)[source]
Return the likelihood marginalized over psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_d_cosi_psi(a_hat, f_plus, f_cross, d, x, psi, marg=True)[source]
Return the likelihood marginalized over phi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_marg_over_alpha_44(a_hat, g_hat, f_plus, f_cross, d, x, alpha_44_hat, marg=True)[source]
Return the likelihood marginalized over phi and psi, with a uniform (1/2pi) prior on both
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
- simple_pe.likelihood.likelihood_hm.like_marg_over_alpha_44_phi(a_hat, g_hat, f_plus, f_cross, d, x, phi, alpha_44_hat, marg)[source]
Return the likelihood marginalized over psi, using flat (1/2pi) prior
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
d – distance
x – cos(inclination)
psi – polarization
marg – do or don’t do the marginalization
- Returns:
the marginalization factor. I don’t think it includes the exp(rho^2/2) term.
- simple_pe.likelihood.likelihood_hm.like_marg_over_alpha_44_psi_phi(a_hat, g_hat, f_plus, f_cross, d, x, psi, phi, alpha_44_hat, marg)[source]
to be used by below function
int_0^inf L22*k*exp(-a alpha_44^2 + b alpha_44) dalpha44 = L22 * k * sqrt(pi) * exp(b**2/(4*a)) * ( erf(b/(2*sqrt(a))) + 1 ) / (2*sqrt(a))
—the last line can be re-written using the complementary error function, cerf=1-erf, and we can use the exponentially scaled version to prevent rounding errors. AND must add the data ghat2 factor to normalize.
- simple_pe.likelihood.likelihood_hm.like_parts_d_cosi_psi(a_hat, f_plus, f_cross, x, psi)[source]
calculate the two dimensional likelihood, marginalized over phi log-likelihood can be written as: 1/2(ahat^2 - 2*d0/d * f(x, psi) * cos(2phi - phi0) + (d0/d)^2 g(x,psi))
- Returns:
ahat2, f, g
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
psi – polarization
- simple_pe.likelihood.likelihood_hm.like_parts_d_cosi_psi_phi(a_hat, f_plus, f_cross, d, x, psi, phi, numerical=False, phi_first=False)[source]
calculate the two dimensional likelihood, marginalized over phi log-likelihood can be written as: 1/2(ahat^2 - 2*d0/d * f(x, psi) * cos(2phi - phi0) + (d0/d)^2 g(x,psi))
- Returns:
ahat2, f, g
- Parameters:
a_hat – the F-stat A parameters
f_plus – F_plus sensitivity
f_cross – F_cross sensitivity
x – cos(inclination)
psi – polarization
- simple_pe.likelihood.likelihood_hm.sqri21(iota)
- simple_pe.likelihood.likelihood_hm.sqri2m1(iota)
- simple_pe.likelihood.likelihood_hm.sqri32(iota)
- simple_pe.likelihood.likelihood_hm.sqri33(iota)
- simple_pe.likelihood.likelihood_hm.sqri3m2(iota)
- simple_pe.likelihood.likelihood_hm.sqri3m3(iota)
- simple_pe.likelihood.likelihood_hm.sqri43(iota)
- simple_pe.likelihood.likelihood_hm.sqri4m3(iota)
- simple_pe.likelihood.likelihood_hm.t(iota)