diff --git a/gstlal/python/stats/__init__.py b/gstlal/python/stats/__init__.py index d58d2d96c6c2767151a2472e0b4826968d17dcc4..1ff6c3bdd2c9239f6aa64c728332580ef5d36ceb 100644 --- a/gstlal/python/stats/__init__.py +++ b/gstlal/python/stats/__init__.py @@ -123,6 +123,17 @@ def assert_probability(f): return g +def assert_ln_probability(f): + def g(*args, **kwargs): + p = f(*args, **kwargs) + if isinstance(p, numpy.ndarray): + assert (p <= 0.).all() + else: + assert p <= 0. + return p + return g + + @assert_probability @numpy.vectorize def poisson_p_not_0(l): @@ -178,6 +189,15 @@ def poisson_p_0(l): return numpy.exp(-l) +@assert_ln_probability +def 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. + """ + return -l + + # # ============================================================================= #