|
|
|
collecting data from measured contact angles
|
|
|
|
============================================
|
|
|
|
|
|
|
|
While measuring contact angles, for each drop three pictures are recorded
|
|
|
|
for the static, advancing and the receeding contact angle.
|
|
|
|
|
|
|
|
Usually the file name of this pictures consists of four parts:
|
|
|
|
|
|
|
|
1. an identifier for the measurement
|
|
|
|
2. what type of angle was measured, e.g. RCA for receeding contact angle
|
|
|
|
3. the measured contact angle on the left side of the drop
|
|
|
|
4. the measured contact angle on the right side of the drop
|
|
|
|
|
|
|
|
So a typical file name looks quite cyptic like: 'PS1 RCA 12,5 15,6'
|
|
|
|
|
|
|
|
In adittion to cryptic file names with abbreviations, there is normally
|
|
|
|
quite an amount of files: 5 measurements x 3 types = 15 files for one
|
|
|
|
substrate or coating alone.
|
|
|
|
|
|
|
|
This script provides means to rename these files to a more verbose version
|
|
|
|
and to collect the data into a text file that can be imported in excel.
|
|
|
|
|
|
|
|
Since the naming of the type of measurement and the contact angles themselves
|
|
|
|
are somehow fixed, the 'user defined action' is renaming the identifier. To
|
|
|
|
do such a rename, a function accepting the identifier as string and returning
|
|
|
|
a verbose version as a string needs to be provided
|
|
|
|
|
|
|
|
An Example
|
|
|
|
>>> import conactangle as ca
|
|
|
|
>>> def verbose_id(identifier):
|
|
|
|
... if identifier.startswith('PS'):
|
|
|
|
... verbose_name = 'Polystyrol'
|
|
|
|
... else:
|
|
|
|
... verbose_name = 'Unknown Substrate'
|
|
|
|
... number = identifier[-1]
|
|
|
|
... return '{}, Measurement {}'.format(verbose_name, number)
|
|
|
|
...
|
|
|
|
>>> ca.rename(verbose_id, path='/example/directory')
|
|
|
|
|
|
|
|
This will change the cryptic filename 'PS1 RCA 12,5 15,6.bmp' to
|
|
|
|
'Polystyrol, Measurement 1, receeding, L12,5 R15,6.bmp'
|
|
|
|
|
|
|
|
To not tinker with the original files, the 'renaming' is done on a copy of
|
|
|
|
the orignal data. The results file is called 'results.txt' and is created
|
|
|
|
in the same directory where the raw data resides.
|
|
|
|
|
|
|
|
This is actually a two step process: first the files are processed and the
|
|
|
|
future result of the rename is printed to stdout. If no exception occurs,
|
|
|
|
the renaming of the files is done in a second round.
|