Jumping to 0.25.0 for openpiv-python

49 views
Skip to first unread message

Alex Liberzon

unread,
Oct 20, 2022, 2:30:41 PM10/20/22
to openpiv-users
Dear users

I've worked for the couple of weeks on improving our masking procedures. The main idea is to have an option to add an image mask (can be static for all pairs or dynamic, per each pair) that will be preserved through all the operations of invalid vector marking, filtering and replacement, plus through the window deformation procedures.
So we use now `numpy.ma.masked_arrays` to keep the image mask over the `x,y` grid for each matrix `u,v` and this mask can be stored in the ASCII output and save for future masking of the undesired regions.

This work also required some changes that unfortunately break backward compatibility of your code. I'm really sorry about it and looking forward for the feedback. Most of the details are in the pull request


Those that want to try and test the code are welcome to install the 0.24.4a version from my personal fork:

```
```

The new documents are uploaded here



After we get positive reviews and correct mistakes, we'll merge it into the OpenPIV/openpiv-python, the pull request #263 will remain open for some time.

Please note that you'll always be able to install an older version and get back to your working code using

```
pip install openpiv==0.24.4
```
or other, older version.

Ivan Nepomnyashchikh

unread,
Oct 27, 2022, 3:02:31 PM10/27/22
to openpiv-users
I had a problem installing it. It took me several days to figure out the solution. Unfortunately, I don't have enough reputation on StackOverFlow to post the solution there, so I decided to leave it here in case somebody has a problem installing it.

I use miniconda3 on Windows10. I had been using base environment only and had never tried to create other environments. Since OpenPIV 0.25.0 is not backward compatible, I decided to create an environment specifically for the new OpenPIV version.

It turned out, the installation method Dr. Liberzon suggested - pip install git+https://github.com/alexlib/openpiv-python - works fine only in the base environment. In my newly created environment it would give an error:  ImportError: DLL load failed while importing _ctypes: The specified module could not be found.

The solution posted here didn't work for me. The reason it might not work was discussed here. The atom forum discussion suggests using CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1. The way to use it is described here (scroll down a bit to the NumPy MKL library load failed title). There, it is suggested to update python by conda update -c defaults python before going with the control environment variable. I updated python that way, did not try  CONDA_DLL_SEARCH_MODIFICATION_ENABLE=1 and tried installing OpenPIV with  pip install git+https://github.com/alexlib/openpiv-python. And it worked.

Therefore, the probable root of the issue was that I installed python with conda install python when I created the new environment. Instead, I had to use conda install -c defaults python.

Also, pay attention that I did use os.add_dll_directory() as suggested here (use conda env list to find out the path to your environment, add /DLLs to the end of that path, open python in the terminal, import os, apply os.add_dll_directory() to the resultant path, exit python).

Ivan

Alex Liberzon

unread,
Oct 31, 2022, 5:25:03 PM10/31/22
to openpiv-users
I do not have any issue to install it on Windows 10 with Anaconda, and I do use conda environments.

Recently I also use Enthought Deployment Manager, edm - it works very similar to conda and has may pre-compiled packages.

Alex Liberzon

unread,
Nov 4, 2022, 5:27:01 AM11/4/22
to openpiv-users
Please, review the pull request




We will have much better masking  - not limited to polygons, dynamic and static, the mask is now saved with the data. Plus, all the invalid vectors are flagged and stored in another column.
Inevitably it leads also to some syntax updates that you will have to adjust in your scripts:

instead of tools.save(x,y,u,v,'test.txt') we have now tools.save('test.txt',x,y,u,v,image_mask,flags)

you can find all the possible ways to run openpiv-python in the updated set of examples https://github.com/OpenPIV/openpiv-python-examples
Reply all
Reply to author
Forward
0 new messages