(x, y, nfinite, result, align_finiteness=False)
return nfinite, (sum_x, sum_y, sum_xy, count + 1)
Calculate the window sums for cov with new value.
Calculate the window sums for cov with new value.
Calculate the window sums for cov with new value .
def put_cov(x, y, nfinite, result, align_finiteness=False):
    """Calculate the window sums for cov with new value."""
    sum_x, sum_y, sum_xy, count = result
    if numpy.isfinite(x) and numpy.isfinite(y):
        nfinite += 1
        sum_x += x
        sum_y += y
        sum_xy += x * y

        return nfinite, (sum_x, sum_y, sum_xy, count + 1)

    if align_finiteness or numpy.isnan(x) or numpy.isnan(y):
        # alignment by finiteness means replacement of all the infinite values with nans
        # count should NOT be recalculated in case of nans
        return nfinite, result

    return nfinite, (sum_x, sum_y, sum_xy, count + 1)
def put_cov ( x , y , nfinite , result , align_finiteness = False ) : sum_x , sum_y , sum_xy , count = result if numpy . isfinite ( x ) and numpy . isfinite ( y ) : nfinite += 1 sum_x += x sum_y += y sum_xy += x * y return nfinite , ( sum_x , sum_y , sum_xy , count + 1 ) if align_finiteness or numpy . isnan ( x ) or numpy . isnan ( y ) : # alignment by finiteness means replacement of all the infinite values with nans # count should NOT be recalculated in case of nans return nfinite , result return nfinite , ( sum_x , sum_y , sum_xy , count + 1 )