Skip to content

Commit 80eae2c

Browse files
committed
fix sum1d() calculation
1 parent 657b46f commit 80eae2c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

gempy/library/nddops.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,9 +651,11 @@ def sum1d(ndd, x1, x2, proportional_variance=True):
651651
(fx2 if proportional_variance else fx2*fx2)*ndd.variance[ix2])
652652
else:
653653
# calculate_variance returns the standard error on the mean
654+
# (~sigma^2/N) but this is a "sum" operation, so we want the sum
655+
# of the variance, ~sigma^2*N, and need to multiply accordingly.
654656
# mask=None because we ignore the mask is the above calculation
655657
var = NDStacker.calculate_variance(
656658
ndd.data[ix1+1:ix2, np.newaxis],
657-
mask=None, out_data=data/(x2-x1)) * (ix2 - ix1 - 1)
659+
mask=None, out_data=data/(x2-x1)) * (ix2 - ix1 - 1) * (x2 - x1)
658660

659661
return NDD(data, mask, var)

0 commit comments

Comments
 (0)