Skip to content

Commit

Permalink
updated to use modern openpiv. works till postprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlib committed Apr 18, 2024
1 parent 4336cf5 commit 1398cac
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
5 changes: 3 additions & 2 deletions build/lib/openpivgui/OpenPivGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from openpivgui.CreateToolTip import CreateToolTip
from openpivgui.OpenPivParams import OpenPivParams
import openpivgui.AddInHandler as AddInHandler
from scipy.ndimage.filters import gaussian_filter, gaussian_laplace
from scipy.ndimage import gaussian_filter, gaussian_laplace
from matplotlib.figure import Figure as Fig
from matplotlib.backend_bases import key_press_handler
from matplotlib.backends.backend_tkagg import (
Expand Down Expand Up @@ -222,6 +222,7 @@ def processing(self):
(os.cpu_count() - cpu_count), os.cpu_count()))

mp.run(func=mp.process, n_cpus=cpu_count)
# mp.run(func=mp.process, n_cpus=cpu_count)

# update file list with result vector files:
self.tkvars['fnames'].set(return_fnames)
Expand Down Expand Up @@ -531,7 +532,7 @@ def __init_buttons(self):
piv = ttk.Menubutton(f, text='Analysis')
options2 = tk.Menu(piv, tearoff=0)
piv.config(menu=options2)
options2.add_command(label='Algorithms\Calibration',
options2.add_command(label='Algorithms/Calibration',
command=lambda: self.selection(2))
options2.add_command(label='Windowing',
command=lambda: self.selection(3))
Expand Down
15 changes: 8 additions & 7 deletions openpivgui/MultiProcessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
import openpiv.filters as piv_flt
import openpiv.validation as piv_vld
import openpiv.windef as piv_wdf
import openpiv.pyprocess as piv_prc
import openpiv.preprocess as piv_pre
import openpiv.tools as piv_tls



__licence__ = '''
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -229,7 +230,7 @@ def smoothn(u, s):
overlap_0)

# validating first pass
mask = np.full_like(x, 0)
mask = np.zeros_like(x, dtype=bool)
u = np.ma.copy(u)
v = np.ma.copy(v)

Expand Down Expand Up @@ -325,7 +326,7 @@ def smoothn(u, s):

# validate other passes
if self.parameter['sp_vld_global_threshold']:
u, v, Mask = piv_vld.global_val(
Mask = piv_vld.global_val(
u, v,
u_thresholds=(self.parameter['sp_MinU'],
self.parameter['sp_MaxU']),
Expand All @@ -334,13 +335,13 @@ def smoothn(u, s):
mask += Mask # consolidate effects of mask

if self.parameter['sp_vld_global_threshold']:
u, v, Mask = piv_vld.global_std(
Mask = piv_vld.global_std(
u, v,
std_threshold=self.parameter['sp_std_threshold'])
mask += Mask

if self.parameter['sp_local_med_validation']:
u, v, Mask = piv_vld.local_median_val(
Mask = piv_vld.local_median_val(
u, v,
u_threshold=self.parameter['sp_local_med'],
v_threshold=self.parameter['sp_local_med'],
Expand All @@ -349,7 +350,7 @@ def smoothn(u, s):

if self.parameter['adv_repl']:
u, v = piv_flt.replace_outliers(
u, v,
u, v, mask,
method=self.parameter['adv_repl_method'],
max_iter=self.parameter['adv_repl_iter'],
kernel_size=self.parameter['adv_repl_kernel'])
Expand Down
8 changes: 6 additions & 2 deletions openpivgui/OpenPivGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from openpivgui.CreateToolTip import CreateToolTip
from openpivgui.OpenPivParams import OpenPivParams
import openpivgui.AddInHandler as AddInHandler
from scipy.ndimage.filters import gaussian_filter, gaussian_laplace
from scipy.ndimage import gaussian_filter, gaussian_laplace
from matplotlib.figure import Figure as Fig
from matplotlib.backend_bases import key_press_handler
from matplotlib.backends.backend_tkagg import (
Expand All @@ -38,6 +38,10 @@
import re
import os

import multiprocessing, logging
logger = multiprocessing.log_to_stderr()
logger.setLevel(multiprocessing.SUBDEBUG)

__version__ = '0.4.15'

__licence__ = '''
Expand Down Expand Up @@ -533,7 +537,7 @@ def __init_buttons(self):
piv = ttk.Menubutton(f, text='Analysis')
options2 = tk.Menu(piv, tearoff=0)
piv.config(menu=options2)
options2.add_command(label='Algorithms\Calibration',
options2.add_command(label='Algorithms/Calibration',
command=lambda: self.selection(2))
options2.add_command(label='Windowing',
command=lambda: self.selection(3))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
"License :: OSI Approved :: GNU General Public License (GPL)",
"Operating System :: OS Independent",
],
python_requires='>=3.0',
python_requires='>=3.10',
)

0 comments on commit 1398cac

Please sign in to comment.