Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)

        def avestd(vals):
    (sum, sum2) = (0.,0.)
    N = float(len(vals))
    for val in vals:
        sum  = sum  + float(val)
        sum2 = sum2 + float(val)*float(val)
    if N == 0:
        ave = 0
        std = 0
    elif N == 1:
        ave = sum
        std = 0
    else:
        ave = sum /  N
        diff2 = sum2-(N*ave*ave)
        if diff2 >= 0.0:
            std = math.sqrt( diff2 / (N-1.0) )
        else:
            std = 0
    return(ave,std)
        


src/t/a/TAMO-HEAD/TAMO/util/Poisson.py   TAMO(Download)
import sys
from math  import *
from Arith import fact, avestd, stirling
 
def Poisson_estimate(obs,_dist):
    '''
    pairs    = zip(xvals,yvals)
    ave,std  = avestd(_dist)
    var      = std*std
    minlam   = min(ave,var)*0.9