Skip to content

Commit

Permalink
added warnings to replace_outliers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlib committed Oct 17, 2024
1 parent ebb3e9d commit cd922ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions openpiv/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy.typing as npt
from scipy.signal import convolve
from openpiv.lib import replace_nans
import warnings

__licence_ = """
Copyright (C) 2011 www.openpiv.net
Expand Down Expand Up @@ -192,6 +193,9 @@ def replace_outliers(
kernel_size=kernel_size
)

if np.isnan(uf).any() or np.isnan(vf).any():
warnings.warn("There are still NaNs in the velocity fields after replacement.")


uf = np.ma.masked_array(uf, mask=grid_mask)
vf = np.ma.masked_array(vf, mask=grid_mask)
Expand Down
6 changes: 3 additions & 3 deletions openpiv/test/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@



THRESHOLD = 0.25
THRESHOLD = 0.3

# define "PIV" shift, i.e. creating u,v values that we want to get
# -5.5 pixels to the left and 3.2 pixels upwards
Expand All @@ -25,11 +25,11 @@


# <------
SHIFT_U = -3.5 # shift to the left, should be placed in columns, axis=1
SHIFT_U = -3.4 # shift to the left, should be placed in columns, axis=1
# ^
# |
# |
SHIFT_V = 2.5 # shift upwards, should be placed in rows, axis=0
SHIFT_V = 2.6 # shift upwards, should be placed in rows, axis=0


def create_pair(image_size=32, u=SHIFT_U, v=SHIFT_V):
Expand Down

0 comments on commit cd922ef

Please sign in to comment.