Skip to content

Commit 3235324

Browse files
authored
Merge pull request #176 from OpenPIV/windef_with_mask
Windef with mask
2 parents e5b0d3f + e8545fe commit 3235324

File tree

10 files changed

+186
-709
lines changed

10 files changed

+186
-709
lines changed

openpiv/docs/src/developers.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,19 @@ Things OpenPIV currently needs, (in order of importance)
4343
* Cython wrappers for C/C++ codes.
4444
* A good graphical user interface (in progress)
4545

46+
47+
How to test all the notebooks
48+
-----------------------------
49+
50+
conda install ipykernel
51+
python -m ipykernel install --user --name openpiv --display-name="openpiv"
52+
jupyter nbconvert --to html --ExecutePreprocessor.kernel_name=openpiv --execute *.ipynb
53+
54+
Then open the `openpiv/examples/notebooks` and check the HTML files. If one of those will fail, the error message will be in the command shell
55+
56+
If you need to install cv2
57+
--------------------------
58+
59+
conda install -c conda-forge opencv
60+
61+

openpiv/examples/notebooks/PIV_3D_example.ipynb

Lines changed: 54 additions & 15 deletions
Large diffs are not rendered by default.

openpiv/examples/notebooks/all_test_cases_sample.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,21 @@
2828
"name": "stdout",
2929
"output_type": "stream",
3030
"text": [
31-
"CPython 3.8.5\n",
31+
"CPython 3.8.3\n",
3232
"IPython 7.19.0\n",
3333
"\n",
3434
"numpy 1.19.4\n",
35-
"openpiv 0.23.1a0\n",
35+
"openpiv 0.23.2rc1\n",
3636
"\n",
37-
"compiler : GCC 7.3.0\n",
37+
"compiler : GCC 7.5.0\n",
3838
"system : Linux\n",
39-
"release : 5.4.0-54-generic\n",
39+
"release : 5.4.0-56-generic\n",
4040
"machine : x86_64\n",
4141
"processor : x86_64\n",
4242
"CPU cores : 8\n",
4343
"interpreter: 64bit\n",
44-
"Git hash : 6edda3f747a61489b040b4d59a7a6d0442e8e341\n",
45-
"Git branch : sig2noise_validation\n"
44+
"Git hash : b750f179dc14baecdad6dbf0bb96622bcc199fd4\n",
45+
"Git branch : windef_with_mask\n"
4646
]
4747
}
4848
],
@@ -304,7 +304,7 @@
304304
"name": "python",
305305
"nbconvert_exporter": "python",
306306
"pygments_lexer": "ipython3",
307-
"version": "3.8.5"
307+
"version": "3.8.3"
308308
}
309309
},
310310
"nbformat": 4,

openpiv/examples/notebooks/case_B_windef_small_window.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"'Processing Parameters'\n",
7272
"settings.correlation_method='circular' # 'circular' or 'linear'\n",
7373
"settings.normalized_correlation = True\n",
74-
"settings.iterations = 3 # select the number of PIV passes\n",
74+
"settings.num_iterations = 3 # select the number of PIV passes\n",
7575
"# add the interrogation window size for each pass. \n",
7676
"# For the moment, it should be a power of 2 \n",
7777
"\n",
@@ -366,7 +366,7 @@
366366
"name": "python",
367367
"nbconvert_exporter": "python",
368368
"pygments_lexer": "ipython3",
369-
"version": "3.8.5"
369+
"version": "3.8.3"
370370
}
371371
},
372372
"nbformat": 4,

