Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 8d750537 authored by ulrich_y's avatar ulrich_y
Browse files

Bug fix in #17: the nan protection removed under- and overflow bins

parent 66b6af99
No related branches found
No related tags found
No related merge requests found
......@@ -62,19 +62,19 @@ def mergeplots(ps, returnchi=False):
ps = np.array(ps)
with np.errstate(divide='ignore', invalid='ignore'):
w = sum(1/ps[:,:,2]**2)
w = np.sum(1/ps[:,:,2]**2,0)
out = np.zeros(ps[0].shape)
out[:,0] = ps[0,:,0]
out[:,1] = sum(ps[:,:,1]/ps[:,:,2]**2 / w)
out[:,1] = np.sum(ps[:,:,1]/ps[:,:,2]**2 / w, 0)
out[:,2] = np.sqrt(1/w)
# if one bin is empty, the zero causes trouble
out[~np.isfinite(out)] = 0
out[:,0] = ps[0,:,0]
chi = 1./(len(ps)-1)*sum((ps[:,:,1]-out[:,1])**2/ps[:,:,2]**2)
chi = np.column_stack((out[:,0], chi))
chi = 1./(len(ps)-1)*np.sum((ps[:,:,1]-out[:,1])**2/ps[:,:,2]**2,0)
chi[~np.isfinite(chi)] = 0
chi = np.column_stack((out[:,0], chi))
if returnchi:
return out, chi
......@@ -93,9 +93,11 @@ def combineplots(a, b, yfunc, efunc):
y = yfunc(a[maskA, 1], b[maskB, 1])
e = efunc(a[maskA, 1], a[maskA, 2], b[maskB, 1], b[maskB, 2])
y[~np.isfinite(y)] = 0
e[~np.isfinite(e)] = 0
out = np.column_stack((x, y, e))
# if one bin is empty, the zero causes trouble
out[~np.isfinite(out)] = 0
return out
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment