We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 713586c + bf98c9f commit 402646eCopy full SHA for 402646e
1 file changed
openpiv/filters.py
@@ -44,8 +44,13 @@ def _gaussian_kernel(half_width: int=1)-> np.ndarray:
44
45
"""
46
# size = int(half_width)
47
- x, y = np.mgrid[-half_width:half_width + 1, -half_width:half_width + 1]
48
- g = np.exp(-(x ** 2 / float(half_width) + y ** 2 / float(half_width)))
+
+ if half_width == 0:
49
+ return 1
50
+ else:
51
+ x, y = np.mgrid[-half_width:half_width + 1, -half_width:half_width + 1]
52
+ g = np.exp(-(x ** 2 / float(half_width) + y ** 2 / float(half_width)))
53
54
return g / g.sum()
55
56
0 commit comments