flowrate#
This script compute “volumetric flow rate” in a channel from 2D PIV data. The unit of the flow rate will be px^2/s (it comes from a mean velocity, px/s, multiplied by a width, px).
We assume the following folder structure. We will generate flow rate data files based on the PIV file name before “_”. Columns in each file will be determined by PIV file name after “_”. For example, flow rate data computed from 04_A.mat, 04_B.mat will be put in a file 04.csv, with columns A and B.
|-- main_piv_folder
|-- 00_A.mat
|-- 00_B.mat
|-- ...
|-- 09_A.mat
|-- flowrate_folder
|-- (to be generated)
Syntax
python flowrate.py main_piv_folder flowrate_folder dt
main_piv_folder – the folder contains PIV of all crops (channels).
flowrate_folder – full directory of flow rate data folder. The data will be [“A”, “B”, “C”, “t”].
dt – time interval between two PIV data
Note
dt
is 2/FPS by default. However, sometimes we do PIV in a denser way, e.g. 1->2, 2->3, 3->4. In such case, dt=1/FPS
.
Note
The PIV data generated by ImageJ PIV have unit px/frame. So the flow rates from them are px^2/frame.
Edit
Nov 03, 2022 – Initial commit.
Dec 01, 2022 – We now adopt the “compact PIV” data structure, so the downstream processing needs to be modified.
Jan 05, 2023 – Adapt myimagelib import style.
Jan 18, 2023 – (i) Fix bug in
get_frame
function, use “label” instead of “filename” to be consistent withpivLib
. (ii) Handle unequal lengths of PIV dataFeb 08, 2023 – Rewrite in function wrapper form, to make autodoc work properly. (autodoc import the script and execute it, so anything outside
if __name__=="__main__"
will be executed, causing problems)