Skip to content

Commit

Permalink
plots.xy_1d: fixup combined_uncertainty (subtract number of nans)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmldrmota committed May 8, 2024
1 parent db3089b commit 64f62fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ndscan/plots/xy_1d.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ def combined_uncertainty(points: list[SourcePoint], num_samples_per_point=1):
where we overestimate the true standard deviation if actually,
``num_samples_per_point > 1``.
"""
n = len(points)
y = [p.y for p in points]
n = len(y) - np.count_nonzero(np.isnan(y))
total_var = np.nanvar(y) / max(1, num_samples_per_point * n - 1) # max() avoids 0/0
if points[0].y_err is not None:
total_var += sum(p.y_err**2 for p in points) / n**2
Expand Down

0 comments on commit 64f62fa

Please sign in to comment.