PaIRS-UniNa 0.1.13__cp310-cp310-win_amd64.whl → 0.2.8__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PaIRS_UniNa/Calibration_Tab.py +331 -0
- PaIRS_UniNa/Changes.txt +134 -2
- PaIRS_UniNa/Custom_Top.py +299 -299
- PaIRS_UniNa/Explorer.py +3136 -0
- PaIRS_UniNa/FolderLoop.py +562 -0
- PaIRS_UniNa/Input_Tab.py +831 -0
- PaIRS_UniNa/Input_Tab_CalVi.py +786 -0
- PaIRS_UniNa/Input_Tab_tools.py +3025 -0
- PaIRS_UniNa/Log_Tab.py +57 -14
- PaIRS_UniNa/Output_Tab.py +922 -0
- PaIRS_UniNa/PaIRS_PIV.py +111 -18
- PaIRS_UniNa/PaIRS_pypacks.py +698 -140
- PaIRS_UniNa/Process_Tab.py +1221 -1402
- PaIRS_UniNa/Process_Tab_CalVi.py +137 -262
- PaIRS_UniNa/Process_Tab_Disp.py +163 -0
- PaIRS_UniNa/Process_Tab_Min.py +120 -0
- PaIRS_UniNa/Saving_tools.py +296 -0
- PaIRS_UniNa/TabTools.py +863 -543
- PaIRS_UniNa/Vis_Tab.py +1898 -1315
- PaIRS_UniNa/Vis_Tab_CalVi.py +484 -356
- PaIRS_UniNa/Whatsnew.py +59 -10
- PaIRS_UniNa/_PaIRS_PIV.pyd +0 -0
- PaIRS_UniNa/__init__.py +4 -3
- PaIRS_UniNa/addwidgets_ps.py +326 -56
- PaIRS_UniNa/calib.py +19 -12
- PaIRS_UniNa/calibView.py +48 -25
- PaIRS_UniNa/gPaIRS.py +3902 -3461
- PaIRS_UniNa/gPalette.py +189 -170
- PaIRS_UniNa/icons/align_all.png +0 -0
- PaIRS_UniNa/icons/announcement.png +0 -0
- PaIRS_UniNa/icons/automatic_levels_off.png +0 -0
- PaIRS_UniNa/icons/automatic_levels_on.png +0 -0
- PaIRS_UniNa/icons/automatic_off.png +0 -0
- PaIRS_UniNa/icons/automatic_on.png +0 -0
- PaIRS_UniNa/icons/automatic_size_off.png +0 -0
- PaIRS_UniNa/icons/automatic_size_on.png +0 -0
- PaIRS_UniNa/icons/bin_off.png +0 -0
- PaIRS_UniNa/icons/bin_on.png +0 -0
- PaIRS_UniNa/icons/brush_cursor.png +0 -0
- PaIRS_UniNa/icons/bugfix.png +0 -0
- PaIRS_UniNa/icons/cal_proc.png +0 -0
- PaIRS_UniNa/icons/cal_proc_off.png +0 -0
- PaIRS_UniNa/icons/cal_step.png +0 -0
- PaIRS_UniNa/icons/cal_step_off.png +0 -0
- PaIRS_UniNa/icons/calibration_logo.png +0 -0
- PaIRS_UniNa/icons/change_folder.png +0 -0
- PaIRS_UniNa/icons/change_folder_off.png +0 -0
- PaIRS_UniNa/icons/close_all.png +0 -0
- PaIRS_UniNa/icons/close_workspace.png +0 -0
- PaIRS_UniNa/icons/colormap.png +0 -0
- PaIRS_UniNa/icons/colormaps/Accent.png +0 -0
- PaIRS_UniNa/icons/colormaps/BrBG.png +0 -0
- PaIRS_UniNa/icons/colormaps/Dark2.png +0 -0
- PaIRS_UniNa/icons/colormaps/PRGn.png +0 -0
- PaIRS_UniNa/icons/colormaps/Paired.png +0 -0
- PaIRS_UniNa/icons/colormaps/Pastel1.png +0 -0
- PaIRS_UniNa/icons/colormaps/Pastel2.png +0 -0
- PaIRS_UniNa/icons/colormaps/PiYG.png +0 -0
- PaIRS_UniNa/icons/colormaps/PuOr.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdBu.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdGy.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdYlBu.png +0 -0
- PaIRS_UniNa/icons/colormaps/RdYlGn.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set1.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set2.png +0 -0
- PaIRS_UniNa/icons/colormaps/Set3.png +0 -0
- PaIRS_UniNa/icons/colormaps/Spectral.png +0 -0
- PaIRS_UniNa/icons/colormaps/Wistia.png +0 -0
- PaIRS_UniNa/icons/colormaps/afmhot.png +0 -0
- PaIRS_UniNa/icons/colormaps/autumn.png +0 -0
- PaIRS_UniNa/icons/colormaps/binary.png +0 -0
- PaIRS_UniNa/icons/colormaps/blackVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/blueVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/bone.png +0 -0
- PaIRS_UniNa/icons/colormaps/brg.png +0 -0
- PaIRS_UniNa/icons/colormaps/bwr.png +0 -0
- PaIRS_UniNa/icons/colormaps/cividis.png +0 -0
- PaIRS_UniNa/icons/colormaps/cool.png +0 -0
- PaIRS_UniNa/icons/colormaps/coolwarm.png +0 -0
- PaIRS_UniNa/icons/colormaps/copper.png +0 -0
- PaIRS_UniNa/icons/colormaps/cubehelix.png +0 -0
- PaIRS_UniNa/icons/colormaps/cyanVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/flag.png +0 -0
- PaIRS_UniNa/icons/colormaps/gist_heat.png +0 -0
- PaIRS_UniNa/icons/colormaps/gray.png +0 -0
- PaIRS_UniNa/icons/colormaps/greenVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/hot.png +0 -0
- PaIRS_UniNa/icons/colormaps/hsv.png +0 -0
- PaIRS_UniNa/icons/colormaps/inferno.png +0 -0
- PaIRS_UniNa/icons/colormaps/jet.png +0 -0
- PaIRS_UniNa/icons/colormaps/magentaVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/magma.png +0 -0
- PaIRS_UniNa/icons/colormaps/ocean.png +0 -0
- PaIRS_UniNa/icons/colormaps/pink.png +0 -0
- PaIRS_UniNa/icons/colormaps/plasma.png +0 -0
- PaIRS_UniNa/icons/colormaps/prism.png +0 -0
- PaIRS_UniNa/icons/colormaps/rainbow.png +0 -0
- PaIRS_UniNa/icons/colormaps/redVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/seismic.png +0 -0
- PaIRS_UniNa/icons/colormaps/spring.png +0 -0
- PaIRS_UniNa/icons/colormaps/summer.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab10.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20b.png +0 -0
- PaIRS_UniNa/icons/colormaps/tab20c.png +0 -0
- PaIRS_UniNa/icons/colormaps/terrain.png +0 -0
- PaIRS_UniNa/icons/colormaps/twilight.png +0 -0
- PaIRS_UniNa/icons/colormaps/viridis.png +0 -0
- PaIRS_UniNa/icons/colormaps/whiteVector.png +0 -0
- PaIRS_UniNa/icons/colormaps/winter.png +0 -0
- PaIRS_UniNa/icons/colormaps/yellowVector.png +0 -0
- PaIRS_UniNa/icons/common_region.png +0 -0
- PaIRS_UniNa/icons/common_region_off.png +0 -0
- PaIRS_UniNa/icons/completed.png +0 -0
- PaIRS_UniNa/icons/contourf_off.png +0 -0
- PaIRS_UniNa/icons/contourf_on.png +0 -0
- PaIRS_UniNa/icons/copy.png +0 -0
- PaIRS_UniNa/icons/copy_process.png +0 -0
- PaIRS_UniNa/icons/copy_process_off.png +0 -0
- PaIRS_UniNa/icons/cut.png +0 -0
- PaIRS_UniNa/icons/cut_warnings.png +0 -0
- PaIRS_UniNa/icons/darkmode.png +0 -0
- PaIRS_UniNa/icons/disp_step.png +0 -0
- PaIRS_UniNa/icons/disp_step_off.png +0 -0
- PaIRS_UniNa/icons/edit_list.png +0 -0
- PaIRS_UniNa/icons/example_list.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_download_warning.png +0 -0
- PaIRS_UniNa/icons/flip_y_off.png +0 -0
- PaIRS_UniNa/icons/flip_y_on.png +0 -0
- PaIRS_UniNa/icons/folder_loop_cleanup.png +0 -0
- PaIRS_UniNa/icons/folder_loop_cleanup_off.png +0 -0
- PaIRS_UniNa/icons/gear.gif +0 -0
- PaIRS_UniNa/icons/gear.png +0 -0
- PaIRS_UniNa/icons/import_set.png +0 -0
- PaIRS_UniNa/icons/information.png +0 -0
- PaIRS_UniNa/icons/input_logo.png +0 -0
- PaIRS_UniNa/icons/issue.png +0 -0
- PaIRS_UniNa/icons/laser_NTR.png +0 -0
- PaIRS_UniNa/icons/laser_TR_double.png +0 -0
- PaIRS_UniNa/icons/laser_TR_single.png +0 -0
- PaIRS_UniNa/icons/link.png +0 -0
- PaIRS_UniNa/icons/linked.png +0 -0
- PaIRS_UniNa/icons/log_logo.png +0 -0
- PaIRS_UniNa/icons/logo_opaco.png +0 -0
- PaIRS_UniNa/icons/measure.png +0 -0
- PaIRS_UniNa/icons/measure_off.png +0 -0
- PaIRS_UniNa/icons/min_proc.png +0 -0
- PaIRS_UniNa/icons/min_proc_off.png +0 -0
- PaIRS_UniNa/icons/min_step.png +0 -0
- PaIRS_UniNa/icons/min_step_off.png +0 -0
- PaIRS_UniNa/icons/new_workspace.png +0 -0
- PaIRS_UniNa/icons/open_image.png +0 -0
- PaIRS_UniNa/icons/open_new_window.png +0 -0
- PaIRS_UniNa/icons/open_result.png +0 -0
- PaIRS_UniNa/icons/open_workspace.png +0 -0
- PaIRS_UniNa/icons/output_logo.png +0 -0
- PaIRS_UniNa/icons/paste_above.png +0 -0
- PaIRS_UniNa/icons/paste_below.png +0 -0
- PaIRS_UniNa/icons/paused.png +0 -0
- PaIRS_UniNa/icons/piv_proc.png +0 -0
- PaIRS_UniNa/icons/piv_proc_off.png +0 -0
- PaIRS_UniNa/icons/piv_step.png +0 -0
- PaIRS_UniNa/icons/piv_step_off.png +0 -0
- PaIRS_UniNa/icons/process_logo.png +0 -0
- PaIRS_UniNa/icons/process_loop.png +0 -0
- PaIRS_UniNa/icons/project.png +0 -0
- PaIRS_UniNa/icons/pylog.png +0 -0
- PaIRS_UniNa/icons/python_warning.png +0 -0
- PaIRS_UniNa/icons/queue.png +0 -0
- PaIRS_UniNa/icons/read.png +0 -0
- PaIRS_UniNa/icons/read_list.png +0 -0
- PaIRS_UniNa/icons/reset.png +0 -0
- PaIRS_UniNa/icons/reset_levels.png +0 -0
- PaIRS_UniNa/icons/restore_undo.png +0 -0
- PaIRS_UniNa/icons/running.gif +0 -0
- PaIRS_UniNa/icons/running.png +0 -0
- PaIRS_UniNa/icons/running_warn.png +0 -0
- PaIRS_UniNa/icons/save_and_stop.png +0 -0
- PaIRS_UniNa/icons/save_cfg.png +0 -0
- PaIRS_UniNa/icons/saveas_workspace.png +0 -0
- PaIRS_UniNa/icons/scale_all.png +0 -0
- PaIRS_UniNa/icons/scale_down.png +0 -0
- PaIRS_UniNa/icons/scale_up.png +0 -0
- PaIRS_UniNa/icons/scan_list.png +0 -0
- PaIRS_UniNa/icons/scan_path.png +0 -0
- PaIRS_UniNa/icons/scan_path_loop.png +0 -0
- PaIRS_UniNa/icons/scan_path_loop_off.png +0 -0
- PaIRS_UniNa/icons/search.png +0 -0
- PaIRS_UniNa/icons/showIW_off.png +0 -0
- PaIRS_UniNa/icons/showIW_on.png +0 -0
- PaIRS_UniNa/icons/show_all.png +0 -0
- PaIRS_UniNa/icons/sort.png +0 -0
- PaIRS_UniNa/icons/sort_reversed.png +0 -0
- PaIRS_UniNa/icons/spiv_proc.png +0 -0
- PaIRS_UniNa/icons/spiv_proc_off.png +0 -0
- PaIRS_UniNa/icons/star.png +0 -0
- PaIRS_UniNa/icons/step_inheritance.png +0 -0
- PaIRS_UniNa/icons/subMIN_off.png +0 -0
- PaIRS_UniNa/icons/subMIN_on.png +0 -0
- PaIRS_UniNa/icons/unedited.png +0 -0
- PaIRS_UniNa/icons/uninitialized.png +0 -0
- PaIRS_UniNa/icons/unlink.png +0 -0
- PaIRS_UniNa/icons/unwrap_items.png +0 -0
- PaIRS_UniNa/icons/vectorColor.png +0 -0
- PaIRS_UniNa/icons/view.png +0 -0
- PaIRS_UniNa/icons/view_off.png +0 -0
- PaIRS_UniNa/icons/vis_logo.png +0 -0
- PaIRS_UniNa/icons/warning_circle.png +0 -0
- PaIRS_UniNa/icons/window.png +0 -0
- PaIRS_UniNa/icons/workspace.png +0 -0
- PaIRS_UniNa/icons/wrap_items.png +0 -0
- PaIRS_UniNa/icons/write_list.png +0 -0
- PaIRS_UniNa/listLib.py +303 -0
- PaIRS_UniNa/mtfPIV.py +8 -8
- PaIRS_UniNa/parForMulti.py +7 -5
- PaIRS_UniNa/parForWorkers.py +370 -31
- PaIRS_UniNa/pivParFor.py +233 -229
- PaIRS_UniNa/plt_util.py +141 -141
- PaIRS_UniNa/preProcParFor.py +153 -148
- PaIRS_UniNa/procTools.py +631 -178
- PaIRS_UniNa/readcfg.py +31 -1
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereoPivParFor.py +227 -0
- PaIRS_UniNa/tAVarie.py +215 -215
- PaIRS_UniNa/tabSplitter.py +612 -0
- PaIRS_UniNa/ui_Calibration_Tab.py +545 -0
- PaIRS_UniNa/ui_Custom_Top.py +5 -5
- PaIRS_UniNa/ui_Input_Tab.py +1101 -0
- PaIRS_UniNa/{ui_Import_Tab_CalVi.py → ui_Input_Tab_CalVi.py} +1282 -1275
- PaIRS_UniNa/ui_Log_Tab.py +262 -257
- PaIRS_UniNa/{ui_Export_Tab.py → ui_Output_Tab.py} +2361 -1778
- PaIRS_UniNa/ui_Process_Tab.py +3809 -3758
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1546
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
- PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
- PaIRS_UniNa/ui_Vis_Tab.py +1626 -1208
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
- PaIRS_UniNa/ui_Whatsnew.py +131 -131
- PaIRS_UniNa/ui_gPairs.py +876 -950
- PaIRS_UniNa/ui_infoPaIRS.py +550 -425
- PaIRS_UniNa/whatsnew.txt +6 -4
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/METADATA +69 -51
- pairs_unina-0.2.8.dist-info/RECORD +329 -0
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/WHEEL +1 -1
- PaIRS_UniNa/CalVi.py +0 -18
- PaIRS_UniNa/Export_Tab.py +0 -574
- PaIRS_UniNa/Import_Tab.py +0 -657
- PaIRS_UniNa/Import_Tab_CalVi.py +0 -861
- PaIRS_UniNa/Import_Tab_tools.py +0 -598
- PaIRS_UniNa/Tree_Tab.py +0 -543
- PaIRS_UniNa/gCalVi.py +0 -2024
- PaIRS_UniNa/icons/add.png +0 -0
- PaIRS_UniNa/icons/cancelled.png +0 -0
- PaIRS_UniNa/icons/chain.png +0 -0
- PaIRS_UniNa/icons/chain_broken.png +0 -0
- PaIRS_UniNa/icons/default_sizes.png +0 -0
- PaIRS_UniNa/icons/dock_tabs.png +0 -0
- PaIRS_UniNa/icons/done.png +0 -0
- PaIRS_UniNa/icons/down_arrow.png +0 -0
- PaIRS_UniNa/icons/export_logo.png +0 -0
- PaIRS_UniNa/icons/fast_delete.png +0 -0
- PaIRS_UniNa/icons/flip_y.png +0 -0
- PaIRS_UniNa/icons/ganci.png +0 -0
- PaIRS_UniNa/icons/import_blue.png +0 -0
- PaIRS_UniNa/icons/import_logo.png +0 -0
- PaIRS_UniNa/icons/missing.png +0 -0
- PaIRS_UniNa/icons/process_icon.png +0 -0
- PaIRS_UniNa/icons/processing.png +0 -0
- PaIRS_UniNa/icons/restart.png +0 -0
- PaIRS_UniNa/icons/right_arrow.png +0 -0
- PaIRS_UniNa/icons/run_piv.png +0 -0
- PaIRS_UniNa/icons/terminal.png +0 -0
- PaIRS_UniNa/icons/undock_tabs.png +0 -0
- PaIRS_UniNa/icons/vect_field.png +0 -0
- PaIRS_UniNa/icons/w0.png +0 -0
- PaIRS_UniNa/icons/w1.png +0 -0
- PaIRS_UniNa/icons/w2.png +0 -0
- PaIRS_UniNa/icons/w3.png +0 -0
- PaIRS_UniNa/icons/w4.png +0 -0
- PaIRS_UniNa/icons/w5.png +0 -0
- PaIRS_UniNa/run_CalVi.py +0 -14
- PaIRS_UniNa/run_gcalvi.py +0 -5
- PaIRS_UniNa/ui_Import_Tab.py +0 -1077
- PaIRS_UniNa/ui_Tree_Tab.py +0 -684
- PaIRS_UniNa/ui_gCalVi.py +0 -640
- PaIRS_UniNa/ui_infoCalVi.py +0 -428
- PaIRS_UniNa-0.1.13.dist-info/LICENSE +0 -19
- PaIRS_UniNa-0.1.13.dist-info/RECORD +0 -174
- /PaIRS_UniNa/icons/{clean_queue.png → clean.png} +0 -0
- /PaIRS_UniNa/icons/{waiting_c.png → sandglass.png} +0 -0
- {PaIRS_UniNa-0.1.13.dist-info → pairs_unina-0.2.8.dist-info}/top_level.txt +0 -0
PaIRS_UniNa/procTools.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
''' 2d PIV helper function for parfor '''
|
|
2
2
|
from datetime import timedelta
|
|
3
|
+
import os.path
|
|
3
4
|
|
|
4
5
|
# In hex is easy 0606 both read and processed 01234156789abcdef
|
|
5
6
|
FLAG_READ_ERR = [1, 1<<8] #2, 256= 0001 1 0001 0000 0000
|
|
@@ -19,87 +20,140 @@ FLAG_FINALIZED_OR_ERR = [ p|e for (p,e) in zip(FLAG_FINALIZED,FLAG_READ_ERR)]
|
|
|
19
20
|
# per annullare un bit f=f& (~FLAG_CALLBACK)
|
|
20
21
|
|
|
21
22
|
from .PaIRS_pypacks import*
|
|
22
|
-
from .
|
|
23
|
-
from .
|
|
24
|
-
from .
|
|
23
|
+
from .Input_Tab import INPpar as INPpar
|
|
24
|
+
from .Output_Tab import OUTpar as OUTpar
|
|
25
|
+
from .Output_Tab import outType_dict
|
|
25
26
|
from .Process_Tab import PROpar as PROpar
|
|
27
|
+
from .Process_Tab_Min import PROpar_Min as PROpar_Min
|
|
28
|
+
from .Process_Tab_Disp import PROpar_Disp as PROpar_Disp
|
|
26
29
|
from .Vis_Tab import VISpar as VISpar
|
|
27
30
|
from .Vis_Tab import NamesPIV
|
|
28
31
|
from .TabTools import TABpar
|
|
32
|
+
from .readcfg import readCalFile
|
|
29
33
|
from .__init__ import __version__,__subversion__,__year__
|
|
30
34
|
|
|
35
|
+
processData = {
|
|
36
|
+
ProcessTypes.min: {'name': 'Pre-process', 'caption': 'Pre-process analysis of a set of images aimed at computing historical minimum background',
|
|
37
|
+
'class': 0, 'icon': 'min_proc.png',
|
|
38
|
+
'children': {StepTypes.min:True}, 'mandatory': [StepTypes.min]},
|
|
39
|
+
ProcessTypes.piv: {'name': 'PIV process', 'caption': 'Particle Image Velocimetry analysis for computation of the two-dimensional two-component velocity field',
|
|
40
|
+
'class': 0, 'icon': 'piv_proc.png',
|
|
41
|
+
'children': {StepTypes.min:False,StepTypes.piv:True}, 'mandatory': [StepTypes.piv]},
|
|
42
|
+
ProcessTypes.cal: {'name': 'Calibration', 'caption': 'Accurate optical calibration of single and multiple camera bundles',
|
|
43
|
+
'class': 0, 'icon': 'cal_proc.png',
|
|
44
|
+
'children': {StepTypes.cal:True}, 'mandatory': [StepTypes.cal]},
|
|
45
|
+
ProcessTypes.spiv: {'name': 'Stereo-PIV process', 'caption': 'Stereoscopic Particle Image Velocimetry analysis for computation of the two-dimensional three-component velocity field',
|
|
46
|
+
'class': 0, 'icon': 'spiv_proc.png',
|
|
47
|
+
'children': {StepTypes.cal:True,StepTypes.min:False,StepTypes.disp:True,StepTypes.spiv:True},'mandatory': [StepTypes.cal]},
|
|
48
|
+
}
|
|
49
|
+
for p in processData:
|
|
50
|
+
processData[p]['type']=p
|
|
51
|
+
|
|
52
|
+
stepData= {
|
|
53
|
+
StepTypes.cal: {'name': 'Camera calibration', 'caption': 'Select an appropriate camera model and estimate the parameters of the mapping functions based on calibration target images',
|
|
54
|
+
'class': 1, 'icon': 'cal_step.png', 'parents': [],
|
|
55
|
+
'tabs': ['Calibration','Input_CalVi','Process_CalVi','Vis_CalVi'], },
|
|
56
|
+
StepTypes.min: {'name': 'Image pre-processing', 'caption': 'Select a set of particle images and compute the historical minimum background for subsets corresponding to the same laser light source',
|
|
57
|
+
'class': 1, 'icon': 'min_step.png', 'parents': [],
|
|
58
|
+
'tabs': ['Input','Output','Process_Min','Log','Vis'], },
|
|
59
|
+
StepTypes.piv: {'name': 'PIV analysis', 'caption': 'Select a set of particle images, craft a custom iterative multi-grid method and compute the two-dimensional two-component displacement field',
|
|
60
|
+
'class': 1, 'icon': 'piv_step.png', 'parents': [],
|
|
61
|
+
'tabs': ['Input','Output','Process','Log','Vis'], },
|
|
62
|
+
StepTypes.disp: {'name': 'Disparity correction', 'caption': 'Select a a set of particle images and compute the laser sheet position and orientation to adjust the camera disparities in the stereo-setup',
|
|
63
|
+
'class': 1, 'icon': 'disp_step.png', 'parents': [StepTypes.cal],
|
|
64
|
+
'tabs': ['Input','Output','Process_Disp','Log','Vis'], },
|
|
65
|
+
StepTypes.spiv: {'name': 'Stereoscopic PIV analysis', 'caption': 'Select a set of particle images, craft a custom iterative multi-grid method and compute the two-dimensional three-component displacement field',
|
|
66
|
+
'class': 1, 'icon': 'piv_step.png', 'parents': [StepTypes.cal,StepTypes.disp],
|
|
67
|
+
'tabs': ['Input','Output','Process','Log','Vis'], },
|
|
68
|
+
}
|
|
69
|
+
for p in stepData:
|
|
70
|
+
stepData[p]['type']=p
|
|
31
71
|
|
|
32
72
|
class dataTreePar(TABpar):
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
typeProc=0
|
|
40
|
-
flagRun=0
|
|
41
|
-
if len(args): typeProc=args[0]
|
|
42
|
-
if len(args)>1: flagRun=args[1]
|
|
43
|
-
self.setup(typeProc,flagRun)
|
|
44
|
-
super().__init__()
|
|
45
|
-
self.name='dataTreePar'
|
|
46
|
-
if typeProc==dataTreePar.typeMIN:
|
|
47
|
-
self.name+=':MINproc'
|
|
48
|
-
elif typeProc==dataTreePar.typePIV:
|
|
49
|
-
self.name+=':PIVproc'
|
|
73
|
+
def __init__(self,Process=ProcessTypes.null,Step=StepTypes.null):
|
|
74
|
+
self.setup(Process,Step)
|
|
75
|
+
super().__init__('dataTreePar','ITEpar')
|
|
76
|
+
|
|
77
|
+
self.setCompleteLog()
|
|
78
|
+
|
|
50
79
|
self.surname='itemTreePar.gPaIRS'
|
|
51
80
|
self.unchecked_fields+=['name_fields']
|
|
81
|
+
self.uncopied_fields+=['ind']
|
|
52
82
|
|
|
53
|
-
def setup(self,
|
|
83
|
+
def setup(self,Process,Step):
|
|
54
84
|
#typeProc, names, icon, log: item fields
|
|
55
|
-
self.
|
|
85
|
+
self.Process=Process
|
|
86
|
+
self.Step=Step
|
|
87
|
+
self.namesPIV=NamesPIV(Step)
|
|
56
88
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
89
|
+
if Step:
|
|
90
|
+
self.itemname=stepData[Step]['name']
|
|
91
|
+
else:
|
|
92
|
+
self.itemname=''
|
|
93
|
+
self.filename_proc = ''
|
|
94
|
+
self.name_proc = ''
|
|
61
95
|
|
|
62
96
|
self.Log=''
|
|
63
|
-
self.subHeader=''
|
|
64
97
|
self.procLog=['','',''] #LogProc, LogStat, LogErr
|
|
98
|
+
self.FlagErr=False
|
|
65
99
|
self.warnings=['',''] #warnings once completed the process, warnings related to current state
|
|
66
100
|
|
|
67
|
-
self.item_fields=[f for f,_ in self.__dict__.items()]+['
|
|
101
|
+
self.item_fields=[f for f,_ in self.__dict__.items()]+['ind']
|
|
68
102
|
|
|
69
|
-
#
|
|
70
|
-
self.flagRun=flagRun #0:not launched yet, 1:completed, -1:interrupted
|
|
71
|
-
#min data
|
|
103
|
+
#common data
|
|
72
104
|
self.inpPath=''
|
|
105
|
+
self.outPath=''
|
|
73
106
|
self.outPathRoot=''
|
|
74
|
-
self.inpExt=''
|
|
75
|
-
self.flag_TR=None
|
|
76
|
-
self.compMin:CompMin=CompMin()
|
|
77
|
-
#piv data
|
|
78
|
-
self.NumThreads=-1
|
|
79
107
|
self.ndig=-1
|
|
80
108
|
self.outExt=''
|
|
109
|
+
self.compMin:CompMin=CompMin()
|
|
110
|
+
self.mediaPIV:MediaPIV=MediaPIV(stepType=Step)
|
|
111
|
+
#if Step==StepTypes.min:
|
|
112
|
+
self.FlagTR = False
|
|
113
|
+
self.LaserType = False
|
|
114
|
+
self.SogliaNoise_Min = 0.0
|
|
115
|
+
self.SogliaStd_Min = 100.0
|
|
116
|
+
|
|
117
|
+
#elif Step in (StepTypes.piv, StepTypes.disp, StepTypes.spiv):
|
|
118
|
+
#common
|
|
119
|
+
self.FlagMIN=False
|
|
81
120
|
self.Imin=[]
|
|
82
|
-
|
|
83
|
-
self.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
self.
|
|
87
|
-
|
|
88
|
-
self.
|
|
89
|
-
self.
|
|
121
|
+
|
|
122
|
+
self.dispFrames=0
|
|
123
|
+
|
|
124
|
+
self.numUsedProcs=1
|
|
125
|
+
self.numPivOmpCores=-1 # used by PIV_ParFor_Workerfor setting the correct number of threads
|
|
126
|
+
|
|
127
|
+
self.OUT_dict={}
|
|
128
|
+
self.PRO_dict={}
|
|
129
|
+
self.PRO_Disp_dict={}
|
|
130
|
+
|
|
131
|
+
self.Nit=0
|
|
90
132
|
self.nimg=0
|
|
133
|
+
self.ncam=0
|
|
134
|
+
self.nframe=2
|
|
135
|
+
self.nsteps=0
|
|
91
136
|
self.list_Image_Files=[]
|
|
92
137
|
self.list_eim=[]
|
|
93
138
|
self.list_pim=[]
|
|
94
139
|
self.list_print=[]
|
|
95
140
|
|
|
141
|
+
#if Step in (StepTypes.disp, StepTypes.spiv):
|
|
142
|
+
self.calList=[]
|
|
143
|
+
self.calEx=[]
|
|
144
|
+
self.res=0
|
|
145
|
+
self.laserConst=[0.0 for _ in range(3)]
|
|
146
|
+
|
|
147
|
+
#if Step==StepTypes.spiv:
|
|
148
|
+
self.FlagDISP=False
|
|
149
|
+
#self.dispFile=''
|
|
150
|
+
|
|
96
151
|
fields=[f for f,_ in self.__dict__.items()]
|
|
97
152
|
self.numCallBackTotOk=0 #numero di callback ricevute= quelle con problema + finalized
|
|
98
153
|
self.numFinalized=0 #numero di processi andati a buon fine
|
|
99
154
|
self.numProcOrErrTot=0
|
|
100
155
|
self.FlagFinished=False
|
|
101
156
|
self.flagParForCompleted=False # par for completed
|
|
102
|
-
|
|
103
157
|
|
|
104
158
|
# processing time
|
|
105
159
|
self.initProcTime=time() #initial time qhen starting the process
|
|
@@ -110,55 +164,111 @@ class dataTreePar(TABpar):
|
|
|
110
164
|
#interface
|
|
111
165
|
self.freset_par=''
|
|
112
166
|
self.procfields=[f for f,_ in self.__dict__.items() if f not in fields]+ ['compMin','mediaPIV']
|
|
113
|
-
|
|
167
|
+
|
|
168
|
+
self.assignDataName()
|
|
114
169
|
return
|
|
115
170
|
|
|
116
|
-
def
|
|
117
|
-
self.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
self.
|
|
136
|
-
|
|
137
|
-
self.
|
|
171
|
+
def resF(self,i,string=''):
|
|
172
|
+
if self.ndig<-1: return ''
|
|
173
|
+
if string=='dispMap':
|
|
174
|
+
fold=os.path.dirname(self.outPathRoot)
|
|
175
|
+
rad=os.path.splitext(os.path.basename(self.outPathRoot))[0]
|
|
176
|
+
if rad[-1]!='_': rad+='_'
|
|
177
|
+
return myStandardRoot(os.path.join(fold, f'dispMap_rot_{rad}{i}.png'))
|
|
178
|
+
else:
|
|
179
|
+
if type(i)==str:
|
|
180
|
+
return f"{self.outPathRoot}_{i}{self.outExt}"
|
|
181
|
+
elif type(i)==int:
|
|
182
|
+
return f"{self.outPathRoot}_{i:0{self.ndig:d}d}{self.outExt}"
|
|
183
|
+
else:
|
|
184
|
+
return ''
|
|
185
|
+
|
|
186
|
+
def setProc(self,INP:INPpar=INPpar(),OUT:OUTpar=OUTpar(),PRO:PROpar=PROpar(),PRO_Min:PROpar_Min=PROpar_Min(),PRO_Disp:PROpar_Disp=PROpar_Disp()):
|
|
187
|
+
if INP is None: return
|
|
188
|
+
self.inpPath=INP.path
|
|
189
|
+
self.outPath=myStandardRoot(OUT.path+OUT.subfold)
|
|
190
|
+
self.outPathRoot=myStandardRoot(OUT.path+OUT.subfold+OUT.root)
|
|
191
|
+
|
|
192
|
+
if self.Step==StepTypes.disp:
|
|
193
|
+
self.list_Image_Files=INP.imList
|
|
194
|
+
self.list_eim=INP.imEx
|
|
195
|
+
else:
|
|
196
|
+
self.list_Image_Files=[]
|
|
197
|
+
self.list_eim=[]
|
|
198
|
+
for c in range(INP.ncam):
|
|
199
|
+
for k in range(INP.nimg):
|
|
200
|
+
for f in range(2):
|
|
201
|
+
self.list_Image_Files.append(INP.imList[c][f][k])
|
|
202
|
+
self.list_eim.append(INP.imEx[c][f][k])
|
|
203
|
+
self.ncam=len(INP.imList)
|
|
204
|
+
self.FlagTR=INP.FlagTR
|
|
205
|
+
self.LaserType=INP.LaserType
|
|
206
|
+
self.FlagMIN=INP.FlagMIN
|
|
207
|
+
self.Imin=INP.imListMin
|
|
208
|
+
|
|
209
|
+
if self.Step==StepTypes.min:
|
|
210
|
+
self.compMin.outName = self.outPathRoot+'_data'+outExt.min
|
|
211
|
+
self.compMin.name_proc = self.name_proc
|
|
212
|
+
self.compMin.flag_TR=self.FlagTR
|
|
213
|
+
self.compMin.LaserType=self.LaserType
|
|
214
|
+
self.compMin.setup(self.ncam,self.nframe)
|
|
215
|
+
self.nimg=(len(self.list_Image_Files)//(2*self.ncam)+1)//2 if self.FlagTR else len(self.list_Image_Files)//(2*self.ncam)
|
|
216
|
+
elif self.Step in (StepTypes.piv,StepTypes.disp,StepTypes.spiv):
|
|
217
|
+
if self.Step==StepTypes.piv:
|
|
218
|
+
self.mediaPIV.outName = self.outPathRoot+'_data'+outExt.piv
|
|
219
|
+
self.mediaPIV.name_proc = self.name_proc
|
|
220
|
+
elif self.Step==StepTypes.spiv:
|
|
221
|
+
self.mediaPIV.outName = self.outPathRoot+'_data'+outExt.spiv
|
|
222
|
+
self.mediaPIV.name_proc = self.name_proc
|
|
223
|
+
self.nimg=INP.nimg
|
|
224
|
+
self.ndig=len(str(self.nimg))
|
|
225
|
+
self.outExt=list(outType_dict)[OUT.outType]
|
|
226
|
+
self.numUsedProcs=self.numUsedProcs #TODEL
|
|
227
|
+
if self.Step in (StepTypes.disp,StepTypes.spiv):
|
|
228
|
+
self.calList=INP.calList
|
|
229
|
+
self.calEx =INP.calEx
|
|
230
|
+
if self.Step==StepTypes.disp:
|
|
231
|
+
self.Nit = PRO_Disp.Nit
|
|
232
|
+
self.dispFrames = PRO_Disp.frames
|
|
233
|
+
#if self.Step==StepTypes.spiv:
|
|
234
|
+
#self.FlagDISP=INP.FlagDISP
|
|
235
|
+
#self.dispFile=INP.dispFile
|
|
236
|
+
|
|
237
|
+
self.nsteps=self.Nit if self.Step==StepTypes.disp else self.nimg
|
|
238
|
+
self.list_pim=[0]*self.nsteps
|
|
239
|
+
self.list_print=['']*self.nsteps
|
|
240
|
+
|
|
241
|
+
if PRO_Min:
|
|
242
|
+
self.SogliaNoise_Min=PRO_Min.SogliaNoise
|
|
243
|
+
self.SogliaStd_Min=PRO_Min.SogliaStd
|
|
244
|
+
|
|
245
|
+
for f,v in OUT.duplicate().__dict__.items():
|
|
246
|
+
self.OUT_dict[f]=v
|
|
247
|
+
if self.Step in (StepTypes.piv,StepTypes.spiv):
|
|
248
|
+
for f,v in PRO.duplicate().__dict__.items():
|
|
249
|
+
self.PRO_dict[f]=v
|
|
250
|
+
if self.Step == StepTypes.disp:
|
|
251
|
+
for f,v in PRO_Disp.duplicate().__dict__.items():
|
|
252
|
+
self.PRO_Disp_dict[f]=v
|
|
253
|
+
#self.setPIV(OUT,PRO,flagSpiv)
|
|
138
254
|
|
|
139
255
|
def assignDataName(self):
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
self.itemname=f"Minimum computation ({self.filename_proc[self.typeProc]})"
|
|
153
|
-
elif self.typeProc==dataTreePar.typePIV:
|
|
154
|
-
self.name='itemTREEpar:PIVProc'
|
|
155
|
-
if self.INP.flag_min:
|
|
156
|
-
self.filename_proc[dataTreePar.typeMIN]=f"{self.outPathRoot}{outExt.min}"
|
|
157
|
-
else:
|
|
158
|
-
self.filename_proc[dataTreePar.typeMIN]=''
|
|
159
|
-
self.filename_proc[self.typeProc]=f"{self.outPathRoot}{outExt.piv}"
|
|
160
|
-
self.itemname=f"PIV computation ({self.filename_proc[self.typeProc]})"
|
|
256
|
+
self.name_proc,_,_=identifierName(typeObject='proc')
|
|
257
|
+
|
|
258
|
+
if self.Step!=StepTypes.null:
|
|
259
|
+
self.itemname=stepData[self.Step]['name']
|
|
260
|
+
for f,v in StepTypes.__dict__.items():
|
|
261
|
+
if v==self.Step:
|
|
262
|
+
break
|
|
263
|
+
ext=getattr(outExt,f)
|
|
264
|
+
self.filename_proc=f"{self.outPathRoot}{ext}"
|
|
265
|
+
|
|
266
|
+
def procOutName(self):
|
|
267
|
+
return procOutName(self)
|
|
161
268
|
|
|
269
|
+
def stepOutName(self):
|
|
270
|
+
return stepOutName(self)
|
|
271
|
+
|
|
162
272
|
def resetTimeStat(self):
|
|
163
273
|
''' reset all the TimeStat parameters should be called before starting a new process maybe it is useless ask GP'''
|
|
164
274
|
self.procTime=0
|
|
@@ -188,7 +298,7 @@ class dataTreePar(TABpar):
|
|
|
188
298
|
def calcTimeStat(self,actualTime,numDone):
|
|
189
299
|
''' Should be called when when the eta should be updated '''
|
|
190
300
|
procTime=self.procTime+actualTime-self.initProcTime
|
|
191
|
-
numStilToProc=self.
|
|
301
|
+
numStilToProc=self.nsteps-numDone
|
|
192
302
|
|
|
193
303
|
if numDone==0:
|
|
194
304
|
self.eta=0
|
|
@@ -200,25 +310,25 @@ class dataTreePar(TABpar):
|
|
|
200
310
|
#pr(f'dt={procTime} ETA={self.eta} {self.deltaTime2String(self.eta)} dt+ETA={round(procTime+ self.eta)} timePerImage={self.timePerImage} numStilToProc={numStilToProc} numDone={numDone} ')
|
|
201
311
|
return self.deltaTime2String(self.eta)
|
|
202
312
|
|
|
203
|
-
def setPIV(self):
|
|
204
|
-
self.PIV=data2PIV(self)
|
|
313
|
+
def setPIV(self,flagSpiv=False):
|
|
314
|
+
self.PIV=data2PIV(self,flagSpiv)
|
|
205
315
|
|
|
206
316
|
def createLogHeader(self):
|
|
207
317
|
header=PaIRS_Header
|
|
208
|
-
if self.
|
|
318
|
+
if self.Step==StepTypes.null: #minimum
|
|
209
319
|
name='Welcome to PaIRS!\nEnjoy it!\n\n'
|
|
210
320
|
header=header+name
|
|
211
321
|
else:
|
|
212
|
-
name=f'{self.itemname}\n'
|
|
213
|
-
name+=self.name_proc
|
|
322
|
+
name=f'{self.itemname} ({self.filename_proc})\n'
|
|
323
|
+
name+=self.name_proc
|
|
214
324
|
date_time=QDate.currentDate().toString('yyyy/MM/dd')+' at '+\
|
|
215
325
|
QTime().currentTime().toString()
|
|
216
326
|
header+=f'{name}\n'+'Last modified date: '+date_time+'\n\n\n'
|
|
217
327
|
return header
|
|
218
|
-
|
|
328
|
+
|
|
219
329
|
def setCompleteLog(self):
|
|
220
330
|
warn1=self.headerSection('WARNINGS',self.warnings[1],'!')
|
|
221
|
-
if self.flagRun:
|
|
331
|
+
if self.flagRun not in (0,-10):
|
|
222
332
|
warn0=''
|
|
223
333
|
self.createLogProc()
|
|
224
334
|
LogProc = self.headerSection('OUTPUT',self.procLog[0])
|
|
@@ -228,7 +338,14 @@ class dataTreePar(TABpar):
|
|
|
228
338
|
if self.warnings[0]: warn0='*Further information:\n'+self.warnings[0]+'\n'
|
|
229
339
|
self.Log=self.createLogHeader()+procLog+warn0+warn1
|
|
230
340
|
else:
|
|
231
|
-
self.
|
|
341
|
+
if self.flagRun:
|
|
342
|
+
self.Log=self.createLogHeader()
|
|
343
|
+
else:
|
|
344
|
+
self.Log=self.createLogHeader()+warn1
|
|
345
|
+
|
|
346
|
+
def createWarningLog(self,warning):
|
|
347
|
+
warn1=self.headerSection('WARNINGS',warning,'!')
|
|
348
|
+
return self.createLogHeader()+warn1
|
|
232
349
|
|
|
233
350
|
def headerSection(self,nameSection,Log,*args):
|
|
234
351
|
if len(Log):
|
|
@@ -238,22 +355,67 @@ class dataTreePar(TABpar):
|
|
|
238
355
|
if len(args)>1: n=args[1]
|
|
239
356
|
ln=len(nameSection)
|
|
240
357
|
ns=int((n-ln)/2)
|
|
241
|
-
|
|
358
|
+
header=f'{f"{c}"*n}\n{" "*ns}{nameSection}{" "*ns}\n{f"{c}"*n}\n'
|
|
359
|
+
if Log!=' ': Log=header+Log+'\n'
|
|
360
|
+
else: Log=header
|
|
242
361
|
return Log
|
|
243
362
|
|
|
363
|
+
def eyeHeaderSection(self, text:str, width:int=54, height:int=11, border:str='o', pad:int=0)->str:
|
|
364
|
+
"""
|
|
365
|
+
Draw an eye-shaped frame with the given text centered on the middle row.
|
|
366
|
+
Works in monospace consoles or QTextEdit. Uses a smooth parametric eye curve.
|
|
367
|
+
"""
|
|
368
|
+
width=max(width, len(text)+2*pad+2)
|
|
369
|
+
height=max(5, height|(1)) # make it odd
|
|
370
|
+
mid=height//2
|
|
371
|
+
# eye boundary: y = a*(1 - |x|^p)^b, mirrored top/bottom
|
|
372
|
+
import math
|
|
373
|
+
p,b=1.6,1.0 # shape controls (p: pointiness, b: roundness)
|
|
374
|
+
ax=width/2-1
|
|
375
|
+
ay=mid-1 # vertical semi-size (controls thickness of eye)
|
|
376
|
+
eps=0.6 # border thickness in "cells"
|
|
377
|
+
|
|
378
|
+
rows=[]
|
|
379
|
+
for r in range(height):
|
|
380
|
+
y=(r-mid)/ay # -1..1
|
|
381
|
+
line=[]
|
|
382
|
+
for c in range(width):
|
|
383
|
+
x=(c- (width-1)/2)/ax # -1..1
|
|
384
|
+
# target boundary (top curve positive y, bottom negative)
|
|
385
|
+
yb = (1 - abs(x)**p)
|
|
386
|
+
yb = (yb if yb>0 else 0)**b # clamp
|
|
387
|
+
# distance to boundary (abs because top/bottom)
|
|
388
|
+
d=abs(abs(y)-yb)
|
|
389
|
+
ch=' '
|
|
390
|
+
if yb<=0 and abs(y)<eps/ay: # very ends -> leave blank
|
|
391
|
+
ch=' '
|
|
392
|
+
elif d*ay<=eps and yb>0: # on border
|
|
393
|
+
ch=border
|
|
394
|
+
line.append(ch)
|
|
395
|
+
rows.append(''.join(line))
|
|
396
|
+
|
|
397
|
+
# write text on middle row
|
|
398
|
+
body=list(rows[mid])
|
|
399
|
+
s=f' {text} '
|
|
400
|
+
start=(width-len(s))//2
|
|
401
|
+
body[start:start+len(s)]=list(s)
|
|
402
|
+
rows[mid]=''.join(body)
|
|
403
|
+
|
|
404
|
+
return '\n'.join(rows)
|
|
405
|
+
|
|
244
406
|
def createLogProc(self):
|
|
245
407
|
splitAs='\n '#used to join the strings together tab or spaces may be use to indent the error
|
|
246
|
-
numImgTot=len(self.list_pim) if self.
|
|
408
|
+
numImgTot=len(self.list_pim) if self.Step!=StepTypes.min else (2*len(self.list_pim))
|
|
247
409
|
LogProc=''
|
|
248
410
|
LogErr=''
|
|
249
411
|
cont=0
|
|
250
412
|
contErr=0
|
|
251
413
|
for i,p in enumerate(self.list_pim):
|
|
252
|
-
if not p:
|
|
414
|
+
if not p or self.list_print[i]=='':
|
|
253
415
|
continue
|
|
254
|
-
if self.
|
|
416
|
+
if self.Step==StepTypes.min: #minimum
|
|
255
417
|
cont+=2
|
|
256
|
-
flag=(p&FLAG_FINALIZED[0]) and (p&FLAG_FINALIZED[1])
|
|
418
|
+
#flag=(p&FLAG_FINALIZED[0]) and (p&FLAG_FINALIZED[1])
|
|
257
419
|
if (p&FLAG_FINALIZED[0]):
|
|
258
420
|
if (p&FLAG_FINALIZED[1]):
|
|
259
421
|
LogProc+=(self.list_print[i])
|
|
@@ -267,6 +429,7 @@ class dataTreePar(TABpar):
|
|
|
267
429
|
else:# la b nonè stata proprio letta
|
|
268
430
|
cont-=1
|
|
269
431
|
#pri.Process.magenta(f'LogProc wrong {i} {p} {splitAs.join(sAppo[1:-1])} {hex(p)} ')
|
|
432
|
+
LogProc+='\n'
|
|
270
433
|
else:
|
|
271
434
|
sAppo=self.list_print[i].split('\n')
|
|
272
435
|
if (p&FLAG_FINALIZED[1]):
|
|
@@ -277,58 +440,98 @@ class dataTreePar(TABpar):
|
|
|
277
440
|
iDum=len(sAppo)//2
|
|
278
441
|
LogErr+=splitAs.join(sAppo[0:iDum])+'\n'+splitAs.join(sAppo[iDum:-1])+'\n'
|
|
279
442
|
contErr+=2
|
|
280
|
-
elif self.
|
|
443
|
+
elif self.Step in (StepTypes.piv,StepTypes.disp,StepTypes.spiv): #PIV process
|
|
281
444
|
cont+=1
|
|
282
445
|
if p&FLAG_FINALIZED[0]:
|
|
283
446
|
LogProc+=self.list_print[i]+"\n"
|
|
284
447
|
#pr(f'LogProc {i} {p} {self.list_print[i]} {hex(p)} = {hex(FLAG_FINALIZED_AB)}\n')
|
|
285
448
|
else:
|
|
286
449
|
contErr+=1
|
|
287
|
-
|
|
450
|
+
errString=splitAs.join(self.list_print[i].split('\n')[0:-1])
|
|
451
|
+
if errString: LogErr+=errString+'\n'
|
|
288
452
|
|
|
289
|
-
if not LogProc: LogProc=
|
|
453
|
+
if not LogProc: LogProc=self.nullLogProc()
|
|
290
454
|
|
|
291
|
-
|
|
292
|
-
|
|
455
|
+
self.FlagErr=bool(LogErr) or 'CRITICAL ERROR' in self.warnings[0]
|
|
456
|
+
if self.Step in (StepTypes.piv,StepTypes.spiv):
|
|
457
|
+
errStr=f' ({contErr}/{numImgTot} images)'
|
|
458
|
+
else:
|
|
459
|
+
errStr=''
|
|
460
|
+
if 'CRITICAL ERROR' in self.warnings[0]:
|
|
461
|
+
errStr2='!!! Critical errors occured! Please, see further information reported below.\n\n'
|
|
293
462
|
else:
|
|
294
|
-
|
|
295
|
-
|
|
463
|
+
errStr2=''
|
|
464
|
+
if self.FlagErr:
|
|
465
|
+
LogErr=f'There were errors in the current process{errStr}:\n\n{errStr2}'+LogErr
|
|
466
|
+
else:
|
|
467
|
+
LogErr=f'There were no errors in the current process!\n\n'
|
|
468
|
+
if numImgTot:
|
|
469
|
+
pProc=cont*100/numImgTot
|
|
470
|
+
else:
|
|
471
|
+
pProc=100
|
|
296
472
|
pLeft=100-pProc
|
|
297
473
|
if cont:
|
|
298
474
|
pErr=contErr*100/cont
|
|
299
475
|
else:
|
|
300
476
|
pErr=0
|
|
301
477
|
pCorr=100-pErr
|
|
478
|
+
item='pair' if self.Step!=StepTypes.disp else 'iteration'
|
|
479
|
+
sp=' '*6 if self.Step!=StepTypes.disp else ' '
|
|
480
|
+
Log_PIVCores='' if self.Step==StepTypes.min else f' PIV cores: {self.numPivOmpCores}\n'
|
|
302
481
|
LogStat=\
|
|
303
|
-
f'Percentage of
|
|
482
|
+
f'Percentage of {item}s\n'+\
|
|
304
483
|
f' processed: {pProc:.2f}%\n'+\
|
|
305
484
|
f' remaining: {pLeft:.2f}%\n'+\
|
|
306
485
|
f' without errors: {pCorr:.2f}%\n'+\
|
|
307
486
|
f' with errors: {pErr:.2f}%\n\n'+\
|
|
308
487
|
f'Time\n'+\
|
|
309
488
|
f' of the process: {self.deltaTime2String(self.procTime,True)}\n'+\
|
|
310
|
-
f'
|
|
311
|
-
f' to the end: {self.deltaTime2String(self.eta,True)}\n'
|
|
489
|
+
f' {sp} per {item}: {self.deltaTime2String(self.timePerImage,True)}\n'+\
|
|
490
|
+
f' to the end: {self.deltaTime2String(self.eta,True)}\n\n'+\
|
|
491
|
+
f'Multi processing\n'+\
|
|
492
|
+
Log_PIVCores+\
|
|
493
|
+
f' processing units: {floor(self.numUsedProcs)}\n'
|
|
494
|
+
#5f' processing units: {floor(self.numUsedProcs/self.numPivOmpCores)}\n'
|
|
312
495
|
self.procLog=[LogProc,LogStat,LogErr]
|
|
313
496
|
return
|
|
314
497
|
|
|
498
|
+
def nullLogProc(self):
|
|
499
|
+
return 'No output produced!\n\n'
|
|
500
|
+
|
|
315
501
|
def resetLog(self):
|
|
316
|
-
|
|
502
|
+
if self.procLog[0]!=self.nullLogProc():
|
|
503
|
+
self.Log=self.createLogHeader()+self.procLog[0]
|
|
504
|
+
else:
|
|
505
|
+
self.Log=self.createLogHeader()
|
|
506
|
+
return
|
|
317
507
|
|
|
318
|
-
def writeCfgProcPiv(self):
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
else:
|
|
508
|
+
def writeCfgProcPiv(self,filename='',FlagWarningDialog=False):
|
|
509
|
+
flagSpiv=self.Step==StepTypes.spiv
|
|
510
|
+
if filename=='':
|
|
322
511
|
outPathRoot=self.outPathRoot
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
512
|
+
foldOut=os.path.dirname(outPathRoot)
|
|
513
|
+
if not os.path.exists(foldOut):
|
|
514
|
+
try:
|
|
515
|
+
os.mkdir(foldOut)
|
|
516
|
+
except Exception as inst:
|
|
517
|
+
pri.Error.red(f'It was not possible to make the directory {foldOut}:\n{traceback.format_exc()}\n\n{inst}')
|
|
518
|
+
filename=f"{outPathRoot}.cfg"
|
|
519
|
+
try:
|
|
520
|
+
writeCfgProcPiv(self,filename,flagSpiv)
|
|
521
|
+
except Exception as inst:
|
|
522
|
+
warningMessage=f'Error while writing PIV configuration file to location "{filename}":\n{inst}'
|
|
523
|
+
if FlagWarningDialog: warningDialog(None,warningMessage)
|
|
524
|
+
pri.Error.red(f'{warningMessage}\n{traceback.format_exc()}\n')
|
|
327
525
|
|
|
328
|
-
class
|
|
526
|
+
class MediaPIV():
|
|
329
527
|
''' helper class to perform the avearages '''
|
|
330
|
-
def __init__(self):
|
|
331
|
-
self.
|
|
528
|
+
def __init__(self,stepType=StepTypes.piv):
|
|
529
|
+
self.outName=''
|
|
530
|
+
self.name_proc=''
|
|
531
|
+
|
|
532
|
+
self.stepType=stepType
|
|
533
|
+
self.namesPIV=NamesPIV(Step=self.stepType)
|
|
534
|
+
|
|
332
535
|
#self.avgVel=[self.x,self.y,self.u,self.v,self.up,self.vp,self.uvp,self.FCl,self.Info,self.sn]
|
|
333
536
|
self.x=np.zeros(1)
|
|
334
537
|
self.y=np.zeros(1)
|
|
@@ -340,6 +543,17 @@ class mediaPIV():
|
|
|
340
543
|
self.sn=np.zeros(1)
|
|
341
544
|
self.FCl=np.zeros(1)
|
|
342
545
|
self.Info=np.zeros(1)
|
|
546
|
+
if self.stepType==StepTypes.disp:
|
|
547
|
+
self.z=np.zeros(1)
|
|
548
|
+
self.dPar=np.zeros(1)
|
|
549
|
+
self.dOrt=np.zeros(1)
|
|
550
|
+
if self.stepType==StepTypes.spiv:
|
|
551
|
+
self.z=np.zeros(1)
|
|
552
|
+
self.w=np.zeros(1)
|
|
553
|
+
self.wp=np.zeros(1)
|
|
554
|
+
self.uwp=np.zeros(1)
|
|
555
|
+
self.vwp=np.zeros(1)
|
|
556
|
+
self.indu=3 if self.stepType==StepTypes.spiv else 2
|
|
343
557
|
|
|
344
558
|
# just for checking that the variables are the same
|
|
345
559
|
# I cannot do it automatically since variables are not recognized by vscode
|
|
@@ -349,6 +563,8 @@ class mediaPIV():
|
|
|
349
563
|
self.cont=0
|
|
350
564
|
self.nimg=0
|
|
351
565
|
|
|
566
|
+
self.fields=[f for f,_ in self.__dict__.items()]
|
|
567
|
+
|
|
352
568
|
def sum(self,var):
|
|
353
569
|
# should start with x, y ,u ,v
|
|
354
570
|
infoSi=1
|
|
@@ -365,13 +581,20 @@ class mediaPIV():
|
|
|
365
581
|
self.Info=self.Info+1*(var[5]==infoSi) #piv.Info #verificare se sia il caso di sommare solo se =Infosi
|
|
366
582
|
self.sn=self.sn+var[6] #piv.sn
|
|
367
583
|
'''
|
|
368
|
-
self.up=self.up+var[
|
|
369
|
-
self.vp=self.vp+var[
|
|
370
|
-
self.uvp=self.uvp+var[
|
|
584
|
+
self.up=self.up+var[self.indu]*var[self.indu] #piv.up
|
|
585
|
+
self.vp=self.vp+var[self.indu+1]*var[self.indu+1] #piv.vp
|
|
586
|
+
self.uvp=self.uvp+var[self.indu]*var[self.indu+1] #piv.uvp
|
|
587
|
+
if self.stepType==StepTypes.spiv:
|
|
588
|
+
self.wp=self.wp+var[self.indu+2]*var[self.indu+2] #piv.wp
|
|
589
|
+
self.uwp=self.uwp+var[self.indu]*var[self.indu+2] #piv.uwp
|
|
590
|
+
self.vwp=self.vwp+var[self.indu+1]*var[self.indu+2] #piv.vwp
|
|
591
|
+
|
|
371
592
|
|
|
372
593
|
if self.x.size<=1:
|
|
373
594
|
self.x=var[0] #piv.x dovrebbero essere tutti uguali
|
|
374
595
|
self.y=var[1] #piv.y dovrebbero essere tutti uguali
|
|
596
|
+
if self.stepType==StepTypes.spiv:
|
|
597
|
+
self.z=var[2] #piv.y dovrebbero essere tutti uguali
|
|
375
598
|
|
|
376
599
|
def sumMedia(self,medToSum):
|
|
377
600
|
self.cont=self.cont+medToSum.cont
|
|
@@ -383,46 +606,72 @@ class mediaPIV():
|
|
|
383
606
|
self.vp=self.vp+medToSum.vp
|
|
384
607
|
self.uvp=self.uvp+medToSum.uvp
|
|
385
608
|
self.Info=self.Info+medToSum.Info
|
|
609
|
+
if self.stepType==StepTypes.spiv:
|
|
610
|
+
self.w=self.w+medToSum.w
|
|
611
|
+
self.wp=self.wp+medToSum.wp
|
|
612
|
+
self.uwp=self.uwp+medToSum.uwp
|
|
613
|
+
self.vwp=self.vwp+medToSum.vwp
|
|
386
614
|
if self.x.size<=1:
|
|
387
615
|
self.x=medToSum.x #piv.x dovrebbero essere tutti uguali
|
|
388
616
|
self.y=medToSum.y #piv.y dovrebbero essere tutti uguali
|
|
617
|
+
if self.stepType==StepTypes.spiv:
|
|
618
|
+
self.z=medToSum.z #piv.y dovrebbero essere tutti uguali
|
|
389
619
|
|
|
390
620
|
def calcMedia(self):
|
|
391
621
|
if self.cont>0:
|
|
392
622
|
|
|
393
623
|
self.u/=self.cont
|
|
394
624
|
self.v/=self.cont
|
|
625
|
+
|
|
395
626
|
self.sn/=self.cont
|
|
396
627
|
self.FCl/=self.cont
|
|
397
628
|
self.Info/=self.cont#percentuale di vettori buoni 1=100% 0 nememno un vettore buono
|
|
398
629
|
self.up=(self.up/self.cont-self.u*self.u)#nan or inf is no good vector
|
|
399
630
|
self.vp=(self.vp/self.cont-self.v*self.v)#nan or inf is no good vector
|
|
400
631
|
self.uvp=(self.uvp/self.cont-self.u*self.v)#nan or inf is no good vector
|
|
401
|
-
|
|
402
|
-
|
|
632
|
+
if self.stepType==StepTypes.spiv:
|
|
633
|
+
self.w/=self.cont
|
|
634
|
+
self.wp=(self.wp/self.cont-self.w*self.w)#nan or inf is no good vector
|
|
635
|
+
self.uwp=(self.uwp/self.cont-self.u*self.w)#nan or inf is no good vector
|
|
636
|
+
self.vwp=(self.vwp/self.cont-self.w*self.v)#nan or inf is no good vector
|
|
403
637
|
def restoreSum(self):
|
|
404
638
|
|
|
405
639
|
#OPTIMIZE TA GP gestione delle statistiche ora si usano tutti i vettori anche quelli corretti forse si dovrebbe dare la possibiltà all'utente di scegliere?
|
|
406
640
|
self.up=(self.up+self.u*self.u)*self.cont # inf is no good vector
|
|
407
641
|
self.vp=(self.vp+self.v*self.v)*self.cont # inf is no good vector
|
|
408
642
|
self.uvp=(self.uvp+self.u*self.v)*self.cont # inf is no good vector
|
|
643
|
+
if self.stepType==StepTypes.spiv:
|
|
644
|
+
self.wp=(self.wp+self.w*self.w)*self.cont # inf is no good vector
|
|
645
|
+
self.uwp=(self.uwp+self.u*self.w)*self.cont # inf is no good vector
|
|
646
|
+
self.vwp=(self.vwp+self.w*self.v)*self.cont # inf is no good vector
|
|
647
|
+
self.w=self.w*self.cont
|
|
409
648
|
|
|
410
649
|
self.u=self.u*self.cont
|
|
411
650
|
self.v=self.v*self.cont
|
|
412
651
|
self.sn=self.sn*self.cont
|
|
413
652
|
self.Info=self.Info*self.cont#percentuale di vettori buoni 1=100% 0 nememno un vettore buono
|
|
414
653
|
|
|
415
|
-
|
|
416
654
|
class CompMin():
|
|
417
655
|
''' helper class to compute minimum '''
|
|
418
|
-
def __init__(self):
|
|
419
|
-
self.
|
|
420
|
-
self.
|
|
421
|
-
|
|
656
|
+
def __init__(self,ncam=1,nframe=2):
|
|
657
|
+
self.outName=''
|
|
658
|
+
self.name_proc=''
|
|
659
|
+
|
|
660
|
+
self.setup(ncam,nframe)
|
|
422
661
|
#self.cont=0
|
|
423
662
|
#self.cont0=0
|
|
424
663
|
|
|
425
664
|
self.flag_TR=None
|
|
665
|
+
self.LaserType=-1 #0 single, 1 double
|
|
666
|
+
|
|
667
|
+
self.fields=[f for f,_ in self.__dict__.items()]
|
|
668
|
+
|
|
669
|
+
def setup(self,ncam,nframe):
|
|
670
|
+
self.ncam=ncam
|
|
671
|
+
self.nframe=nframe
|
|
672
|
+
self.Imin=[np.zeros(0) for _ in range(self.ncam*self.nframe)]
|
|
673
|
+
self.med=[np.zeros(1) for _ in range(self.ncam*self.nframe)]
|
|
674
|
+
self.contab=[0 for _ in range(ncam*2)]
|
|
426
675
|
|
|
427
676
|
def minSum(self,I,k):
|
|
428
677
|
''' min '''
|
|
@@ -439,9 +688,9 @@ class CompMin():
|
|
|
439
688
|
#prLock(f"minSum contab={self.contab[k]}")
|
|
440
689
|
def checkImg(self,I,sogliaMedia,sogliaStd)->bool:
|
|
441
690
|
''' checkImg '''
|
|
442
|
-
dum=1/I.size
|
|
443
|
-
media=I.ravel().sum()*dum#faster than mean
|
|
444
|
-
dev=np.square(I-media).ravel().sum()*dum
|
|
691
|
+
#dum=1/I.size
|
|
692
|
+
media=I.mean() #I.ravel().sum()*dum #faster than mean, but affected by overflow
|
|
693
|
+
dev=I.std() #np.square(I-media).ravel().sum()*dum
|
|
445
694
|
return media>sogliaMedia and dev >sogliaStd*sogliaStd
|
|
446
695
|
|
|
447
696
|
def calcMin(self,minMed):
|
|
@@ -449,9 +698,8 @@ class CompMin():
|
|
|
449
698
|
#pri.Time.magenta(0,f"self.cont0={self.cont0}")
|
|
450
699
|
#self.cont+=self.cont0
|
|
451
700
|
#nImg=1 if self.flag_TR else 2
|
|
452
|
-
nImg=2
|
|
453
|
-
for k in range(
|
|
454
|
-
|
|
701
|
+
#nImg=2
|
|
702
|
+
for k in range(len(self.Imin)):
|
|
455
703
|
if minMed.contab[k]>0:
|
|
456
704
|
if self.contab[k]==0:
|
|
457
705
|
self.Imin[k]=minMed.Imin[k]
|
|
@@ -464,10 +712,22 @@ class CompMin():
|
|
|
464
712
|
''' calcMed and sum media '''
|
|
465
713
|
pri.Time.magenta(f"calcMed contab={self.contab} ")
|
|
466
714
|
#nImg=1 if self.flag_TR else 2
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
715
|
+
if self.LaserType==0: # single laser
|
|
716
|
+
for cam in range(self.ncam):
|
|
717
|
+
k=self.nframe*cam
|
|
718
|
+
for j in range(1,self.nframe):
|
|
719
|
+
self.Imin[k]=np.minimum(self.Imin[k],self.Imin[k+j])
|
|
720
|
+
self.med[k]+=self.med[k+j]
|
|
721
|
+
self.contab[k]+=self.contab[k+j]
|
|
470
722
|
self.med[k]/=self.contab[k]
|
|
723
|
+
for j in range(1,self.nframe):
|
|
724
|
+
self.Imin[k+j]=self.Imin[k].copy()
|
|
725
|
+
self.med[k+j]=self.med[k].copy()
|
|
726
|
+
self.contab[k+j]=self.contab[k] #useless? I don't think so, important for restoreMin
|
|
727
|
+
else:
|
|
728
|
+
for k in range(len(self.Imin)):
|
|
729
|
+
if self.contab[k]>0:
|
|
730
|
+
self.med[k]/=self.contab[k]
|
|
471
731
|
pri.Time.magenta(f"calcMed fine contab={self.contab} ")
|
|
472
732
|
|
|
473
733
|
|
|
@@ -475,8 +735,7 @@ class CompMin():
|
|
|
475
735
|
def restoreMin(self):
|
|
476
736
|
#pr(f"restoreMin contab={self.contab} self.cont={self.cont} self.cont0={self.cont0}")
|
|
477
737
|
#nImg=1 if self.flag_TR else 2
|
|
478
|
-
|
|
479
|
-
for k in range(nImg):
|
|
738
|
+
for k in range(len(self.Imin)):
|
|
480
739
|
self.med[k]*=self.contab[k]
|
|
481
740
|
|
|
482
741
|
def foList(li,formato):
|
|
@@ -487,9 +746,9 @@ def foList(li,formato):
|
|
|
487
746
|
e.g. print(f'{a:<4d}') -> print(f'{foList([a a],"<4d")}')
|
|
488
747
|
'''
|
|
489
748
|
return f"{''.join(f' {x:{formato}}' for x in li)}"
|
|
490
|
-
# todo delete
|
|
491
|
-
def writeCfgProcPivOld(data,nomeFile):
|
|
492
|
-
PIV=data2PIV(data)
|
|
749
|
+
# todo delete old function
|
|
750
|
+
def writeCfgProcPivOld(data,nomeFile,flagSpiv=False):
|
|
751
|
+
PIV=data2PIV(data,flagSpiv)
|
|
493
752
|
PIV.SetVect([v.astype(np.intc) for v in data.PRO.Vect])
|
|
494
753
|
inp=PIV.Inp
|
|
495
754
|
vect=data.PRO.Vect
|
|
@@ -544,8 +803,8 @@ def writeCfgProcPivOld(data,nomeFile):
|
|
|
544
803
|
f.write(f'{1}, Value of info for an outlier\n')
|
|
545
804
|
# % Windowing parameters (Astarita, Exp Flu, 2007) *************************
|
|
546
805
|
f.write(f'% Windowing parameters (Astarita EiF 2007) *************************\n')
|
|
547
|
-
f.write(f'{inp.FlagCalcVel}, Weighting window for absolute velocity (0=TopHat, 1=Nogueira, 2=
|
|
548
|
-
f.write(f'{inp.FlagWindowing}, Weighting window for the correlation map (0=TopHat 1= Nogueira 2=
|
|
806
|
+
f.write(f'{inp.FlagCalcVel}, Weighting window for absolute velocity (0=TopHat, 1=Nogueira, 2=Blackman,...) (26)\n')
|
|
807
|
+
f.write(f'{inp.FlagWindowing}, Weighting window for the correlation map (0=TopHat 1= Nogueira 2=Blackman 3=top hat at 50%) (27)\n')
|
|
549
808
|
f.write(f'{inp.SemiDimCalcVel}, Half-width of the filtering window (0=window dimension) (28)\n')
|
|
550
809
|
# % Adaptive PIV parameters (Astarita, Exp Flu, 2009) *************************
|
|
551
810
|
f.write(f'% Adaptive PIV parameters (Astarita EiF 2009) *************************\n')
|
|
@@ -625,8 +884,8 @@ def writeCfgProcPivOld(data,nomeFile):
|
|
|
625
884
|
|
|
626
885
|
|
|
627
886
|
#'''
|
|
628
|
-
def writeCfgProcPiv(data,nomeFile):
|
|
629
|
-
PIV=data2PIV(data)
|
|
887
|
+
def writeCfgProcPiv(data,nomeFile,flagSpiv=False):
|
|
888
|
+
PIV=data2PIV(data,flagSpiv)
|
|
630
889
|
inp=PIV.Inp
|
|
631
890
|
vect=PIV.GetVect()
|
|
632
891
|
vectWindowing=PIV.GetWindowingVect()
|
|
@@ -661,8 +920,8 @@ def writeCfgProcPiv(data,nomeFile):
|
|
|
661
920
|
# % Windowing parameters (Astarita, Exp Flu, 2007) ***************************
|
|
662
921
|
|
|
663
922
|
f.write(f'% Windowing parameters (Astarita, Exp Flu, 2007) ***************************\n')
|
|
664
|
-
f.write(f'[{foList(vectWindowing[1],"<3d")}], WW for predictor (0=TopHat; 2=
|
|
665
|
-
f.write(f'[{foList(vectWindowing[2],"<3d")}], WW for the correlation map (0=TopHat;2=
|
|
923
|
+
f.write(f'[{foList(vectWindowing[1],"<3d")}], WW for predictor (0=TopHat; 2=Blackman;...) (16)\n')
|
|
924
|
+
f.write(f'[{foList(vectWindowing[2],"<3d")}], WW for the correlation map (0=TopHat;2=Blackman 3=top hat at 50%)(17)\n')
|
|
666
925
|
f.write(f'[{foList(vectWindowing[3],"<3d")}], Half-width of the filtering window (0=window dimension) (18)\n')
|
|
667
926
|
f.write(f'[{foList(vectWindowing[4],"<3d")}], Flag direct correlation (0=no 1=yes ) (19)\n')
|
|
668
927
|
f.write(f'[{foList(vectWindowing[0],"<3d")}], Max displacement if <0 fraction of wa i.e. -4-> Wa/4 (20)\n')
|
|
@@ -804,8 +1063,6 @@ def PIV2Pro(piv:PaIRS_lib.PIV)-> PROpar:
|
|
|
804
1063
|
pro.FlagDirectCorr=piv.Inp.FlagDirectCorr
|
|
805
1064
|
pro.FlagBordo=piv.Inp.FlagBordo
|
|
806
1065
|
|
|
807
|
-
|
|
808
|
-
|
|
809
1066
|
if piv.Inp.SemiDimCalcVel<0:
|
|
810
1067
|
pro.NItAdaptative=-piv.Inp.SemiDimCalcVel
|
|
811
1068
|
pro.NIterazioni=piv.Inp.NIterazioni-pro.NItAdaptative
|
|
@@ -817,15 +1074,24 @@ def PIV2Pro(piv:PaIRS_lib.PIV)-> PROpar:
|
|
|
817
1074
|
|
|
818
1075
|
return pro
|
|
819
1076
|
|
|
820
|
-
def data2PIV(data):
|
|
821
|
-
|
|
1077
|
+
def data2PIV(data:dataTreePar,flagSpiv=False):
|
|
1078
|
+
OUT=OUTpar()
|
|
1079
|
+
OUT.copyfromdiz(data.OUT_dict)
|
|
1080
|
+
PRO=PROpar()
|
|
1081
|
+
PRO.copyfromdiz(data.PRO_dict)
|
|
1082
|
+
|
|
1083
|
+
if flagSpiv:
|
|
1084
|
+
PIV=PaIRS_lib.Stereo()
|
|
1085
|
+
else:
|
|
1086
|
+
PIV=PaIRS_lib.PIV()
|
|
822
1087
|
|
|
823
1088
|
PIV.DefaultValues()
|
|
824
|
-
|
|
825
|
-
|
|
1089
|
+
PIV.Inp.FlagNumThreads=data.numPivOmpCores
|
|
1090
|
+
#OUT=data.OUT
|
|
1091
|
+
#PRO=data.PRO
|
|
826
1092
|
|
|
827
1093
|
# % Windows dimensions position and iterations *******************************
|
|
828
|
-
PIV.SetVect([v.astype(np.intc) for v in
|
|
1094
|
+
PIV.SetVect([np.array(v).astype(np.intc) for v in PRO.Vect])
|
|
829
1095
|
PIV.Inp.FlagBordo=PRO.FlagBordo
|
|
830
1096
|
PIV.Inp.NIterazioni=PRO.NIterazioni+PRO.NItAdaptative if PRO.FlagAdaptative else PRO.NIterazioni
|
|
831
1097
|
# % Process parameters - Interpolation ***********************************
|
|
@@ -864,7 +1130,7 @@ def data2PIV(data):
|
|
|
864
1130
|
PIV.Inp.InfoNo=0
|
|
865
1131
|
|
|
866
1132
|
# % Windowing parameters (Astarita, Exp Flu, 2007) ***************************
|
|
867
|
-
PIV.Inp.numInitIt=max(len(v) for v in
|
|
1133
|
+
PIV.Inp.numInitIt=max(len(v) for v in PRO.Vect)
|
|
868
1134
|
PIV.Inp.FlagWindowing=PRO.FlagWindowing
|
|
869
1135
|
"""
|
|
870
1136
|
if (PIV.Inp.FlagWindowing >= 0) :
|
|
@@ -928,44 +1194,230 @@ def data2PIV(data):
|
|
|
928
1194
|
'''
|
|
929
1195
|
|
|
930
1196
|
|
|
1197
|
+
return PIV
|
|
931
1198
|
|
|
1199
|
+
def data2StereoPIV(data:dataTreePar):
|
|
1200
|
+
StereoPIV=data2PIV(data,flagSpiv=True)
|
|
1201
|
+
|
|
1202
|
+
OUT=OUTpar()
|
|
1203
|
+
OUT.copyfromdiz(data.OUT_dict)
|
|
1204
|
+
PRO=PROpar()
|
|
1205
|
+
PRO.copyfromdiz(data.PRO_dict)
|
|
1206
|
+
|
|
1207
|
+
spiv=StereoPIV.SPIVIn
|
|
1208
|
+
dP=StereoPIV.dataProc
|
|
1209
|
+
inPiv=StereoPIV.Inp
|
|
1210
|
+
|
|
1211
|
+
# STEREO CFG file
|
|
1212
|
+
# A €£ indicate that the feature is not enabled in the python wrapper
|
|
1213
|
+
spiv.nomecal='' # Root of calibration constants
|
|
1214
|
+
#spiv.NomeCostPiano=data.dispFile[:-4] # Root of disparity plane constants
|
|
1215
|
+
|
|
1216
|
+
spiv.percorsocal='' # Path of calibration constants
|
|
1217
|
+
spiv.FlagParallel=0 # Type of parallel process 0 horizontal 1 vertical (faster but with less information and mor RAM occupied)
|
|
1218
|
+
dP.FlagInt=StereoPIV.Inp.IntFin # IS for image reconstruction (only used when FlagRad==0)
|
|
1219
|
+
inPiv.FlagRad=1 # 1 internal (in piv) or 0 external de-warping of the images (the latter €£)
|
|
1220
|
+
dP.FlagCoordRad=0 # when equal to 0 the de-warping is carried on with the larger resolution (pix/mm)
|
|
1221
|
+
# when equal to 1 (2) the x (y) axis resolution is used
|
|
1222
|
+
spiv.salvarad=0 # if true and FlagRad is equal to 0 then the dewarped images are saved (€£)
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
# % ********************* Input/Output
|
|
1226
|
+
spiv.FirstImg=0 # # of first img to be processed (€£)
|
|
1227
|
+
spiv.LastImg=0 # # of first last to be processed (€£)
|
|
1228
|
+
spiv.Digit=0 # number of figures i.e. zeros (MAX 10) (€£)
|
|
1229
|
+
spiv.ImgRoot='' # Root of the input Images (€£)
|
|
1230
|
+
spiv.InDir='' # Path of the images (€£)
|
|
1231
|
+
spiv.InExt='' # Extension of the images (€£)
|
|
1232
|
+
spiv.OutRoot ='' # Root of the output Files (€£)
|
|
1233
|
+
spiv.OutDir ='' # Output path (€£)
|
|
1234
|
+
spiv.OutExt ='' # Output extension (€£)
|
|
1235
|
+
spiv.OutFlag = 0 # type of output file : 0 binary Tecplot 1 ascii tecplot (€£)
|
|
1236
|
+
spiv.WrtFlag = 1 # 0 only mean values are saved 1 all the instantaneous images are written (€£)
|
|
1237
|
+
|
|
1238
|
+
spiv.RigaPart=OUT.x # Starting row (€£)
|
|
1239
|
+
spiv.ColPart=OUT.y # Starting Col (€£)
|
|
1240
|
+
dP.ImgH=OUT.H # Ending row
|
|
1241
|
+
dP.ImgW=OUT.W # Starting Col
|
|
1242
|
+
# % *********************** Process parameters
|
|
1243
|
+
dP.FlagZonaCom=0 # Flag for common zone should be equal to 0
|
|
1244
|
+
# Volume ********************************
|
|
1245
|
+
dP.xinfZC = OUT.x_min # minimum x world coordinates
|
|
1246
|
+
dP.yinfZC = OUT.y_min # minimum y world coordinates
|
|
1247
|
+
dP.xsupZC = OUT.x_max # maximum x world coordinates
|
|
1248
|
+
dP.ysupZC = OUT.y_max # maximum y world coordinates
|
|
1249
|
+
spiv.FlagRis=OUT.unit # 0 displacements in m/s 1 in pixels
|
|
1250
|
+
spiv.dt=OUT.dt # time separation. If the displacements in mm are needed use 1000 (and 0 for the previous parameter)
|
|
1251
|
+
spiv.Sfas=3 # in case of images in a single file the distance between images. Normally define the name (€£)
|
|
1252
|
+
# 1=a,b (after number); 2=_1,_2 (after number); 3=a,b (before number)
|
|
1253
|
+
# % Output
|
|
1254
|
+
spiv.FlagRotImg=0 # Rotation of the img 0=no rot 1=90°, 2=180° 3= 270° clockwise (£€)
|
|
1255
|
+
inPiv.FlagLog=9 # 0=no 1=video 2=log 3=video e log 4=Log short 5=video e log short (£€)
|
|
1256
|
+
spiv.StatFlag =0 # stat on: 1 all the vectors 0 only the good ones
|
|
1257
|
+
spiv.nomecfgPiv ='' # name of the cfg file for PIV
|
|
1258
|
+
|
|
1259
|
+
# ******************************
|
|
1260
|
+
flagReadCalConst=0# if true internal reading
|
|
1261
|
+
if flagReadCalConst:
|
|
1262
|
+
StereoPIV.readCalConst()
|
|
1263
|
+
else:
|
|
1264
|
+
c=0
|
|
1265
|
+
cost=[]
|
|
1266
|
+
for c in range(2):
|
|
1267
|
+
fileName=data.calList[c]
|
|
1268
|
+
flagCal,numCostCalib,costDum=readCalFile(fileName)
|
|
1269
|
+
if c==0:
|
|
1270
|
+
dP.FlagCal=flagCal
|
|
1271
|
+
dP.NumCostCalib=numCostCalib
|
|
1272
|
+
else:
|
|
1273
|
+
if (dP.FlagCal!=flagCal):
|
|
1274
|
+
raise('error the two calibration file are not compatible')
|
|
1275
|
+
cost.append(costDum)
|
|
1276
|
+
StereoPIV.setCalConst( flagCal, numCostCalib,cost)
|
|
932
1277
|
|
|
1278
|
+
StereoPIV.vect.PianoLaser[0]=np.float32(data.OUT_dict['zconst'])
|
|
1279
|
+
StereoPIV.vect.PianoLaser[1]=np.float32(data.OUT_dict['xterm'])
|
|
1280
|
+
StereoPIV.vect.PianoLaser[2]=np.float32(data.OUT_dict['yterm'])
|
|
1281
|
+
"""
|
|
1282
|
+
flagReadPlaneConst=0# if true internal reading
|
|
1283
|
+
if flagReadPlaneConst:
|
|
1284
|
+
if StereoPIV.readPlaneConst()==0:
|
|
1285
|
+
pri.Callback.green('Laser plane constants correclty read!')
|
|
1286
|
+
else:
|
|
1287
|
+
pri.Error.red('Error while reading the file containing the laser plane constants!')
|
|
1288
|
+
data.laserConst=[const for const in StereoPIV.vect.PianoLaser]
|
|
1289
|
+
else:
|
|
1290
|
+
StereoPIV.vect.PianoLaser[0]=data.laserConst[0]
|
|
1291
|
+
StereoPIV.vect.PianoLaser[1]=data.laserConst[1]
|
|
1292
|
+
StereoPIV.vect.PianoLaser[2]=data.laserConst[2]
|
|
1293
|
+
#piv *******************************************************************************
|
|
1294
|
+
"""
|
|
1295
|
+
#StereoPIV.readCfgProc(spiv.nomecfgPiv)
|
|
1296
|
+
return StereoPIV
|
|
1297
|
+
|
|
1298
|
+
def data2Disp(data:dataTreePar):
|
|
1299
|
+
OUT=OUTpar()
|
|
1300
|
+
OUT.copyfromdiz(data.OUT_dict)
|
|
1301
|
+
PRO_Disp=PROpar_Disp()
|
|
1302
|
+
PRO_Disp.copyfromdiz(data.PRO_Disp_dict)
|
|
1303
|
+
|
|
1304
|
+
Disp=PaIRS_lib.StereoDisp()
|
|
1305
|
+
spiv=Disp.SPIVIn
|
|
1306
|
+
dP=Disp.dataProc
|
|
1307
|
+
dAC=Disp.dispAvCo
|
|
933
1308
|
|
|
934
|
-
|
|
935
|
-
|
|
1309
|
+
spiv.nomecal='' #os.path.splitext(os.path.basename(INP.calList[0])) # Root of calibration constants
|
|
1310
|
+
spiv.percorsocal='' #os.path.dirname(INP.calList[0]) #Path of calibration constants
|
|
1311
|
+
spiv.ImgRoot='' # Root input Images
|
|
1312
|
+
spiv.InExt='' # Extension of the images
|
|
1313
|
+
spiv.InDir='' #Path of the images
|
|
1314
|
+
spiv.FirstImg=0 # # of first img to be processed
|
|
1315
|
+
spiv.LastImg=0 # # of first last to be processed
|
|
1316
|
+
spiv.Digit=0 # number of figures i.e. zeros (MAX 10)
|
|
936
1317
|
|
|
937
|
-
|
|
1318
|
+
spiv.RigaPart=OUT.y # Starting row
|
|
1319
|
+
spiv.ColPart=OUT.x # Starting column
|
|
1320
|
+
dP.ImgH=OUT.h # Ending row
|
|
1321
|
+
dP.ImgW=OUT.w # Starting row
|
|
1322
|
+
spiv.Sfas=1 # Sfasamento sub-immagini (righe a partire dall'origine): 0 per singola img: 1=a,b (finali); 2=_1,_2 (finali); 3=a,b (prima del numero sequenziale
|
|
1323
|
+
spiv.FlagImgTau=data.dispFrames # Img da processare: 0-entrambe; 1-solo la prima; 2-solo la seconda;PARAMETRO IGNORATO SE SFAS=0
|
|
1324
|
+
|
|
1325
|
+
#Output
|
|
1326
|
+
spiv.OutRoot = OUT.root # Root of output Files
|
|
1327
|
+
spiv.OutDir = OUT.path+OUT.subfold # Output path
|
|
1328
|
+
# Process parameters **********************
|
|
1329
|
+
dP.FlagInt=PRO_Disp.IntIniz # Metodo di raddrizzamento: 0=veloce (simp.), 1=quad…….
|
|
1330
|
+
dP.FlagZonaCom=0 # Flag per la zona comune: 0=coordinate nel piano oggetto; 1=coord. nel piano img
|
|
1331
|
+
spiv.Niter=PRO_Disp.Nit # Numero di iterazioni
|
|
1332
|
+
"""
|
|
1333
|
+
if (spiv.Niter < 0) :
|
|
1334
|
+
spiv.WrtFlag = 1
|
|
1335
|
+
spiv.Niter = -spiv.Niter
|
|
1336
|
+
else:
|
|
1337
|
+
spiv.WrtFlag = 0
|
|
1338
|
+
"""
|
|
1339
|
+
|
|
1340
|
+
dAC.HCella=PRO_Disp.Vect[0] # Correlation window Height
|
|
1341
|
+
dAC.WCella=PRO_Disp.Vect[2] # Correlation window Width
|
|
1342
|
+
dAC.HGrid=PRO_Disp.Vect[1] # Grid distance vertical
|
|
1343
|
+
dAC.WGrid=PRO_Disp.Vect[3] # Grid distance horizontal
|
|
1344
|
+
dAC.N_NormEpi=PRO_Disp.SemiWidth_Epipolar # Semiwidth in the direction normal to the epipolar line
|
|
1345
|
+
dAC.RaggioFiltro=PRO_Disp.Filter_SemiWidth # Semiwidth of the filter for the detection of the maximum in the displacement map
|
|
1346
|
+
dAC.SogliaCor = PRO_Disp.Threshold # Threshold for the determination of point used in the baricentric search of the maximum in the disp map
|
|
1347
|
+
dAC.nIterMaxValid = PRO_Disp.Nit_OutDet
|
|
1348
|
+
dAC.numStd = PRO_Disp.Std_Threshold
|
|
938
1349
|
|
|
939
|
-
|
|
1350
|
+
#%% Volume ********************************
|
|
1351
|
+
dP.xinfZC = OUT.x_min # Coordinata x inferiore
|
|
1352
|
+
dP.yinfZC = OUT.y_min # Coordinata y inferiore
|
|
1353
|
+
dP.xsupZC = OUT.x_max #28 # Coordinata x superiore
|
|
1354
|
+
dP.ysupZC = OUT.y_max #15 # Coordinata y superiore
|
|
1355
|
+
# ******************************
|
|
1356
|
+
flagReadCalConst=0# if true internal reading
|
|
1357
|
+
if flagReadCalConst:
|
|
1358
|
+
Disp.readCalConst()
|
|
1359
|
+
else:
|
|
1360
|
+
c=0
|
|
1361
|
+
cost=[]
|
|
1362
|
+
for c in range(2):
|
|
1363
|
+
fileName=data.calList[c]
|
|
1364
|
+
flagCal,numCostCalib,costDum=readCalFile(fileName)
|
|
1365
|
+
if c==0:
|
|
1366
|
+
dP.FlagCal=flagCal
|
|
1367
|
+
dP.NumCostCalib=numCostCalib
|
|
1368
|
+
else:
|
|
1369
|
+
if (dP.FlagCal!=flagCal):
|
|
1370
|
+
raise('error the two calibration file are not compatible')
|
|
1371
|
+
cost.append(costDum)
|
|
1372
|
+
Disp.setCalConst( flagCal, numCostCalib,cost)
|
|
1373
|
+
|
|
1374
|
+
flagReadPlaneConst=0# if true internal reading
|
|
1375
|
+
if flagReadPlaneConst:
|
|
1376
|
+
if Disp.readPlaneConst()==0:
|
|
1377
|
+
pri.Callback.green('readPlaneConst ok')
|
|
1378
|
+
else:
|
|
1379
|
+
Disp.vect.PianoLaser[0]=0
|
|
1380
|
+
Disp.vect.PianoLaser[1]=0
|
|
1381
|
+
Disp.vect.PianoLaser[2]=0
|
|
1382
|
+
return Disp
|
|
1383
|
+
|
|
1384
|
+
def printPIVLog(PD):
|
|
940
1385
|
stampa="It IW #IW #Vect/#Tot % CC CC(avg) DC%\n"# NR% Cap%\n"
|
|
941
|
-
for j in range(len(
|
|
1386
|
+
for j in range(len(PD.It)):
|
|
942
1387
|
riga="%3d %3dx%-3d %4dx%-4d %7d/%-7d %5.1f %8.7f %8.7f %4.1f\n" %\
|
|
943
|
-
(
|
|
944
|
-
|
|
945
|
-
|
|
1388
|
+
(PD.It[j], PD.WCella[j], PD.HCella[j], PD.W[j], PD.H[j], PD.NVect[j],\
|
|
1389
|
+
PD.W[j]*PD.H[j], 100.0*PD.NVect[j]/(PD.W[j]*PD.H[j]), PD.Fc[j],\
|
|
1390
|
+
PD.FcMedia[j], 100.0*PD.ContErorreDc[j]/(PD.W[j]*PD.H[j]))#,\
|
|
946
1391
|
#100.0*PIV.PD.ContRemNoise[j]/(PIV.Inp.ImgW*PIV.Inp.ImgH),\
|
|
947
1392
|
#100.0*PIV.PD.ContCap[j]/(PIV.Inp.ImgW*PIV.Inp.ImgH))
|
|
948
1393
|
stampa=stampa+riga
|
|
949
1394
|
return stampa
|
|
950
1395
|
|
|
1396
|
+
|
|
951
1397
|
def saveMin(data:dataTreePar,Imin=list):
|
|
952
1398
|
pri.Time.magenta('saveMin Init ')
|
|
953
1399
|
frames='ab'
|
|
954
1400
|
#nImg=1 if self.flag_TR else 2
|
|
955
|
-
nImg=2
|
|
956
|
-
for j in range(
|
|
957
|
-
|
|
1401
|
+
#nImg=2
|
|
1402
|
+
for j in range(len(Imin)):
|
|
1403
|
+
k=j%data.nframe
|
|
1404
|
+
cam=j//data.nframe%data.ncam
|
|
1405
|
+
name_min=f"{data.outPathRoot}_cam{cam+1}_{frames[k]}_min.png"
|
|
958
1406
|
im = Image.fromarray(Imin[j])
|
|
959
1407
|
im.save(name_min)
|
|
960
1408
|
pri.Time.magenta('saveMin End')
|
|
961
1409
|
|
|
962
1410
|
def saveResults(data:dataTreePar,i,Var,nameVar):
|
|
963
1411
|
#pri.Time.magenta('saveResults Init')
|
|
964
|
-
if i
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1412
|
+
if type(i)==int:
|
|
1413
|
+
if i<0:
|
|
1414
|
+
nameFileOut=data.resF('*').replace('_*','')
|
|
1415
|
+
else:
|
|
1416
|
+
nameFileOut=data.resF(i)
|
|
1417
|
+
elif type(i)==str:
|
|
1418
|
+
nameFileOut=data.resF(i)
|
|
968
1419
|
#infoPrint.white(f'---> Saving field #{i}: {nameFileOut}')
|
|
1420
|
+
|
|
969
1421
|
if '.plt' in data.outExt:
|
|
970
1422
|
writePlt(nameFileOut,Var,f'PaIRS - 2D PIV',nameVar,nameFileOut)
|
|
971
1423
|
elif '.mat' in data.outExt:
|
|
@@ -977,6 +1429,7 @@ def saveResults(data:dataTreePar,i,Var,nameVar):
|
|
|
977
1429
|
#timeit.timeit (lambda :'writePlt(nameFileOut,Var,"b16",nameVar,nameFileOut)')
|
|
978
1430
|
#timeit.timeit (lambda :'scipy.io.savemat(nameFileOut,dict_out)')
|
|
979
1431
|
#pri.Time.magenta('saveResults End')
|
|
1432
|
+
return
|
|
980
1433
|
|
|
981
1434
|
def memoryUsagePsutil():
|
|
982
1435
|
''' return the memory usage in MB '''
|