remove try/except in _denoise_chambolle_nd. just use the numpy 1.6 compatible case

This commit is contained in:
Gregory R. Lee
2015-12-22 20:22:47 -05:00
committed by Gregory R. Lee
parent 4a0ad77780
commit 4bc4f0a169
+1 -6
View File
@@ -175,12 +175,7 @@ def _denoise_tv_chambolle_nd(im, weight=0.2, eps=2.e-4, n_iter_max=200):
g[slices_g] = np.diff(out, axis=ax)
slices_g[ax] = slice(None)
try:
norm = np.sqrt((g*g).sum(-1, keepdims=True))
except:
# no keepdims argument available prior to numpy 1.7
norm = np.sqrt((g*g).sum(-1))[..., np.newaxis]
norm = np.sqrt((g*g).sum(-1))[..., np.newaxis]
E += weight * norm.sum()
norm *= 0.5 / weight
norm += 1.