Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
inverse poisson distribution.

cdf : the CDF
lam : the lambda of poisson distribution

note: maxmimum return value is 1000
and lambda must be smaller than 740.

        def poisson_cdf_inv ( cdf, lam, maximum=1000):
    """inverse poisson distribution.

    cdf : the CDF
    lam : the lambda of poisson distribution

    note: maxmimum return value is 1000
    and lambda must be smaller than 740.
    """
    assert lam < 740
    if cdf < 0 or cdf > 1:
        raise Exception ("CDF must >= 0 and <= 1")
    elif cdf == 0:
        return 0
    sum2 = 0
    newval = exp( -lam )
    sum2 = newval
#     if cdf <= sum2:
#         return i

    for i in xrange(1,maximum+1):
        sumold = sum2
#         if i == 0:
#             newval = exp( -a )
#             if newval==0:
#                 newval = 4.9406564584124654e-324
#             sum2 = newval
#         else:
        last = newval
        newval = last * lam / i
        sum2 = sum2 + newval
        if sumold <= cdf and cdf <= sum2:
            return i
    
    return maximum
        


src/t/e/TEToolkit-1.0/TEToolkit/PeakDetect.py   TEToolkit(Download)
import subprocess
 
from TEToolkit.Prob import poisson_cdf,poisson_cdf_inv
from TEToolkit.Constants import *
from TEToolkit.IO.FeatIO import FWTrackII
        self.info("#3 all peaks candidate lambda_bg0 = : %f" % (lambda_bg0))       
 
        min_tags = poisson_cdf_inv(1-pow(10,self.pvalue/-10),lambda_bg0)+1
        peak_candidates = {}