This would be easier to read, and more extensible to non-average link approaches if you factored out `(x * x_weight + y * y_weight) / (x_weight + y_weight)` as a separate function... or just use `np.average` for now.