Skip to content

Commit

Permalink
Merge pull request #334 from JUDEKEPA/master
Browse files Browse the repository at this point in the history
A change in overlap setting.
  • Loading branch information
alexlib authored Nov 19, 2024
2 parents a960e18 + 99a1d97 commit 707437e
Show file tree
Hide file tree
Showing 3 changed files with 435 additions and 2 deletions.
4 changes: 2 additions & 2 deletions openpiv/pyprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,8 @@ def extended_search_area_piv(
search_area_size = (search_area_size, search_area_size)

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

if search_area_size[0] < window_size[0] or search_area_size[1] < window_size[1]:
raise ValueError("Search size cannot be smaller than the window_size")
Expand Down
23 changes: 23 additions & 0 deletions openpiv/test/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,26 @@ def test_fft_correlate():
assert np.allclose(u, SHIFT_U, atol=THRESHOLD)
assert np.allclose(v, SHIFT_V, atol=THRESHOLD)


def test_new_overlap_setting():
""" test of the new overlap setting changed on 19/11/2024"""
frame_a, frame_b = create_pair(image_size=72)
u, v, _ = piv(frame_a, frame_b,
window_size=16,
search_area_size=32,
overlap=22)

assert u.shape == (5, 5) and v.shape == (5, 5)

u, v, _ = piv(frame_a, frame_b,
window_size=16,
search_area_size=32,
overlap=21)
assert u.shape == (4, 4) and v.shape == (4, 4)

u, v, _ = piv(frame_a, frame_b,
window_size=16,
search_area_size=32,
overlap=19)
assert u.shape == (4, 4) and v.shape == (4, 4)

410 changes: 410 additions & 0 deletions openpiv/tutorials/Example for overlap setting change.ipynb

Large diffs are not rendered by default.

0 comments on commit 707437e

Please sign in to comment.