Skip to content

Commit

Permalink
Merge pull request #328 from nepomnyi/master
Browse files Browse the repository at this point in the history
Normalized median filter is added to `windef.py`.
  • Loading branch information
alexlib authored Aug 16, 2024
2 parents 309e3d2 + a863992 commit 9d3f577
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
23 changes: 16 additions & 7 deletions openpiv/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,22 @@ def typical_validation(
# plt.quiver(u,v,color='k')


flag_m = local_median_val(
u,
v,
u_threshold=settings.median_threshold,
v_threshold=settings.median_threshold,
size=settings.median_size,
)
if settings.median_normalized:
flag_m = local_norm_median_val(
u,
v,
ε=0.2, # use the recomended value at this point, later add user's input for this
threshold=settings.median_threshold,
size=settings.median_size
)
else:
flag_m = local_median_val(
u,
v,
u_threshold=settings.median_threshold,
v_threshold=settings.median_threshold,
size=settings.median_size,
)

# u[flag_m] = np.ma.masked
# v[flag_m] = np.ma.masked
Expand Down
5 changes: 3 additions & 2 deletions openpiv/windef.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ class PIVSettings:
min_max_v_disp: Tuple=(-30, 30)
# The second filter is based on the global STD threshold
std_threshold: int=10 # threshold of the std validation
# The third filter is the median test (not normalized at the moment)
# The third filter is the median test: pick between normalized and regular
median_normalized: bool=False # False = do regular median, True = do normalized median
median_threshold: int=3 # threshold of the median validation
median_size: int=1 # defines the size of the local median
# On the last iteration, an additional validation can be done based on
# the S/N.
median_size: int=1 # defines the size of the local median



Expand Down

0 comments on commit 9d3f577

Please sign in to comment.