gwinferno.pipeline.analysis.detection_efficiency#

detection_efficiency(weights, Ninj, log=False)[source]#

Calculates the detection efficiency – the expected fraction of sources detected from a population parameterized by \(\Lambda\) – estimated by importance sampling over the found injections from a fiducial population parameterized by \(\Lambda_\emptyset\):

\[\mu = \int P(\mathrm{det}|\theta)p(\theta|\Lambda) d\theta \approx \frac{1}{N_\mathrm{found}}\sum_{i=1}^{N_\mathrm{found}} \frac{p(\theta_i|\Lambda)}{p(\theta_i | \Lambda_\emptyset)}\]

with Monte Carlo integration over found injections, along with the effective sample size of the Monte Carlo integral.

Parameters:
weightsjax.DeviceArray

JAX array of weights to integrate over. Expected size of (N_found_injections,).

Ninjint

Total number of injections.

logbool, optional

Flag to perform calculations in log probability. Interprets weights as log weights. This is slower but more numerically stable. Defaults to False.

Returns:
jax.DeviceArray

Array of log detection efficiency.

jax.DeviceArray

Array of log N_eff from Monte Carlo integral.

jax.DeviceArray

Array of variance estimated from log of Monte Carlo integral.