Python script to analyse sessile drops by measuring contact angle, drop volume and contact line speed
Find a file
2021-04-23 21:22:19 +02:00
docs Layout the repo like a package 2021-04-11 19:33:35 +01:00
drop_analysis Fix error if nonexistent parent folder 2021-04-23 21:22:19 +02:00
Old scripts move framesource objects to separate file add jpeg mimetype 2020-10-16 18:56:36 +02:00
Sample add sample.avi 2021-04-11 20:15:13 +02:00
.gitignore Layout the repo like a package 2021-04-11 19:33:35 +01:00
LICENSE Initial commit 2017-01-27 13:27:18 +01:00
MANIFEST.in make it actually installable 2021-04-13 23:57:34 +02:00
pyproject.toml Layout the repo like a package 2021-04-11 19:33:35 +01:00
README.md Recommended use is now by pip install-ing it 2021-04-14 00:06:10 +02:00
Screenshot.png small readme update, add screenshot 2020-10-11 01:36:42 +02:00
setup.cfg make it actually installable 2021-04-13 23:57:34 +02:00
setup.py pkg_resources etc 2021-04-11 19:51:58 +01:00
tox.ini Layout the repo like a package 2021-04-11 19:33:35 +01:00

Python sessile drop analysis

Element Android Matrix room #Sessile.Drop.Analysis:matrix.vgorcum.com

Made by Mathijs van Gorcum during his PhD at the Physics of Fluids group of the University of Twente.

Python script to analyse sessile drops by measuring contact angle, drop volume and contact line speed.
This script analyses an image sequence (in the form of an avi, a tiffstack or a folder containing the images) and finds the contact angle, drop volume and the contact line speed.
The script assumes a black and white image of the drop on the surface, where the drop is black, and the background is white.
The script will ask for the file (or a file, in the case of a folder containing images), a crop (to increase calculation speed, and cut off any irrelevant parts) and a baseline. We use a subpixel edge detection, either fast, with a linear interpolation between two pixels around the edge, or slow by fitting an error function around the edge. To find the contact line position and the contact angle the detected edge is fitted with a 3rd order polynomial fit, and the slope of the baseline is also used to calculate the contact angles. Note that the drop volume assume cylindrical symmetry and if there is a needle present, the volume of the needle is added.

A GUI using pyqtgraph and pyqt5 is available, as well as a standalone script. The old standalone script is probably beneficial when using an IDE like spyder and you want to be able to customize the inner workings of the script.

Screenshot

Prerequisites

If you don't use the precomiled releases nor pip install it you'll need: The script requires numpy, pandas, scipy, pyqt5, opencv-python, scikit-image, imageio, shapely, pyqtgraph >=0.11.0, toml, h5py, json, and appdirs.

Install and running

To install the program run pip install . in the sessile.drop.analysis folder. To run the program after installing simply run drop_analysis in the terminal.

Some details

  • The code is written for Python 3.8
  • The edge detection uses only a horizontal subpixel correction, and when fitting the errorfunction, 40 pixels left and right of the edge are used.
  • To find the contact angle and contact point a polyfit is used, but the fit is made flipping the x and y coordinates, because polyfits don't perform well for vertical lines (ie at contact angles of 90 degrees).
  • In the non-gui script, the variable k is used to set the amount of pixels used in the polyfit, by default set at 70.
  • The thresh variable is the threshold level, for the fast edge detection the value is used explicitly while for the error function fitting the value is only used to find an approximate edge, to fit the errorfunction around.
  • The contact line speed is calculated using a linear regression of the contact line position.
  • The non-gui script calculates the speed in pixels/frame, and the volume in pixels^3, so be sure to convert it.

Contributing

Feel free to send pull requests, critique my awful code or point out any issues.

License

This project is licensed under the GPLv3 license - see the LICENSE file for details