OpenPIV / openpiv-python

OpenPIV is an open source Particle Image Velocimetry analysis software written in Python and Cython
http://www.openpiv.net
GNU General Public License v3.0
247 stars 143 forks source link

Added normalized median filter to validation.py (i.e. the 2005 version of Westerweel's median filter). #327

Closed nepomnyi closed 3 months ago

nepomnyi commented 3 months ago

I added the function local_norm_median_val() to validation.py. This function is the implementation of the normalized median filter given in the article J. Westerweel, F. Scarano, "Universal outlier detection for PIV data", Experiments in fluids, 39(6), p.1096-1100, 2005. This function complements the already existing function local_median_val() which is, essentially, the original Westerweel's median filter from 1994. Note that, as opposed to local_median_val(), I am checking the threshold condition exactly like it is shown in the referenced article, i.e., via the mean square root concept - not via the boolean "OR". I added the test for local_norm_median_val() as well. The test is called test_local_norm_median_validation() and is located in the file test_validation.py. When I ran all the tests with pytest, my test ran without errors or warnings. However, another test failed with the following error: FAILED test\test_preprocess.py::test_dynamic_masking - _tkinter.TclError: Can't find a usable tk.tcl in the following directories:. I checked: I didn't do anything with the function dynamic_masking(). So, I am wondering if we can proceed with my pull request and deal with the failed test later.

nepomnyi commented 3 months ago

Hello, Dr. Liberzon @alexlib , I have just added this normalized median filter to windef.py. If you choose to accept this pull request, I will send another one where the filter is added to windef.py. Just letting you know in case anybody else was going to add it to windef.py.

alexlib commented 3 months ago

Thanks @nepomnyi, it’s rather clear and straightforward. Hope the users would find a great use for it. Please announce on the forum.