From 1398cac7ddb5817f89c4ed0e785974e261110b76 Mon Sep 17 00:00:00 2001 From: Alex Liberzon Date: Fri, 19 Apr 2024 00:37:34 +0300 Subject: [PATCH] updated to use modern openpiv. works till postprocessing --- build/lib/openpivgui/OpenPivGui.py | 5 +++-- openpivgui/MultiProcessing.py | 15 ++++++++------- openpivgui/OpenPivGui.py | 8 ++++++-- setup.py | 2 +- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/build/lib/openpivgui/OpenPivGui.py b/build/lib/openpivgui/OpenPivGui.py index 02245c0b..1e1b7b26 100644 --- a/build/lib/openpivgui/OpenPivGui.py +++ b/build/lib/openpivgui/OpenPivGui.py @@ -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 ( @@ -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) @@ -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)) diff --git a/openpivgui/MultiProcessing.py b/openpivgui/MultiProcessing.py index f510b091..2bc92df1 100755 --- a/openpivgui/MultiProcessing.py +++ b/openpivgui/MultiProcessing.py @@ -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 @@ -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) @@ -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']), @@ -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'], @@ -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']) diff --git a/openpivgui/OpenPivGui.py b/openpivgui/OpenPivGui.py index 10186153..fa57308c 100755 --- a/openpivgui/OpenPivGui.py +++ b/openpivgui/OpenPivGui.py @@ -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 ( @@ -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__ = ''' @@ -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)) diff --git a/setup.py b/setup.py index 6bd3ae44..7e12e2d7 100644 --- a/setup.py +++ b/setup.py @@ -21,5 +21,5 @@ "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", ], - python_requires='>=3.0', + python_requires='>=3.10', )