Skip to content

Commit 707437e

Browse files
authored
Merge pull request #334 from JUDEKEPA/master
A change in overlap setting.
2 parents a960e18 + 99a1d97 commit 707437e

File tree

3 files changed

+435
-2
lines changed

3 files changed

+435
-2
lines changed

openpiv/pyprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,8 +1022,8 @@ def extended_search_area_piv(
10221022
search_area_size = (search_area_size, search_area_size)
10231023

10241024
# verify that things are logically possible:
1025-
if overlap[0] >= window_size[0] or overlap[1] >= window_size[1]:
1026-
raise ValueError("Overlap has to be smaller than the window_size")
1025+
if overlap[0] >= search_area_size[0] or overlap[1] >= search_area_size[1]:
1026+
raise ValueError("Overlap has to be smaller than the search_area_size")
10271027

10281028
if search_area_size[0] < window_size[0] or search_area_size[1] < window_size[1]:
10291029
raise ValueError("Search size cannot be smaller than the window_size")

openpiv/test/test_process.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,26 @@ def test_fft_correlate():
156156
assert np.allclose(u, SHIFT_U, atol=THRESHOLD)
157157
assert np.allclose(v, SHIFT_V, atol=THRESHOLD)
158158

159+
160+
def test_new_overlap_setting():
161+
""" test of the new overlap setting changed on 19/11/2024"""
162+
frame_a, frame_b = create_pair(image_size=72)
163+
u, v, _ = piv(frame_a, frame_b,
164+
window_size=16,
165+
search_area_size=32,
166+
overlap=22)
167+
168+
assert u.shape == (5, 5) and v.shape == (5, 5)
169+
170+
u, v, _ = piv(frame_a, frame_b,
171+
window_size=16,
172+
search_area_size=32,
173+
overlap=21)
174+
assert u.shape == (4, 4) and v.shape == (4, 4)
175+
176+
u, v, _ = piv(frame_a, frame_b,
177+
window_size=16,
178+
search_area_size=32,
179+
overlap=19)
180+
assert u.shape == (4, 4) and v.shape == (4, 4)
181+

openpiv/tutorials/Example for overlap setting change.ipynb

Lines changed: 410 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)