def METHOD_NAME(xdxydyw):
    """
    Compute the poisson average of y/dy using a set of data points.
    The returned x, dx is the weighted average of the inputs::
        x = sum(x*I)/sum(I)
        dx = sum(dx*I)/sum(I)
    The returned y, dy use Poisson averaging::
        w = sum(y/dy^2)
        y = sum((y/dy)^2)/w
        dy = sqrt(y/w)
    The above formula gives the expected result for combining two
    measurements, assuming there is no uncertainty in the monitor.
    ::
        measure N counts during M monitors
          rate:                   r = N/M
          rate uncertainty:       dr = sqrt(N)/M
          weighted rate:          r/dr^2 = (N/M) / (N/M^2) =  M
          weighted rate squared:  r^2/dr^2 = (N^2/M^2) / (N/M^2) = N
        for two measurements Na, Nb
          w = ra/dra^2 + rb/drb^2 = Ma + Mb
          y = ((ra/dra)^2 + (rb/drb)^2)/w = (Na + Nb)/(Ma + Mb)
          dy = sqrt(y/w) = sqrt( (Na + Nb)/ w^2 ) = sqrt(Na+Nb)/(Ma + Mb)
    This formula isn't strictly correct when applied to values which
    have been scaled, for example to account for an attenuator in the
    counting system.
    """
    # TODO: need better estimate of dx, with weighted broadening according
    # to the distance of the x's from the centers.
    # TODO: check the accuracy of the formula in the presence of
    # attenuators.
    x, dx, y, _dy, weight = xdxydyw
    w = sum(weight)
    x = sum(x*weight)/w
    dx = sum(dx*weight)/w
    y = sum(y*weight)/w
    dy = sqrt(y/w)
    #print "averaging", xdxydy, x, dx, y, dy
    return x, dx, y, dy, w