openpiv/examples/notebooks/vonKarman_pivlab_with_openpiv.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
"settings.deformation_method = 'symmetric' # or 'second image'\n",
106106
"\n",
107107
"\n",
108-
"settings.iterations = 4 # select the number of PIV passes\n",
108+
"settings.num_iterations = 4 # select the number of PIV passes\n",
109109
"\n",
110110
"# add the interrogation window size for each pass. \n",
111111
"# For the moment, it should be a power of 2 \n",
@@ -415,7 +415,7 @@
415415
" frame_b,\n",
416416
" settings.windowsizes[0],\n",
417417
" settings.overlap[0],\n",
418-
" settings.iterations,\n",
418+
" settings.num_iterations,\n",
419419
" correlation_method=settings.correlation_method,\n",
420420
" subpixel_method=settings.subpixel_method,\n",
421421
" do_sig2noise=settings.extract_sig2noise,\n",
@@ -989,7 +989,7 @@
989989
"outputs": [],
990990
"source": [
991991
"# \"filter to replace the values that where marked by the validation\"\n",
992-
"# if settings.iterations > 1:\n",
992+
"# if settings.num_iterations > 1:\n",
993993
"\n",
994994
"\n",
995995
"u, v = filters.replace_outliers(\n",
@@ -1272,13 +1272,13 @@
12721272
}
12731273
],
12741274
"source": [
1275-
"for i in range(1, settings.iterations): ## all other passes\n",
1275+
"for i in range(1, settings.num_iterations): ## all other passes\n",
12761276
" x, y, u, v, sig2noise_ratio = windef.multipass_img_deform(\n",
12771277
" frame_a,\n",
12781278
" frame_b,\n",
12791279
" settings.windowsizes[i],\n",
12801280
" settings.overlap[i],\n",
1281-
" settings.iterations,\n",
1281+
" settings.num_iterations,\n",
12821282
" i,\n",
12831283
" x,\n",
12841284
" y,\n",
@@ -1304,8 +1304,8 @@
13041304
" \n",
13051305
" if (\n",
13061306
" settings.extract_sig2noise is True\n",
1307-
" and i == settings.iterations\n",
1308-
" and settings.iterations != 1\n",
1307+
" and i == settings.num_iterations\n",
1308+
" and settings.num_iterations != 1\n",
13091309
" and settings.do_sig2noise_validation is True\n",
13101310
" ):\n",
13111311
" u, v, mask_s2n = validation.sig2noise_val(\n",
@@ -1340,7 +1340,7 @@
13401340
" kernel_size=settings.filter_kernel_size,\n",
13411341
" )\n",
13421342
" \n",
1343-
" if (i != settings.iterations) and (settings.smoothn is True):\n",
1343+
" if (i != settings.num_iterations) and (settings.smoothn is True):\n",
13441344
" u, _, _, _ = smoothn.smoothn(\n",
13451345
" u, s=settings.smoothn_p )\n",
13461346
" v, _, _, _ = smoothn.smoothn(\n",

openpiv/examples/notebooks/window_deformation_comparison.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
"settings.correlation_method='circular' # 'circular' or 'linear'\n",
7070
"settings.normalized_correlation=False\n",
7171
"\n",
72-
"settings.iterations = 2 # select the number of PIV passes\n",
72+
"settings.num_iterations = 2 # select the number of PIV passes\n",
7373
"# add the interroagtion window size for each pass. \n",
7474
"# For the moment, it should be a power of 2 \n",
7575
"settings.windowsizes = (64, 32, 16) # if longer than n iteration the rest is ignored\n",

openpiv/test/test_windef.ipynb

Lines changed: 0 additions & 611 deletions
This file was deleted.

openpiv/validation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def global_std(u, v, std_threshold=3):
131131
return u, v, mask
132132

133133

134-
def sig2noise_val(u, v, sig2noise, w=None, threshold=1.05):
134+
def sig2noise_val(u, v, s2n, w=None, threshold=1.05):
135135
"""Eliminate spurious vectors from cross-correlation signal to noise ratio.
136136
137137
Replace spurious vectors with zero if signal to noise ratio
@@ -145,7 +145,7 @@ def sig2noise_val(u, v, sig2noise, w=None, threshold=1.05):
145145
v : 2d or 3d np.ndarray
146146
a two or three dimensional array containing the v velocity component.
147147
148-
sig2noise : 2d np.ndarray
148+
s2n : 2d np.ndarray
149149
a two or three dimensional array containing the value of the signal to
150150
noise ratio from cross-correlation function.
151151
w : 2d or 3d np.ndarray
@@ -180,7 +180,7 @@ def sig2noise_val(u, v, sig2noise, w=None, threshold=1.05):
180180
181181
"""
182182

183-
ind = sig2noise < threshold
183+
ind = s2n < threshold
184184

185185
u[ind] = np.nan
186186
v[ind] = np.nan

0 commit comments

Comments
 (0)