gstlal  1.4.1
Functions | Variables
__init__.py File Reference

The python module to implement false alarm probability and false alarm rate. More...

Go to the source code of this file.

Functions

def python.stats.logiv (v, z)
 
def python.stats.ncx2logpdf (x, k, l)
 
def python.stats.ncx2pdf (x, k, l)
 
def python.stats.assert_probability (f)
 
def python.stats.assert_ln_probability (f)
 
def python.stats.poisson_p_not_0 (l)
 
def python.stats.poisson_p_0 (l)
 
def python.stats.poisson_ln_p_0 (l)
 
def python.stats.fap_after_trials (p, m)
 
def python.stats.trials_from_faps (p0, p1)
 

Variables

 python.stats.NaN = float("nan")
 
 python.stats.NegInf = float("-inf")
 
 python.stats.PosInf = float("+inf")
 

Detailed Description

The python module to implement false alarm probability and false alarm rate.

Review Status

STATUS: reviewed with actions

Names Hash Date Diff to Head of Master
Hanna, Cannon, Meacher, Creighton J, Robinet, Sathyaprakash, Messick, Dent, Blackburn 7fb5f008afa337a33a72e182d455fdd74aa7aa7a 2014-11-05 far.py
Hanna, Cannon, Meacher, Creighton J, Sathyaprakash, 72875f5cb241e8d297cd9b3f9fe309a6cfe3f716 2015-11-06 far.py

Action items

Definition in file __init__.py.

Function Documentation

◆ fap_after_trials()

def python.stats.fap_after_trials (   p,
  m 
)
Given the probability, p, that an event occurs, compute the
probability of at least one such event occuring after m independent
trials.

The return value is 1 - (1 - p)^m computed avoiding round-off
errors and underflows.  m cannot be negative but need not be an
integer.

Example:

>>> fap_after_trials(0.5, 1)
0.5
>>> fap_after_trials(0.066967008463192584, 10)
0.5
>>> fap_after_trials(0.0069075045629640984, 100)
0.5
>>> fap_after_trials(0.00069290700954747807, 1000)
0.5
>>> fap_after_trials(0.000069312315846428086, 10000)
0.5
>>> fap_after_trials(.000000006931471781576803, 100000000)
0.5
>>> fap_after_trials(0.000000000000000069314718055994534, 10000000000000000)
0.5
>>> "%.15g" % fap_after_trials(0.1, 21.854345326782834)
'0.9'
>>> "%.15g" % fap_after_trials(1e-17, 2.3025850929940458e+17)
'0.9'
>>> fap_after_trials(0.1, .2)
0.020851637639023216

Definition at line 230 of file __init__.py.

◆ poisson_ln_p_0()

def python.stats.poisson_ln_p_0 (   l)
Return the natural logarithm of the probability that a Poisson
process with a mean rate of l yields a zero count.  = -l, but with
a sanity check that l is non-negative.

Definition at line 209 of file __init__.py.

◆ poisson_p_0()

def python.stats.poisson_p_0 (   l)
Return the probability that a Poisson process with a mean rate of l
yields a zero count.  = exp(-l), but with a sanity check that l is
non-negative.

Definition at line 198 of file __init__.py.

◆ poisson_p_not_0()

def python.stats.poisson_p_not_0 (   l)
Return the probability that a Poisson process with a mean rate of l
yields a non-zero count.  = 1 - exp(-l), but computed in a way that
avoids loss of precision and over-/underflows.

Example:

>>> print(poisson_p_not_0(1e+60))
1.0
>>> print(poisson_p_not_0(1)
0.632120558829
>>> print(poisson_p_not_0(1e-60))
1e-60
>>> print(poisson_p_not_0(0))
0.0

Definition at line 139 of file __init__.py.

◆ trials_from_faps()

def python.stats.trials_from_faps (   p0,
  p1 
)
Given the probabiity, p0, of an event occuring, and the
probability, p1, of at least one such event being observed after
some number of independent trials, solve for and return the number
of trials, m, that relates the two probabilities.  The three
quantities are related by p1 = 1 - (1 - p0)^m.  Generally the
return value is not an integer.

See also fap_after_trials().  Note that if p0 is 0 or 1 then p1
must be 0 or 1 respectively, and in both cases m is undefined.
Otherwise if p1 is 1 then inf is returned.

Definition at line 386 of file __init__.py.