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/Process_Tab.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from .ui_Process_Tab import*
|
|
2
2
|
from .TabTools import*
|
|
3
3
|
from .Custom_Top import Custom_Top
|
|
4
|
+
#from procTools import *
|
|
4
5
|
|
|
5
6
|
Flag_type_of_DCs=False
|
|
6
7
|
Flag_Hart_corr=False
|
|
7
8
|
Flag_Nogueira=False
|
|
8
|
-
|
|
9
|
+
minNIterAdaptative=5
|
|
9
10
|
|
|
10
11
|
mode_items= ['simple', #0
|
|
11
12
|
'advanced', #1
|
|
@@ -19,8 +20,8 @@ top_items=[ 'custom', #0
|
|
|
19
20
|
'high resolution', #5
|
|
20
21
|
'adaptative resolution'] #6
|
|
21
22
|
|
|
22
|
-
mode_init=
|
|
23
|
-
top_init=
|
|
23
|
+
mode_init=0
|
|
24
|
+
top_init=3
|
|
24
25
|
WSize_init=[128, 64, 32]
|
|
25
26
|
WSpac_init=[ 64, 16, 8]
|
|
26
27
|
|
|
@@ -34,7 +35,7 @@ ImInt_items=( #************ do not change the order of items here!
|
|
|
34
35
|
'sinc (Whittaker-Shannon)', # sinc (Whittaker-Shannon)
|
|
35
36
|
'B-spline' # B-spline
|
|
36
37
|
)
|
|
37
|
-
ImInt_order=[i for i in range(
|
|
38
|
+
ImInt_order=[i for i in range(len(ImInt_items))] #************ change here, please!
|
|
38
39
|
|
|
39
40
|
VelInt_items=( #************ do not change the order of items here!
|
|
40
41
|
'bilinear', # bilinear
|
|
@@ -44,7 +45,7 @@ VelInt_items=( #************ do not change the order of items here!
|
|
|
44
45
|
'shift theorem (extrapolation)', # shift theorem (extrapolation)
|
|
45
46
|
'B-spline' # B-spline
|
|
46
47
|
)
|
|
47
|
-
VelInt_order=[i for i in range(
|
|
48
|
+
VelInt_order=[i for i in range(len(VelInt_items))] #************ change here, please!
|
|
48
49
|
|
|
49
50
|
|
|
50
51
|
Wind_items=( #************ do not change the order of items here!
|
|
@@ -60,6 +61,109 @@ Wind_abbrev=('TH','NG','BL','BH','TR','HN','GS')
|
|
|
60
61
|
#Wind_order=[i for i in range(8)] #************ change here, please!
|
|
61
62
|
Wind_order=[0,2,6,3,5,1,4]
|
|
62
63
|
|
|
64
|
+
spin_tips={
|
|
65
|
+
'final_iter' : 'Number of final iterations',
|
|
66
|
+
'final_it' : 'Number of final iterations for different image interpolation',
|
|
67
|
+
'KernMed' : 'Semi-kernel for median test',
|
|
68
|
+
'SogliaMed' : 'Alpha threshold for median test',
|
|
69
|
+
'ErroreMed' : 'Epsilon threshold for median test',
|
|
70
|
+
'JumpMed' : 'Spacing of vectors for validation',
|
|
71
|
+
'SogliaSN' : 'Threshold for S/N test',
|
|
72
|
+
'SogliaCP' : 'Threshold for correlation peak test',
|
|
73
|
+
'SogliaMedia' : 'Tolerance for Nogueira test',
|
|
74
|
+
'SogliaNumVet' : 'Number of vectors for Nogueira test',
|
|
75
|
+
'SogliaNoise' : 'Minimum allowed value for validation',
|
|
76
|
+
'SogliaStd' : 'Minimum allowed st.d. value for validation',
|
|
77
|
+
'Wind_halfwidth' : 'Weighting window half-width',
|
|
78
|
+
'NItAdaptative' : 'Number of iterations for adaptative process',
|
|
79
|
+
'MinC' : 'Minimum correlation value for adapatative process',
|
|
80
|
+
'MaxC' : 'Maximum correlation value for adapatative process',
|
|
81
|
+
'LarMax' : 'Maximum half-width for adapatative process',
|
|
82
|
+
'LarMin' : 'Minimum half-width for adapatative process',
|
|
83
|
+
'order' : 'Kernel width for image interpolation',
|
|
84
|
+
'order_2' : 'Kernel width for image interpolation (final it.)',
|
|
85
|
+
'VelInt_order' : 'Kernel width for velocity interpolation',
|
|
86
|
+
'par_Gauss' : 'Alpha threshold for Gaussian window',
|
|
87
|
+
'par_Gauss_2' : 'Half-width for Gaussian window',
|
|
88
|
+
'MaxDisp_absolute' : 'Maximum displacement',
|
|
89
|
+
}
|
|
90
|
+
button_tips={
|
|
91
|
+
'more_size' : 'Rectangular IW',
|
|
92
|
+
'more_iter' : 'Image interpolation (final it.)',
|
|
93
|
+
'edit_custom': 'Custom type of process',
|
|
94
|
+
'add' : 'PIV process iterations',
|
|
95
|
+
'delete' : 'PIV process iterations',
|
|
96
|
+
'FinIt' : 'Final iteration box',
|
|
97
|
+
'Interp' : 'Interpolation box',
|
|
98
|
+
'Validation' : 'Validation box',
|
|
99
|
+
'Windowing' : 'Windowing box',
|
|
100
|
+
'top' : 'Type of process box',
|
|
101
|
+
'save_custom': 'Save custom process',
|
|
102
|
+
'mtf' : 'Plot MTF',
|
|
103
|
+
'save_cfg' : 'Save of .cfg file',
|
|
104
|
+
'tool_CollapBox_IntWind' : 'Graphics',
|
|
105
|
+
'CollapBox_IntWind' : 'Graphics',
|
|
106
|
+
'tool_CollapBox_FinIt' : 'Graphics',
|
|
107
|
+
'CollapBox_FinIt' : 'Graphics',
|
|
108
|
+
'tool_CollapBox_top' : 'Graphics',
|
|
109
|
+
'CollapBox_top' : 'Graphics',
|
|
110
|
+
'tool_CollapBox_Interp' : 'Graphics',
|
|
111
|
+
'CollapBox_Interp' : 'Graphics',
|
|
112
|
+
'tool_Validation' : 'Graphics',
|
|
113
|
+
'CollapBox_Validation' : 'Graphics',
|
|
114
|
+
'tool_Windowing' : 'Graphics',
|
|
115
|
+
'CollapBox_Windowing' : 'Graphics',
|
|
116
|
+
}
|
|
117
|
+
check_tips={
|
|
118
|
+
'Bordo' : 'First vector at IW spacing',
|
|
119
|
+
'DC' : 'Direct correlation',
|
|
120
|
+
'SecMax' : 'Second correlation peak correction',
|
|
121
|
+
'CorrHart' : 'Hart''s correction',
|
|
122
|
+
'DC_it' : 'DC for current iteration',
|
|
123
|
+
}
|
|
124
|
+
line_edit_tips={
|
|
125
|
+
'size' : 'IW size' ,
|
|
126
|
+
'spacing' : 'IW spacing',
|
|
127
|
+
'size_2' : 'IW size' ,
|
|
128
|
+
'spacing_2' : 'IW spacing',
|
|
129
|
+
'IW' : 'IW sizes and/or spacings',
|
|
130
|
+
}
|
|
131
|
+
combo_tips ={
|
|
132
|
+
'mode' : 'Process mode',
|
|
133
|
+
'top' : 'Type of process',
|
|
134
|
+
'custom_top' : 'Custom type of process',
|
|
135
|
+
'correlation' : 'Correlation map interpolation',
|
|
136
|
+
'TypeMed' : 'Median test type',
|
|
137
|
+
'FlagCorrezioneVel' : 'Correction type',
|
|
138
|
+
'FlagSommaProd' : 'Type of DCs',
|
|
139
|
+
'ImInt' : 'Image interpolation',
|
|
140
|
+
'par_pol' : 'Polynomial interpolation',
|
|
141
|
+
'par_imshift' : 'Moving window',
|
|
142
|
+
'ImInt_2' : 'Image interpolation (final it.)',
|
|
143
|
+
'par_pol_2' : 'Polynomial interpolation (final it.)',
|
|
144
|
+
'par_imshift_2' : 'Moving window (final it.)',
|
|
145
|
+
'int_vel' : 'Velocity field interpolation',
|
|
146
|
+
'Wind_Vel_type' : 'Velocity weighting window',
|
|
147
|
+
'par_tophat' : 'Top-hat window type (vel.)',
|
|
148
|
+
'par_Nog' : 'Nogueira window type (vel.)',
|
|
149
|
+
'par_Bla' : 'Blackman window type (vel.)',
|
|
150
|
+
'par_Har' : 'Blackman-Harris window type (vel.)',
|
|
151
|
+
'Wind_Corr_type' : 'Correlation map weighting window',
|
|
152
|
+
'par_tophat_2' : 'Top-hat window type (corr.)',
|
|
153
|
+
'par_Nog_2' : 'Nogueira window type (corr.)',
|
|
154
|
+
'par_Bla_2' : 'Blackman window type (corr.)',
|
|
155
|
+
'par_Har_2' : 'Blackman-Harris window type (corr.)',
|
|
156
|
+
'MaxDisp_type' : 'Maximum displacement type',
|
|
157
|
+
'MaxDisp_relative' : 'Maximum displacement',
|
|
158
|
+
}
|
|
159
|
+
radio_tips={
|
|
160
|
+
'MedTest' : 'Median test',
|
|
161
|
+
'SNTest' : 'S/N test',
|
|
162
|
+
'CPTest' : 'Correlation peak test',
|
|
163
|
+
'Nogueira' : 'Nogueira test',
|
|
164
|
+
'Adaptative': 'Adaptative process',
|
|
165
|
+
}
|
|
166
|
+
|
|
63
167
|
def cont_fields(diz):
|
|
64
168
|
cont=0
|
|
65
169
|
for f,v in diz:
|
|
@@ -70,29 +174,19 @@ def cont_fields(diz):
|
|
|
70
174
|
class PROpar(TABpar):
|
|
71
175
|
mode=mode_init
|
|
72
176
|
|
|
73
|
-
def __init__(self
|
|
74
|
-
top=top_init
|
|
75
|
-
if len(args):
|
|
76
|
-
top=args[0]
|
|
77
|
-
if len(args)>1:
|
|
78
|
-
WSize=args[1]
|
|
79
|
-
else:
|
|
80
|
-
WSize=WSize_init
|
|
81
|
-
if len(args)>2:
|
|
82
|
-
WSpac=args[2]
|
|
83
|
-
else:
|
|
84
|
-
WSpac=WSpac_init
|
|
177
|
+
def __init__(self,top=top_init,WSize=WSize_init,WSpac=WSpac_init,Process=ProcessTypes.null,Step=StepTypes.null):
|
|
85
178
|
#attributes in fields
|
|
86
|
-
self.setup(top,WSize,WSpac)
|
|
87
|
-
super().__init__()
|
|
88
|
-
self.
|
|
89
|
-
self.surname='PROCESS_Tab'
|
|
90
|
-
self.unchecked_fields+=['prev_top','top','mode',\
|
|
179
|
+
self.setup(top,WSize,WSpac,Process,Step)
|
|
180
|
+
super().__init__('PROpar','Process')
|
|
181
|
+
self.unchecked_fields+=['prev_top','mode',\
|
|
91
182
|
'FlagFinIt_reset','FlagInterp_reset','FlagValidation_reset','FlagWindowing_reset','FlagCustom',\
|
|
183
|
+
'IntIniz_ind_list','IntFin_ind_list',\
|
|
92
184
|
'VectFlag','flag_rect_wind','row','col',\
|
|
93
|
-
'FlagCalcVel','FlagWindowing','SemiDimCalcVel','MaxDisp','
|
|
185
|
+
'FlagCalcVel','FlagWindowing','SemiDimCalcVel','MaxDisp','FlagDC_it']
|
|
94
186
|
|
|
95
|
-
def setup(self,top,WSize,WSpac):
|
|
187
|
+
def setup(self,top=top_init,WSize=WSize_init,WSpac=WSpac_init,Process=ProcessTypes.null,Step=StepTypes.null):
|
|
188
|
+
self.Process = Process
|
|
189
|
+
self.Step = Step
|
|
96
190
|
cont=[0]
|
|
97
191
|
name_fields=['']
|
|
98
192
|
#************* DEFAULT VALUES
|
|
@@ -104,17 +198,17 @@ class PROpar(TABpar):
|
|
|
104
198
|
self.FlagWindowing_reset=False
|
|
105
199
|
|
|
106
200
|
if not self.mode in mode_items:
|
|
107
|
-
self.mode=
|
|
201
|
+
self.mode=0
|
|
108
202
|
self.top=top
|
|
109
|
-
self.prev_top=
|
|
203
|
+
self.prev_top=top
|
|
204
|
+
self.custom_top_name=''
|
|
110
205
|
|
|
111
206
|
cont.append(cont_fields(self.__dict__.items()))
|
|
112
207
|
name_fields.append('base')
|
|
113
208
|
|
|
114
209
|
#******************************* IW_fields
|
|
115
210
|
self.Nit=len(WSize)
|
|
116
|
-
Vect=[
|
|
117
|
-
np.array(WSize,np.intc), np.array(WSpac,np.intc)]
|
|
211
|
+
Vect=[copy.deepcopy(WSize),copy.deepcopy(WSpac),copy.deepcopy(WSize),copy.deepcopy(WSpac)]
|
|
118
212
|
self.Vect=Vect
|
|
119
213
|
self.VectFlag=[True]*4
|
|
120
214
|
self.flag_rect_wind=False
|
|
@@ -123,9 +217,18 @@ class PROpar(TABpar):
|
|
|
123
217
|
cont.append(cont_fields(self.__dict__.items()))
|
|
124
218
|
name_fields.append('IW')
|
|
125
219
|
|
|
220
|
+
#******************************* FinalIt_fields
|
|
221
|
+
self.FlagDirectCorr=1
|
|
222
|
+
self.NIterazioni=0
|
|
223
|
+
|
|
224
|
+
cont.append(cont_fields(self.__dict__.items()))
|
|
225
|
+
name_fields.append('FinalIt')
|
|
226
|
+
|
|
126
227
|
#******************************* Int_fields
|
|
127
228
|
self.IntIniz=1
|
|
229
|
+
self.IntIniz_ind_list=[3,1,2]
|
|
128
230
|
self.IntFin=1
|
|
231
|
+
self.IntFin_ind_list=[3,1,2]
|
|
129
232
|
self.FlagInt=0
|
|
130
233
|
self.IntCorr=0
|
|
131
234
|
self.IntVel=1
|
|
@@ -133,13 +236,6 @@ class PROpar(TABpar):
|
|
|
133
236
|
cont.append(cont_fields(self.__dict__.items()))
|
|
134
237
|
name_fields.append('Int')
|
|
135
238
|
|
|
136
|
-
#******************************* FinalIt_fields
|
|
137
|
-
self.FlagDirectCorr=1
|
|
138
|
-
self.NIterazioni=0
|
|
139
|
-
|
|
140
|
-
cont.append(cont_fields(self.__dict__.items()))
|
|
141
|
-
name_fields.append('FinalIt')
|
|
142
|
-
|
|
143
239
|
#******************************* Validation_fields
|
|
144
240
|
self.FlagMedTest=1
|
|
145
241
|
self.TypeMed=1
|
|
@@ -164,7 +260,7 @@ class PROpar(TABpar):
|
|
|
164
260
|
self.FlagSecMax=1
|
|
165
261
|
self.FlagCorrHart=0
|
|
166
262
|
|
|
167
|
-
cont.append(cont_fields(self.__dict__.items()))
|
|
263
|
+
cont.append(cont_fields(self.__dict__.items()))
|
|
168
264
|
name_fields.append('Validation')
|
|
169
265
|
|
|
170
266
|
#******************************* Windowing_fields
|
|
@@ -192,22 +288,22 @@ class PROpar(TABpar):
|
|
|
192
288
|
self.row=0
|
|
193
289
|
self.col=0
|
|
194
290
|
|
|
195
|
-
if self.top==
|
|
291
|
+
if self.top==1: #preview/custom
|
|
196
292
|
self.IntIniz=3
|
|
197
293
|
self.IntFin=3
|
|
198
294
|
self.IntVel=1
|
|
199
295
|
self.NIterazioni=0
|
|
200
|
-
elif self.top==
|
|
296
|
+
elif self.top==2: #fast
|
|
201
297
|
self.IntIniz=1
|
|
202
298
|
self.IntFin=1
|
|
203
299
|
self.IntVel=1
|
|
204
300
|
self.NIterazioni=1
|
|
205
|
-
elif self.top==
|
|
301
|
+
elif self.top==0 or self.top==3: #standard
|
|
206
302
|
self.IntIniz=53
|
|
207
303
|
self.IntFin=53
|
|
208
304
|
self.IntVel=52
|
|
209
305
|
self.NIterazioni=2
|
|
210
|
-
elif self.top==
|
|
306
|
+
elif self.top==4: #advanced
|
|
211
307
|
self.IntIniz=57
|
|
212
308
|
self.IntFin=57
|
|
213
309
|
self.IntVel=53
|
|
@@ -215,7 +311,7 @@ class PROpar(TABpar):
|
|
|
215
311
|
|
|
216
312
|
self.vFlagCalcVel=[2]*self.Nit
|
|
217
313
|
self.vFlagWindowing=[2]*self.Nit
|
|
218
|
-
elif self.top==
|
|
314
|
+
elif self.top==5: #high resolution
|
|
219
315
|
self.IntIniz=57
|
|
220
316
|
self.IntFin=57
|
|
221
317
|
self.IntVel=53
|
|
@@ -224,7 +320,7 @@ class PROpar(TABpar):
|
|
|
224
320
|
self.vFlagCalcVel=[2]*self.Nit
|
|
225
321
|
self.vFlagWindowing=[2]*self.Nit
|
|
226
322
|
self.vSemiDimCalcVel=[3]*self.Nit
|
|
227
|
-
elif self.top==
|
|
323
|
+
elif self.top==6: #adaptative
|
|
228
324
|
self.IntIniz=57
|
|
229
325
|
self.IntFin=57
|
|
230
326
|
self.IntVel=53
|
|
@@ -241,7 +337,7 @@ class PROpar(TABpar):
|
|
|
241
337
|
self.FlagWindowing =self.vFlagWindowing [self.row]
|
|
242
338
|
self.SemiDimCalcVel=self.vSemiDimCalcVel[self.row]
|
|
243
339
|
self.MaxDisp =self.vMaxDisp [self.row]
|
|
244
|
-
self.
|
|
340
|
+
self.FlagDC_it =self.vDC [self.row]
|
|
245
341
|
|
|
246
342
|
for j in range(1,len(cont)):
|
|
247
343
|
setattr(self,name_fields[j]+"_fields",[])
|
|
@@ -255,7 +351,8 @@ class PROpar(TABpar):
|
|
|
255
351
|
def change_top(self,top_new):
|
|
256
352
|
WSize=[w for w in self.Vect[0]]
|
|
257
353
|
WSpac=[w for w in self.Vect[1]]
|
|
258
|
-
newist=PROpar(top_new,WSize,WSpac)
|
|
354
|
+
newist=PROpar(top_new,WSize,WSpac,self.Process,self.Step)
|
|
355
|
+
newist.copyfromfields(self,newist.parFields)
|
|
259
356
|
for f in self.fields:
|
|
260
357
|
if f not in self.IW_fields:
|
|
261
358
|
setattr(self,f,getattr(newist,f))
|
|
@@ -264,15 +361,12 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
264
361
|
class Process_Tab_Signals(gPaIRS_Tab.Tab_Signals):
|
|
265
362
|
pass
|
|
266
363
|
|
|
267
|
-
def __init__(self
|
|
268
|
-
parent=None
|
|
269
|
-
flagInit=True
|
|
270
|
-
if len(args): parent=args[0]
|
|
271
|
-
if len(args)>1: flagInit=args[1]
|
|
364
|
+
def __init__(self,parent: QWidget =None, flagInit= __name__ == "__main__"):
|
|
272
365
|
super().__init__(parent,Ui_ProcessTab,PROpar)
|
|
273
366
|
self.signals=self.Process_Tab_Signals(self)
|
|
274
367
|
|
|
275
368
|
#------------------------------------- Graphical interface: widgets
|
|
369
|
+
self.TABname='Process'
|
|
276
370
|
self.ui: Ui_ProcessTab
|
|
277
371
|
ui=self.ui
|
|
278
372
|
|
|
@@ -293,43 +387,23 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
293
387
|
ui.line_edit_size_2.addwid=ui.line_edit_size.addwid
|
|
294
388
|
ui.line_edit_spacing_2.addlab=ui.check_edit_spacing_2
|
|
295
389
|
ui.line_edit_spacing_2.addwid=ui.line_edit_size.addwid
|
|
390
|
+
ui.table_iter.addwid.append(ui.line_edit_IW)
|
|
296
391
|
|
|
297
392
|
#necessary to change the name and the order of the items
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
for i in range(len(ImInt_items)):
|
|
307
|
-
ui.combo_ImInt.addItem(ImInt_items[ImInt_order[i]])
|
|
308
|
-
ui.combo_ImInt_2.addItem(ImInt_items[ImInt_order[i]])
|
|
309
|
-
ui.combo_int_vel.clear()
|
|
310
|
-
for i in range(len(VelInt_items)):
|
|
311
|
-
ui.combo_int_vel.addItem(VelInt_items[VelInt_order[i]])
|
|
312
|
-
ui.combo_Wind_Vel_type.clear()
|
|
313
|
-
ui.combo_Wind_Corr_type.clear()
|
|
314
|
-
for i in range(len(Wind_items)):
|
|
315
|
-
ui.combo_Wind_Vel_type.addItem(Wind_items[Wind_order[i]])
|
|
316
|
-
ui.combo_Wind_Corr_type.addItem(Wind_items[Wind_order[i]])
|
|
317
|
-
|
|
318
|
-
self.setupWid() #---------------- IMPORTANT
|
|
319
|
-
"""
|
|
320
|
-
ui.CollapBoxes=self.findChildren(CollapsibleBox)
|
|
321
|
-
height_min=2^64
|
|
322
|
-
for cb in ui.CollapBoxes:
|
|
323
|
-
cb.setup()
|
|
324
|
-
cb.initFlag=True
|
|
325
|
-
if cb.heightOpened<height_min:
|
|
326
|
-
height_min=cb.heightOpened
|
|
327
|
-
|
|
328
|
-
for cb in ui.CollapBoxes:
|
|
329
|
-
indx=ui.scrollAreaWidgetContents_PT.layout().indexOf(cb)
|
|
330
|
-
cb.setup(indx,cb.heightOpened//height_min+1)
|
|
331
|
-
"""
|
|
393
|
+
for g in list(globals()):
|
|
394
|
+
if '_items' in g or '_ord' in g or '_tips' in g:
|
|
395
|
+
#pri.Info.blue(f'Adding {g} to {self.name_tab}')
|
|
396
|
+
setattr(self,g,eval(g))
|
|
397
|
+
self.Wind_Vel_type_items=Wind_items
|
|
398
|
+
self.Wind_Vel_type_order=Wind_order
|
|
399
|
+
self.Wind_Corr_type_items=Wind_items
|
|
400
|
+
self.Wind_Corr_type_order=Wind_order
|
|
332
401
|
|
|
402
|
+
|
|
403
|
+
if __name__ == "__main__":
|
|
404
|
+
self.app=app
|
|
405
|
+
setAppGuiPalette(self)
|
|
406
|
+
|
|
333
407
|
#------------------------------------- Graphical interface: miscellanea
|
|
334
408
|
self.icon_plus = QIcon()
|
|
335
409
|
self.icon_plus.addFile(u""+ icons_path +"plus.png", QSize(), QIcon.Normal, QIcon.Off)
|
|
@@ -344,9 +418,7 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
344
418
|
self.ui.button_more_iter.setIconSize(self.ui.button_more_iter.size()-QSize(6,6))
|
|
345
419
|
|
|
346
420
|
self.custom_list_file=pro_path+custom_list_file
|
|
347
|
-
self.
|
|
348
|
-
self.custom_list=setCustomList(lambda var,name: self.PROpar_customs.append(var))
|
|
349
|
-
self.updateCustomList(False)
|
|
421
|
+
self.setCustomTops()
|
|
350
422
|
|
|
351
423
|
self.tableHeaders =[self.ui.table_iter.horizontalHeaderItem(i).text() for i in range(self.ui.table_iter.columnCount())]
|
|
352
424
|
header = self.ui.table_iter.horizontalHeader()
|
|
@@ -362,104 +434,58 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
362
434
|
#header.setMaximumSectionSize(int(self.maximumWidth()/2))
|
|
363
435
|
self.ui.table_iter.InfoLabel=self.ui.label_info
|
|
364
436
|
self.ui.table_iter.DeleteButton=self.ui.button_delete
|
|
365
|
-
|
|
366
|
-
self.ui.line_edit_IW.addfuncin["InfoLabelIn"]=self.updateInfoLabel
|
|
367
|
-
self.ui.line_edit_IW.addfuncout["InfoLabelOut"]=self.ui.table_iter.resizeInfoLabel
|
|
368
437
|
self.ui.label_info.hide()
|
|
369
438
|
|
|
370
|
-
|
|
371
|
-
|
|
439
|
+
#------------------------------------- obsolescences
|
|
440
|
+
if not Flag_type_of_DCs:
|
|
441
|
+
#self.ui.w_type_of_DCs.hide()
|
|
442
|
+
self.ui.label_type_of_DCs.hide()
|
|
443
|
+
self.ui.combo_FlagSommaProd.hide()
|
|
444
|
+
if not Flag_Hart_corr: self.ui.check_CorrHart.hide()
|
|
445
|
+
if not Flag_Nogueira: self.ui.w_Nogueira.hide()
|
|
372
446
|
|
|
373
447
|
#------------------------------------- Declaration of parameters
|
|
374
448
|
self.PROpar_base=PROpar()
|
|
375
449
|
self.PROpar:PROpar=self.TABpar
|
|
376
450
|
self.PROpar_old:PROpar=self.TABpar_old
|
|
377
|
-
self.
|
|
451
|
+
self.PROpar_custom=PROpar(0)
|
|
378
452
|
|
|
379
|
-
|
|
380
|
-
self.
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
self.
|
|
453
|
+
#------------------------------------- Callbacks
|
|
454
|
+
self.defineWidgets()
|
|
455
|
+
self.setupWid() #---------------- IMPORTANT
|
|
456
|
+
|
|
457
|
+
self.defineActions()
|
|
458
|
+
self.defineCallbacks()
|
|
459
|
+
self.connectCallbacks()
|
|
460
|
+
self.defineAdditionalCallbacks()
|
|
461
|
+
self.defineSet()
|
|
462
|
+
self.defineSettings()
|
|
463
|
+
self.TABsettings.append(self.table_iter_set)
|
|
464
|
+
self.adjustTABpar=self.adjustPROpar
|
|
465
|
+
self.setTABlayout=self.setPROlayout
|
|
384
466
|
|
|
385
467
|
#------------------------------------- Initializing
|
|
386
468
|
if flagInit:
|
|
387
469
|
self.initialize()
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
if not Flag_type_of_DCs:
|
|
391
|
-
#self.ui.w_type_of_DCs.hide()
|
|
392
|
-
self.ui.label_type_of_DCs.hide()
|
|
393
|
-
self.ui.combo_type_of_DCs.hide()
|
|
394
|
-
if not Flag_Hart_corr: self.ui.check_Hart.hide()
|
|
395
|
-
if not Flag_Nogueira: self.ui.w_Nogueira.hide()
|
|
470
|
+
#else:
|
|
471
|
+
# self.setTABpar(FlagBridge=False)
|
|
396
472
|
|
|
397
473
|
def initialize(self):
|
|
398
474
|
pri.Info.yellow(f'{"*"*20} PROCESS initialization {"*"*20}')
|
|
399
|
-
self.setTABpar(
|
|
475
|
+
self.setTABpar(FlagBridge=False)
|
|
476
|
+
self.add_TABpar('initialization')
|
|
477
|
+
self.setFocus()
|
|
400
478
|
|
|
401
|
-
def
|
|
402
|
-
|
|
403
|
-
self.
|
|
404
|
-
self.
|
|
405
|
-
self.
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
'adaptative_iter','min_Corr','max_Corr','max_Lar','min_Lar',\
|
|
412
|
-
'order','order_2','VelInt_order','par_Gauss','par_Gauss_2','MaxDisp_absolute']
|
|
413
|
-
spin_tips=['Number of final iterations','Number of final iterations for different image interpolation','Semi-kernel for median test','Alpha threshold for median test','Epsilon threshold for median test','Spacing of vectors for validation','Threshold for S/N test',\
|
|
414
|
-
'Threshold for correlation peak test','Tolerance for Nogueira test','Number of vectors for Nogueira test','Minimum allowed value for validation','Minimum allowed st.d. value for validation','Weighting window half-width',\
|
|
415
|
-
'Number of iterations for adaptative process','Minimum correlation value for adapatative process','Maximum correlation value for adapatative process','Maximum half-width for adapatative process','Minimum half-width for adapatative process',\
|
|
416
|
-
'Kernel width for image interpolation','Kernel width for image interpolation (final it.)','Kernel width for velocity interpolation','Alpha threshold for Gaussian window','Half-width for Gaussian window','Maximum displacement']
|
|
417
|
-
self.setSpinCallbacks(spin_names,spin_tips)
|
|
418
|
-
self.ui.spin_final_it.addfuncout['check_more_iter']=self.check_more_iter
|
|
419
|
-
self.ui.spin_final_it.addfuncreturn['check_more_iter']=self.check_more_iter
|
|
420
|
-
|
|
421
|
-
signals=[["clicked"],
|
|
422
|
-
["toggled"],
|
|
423
|
-
["editingFinished"], #"returnPressed" #***** inserire?
|
|
424
|
-
["activated"], #"currentIndexChanged" #***** rimpiazzare?
|
|
425
|
-
["toggled"],
|
|
426
|
-
["clicked"]]
|
|
427
|
-
fields=["button",
|
|
428
|
-
"check",
|
|
429
|
-
"line_edit",
|
|
430
|
-
"combo",
|
|
431
|
-
"radio",
|
|
432
|
-
"push_CollapBox"]
|
|
433
|
-
names=[ ['more_size','more_iter','edit_custom','add','delete'], #button
|
|
434
|
-
['flag_boundary','DC','second_peak','Hart','DC_it'], #check
|
|
435
|
-
['size','spacing','size_2','spacing_2','IW'], #edit
|
|
436
|
-
['mode','top','custom_top','correlation','MedTest_type','Correction_type','type_of_DCs',\
|
|
437
|
-
'ImInt','par_pol','par_imshift','ImInt_2','par_pol_2','par_imshift_2','int_vel',\
|
|
438
|
-
'Wind_Vel_type','par_tophat','par_Nog','par_Bla','par_Har',\
|
|
439
|
-
'Wind_Corr_type','par_tophat_2','par_Nog_2','par_Bla_2','par_Har_2',\
|
|
440
|
-
'MaxDisp_type','MaxDisp_relative',], #combo
|
|
441
|
-
['MedTest','SNTest','CPTest','Nogueira','Adaptative'], #radio
|
|
442
|
-
['FinIt','Interp','Validation','Windowing','top']] #push
|
|
443
|
-
tips=[ ['Rectangular IW','Image interpolation (final it.)','Custom type of process','PIV process iterations','PIV process iterations'], #button
|
|
444
|
-
['First vector at IW spacing','Direct correlation','Second correlation peak correction','Hart''s correction',\
|
|
445
|
-
'DC for current iteration'], #check
|
|
446
|
-
['IW size','IW spacing','IW size','IW spacing','IW sizes and spacings for the iteration selected in the table'], #edit
|
|
447
|
-
['Process mode','Type of process','Custom type of process','Correlation map interpolation','Median test type','Correction type','Type of DCs',\
|
|
448
|
-
'Image interpolation','Polynomial interpolation','Moving window','Image interpolation (final it.)','Polynomial interpolation (final it.)','Moving window (final it.)','Velocity field interpolation',\
|
|
449
|
-
'Velocity weighting window','Top-hat window type (vel.)','Nogueira window type (vel.)','Blackman window type (vel.)','Blackman-Harris window type (vel.)',\
|
|
450
|
-
'Correlation map weighting window','Top-hat window type (corr.)','Nogueira window type (corr.)','Blackman window type (corr.)','Blackman-Harris window type (corr.)',\
|
|
451
|
-
'Maximum displacement type','Maximum displacement'], #combo
|
|
452
|
-
['Median test','S/N test','Correlation peak test','Nogueira test','Adaptative process'], #radio
|
|
453
|
-
['Final iteration box','Interpolation box','Validation box','Windowing box','Type of process box']] #push
|
|
454
|
-
|
|
455
|
-
for f,N,S,T in zip(fields,names,signals,tips):
|
|
456
|
-
for n,t in zip(N,T):
|
|
457
|
-
wid=getattr(self.ui,f+"_"+n)
|
|
458
|
-
fcallback=getattr(self,f+"_"+n+"_callback")
|
|
459
|
-
fcallbackWrapped=self.addParWrapper(fcallback,t)
|
|
460
|
-
for s in S:
|
|
461
|
-
sig=getattr(wid,s)
|
|
462
|
-
sig.connect(fcallbackWrapped)
|
|
479
|
+
def defineActions(self):
|
|
480
|
+
self.defineIWActions()
|
|
481
|
+
self.defineInterpActions()
|
|
482
|
+
self.defineWindowingActions()
|
|
483
|
+
self.defineCollapBoxActions()
|
|
484
|
+
|
|
485
|
+
def defineAdditionalCallbacks(self):
|
|
486
|
+
#additional callbacks
|
|
487
|
+
self.ui.spin_final_it.addfuncout['check_more_iter']=self.spin_final_it_action
|
|
488
|
+
self.ui.spin_final_it.addfuncreturn['check_more_iter']=self.spin_final_it_action
|
|
463
489
|
|
|
464
490
|
#graphical callbacks
|
|
465
491
|
names=['size','spacing','size_2','spacing_2']
|
|
@@ -470,129 +496,416 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
470
496
|
wid.textChanged.connect(fcallback)
|
|
471
497
|
|
|
472
498
|
#other functions
|
|
473
|
-
self.ui.
|
|
499
|
+
self.ui.line_edit_IW.addfuncin["InfoLabelIn"]=self.line_edit_IW_addfuncin
|
|
500
|
+
self.ui.line_edit_IW.addfuncout["InfoLabelOut"]=self.ui.table_iter.resizeInfoLabel
|
|
501
|
+
self.ui.table_iter.itemSelectionChanged.connect(self.wrappedCallback('Iteration table selection',self.table_iter_action))
|
|
474
502
|
self.ui.table_iter.contextMenuEvent=lambda e: self.tableContextMenuEvent(self.ui.table_iter,e)
|
|
475
|
-
self.ui.
|
|
476
|
-
self.ui.button_mtf.clicked.connect(self.showMTF)
|
|
503
|
+
self.ui.spin_LarMin.valueChanged.connect(self.spin_LarMin_changing)
|
|
477
504
|
|
|
478
|
-
def
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
widname=
|
|
505
|
+
def defineIWActions(self):
|
|
506
|
+
wtype='line_edit'
|
|
507
|
+
def defineIWAction(i,n):
|
|
508
|
+
widname=wtype+"_"+n
|
|
482
509
|
a1=getattr(self.ui,'line_edit'+'_'+n)
|
|
483
510
|
a2=getattr(self.ui,'check_edit'+'_'+n)
|
|
484
|
-
|
|
485
|
-
setattr(self,
|
|
486
|
-
|
|
487
|
-
setattr(self,
|
|
511
|
+
edit_changing=widname+'_changing'
|
|
512
|
+
setattr(self,edit_changing,lambda: self.edit_Wind_vectors(a1,a2))
|
|
513
|
+
edit_action=widname+'_action'
|
|
514
|
+
setattr(self,edit_action,lambda: self.set_Wind_vectors(a1,a2,i))
|
|
488
515
|
names=['size','spacing','size_2','spacing_2']
|
|
489
|
-
f='line_edit'
|
|
490
516
|
for i,n in enumerate(names):
|
|
491
|
-
|
|
517
|
+
defineIWAction(i,n)
|
|
492
518
|
return
|
|
493
519
|
|
|
494
|
-
def
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
520
|
+
def defineInterpActions(self):
|
|
521
|
+
if hasattr(self.ui,'combo_ImInt'):
|
|
522
|
+
self.combo_ImInt_action=lambda: Process_Tab.combo_ImInt_action_gen(self,'IntIniz',self.ui.combo_ImInt,self.ui.w_ImInt_par,self.PROpar.IntIniz_ind_list)
|
|
523
|
+
names=['combo_par_pol','combo_par_imshift','spin_order']
|
|
524
|
+
for n in names:
|
|
525
|
+
setattr(self,n+'_action',self.combo_ImInt_action)
|
|
526
|
+
|
|
527
|
+
if hasattr(self.ui,'combo_ImInt_2'):
|
|
528
|
+
self.combo_ImInt_2_action=lambda: Process_Tab.combo_ImInt_action_gen(self,'IntFin',self.ui.combo_ImInt_2,self.ui.w_ImInt_par_2,self.PROpar.IntFin_ind_list)
|
|
529
|
+
names=['combo_par_pol_2','combo_par_imshift_2','spin_order_2']
|
|
530
|
+
for n in names:
|
|
531
|
+
setattr(self,n+'_action',self.combo_ImInt_2_action)
|
|
532
|
+
|
|
533
|
+
if hasattr(self.ui,'combo_int_vel'):
|
|
534
|
+
self.combo_int_vel_action=lambda: Process_Tab.combo_int_vel_action_gen(self,'IntVel',self.ui.combo_int_vel,self.ui.w_VelInt_par)
|
|
535
|
+
self.spin_VelInt_order_action=self.combo_int_vel_action
|
|
508
536
|
return
|
|
509
537
|
|
|
510
|
-
def
|
|
511
|
-
self.
|
|
512
|
-
fmethod1=lambda: self.setWindIndex(self.ui.combo_Wind_Vel_type,self.ui.w_Wind_par)
|
|
538
|
+
def defineWindowingActions(self):
|
|
539
|
+
self.combo_Wind_Vel_type_action=lambda: self.combo_Wind_Vel_action_gen('FlagCalcVel',self.ui.combo_Wind_Vel_type,self.ui.w_Wind_par)
|
|
513
540
|
names=['combo_par_tophat','combo_par_Nog','combo_par_Bla','combo_par_Har','spin_par_Gauss']
|
|
514
541
|
for n in names:
|
|
515
|
-
setattr(self,n+'
|
|
542
|
+
setattr(self,n+'_action',self.combo_Wind_Vel_type_action)
|
|
516
543
|
|
|
517
|
-
self.
|
|
518
|
-
fmethod2=lambda: self.setWindIndex(self.ui.combo_Wind_Corr_type,self.ui.w_Wind_par_2)
|
|
544
|
+
self.combo_Wind_Corr_type_action=lambda: self.combo_Wind_Vel_action_gen('FlagWindowing',self.ui.combo_Wind_Corr_type,self.ui.w_Wind_par_2)
|
|
519
545
|
names=['combo_par_tophat_2','combo_par_Nog_2','combo_par_Bla_2','combo_par_Har_2','spin_par_Gauss_2']
|
|
520
546
|
for n in names:
|
|
521
|
-
setattr(self,n+'
|
|
547
|
+
setattr(self,n+'_action',self.combo_Wind_Corr_type_action)
|
|
522
548
|
|
|
523
|
-
self.
|
|
524
|
-
self.
|
|
549
|
+
self.combo_MaxDisp_relative_action=self.combo_MaxDisp_action
|
|
550
|
+
self.spin_MaxDisp_absolute_action=self.combo_MaxDisp_action
|
|
525
551
|
return
|
|
526
552
|
|
|
527
|
-
def
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
self.
|
|
532
|
-
self.
|
|
533
|
-
self.push_CollapBox_Validation_callback=lambda: self.reset_field(p.Validation_fields,self.ui.push_CollapBox_Validation)
|
|
534
|
-
self.push_CollapBox_Windowing_callback=lambda: self.reset_field(p.Wind_fields,self.ui.push_CollapBox_Windowing)
|
|
535
|
-
self.push_CollapBox_top_callback=self.combo_top_action
|
|
553
|
+
def defineCollapBoxActions(self):
|
|
554
|
+
self.button_CollapBox_FinIt_action=lambda: self.reset_field('FinalIt_fields')
|
|
555
|
+
self.button_CollapBox_Interp_action=lambda: self.reset_field('Int_fields')
|
|
556
|
+
self.button_CollapBox_Validation_action=lambda: self.reset_field('Validation_fields')
|
|
557
|
+
self.button_CollapBox_Windowing_action=lambda: self.reset_field('Wind_fields')
|
|
558
|
+
self.button_CollapBox_top_action=self.combo_top_action
|
|
536
559
|
return
|
|
537
560
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
561
|
+
def defineSet(self):
|
|
562
|
+
self.defineInterpSet()
|
|
563
|
+
self.defineWindowingSet()
|
|
564
|
+
|
|
565
|
+
def defineInterpSet(self):
|
|
566
|
+
if hasattr(self.ui,'combo_ImInt'):
|
|
567
|
+
self.combo_ImInt_set=lambda: Process_Tab.combo_ImInt_set_gen(self,'IntIniz',self.ui.combo_ImInt,self.ui.w_ImInt_par,self.PROpar.IntIniz_ind_list)
|
|
568
|
+
if hasattr(self.ui,'combo_ImInt_2'):
|
|
569
|
+
self.combo_ImInt_2_set=lambda: Process_Tab.combo_ImInt_set_gen(self,'IntFin',self.ui.combo_ImInt_2,self.ui.w_ImInt_par_2,self.PROpar.IntFin_ind_list)
|
|
570
|
+
if hasattr(self.ui,'combo_int_vel'):
|
|
571
|
+
self.combo_int_vel_set=lambda: Process_Tab.combo_int_vel_set_gen(self,'IntVel',self.ui.combo_int_vel,self.ui.w_VelInt_par)
|
|
572
|
+
return
|
|
573
|
+
|
|
574
|
+
def defineWindowingSet(self):
|
|
575
|
+
self.combo_Wind_Vel_type_set=lambda: self.combo_Wind_Vel_set_gen('FlagCalcVel',self.ui.combo_Wind_Vel_type,self.ui.w_Wind_par)
|
|
576
|
+
self.combo_Wind_Corr_type_set=lambda: self.combo_Wind_Vel_set_gen('FlagWindowing',self.ui.combo_Wind_Corr_type,self.ui.w_Wind_par_2)
|
|
577
|
+
self.MTF=None
|
|
578
|
+
|
|
579
|
+
#*************************************************** adjusting PROpars and controls
|
|
580
|
+
def reset_field(self,dizName):
|
|
581
|
+
diz=getattr(self.PROpar,dizName)
|
|
582
|
+
top=self.PROpar.prev_top
|
|
541
583
|
WSize=[w for w in self.PROpar.Vect[0]]
|
|
542
584
|
WSpac=[w for w in self.PROpar.Vect[1]]
|
|
543
|
-
PROpar_old=PROpar(top,WSize,WSpac)
|
|
544
|
-
self.PROpar.
|
|
545
|
-
if self.PROpar.top==
|
|
585
|
+
PROpar_old=PROpar(top,WSize,WSpac,self.PROpar.Process,self.PROpar.Step)
|
|
586
|
+
self.PROpar.copyfromfields(PROpar_old,diz)
|
|
587
|
+
if self.PROpar.top==0:
|
|
546
588
|
self.setPROpar_custom()
|
|
547
589
|
|
|
548
|
-
def
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
else:
|
|
554
|
-
self.PROpar.copyfromdiz(self.PROpar_custom,fields)
|
|
555
|
-
|
|
590
|
+
def adjustPROpar(self):
|
|
591
|
+
self.check_reset()
|
|
592
|
+
self.check_more_iter()
|
|
593
|
+
self.adjustWindowingPar()
|
|
594
|
+
|
|
556
595
|
def check_reset(self):
|
|
557
596
|
WSize=[w for w in self.PROpar.Vect[0]]
|
|
558
597
|
WSpac=[w for w in self.PROpar.Vect[1]]
|
|
559
|
-
PROpar_old=PROpar(self.PROpar.top,WSize,WSpac)
|
|
560
|
-
if PROpar_old.top==
|
|
598
|
+
PROpar_old=PROpar(self.PROpar.top,WSize,WSpac,self.PROpar.Process,self.PROpar.Step)
|
|
599
|
+
if PROpar_old.top==0:
|
|
561
600
|
i=self.ui.combo_custom_top.currentIndex()
|
|
562
601
|
if i!=-1:
|
|
563
602
|
PROpar_old.copyfrom(self.PROpar_customs[i])
|
|
564
|
-
exc=self.PROpar.unchecked_fields+['
|
|
603
|
+
exc=self.PROpar.unchecked_fields+['ind']
|
|
565
604
|
self.PROpar.FlagFinIt_reset=not self.PROpar.isEqualTo(PROpar_old,exc,self.PROpar.FinalIt_fields)
|
|
566
605
|
self.PROpar.FlagInterp_reset=not self.PROpar.isEqualTo(PROpar_old,exc,self.PROpar.Int_fields)
|
|
567
606
|
self.PROpar.FlagValidation_reset=not self.PROpar.isEqualTo(PROpar_old,exc,self.PROpar.Validation_fields)
|
|
568
607
|
self.PROpar.FlagWindowing_reset=not self.PROpar.isEqualTo(PROpar_old,exc,self.PROpar.Wind_fields)
|
|
569
|
-
self.PROpar.printDifferences(PROpar_old,exc)
|
|
608
|
+
#self.PROpar.printDifferences(PROpar_old,exc)
|
|
570
609
|
self.PROpar.FlagCustom=self.PROpar.FlagFinIt_reset|self.PROpar.FlagInterp_reset|\
|
|
571
610
|
self.PROpar.FlagValidation_reset|self.PROpar.FlagWindowing_reset
|
|
611
|
+
|
|
612
|
+
def check_more_iter(self):
|
|
613
|
+
max_it=len(self.PROpar.Vect[0])+self.PROpar.NIterazioni
|
|
614
|
+
if max_it==1:
|
|
615
|
+
self.PROpar.FlagInt=0
|
|
616
|
+
else:
|
|
617
|
+
self.ui.spin_final_it.setMaximum(max_it-1)
|
|
618
|
+
|
|
619
|
+
def adjustWindowingPar(self):
|
|
620
|
+
Nit=self.PROpar.Nit
|
|
621
|
+
fields=['vFlagCalcVel','vFlagWindowing','vSemiDimCalcVel','vDC','vMaxDisp']
|
|
622
|
+
for f in fields:
|
|
623
|
+
v=getattr(self.PROpar,f)
|
|
624
|
+
nWind=len(v)
|
|
625
|
+
if nWind>Nit:
|
|
626
|
+
for k in range(nWind-1,Nit-1,-1):
|
|
627
|
+
v.pop(k)
|
|
628
|
+
elif nWind<Nit:
|
|
629
|
+
for k in range(nWind,Nit):
|
|
630
|
+
v.append(v[-1])
|
|
631
|
+
if self.PROpar.FlagAdaptative:
|
|
632
|
+
self.PROpar.vSemiDimCalcVel[-1]=self.PROpar.LarMin
|
|
633
|
+
self.PROpar.vFlagCalcVel+=[self.PROpar.vFlagCalcVel[-1]] #+=[2] per BL
|
|
634
|
+
self.PROpar.vFlagWindowing+=[self.PROpar.vFlagWindowing[-1]] #+=[2] per BL
|
|
635
|
+
self.PROpar.vSemiDimCalcVel+=[self.PROpar.LarMax]
|
|
636
|
+
self.PROpar.vMaxDisp+=[self.PROpar.vMaxDisp[-1]]
|
|
637
|
+
self.PROpar.vDC+=[self.PROpar.vDC[-1]]
|
|
638
|
+
if not self.PROpar.FlagDirectCorr:
|
|
639
|
+
self.PROpar.vDC=[0]*len(self.PROpar.vDC)
|
|
640
|
+
self.PROpar.row=len(self.PROpar.vFlagCalcVel)-1 if self.PROpar.row>=len(self.PROpar.vFlagCalcVel)-1 else self.PROpar.row if self.PROpar.row>-1 else 0
|
|
641
|
+
self.adjustTablePar()
|
|
642
|
+
if self.PROpar.FlagAdaptative and self.PROpar.row==self.PROpar.Nit-1:
|
|
643
|
+
self.PROpar.SemiDimCalcVel=self.PROpar.LarMin
|
|
644
|
+
return
|
|
645
|
+
|
|
646
|
+
def adjustTablePar(self):
|
|
647
|
+
self.PROpar.FlagCalcVel =self.PROpar.vFlagCalcVel [self.PROpar.row]
|
|
648
|
+
self.PROpar.FlagWindowing =self.PROpar.vFlagWindowing [self.PROpar.row]
|
|
649
|
+
self.PROpar.SemiDimCalcVel=self.PROpar.vSemiDimCalcVel[self.PROpar.row]
|
|
650
|
+
self.PROpar.MaxDisp=self.PROpar.vMaxDisp[self.PROpar.row]
|
|
651
|
+
self.PROpar.FlagDC_it=self.PROpar.vDC[self.PROpar.row]
|
|
652
|
+
pri.Callback.green(f'{" "*10} FlagCalcVel={self.PROpar.FlagCalcVel}, FlagWindowing={self.PROpar.FlagWindowing}, SemiDimCalcVel={self.PROpar.SemiDimCalcVel}, MaxDisp={self.PROpar.MaxDisp}, DC={self.PROpar.FlagDC_it}')
|
|
653
|
+
|
|
654
|
+
def setPushCollapBoxes(self,*args):
|
|
655
|
+
if len(args):
|
|
656
|
+
cb=args #tuple
|
|
657
|
+
else:
|
|
658
|
+
cb=('FinIt','Interp','Validation','Windowing','ToP')
|
|
659
|
+
for n in cb:
|
|
660
|
+
if n!='ToP':
|
|
661
|
+
flag=getattr(self.PROpar,'Flag'+n+'_reset')
|
|
662
|
+
push=getattr(self.ui,'button_CollapBox_'+n)
|
|
663
|
+
CollapBox=getattr(self.ui,'CollapBox_'+n)
|
|
664
|
+
if flag:
|
|
665
|
+
push.show()
|
|
666
|
+
else:
|
|
667
|
+
push.hide()
|
|
668
|
+
w=getattr(self.ui,'CollapBox_'+n)
|
|
669
|
+
#w.setFocus()
|
|
670
|
+
CollapBox.FlagPush=flag
|
|
671
|
+
if self.PROpar.FlagCustom:
|
|
672
|
+
self.ui.button_save_custom.show()
|
|
673
|
+
self.ui.label_top.setText("Modified from ")
|
|
674
|
+
self.ui.button_CollapBox_top.show()
|
|
675
|
+
self.ui.CollapBox_top.FlagPush=True
|
|
676
|
+
else:
|
|
677
|
+
self.ui.button_save_custom.hide()
|
|
678
|
+
self.ui.label_top.setText("Current")
|
|
679
|
+
self.ui.button_CollapBox_top.hide()
|
|
680
|
+
self.ui.CollapBox_top.FlagPush=False
|
|
681
|
+
|
|
682
|
+
#*************************************************** From Parameters to UI
|
|
683
|
+
def setPROlayout(self):
|
|
684
|
+
self.setPROlayout_mode()
|
|
685
|
+
self.setPROlayout_IW()
|
|
686
|
+
self.setPROlayout_ToP()
|
|
572
687
|
self.setPushCollapBoxes()
|
|
688
|
+
self.setPROlayout_Int()
|
|
689
|
+
self.setPROlayout_Valid()
|
|
690
|
+
self.setPROlayout_Wind()
|
|
691
|
+
|
|
692
|
+
#*************************************************** MODE
|
|
693
|
+
#******************** Actions
|
|
694
|
+
def combo_mode_action(self):
|
|
695
|
+
self.PROpar.mode=PROpar.mode=self.ui.combo_mode.currentIndex()
|
|
696
|
+
return
|
|
697
|
+
|
|
698
|
+
def button_save_cfg_action(self):
|
|
699
|
+
Title='Select location and name of the configuration file to save'
|
|
700
|
+
filename, _ = QFileDialog.getSaveFileName(self,Title,
|
|
701
|
+
filter=f'*.cfg',\
|
|
702
|
+
options=optionNativeDialog)
|
|
703
|
+
filename=myStandardRoot('{}'.format(str(filename)))
|
|
704
|
+
if not filename: return
|
|
705
|
+
if 'dataTreePar' not in list(globals()):
|
|
706
|
+
from .procTools import dataTreePar
|
|
707
|
+
data=dataTreePar(self.PROpar.Process,self.PROpar.Step)
|
|
708
|
+
data.setProc(PRO=self.PROpar.duplicate())
|
|
709
|
+
data.writeCfgProcPiv(filename,FlagWarningDialog=True)
|
|
710
|
+
|
|
711
|
+
#******************** Settings
|
|
712
|
+
def combo_mode_set(self):
|
|
713
|
+
self.ui.combo_mode.setCurrentIndex(PROpar.mode)
|
|
714
|
+
return
|
|
715
|
+
|
|
716
|
+
#******************** Layout
|
|
717
|
+
def setPROlayout_mode(self):
|
|
718
|
+
index=PROpar.mode
|
|
719
|
+
self.ui.CollapBox_Interp.setVisible(index>0)
|
|
720
|
+
self.ui.CollapBox_Validation.setVisible(index>1)
|
|
721
|
+
self.ui.CollapBox_Windowing.setVisible(index>1)
|
|
722
|
+
|
|
723
|
+
#*************************************************** INTERROGATION WINDOWS
|
|
724
|
+
#******************** Actions
|
|
725
|
+
def edit_Wind_vectors(self,wedit:QLineEdit,wlab:QLabel):
|
|
726
|
+
text=wedit.text()
|
|
727
|
+
split_text=re.split(r'(\d+)', text)[1:-1:2]
|
|
728
|
+
vect=[int(i) for i in split_text]
|
|
729
|
+
FlagEmpty=len(vect)==0
|
|
730
|
+
if FlagEmpty: FlagError=True
|
|
731
|
+
else: FlagError=not all([v>=w for v,w in zip(vect[:-1],vect[1:])])
|
|
732
|
+
if FlagError:
|
|
733
|
+
wlab.setPixmap(self.Lab_warning)
|
|
734
|
+
if FlagEmpty:
|
|
735
|
+
message="Please, insert at least one element!"
|
|
736
|
+
else:
|
|
737
|
+
message="Items must be inserted in decreasing order!"
|
|
738
|
+
wlab.setToolTip(message)
|
|
739
|
+
wlab.setStatusTip(message)
|
|
740
|
+
"""
|
|
741
|
+
QToolTip.showText(QCursor.pos(),wlab.toolTip(),wedit,QRect(),3000)
|
|
742
|
+
"""
|
|
743
|
+
else:
|
|
744
|
+
wlab.setPixmap(QPixmap())
|
|
745
|
+
self.PROpar.VectFlag[self.Vect_widgets.index(wedit)]=not FlagError
|
|
746
|
+
return split_text, vect, FlagError
|
|
747
|
+
|
|
748
|
+
def set_Wind_vectors(self,wedit:QLineEdit,wlab:QLabel,i):
|
|
749
|
+
_, vect, FlagError=self.edit_Wind_vectors(wedit,wlab)
|
|
750
|
+
self.set_Wind_vectors_new(i,vect,FlagError)
|
|
751
|
+
|
|
752
|
+
def set_Wind_vectors_new(self,i,vect,FlagError=False):
|
|
753
|
+
if not FlagError:
|
|
754
|
+
Nit_i=len(vect)
|
|
755
|
+
if Nit_i>self.PROpar.Nit:
|
|
756
|
+
self.PROpar.Nit=Nit_i
|
|
757
|
+
else:
|
|
758
|
+
if all([v==w for v,w in zip(vect[:Nit_i],self.PROpar.Vect[i][:Nit_i])]):
|
|
759
|
+
self.PROpar.Nit=Nit_i
|
|
760
|
+
Vect2=[]
|
|
761
|
+
for j in range(4):
|
|
762
|
+
if self.PROpar.flag_rect_wind:
|
|
763
|
+
k=j
|
|
764
|
+
else:
|
|
765
|
+
k=j%2
|
|
766
|
+
if k==i:
|
|
767
|
+
Vect2.append(copy.deepcopy(vect))
|
|
768
|
+
else:
|
|
769
|
+
Vect2.append(copy.deepcopy(self.PROpar.Vect[k]))
|
|
770
|
+
self.PROpar.Vect=self.adjustVect(Vect2)
|
|
771
|
+
self.line_edit_size_set()
|
|
772
|
+
|
|
773
|
+
def adjustVect(self,Vect):
|
|
774
|
+
for i,v in enumerate(Vect):
|
|
775
|
+
if self.PROpar.Nit<len(v):
|
|
776
|
+
Vect[i]=v[:self.PROpar.Nit]
|
|
777
|
+
elif self.PROpar.Nit>len(v):
|
|
778
|
+
Vect[i]=v+[v[-1] for _ in range(self.PROpar.Nit-len(v))] #np.append(v,np.repeat(v[-1],self.PROpar.Nit-len(v)))
|
|
779
|
+
"""
|
|
780
|
+
rep=np.array([0,0,0,0])
|
|
781
|
+
for i,v in enumerate(Vect):
|
|
782
|
+
if len(v)>1:
|
|
783
|
+
while rep[i]<len(v)-1:
|
|
784
|
+
if v[-1-rep[i]]==v[-2-rep[i]]: rep[i]+=1
|
|
785
|
+
else: break
|
|
786
|
+
#si potrebbe programmare meglio...
|
|
787
|
+
dit=np.min(rep)
|
|
788
|
+
if dit:
|
|
789
|
+
self.PROpar.Nit-=dit
|
|
790
|
+
for i in range(4):
|
|
791
|
+
Vect[i]=Vect[i][:self.PROpar.Nit]
|
|
792
|
+
self.ui.spin_final_iter.setValue(self.ui.spin_final_iter.value()+dit)
|
|
793
|
+
"""
|
|
794
|
+
self.line_edit_size_set()
|
|
795
|
+
return Vect
|
|
796
|
+
|
|
797
|
+
def button_more_size_action(self):
|
|
798
|
+
self.PROpar.flag_rect_wind=not self.PROpar.flag_rect_wind
|
|
799
|
+
if not self.PROpar.flag_rect_wind:
|
|
800
|
+
self.PROpar.Vect[2]=copy.deepcopy(self.PROpar.Vect[0])
|
|
801
|
+
self.PROpar.Vect[3]=copy.deepcopy(self.PROpar.Vect[1])
|
|
802
|
+
|
|
803
|
+
def check_Bordo_action(self):
|
|
804
|
+
if self.ui.check_Bordo.isChecked():
|
|
805
|
+
self.PROpar.FlagBordo=1
|
|
806
|
+
else:
|
|
807
|
+
self.PROpar.FlagBordo=0
|
|
808
|
+
pass
|
|
809
|
+
|
|
810
|
+
#******************** Settings
|
|
811
|
+
def line_edit_size_set(self):
|
|
812
|
+
for i in range(len(self.Vect_widgets)):
|
|
813
|
+
w=self.Vect_widgets[i]
|
|
814
|
+
v=self.PROpar.Vect[i]
|
|
815
|
+
l=self.Vect_Lab_widgets[i]
|
|
816
|
+
text="".join([str(t)+", " for t in v[:-1]]) + str(v[-1])
|
|
817
|
+
w.setText(text)
|
|
818
|
+
if self.PROpar.VectFlag[i]:
|
|
819
|
+
l.setPixmap(self.Lab_greenv)
|
|
820
|
+
l.setToolTip('')
|
|
821
|
+
l.setStatusTip('')
|
|
822
|
+
else:
|
|
823
|
+
l.setPixmap(self.Lab_redx)
|
|
824
|
+
self.check_more_iter()
|
|
825
|
+
|
|
826
|
+
def button_more_size_set(self):
|
|
827
|
+
self.ui.button_more_size.setChecked(self.PROpar.flag_rect_wind)
|
|
828
|
+
|
|
829
|
+
#******************** Layout
|
|
830
|
+
def setPROlayout_IW(self):
|
|
831
|
+
if self.PROpar.flag_rect_wind:
|
|
832
|
+
self.ui.button_more_size.setIcon(self.icon_minus)
|
|
833
|
+
self.ui.w_IW_size_2.show()
|
|
834
|
+
#self.ui.label_size.setText("Width")
|
|
835
|
+
#self.ui.label_spacing.setText("Horizontal")
|
|
836
|
+
self.ui.label_size.setText("Height")
|
|
837
|
+
self.ui.label_spacing.setText("Vertical")
|
|
838
|
+
else:
|
|
839
|
+
self.ui.button_more_size.setIcon(self.icon_plus)
|
|
840
|
+
self.ui.w_IW_size_2.hide()
|
|
841
|
+
self.ui.label_size.setText("Size")
|
|
842
|
+
self.ui.label_spacing.setText("Spacing")
|
|
843
|
+
|
|
844
|
+
#*************************************************** FINAL ITERATIONS
|
|
845
|
+
#******************** Actions
|
|
846
|
+
def spin_final_iter_action(self):
|
|
847
|
+
self.PROpar.NIterazioni=self.ui.spin_final_iter.value()
|
|
848
|
+
self.check_more_iter()
|
|
849
|
+
|
|
850
|
+
def check_DC_action(self):
|
|
851
|
+
self.PROpar.FlagDirectCorr=int(self.ui.check_DC.isChecked())
|
|
852
|
+
self.PROpar.vDC=[self.PROpar.FlagDirectCorr]*len(self.PROpar.vDC)
|
|
853
|
+
|
|
854
|
+
#******************** Settings
|
|
855
|
+
def spin_final_iter_preset(self):
|
|
856
|
+
if self.PROpar.FlagAdaptative:
|
|
857
|
+
self.ui.spin_final_iter.setMinimum(minNIterAdaptative)
|
|
858
|
+
else:
|
|
859
|
+
self.ui.spin_final_iter.setMinimum(0)
|
|
860
|
+
|
|
861
|
+
def spin_final_iter_set(self):
|
|
862
|
+
self.ui.spin_final_iter.setValue(self.PROpar.NIterazioni)
|
|
863
|
+
|
|
864
|
+
def check_DC_set(self):
|
|
865
|
+
self.ui.check_DC.setChecked(self.PROpar.FlagDirectCorr)
|
|
866
|
+
|
|
867
|
+
#*************************************************** TYPE OF PROCESS
|
|
868
|
+
#******************** Actions
|
|
869
|
+
def combo_top_action(self):
|
|
870
|
+
self.PROpar.prev_top=self.ui.combo_top.currentIndex()
|
|
871
|
+
if not self.PROpar.top:
|
|
872
|
+
self.setPROpar_custom()
|
|
873
|
+
else:
|
|
874
|
+
self.PROpar.change_top(self.PROpar.top)
|
|
875
|
+
return
|
|
876
|
+
|
|
877
|
+
def setPROpar_custom(self):
|
|
878
|
+
fields=[f for f in self.PROpar.fields if not f in self.PROpar.IW_fields+['ind']]
|
|
879
|
+
i=self.combo_custom_top_ind()
|
|
880
|
+
if len(self.PROpar_customs) and i>-1:
|
|
881
|
+
self.PROpar.copyfromfields(self.PROpar_customs[i],fields)
|
|
882
|
+
else:
|
|
883
|
+
self.PROpar.copyfromfields(self.PROpar_custom,fields)
|
|
573
884
|
|
|
574
|
-
def
|
|
885
|
+
def combo_custom_top_action(self):
|
|
886
|
+
self.PROpar.custom_top_name=self.ui.combo_custom_top.currentText()
|
|
887
|
+
self.combo_top_action()
|
|
888
|
+
|
|
889
|
+
def button_save_custom_action(self):
|
|
575
890
|
name=self.save_as_custom()
|
|
576
891
|
if name!='':
|
|
577
|
-
if name in self.
|
|
578
|
-
k=self.
|
|
579
|
-
self.
|
|
580
|
-
|
|
892
|
+
if name in self.custom_top_items:
|
|
893
|
+
k=self.custom_top_items.index(name)
|
|
894
|
+
self.custom_top_items.pop(k)
|
|
895
|
+
self.PROpar_customs.pop(k)
|
|
896
|
+
self.custom_top_items.insert(0,name)
|
|
581
897
|
self.PROpar_customs.insert(0,self.PROpar.duplicate())
|
|
582
|
-
self.
|
|
898
|
+
rewriteCustomList(self.custom_top_items)
|
|
583
899
|
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
self.check_reset()
|
|
589
|
-
self.PROpar_custom.copyfrom(self.PROpar)
|
|
590
|
-
self.FlagAddFunc=True
|
|
900
|
+
self.PROpar_custom.copyfrom(self.PROpar)
|
|
901
|
+
self.PROpar.top=0
|
|
902
|
+
self.PROpar.FlagCustom=False
|
|
903
|
+
return True #prevent addition of redos/undos
|
|
591
904
|
|
|
592
905
|
def save_as_custom(self):
|
|
593
906
|
title="Save custom type of process"
|
|
594
907
|
label="Enter the name of the custom type of process:"
|
|
595
|
-
ok,text=inputDialog(self,title,label,completer_list=self.
|
|
908
|
+
ok,text=inputDialog(self,title,label,completer_list=self.custom_top_items)
|
|
596
909
|
|
|
597
910
|
if ok and text!='':
|
|
598
911
|
filename=pro_path+text+outExt.pro
|
|
@@ -600,130 +913,75 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
600
913
|
Message=f'Process "{text}" already exists.\nDo you want to overwrite it?'
|
|
601
914
|
flagOverwrite=questionDialog(self,Message)
|
|
602
915
|
if not flagOverwrite: return
|
|
603
|
-
|
|
916
|
+
OptionValidRoot=True
|
|
604
917
|
else:
|
|
605
918
|
dummyfilename=pro_path+text+outExt.dum
|
|
606
919
|
try:
|
|
607
920
|
open(dummyfilename,'w')
|
|
608
921
|
except:
|
|
609
|
-
|
|
922
|
+
OptionValidRoot=False
|
|
610
923
|
else:
|
|
611
|
-
|
|
924
|
+
OptionValidRoot=True
|
|
612
925
|
finally:
|
|
613
926
|
if os.path.exists(dummyfilename):
|
|
614
927
|
os.remove(dummyfilename)
|
|
615
|
-
if not
|
|
928
|
+
if not OptionValidRoot:
|
|
616
929
|
warningDialog(self,'Invalid root name! Please, retry.')
|
|
617
930
|
return
|
|
618
931
|
|
|
619
932
|
try:
|
|
620
933
|
with open(filename,'wb') as file:
|
|
621
934
|
|
|
622
|
-
self.PROpar.top=
|
|
935
|
+
self.PROpar.top=0
|
|
623
936
|
self.PROpar.FlagCustom=False
|
|
624
937
|
self.PROpar.name=text
|
|
625
938
|
|
|
626
939
|
pickle.dump(self.PROpar,file)
|
|
627
940
|
pri.Info.blue(f'Saving custom process file {filename}')
|
|
628
941
|
except Exception as inst:
|
|
629
|
-
pri.Error.red(f'Error while saving custom process file {filename}:\n{traceback.
|
|
942
|
+
pri.Error.red(f'Error while saving custom process file {filename}:\n{traceback.format_exc()}\n\n{inst}')
|
|
630
943
|
text=''
|
|
631
944
|
return text
|
|
632
945
|
|
|
633
|
-
def
|
|
634
|
-
|
|
635
|
-
rewriteCustomList(self.custom_list)
|
|
636
|
-
self.ui.combo_custom_top.clear()
|
|
637
|
-
self.ui.combo_custom_top.addItems(self.custom_list)
|
|
638
|
-
|
|
639
|
-
def button_edit_custom_callback(self):
|
|
640
|
-
self.edit_dlg = Custom_Top(self.custom_list)
|
|
946
|
+
def button_edit_custom_action(self):
|
|
947
|
+
self.edit_dlg = Custom_Top(self.custom_top_items)
|
|
641
948
|
self.edit_dlg.close=lambda: self.edit_dlg.done(0)
|
|
642
949
|
self.edit_dlg.exec()
|
|
643
|
-
|
|
950
|
+
|
|
644
951
|
self.edit_dlg.close()
|
|
952
|
+
self.setCustomTops()
|
|
953
|
+
self.combo_custom_top_preset()
|
|
954
|
+
self.combo_top_action()
|
|
955
|
+
return
|
|
956
|
+
|
|
957
|
+
def setCustomTops(self):
|
|
645
958
|
self.PROpar_customs=[]
|
|
646
|
-
self.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
959
|
+
self.custom_top_items=setCustomList(lambda var,name: self.PROpar_customs.append(var))
|
|
960
|
+
|
|
961
|
+
#******************** Settings
|
|
962
|
+
def combo_custom_top_preset(self):
|
|
963
|
+
custom_list=[self.ui.combo_custom_top.itemText(i) for i in range(self.ui.combo_custom_top.count())]
|
|
964
|
+
if custom_list!=self.custom_top_items:
|
|
965
|
+
self.ui.combo_custom_top.clear()
|
|
966
|
+
self.ui.combo_custom_top.addItems(self.custom_top_items)
|
|
967
|
+
|
|
968
|
+
def combo_custom_top_set(self):
|
|
969
|
+
self.ui.combo_custom_top.setCurrentIndex(self.combo_custom_top_ind())
|
|
970
|
+
|
|
971
|
+
def combo_custom_top_ind(self):
|
|
972
|
+
if self.PROpar.custom_top_name in self.custom_top_items:
|
|
973
|
+
ind=self.custom_top_items.index(self.PROpar.custom_top_name)
|
|
651
974
|
else:
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
self.PROpar_custom.copyfrom(self.PROpar)
|
|
655
|
-
return [0,None]
|
|
975
|
+
ind=0
|
|
976
|
+
return ind
|
|
656
977
|
|
|
657
|
-
|
|
658
|
-
def
|
|
659
|
-
#pri.Time.blue(1,'setPROpar: Beginning')
|
|
660
|
-
self.ui.combo_mode.setCurrentIndex(self.ui.combo_mode.findText(self.PROpar.mode))
|
|
661
|
-
self.setMode()
|
|
662
|
-
self.setPROpar_IW()
|
|
663
|
-
self.setPROpar_FinIt()
|
|
664
|
-
self.setPROpar_ToP()
|
|
665
|
-
self.setPROpar_Int()
|
|
666
|
-
self.setPROpar_Valid()
|
|
667
|
-
self.setPROpar_Wind()
|
|
668
|
-
self.check_reset()
|
|
669
|
-
#pri.Time.blue(0,'setPROpar: end')
|
|
670
|
-
|
|
671
|
-
def setPushCollapBoxes(self,*args):
|
|
672
|
-
if len(args):
|
|
673
|
-
cb=args #tuple
|
|
674
|
-
else:
|
|
675
|
-
cb=('FinIt','Interp','Validation','Windowing','ToP')
|
|
676
|
-
for n in cb:
|
|
677
|
-
if n!='ToP':
|
|
678
|
-
flag=getattr(self.PROpar,'Flag'+n+'_reset')
|
|
679
|
-
push=getattr(self.ui,'push_CollapBox_'+n)
|
|
680
|
-
CollapBox=getattr(self.ui,'CollapBox_'+n)
|
|
681
|
-
if flag:
|
|
682
|
-
push.show()
|
|
683
|
-
else:
|
|
684
|
-
push.hide()
|
|
685
|
-
w=getattr(self.ui,'CollapBox_'+n)
|
|
686
|
-
w.setFocus()
|
|
687
|
-
CollapBox.FlagPush=flag
|
|
688
|
-
if self.PROpar.FlagCustom:
|
|
689
|
-
self.ui.button_save_custom.show()
|
|
690
|
-
self.ui.label_top.setText("Modified from ")
|
|
691
|
-
self.ui.push_CollapBox_top.show()
|
|
692
|
-
self.ui.CollapBox_top.FlagPush=True
|
|
693
|
-
else:
|
|
694
|
-
self.ui.button_save_custom.hide()
|
|
695
|
-
self.ui.label_top.setText("Current")
|
|
696
|
-
self.ui.push_CollapBox_top.hide()
|
|
697
|
-
self.ui.CollapBox_top.FlagPush=False
|
|
698
|
-
|
|
699
|
-
def setPROpar_IW(self):
|
|
700
|
-
#Interrogation Windows
|
|
701
|
-
self.ui.button_more_size.setChecked(self.PROpar.flag_rect_wind)
|
|
702
|
-
self.button_more_size_check()
|
|
703
|
-
self.setVect()
|
|
704
|
-
self.ui.check_flag_boundary.setChecked(not self.PROpar.FlagBordo==0)
|
|
705
|
-
|
|
706
|
-
def setPROpar_FinIt(self):
|
|
707
|
-
#Final iterations
|
|
708
|
-
NIterazioni=self.PROpar.NIterazioni
|
|
709
|
-
if self.PROpar.FlagAdaptative:
|
|
710
|
-
self.ui.spin_final_iter.setMinimum(minNIterAdaotative)
|
|
711
|
-
else:
|
|
712
|
-
self.ui.spin_final_iter.setMinimum(0)
|
|
713
|
-
self.ui.spin_final_iter.setValue(NIterazioni)
|
|
714
|
-
self.ui.check_DC.setChecked(self.PROpar.FlagDirectCorr)
|
|
715
|
-
|
|
716
|
-
def setPROpar_ToP(self):
|
|
978
|
+
#******************** Layout
|
|
979
|
+
def setPROlayout_ToP(self):
|
|
717
980
|
#Type of process
|
|
718
|
-
|
|
719
|
-
self.ui.
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
self.ui.w_custom_top.show()
|
|
723
|
-
else:
|
|
724
|
-
self.ui.w_custom_top.hide()
|
|
725
|
-
if flag:
|
|
726
|
-
flagEn=bool(len(self.custom_list))
|
|
981
|
+
flagCustomTop=self.PROpar.top==0
|
|
982
|
+
self.ui.w_custom_top.setVisible(flagCustomTop)
|
|
983
|
+
if flagCustomTop:
|
|
984
|
+
flagEn=bool(len(self.custom_top_items))
|
|
727
985
|
if flagEn:
|
|
728
986
|
self.ui.label_custom_top.setText('Custom types')
|
|
729
987
|
else:
|
|
@@ -731,325 +989,309 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
731
989
|
self.ui.combo_custom_top.setEnabled(flagEn)
|
|
732
990
|
#self.ui.button_edit_custom.setEnabled(flagEn)
|
|
733
991
|
if flagEn:
|
|
734
|
-
|
|
735
|
-
|
|
992
|
+
i=-1
|
|
993
|
+
fields=['name']+self.PROpar.FinalIt_fields+self.PROpar.Int_fields+self.PROpar.Validation_fields+self.PROpar.Wind_fields
|
|
994
|
+
for k,p in enumerate(self.PROpar_customs):
|
|
995
|
+
if p.isEqualTo(self.PROpar,[],fields): i=k
|
|
996
|
+
if i>-1:
|
|
736
997
|
self.ui.combo_custom_top.setCurrentIndex(i)
|
|
737
|
-
#self.check_reset()
|
|
738
|
-
|
|
739
|
-
def checkFlagCustom(self):
|
|
740
|
-
i=-1
|
|
741
|
-
fields=['name']+self.PROpar.FinalIt_fields+self.PROpar.Int_fields+self.PROpar.Validation_fields+self.PROpar.Wind_fields
|
|
742
|
-
for k,p in enumerate(self.PROpar_customs):
|
|
743
|
-
if p.isEqualTo(self.PROpar,[],fields): i=k
|
|
744
|
-
FlagCustom=i==-1
|
|
745
|
-
return FlagCustom,i
|
|
746
|
-
|
|
747
|
-
def setPROpar_Int(self):
|
|
748
|
-
#Interpolation
|
|
749
|
-
self.ImIntIndex2UiOptions(self.PROpar.IntIniz,self.ui.combo_ImInt,self.ui.w_ImInt_par)
|
|
750
|
-
self.ImIntIndex2UiOptions(self.PROpar.IntFin,self.ui.combo_ImInt_2,self.ui.w_ImInt_par_2)
|
|
751
|
-
self.ui.button_more_iter.setChecked(int(self.PROpar.FlagInt))
|
|
752
|
-
self.button_more_iter_check()
|
|
753
|
-
self.ui.combo_correlation.setCurrentIndex(self.PROpar.IntCorr)
|
|
754
|
-
self.VelIntIndex2UiOptions(self.PROpar.IntVel,self.ui.combo_int_vel,self.ui.w_VelInt_par)
|
|
755
|
-
|
|
756
|
-
def setPROpar_Valid(self):
|
|
757
|
-
#Validation
|
|
758
|
-
self.setValidationType()
|
|
759
|
-
self.ui.spin_MinVal.setValue(self.PROpar.SogliaNoise)
|
|
760
|
-
self.ui.spin_MinStD.setValue(self.PROpar.SogliaStd)
|
|
761
|
-
self.ui.combo_Correction_type.setCurrentIndex(self.PROpar.FlagCorrezioneVel)
|
|
762
|
-
self.ui.check_second_peak.setChecked(int(self.PROpar.FlagSecMax))
|
|
763
|
-
self.ui.check_Hart.setChecked(int(self.PROpar.FlagCorrHart))
|
|
764
|
-
|
|
765
|
-
def setPROpar_Wind(self):
|
|
766
|
-
#Windowing
|
|
767
|
-
self.set_table_iter_items()
|
|
768
|
-
self.ui.radio_Adaptative.setChecked(not self.PROpar.FlagAdaptative==0)
|
|
769
|
-
self.ui.spin_adaptative_iter.setValue(self.PROpar.NItAdaptative)
|
|
770
|
-
self.ui.spin_min_Corr.setValue(self.PROpar.MinC)
|
|
771
|
-
self.spin_min_Corr_callback()
|
|
772
|
-
self.ui.spin_max_Corr.setValue(self.PROpar.MaxC)
|
|
773
|
-
self.spin_max_Corr_callback()
|
|
774
|
-
self.ui.spin_min_Lar.setValue(self.PROpar.LarMin)
|
|
775
|
-
self.spin_min_Lar_callback()
|
|
776
|
-
self.ui.spin_max_Lar.setValue(self.PROpar.LarMax)
|
|
777
|
-
self.spin_max_Lar_callback()
|
|
778
|
-
self.ui.combo_type_of_DCs.setCurrentIndex(self.PROpar.FlagSommaProd)
|
|
779
|
-
|
|
780
|
-
def set_table_iter_items(self):
|
|
781
|
-
self.FlagTableSetting=True
|
|
782
|
-
self.adjustPar()
|
|
783
|
-
|
|
784
|
-
self.listClear()
|
|
785
|
-
nWind=len(self.PROpar.vFlagCalcVel)
|
|
786
|
-
Nit=self.PROpar.Nit
|
|
787
|
-
NIterazioni=self.PROpar.NIterazioni
|
|
788
|
-
self.ui.table_iter.RowInfo=['']*nWind
|
|
789
998
|
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
999
|
+
#*************************************************** INTERPOLATION
|
|
1000
|
+
#******************** Actions
|
|
1001
|
+
def combo_ImInt_action_gen(self,par:str,w:QComboBox,p:QStackedWidget,ImInt_ind_list:list):
|
|
1002
|
+
ind_old=getattr(self.PROpar,par)
|
|
1003
|
+
if w.currentText()==ImInt_items[0]: #none
|
|
1004
|
+
ind=0
|
|
1005
|
+
elif w.currentText()==ImInt_items[4]: #Quad4Simplex
|
|
1006
|
+
ind=1
|
|
1007
|
+
elif w.currentText()==ImInt_items[1]: #Moving S, aS
|
|
1008
|
+
q=p.widget(1)
|
|
1009
|
+
qcombo:QComboBox=q.findChild(QComboBox)
|
|
1010
|
+
ind=qcombo.currentIndex()+3
|
|
1011
|
+
elif w.currentText()==ImInt_items[3]: #BiLinear, BiQuad, BiCubic, BiCubic Matlab
|
|
1012
|
+
q=p.widget(2)
|
|
1013
|
+
qcombo=q.findChild(QComboBox)
|
|
1014
|
+
indeff=(5,2,7,6)
|
|
1015
|
+
ind=indeff[qcombo.currentIndex()]
|
|
1016
|
+
elif w.currentText()==ImInt_items[2]: #Linear revitalized
|
|
1017
|
+
ind=10
|
|
1018
|
+
elif w.currentText()==ImInt_items[5]: #Shift
|
|
1019
|
+
q=p.widget(3)
|
|
1020
|
+
qspin:QSpinBox=q.findChild(QSpinBox)
|
|
1021
|
+
if ind_old>=23 and ind_old<=40:
|
|
1022
|
+
ind=qspin.value()+20
|
|
1023
|
+
else:
|
|
1024
|
+
ind=ImInt_ind_list[0]+20
|
|
1025
|
+
elif w.currentText()==ImInt_items[6]: #Sinc
|
|
1026
|
+
q=p.widget(p.currentIndex())
|
|
1027
|
+
qspin=q.findChild(QSpinBox)
|
|
1028
|
+
if ind_old>=41 and ind_old<=50:
|
|
1029
|
+
ind=qspin.value()+40
|
|
1030
|
+
else:
|
|
1031
|
+
ind=ImInt_ind_list[1]+40
|
|
1032
|
+
elif w.currentText()==ImInt_items[7]: #BSpline
|
|
1033
|
+
q=p.widget(p.currentIndex())
|
|
1034
|
+
qspin=q.findChild(QSpinBox)
|
|
1035
|
+
if ind_old>=52 and ind_old<=70:
|
|
1036
|
+
ind=qspin.value()+50
|
|
1037
|
+
else:
|
|
1038
|
+
ind=ImInt_ind_list[2]+50
|
|
1039
|
+
setattr(self.PROpar,par,ind)
|
|
1040
|
+
return
|
|
803
1041
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
1042
|
+
def button_more_iter_action(self):
|
|
1043
|
+
self.PROpar.FlagInt=1 if self.PROpar.FlagInt==0 else 0
|
|
1044
|
+
|
|
1045
|
+
def spin_final_it_action(self):
|
|
1046
|
+
self.PROpar.FlagInt=self.ui.spin_final_it.value()
|
|
809
1047
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
str_adapt=''
|
|
823
|
-
kVect=min([k,self.PROpar.Nit-1])
|
|
824
|
-
IWSize=f'{self.PROpar.Vect[0][kVect]} x {self.PROpar.Vect[2][kVect]}'
|
|
825
|
-
IWSpac=f'{self.PROpar.Vect[1][kVect]} x {self.PROpar.Vect[3][kVect]}'
|
|
826
|
-
self.ui.table_iter.RowInfo[k]=f'{item_name} Window size: {IWSize}, grid distance: {IWSpac}'+str_adapt
|
|
827
|
-
|
|
828
|
-
cc=genTableCell(item_name,tooltip,c,cc)
|
|
829
|
-
|
|
830
|
-
"""
|
|
831
|
-
item_name=IWSize
|
|
832
|
-
tooltip=f'Window size: {IWSize}'
|
|
833
|
-
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1048
|
+
def combo_int_vel_action_gen(self,par:str,w:QComboBox,p:QStackedWidget):
|
|
1049
|
+
for j in range(5):
|
|
1050
|
+
if w.currentText()==VelInt_items[j]: #none
|
|
1051
|
+
indeff=(1,5,2,3,4)
|
|
1052
|
+
ind=indeff[j]
|
|
1053
|
+
break
|
|
1054
|
+
if w.currentText()==VelInt_items[5]: #BSpline
|
|
1055
|
+
q=p.widget(1)
|
|
1056
|
+
qspin:QSpinBox=q.findChild(QSpinBox)
|
|
1057
|
+
ind=qspin.value()+50
|
|
1058
|
+
setattr(self.PROpar,par,ind)
|
|
1059
|
+
return
|
|
834
1060
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
1061
|
+
#******************** Settings
|
|
1062
|
+
def combo_ImInt_set_gen(self,par:str,w:QComboBox,p:QStackedWidget,ImInt_ind_list:list):
|
|
1063
|
+
ind=getattr(self.PROpar,par)
|
|
1064
|
+
if ind==0:
|
|
1065
|
+
w.setCurrentIndex(w.findText(ImInt_items[0])) #none #così se scelgo un nome diverso è automatico
|
|
1066
|
+
p.setCurrentIndex(0)
|
|
1067
|
+
elif ind==1: #Quad4Simplex
|
|
1068
|
+
w.setCurrentIndex(w.findText(ImInt_items[4]))
|
|
1069
|
+
p.setCurrentIndex(0)
|
|
1070
|
+
elif ind in (3,4): #Moving S, aS
|
|
1071
|
+
w.setCurrentIndex(w.findText(ImInt_items[1]))
|
|
1072
|
+
p.setCurrentIndex(1)
|
|
1073
|
+
q=p.widget(p.currentIndex())
|
|
1074
|
+
qcombo:QComboBox=q.findChild(QComboBox)
|
|
1075
|
+
qcombo.setCurrentIndex(ind-3)
|
|
1076
|
+
elif ind in (5,2,7,6): #BiLinear, BiQuad, BiCubic, BiCubic Matlab
|
|
1077
|
+
w.setCurrentIndex(w.findText(ImInt_items[3]))
|
|
1078
|
+
p.setCurrentIndex(2)
|
|
1079
|
+
q=p.widget(p.currentIndex())
|
|
1080
|
+
qcombo=q.findChild(QComboBox)
|
|
1081
|
+
indeff=(-1,-1, 1 ,-1,-1, 0,3,2)
|
|
1082
|
+
qcombo.setCurrentIndex(indeff[ind])
|
|
1083
|
+
elif ind==10: #Linear revitalized
|
|
1084
|
+
w.setCurrentIndex(w.findText(ImInt_items[2]))
|
|
1085
|
+
p.setCurrentIndex(0)
|
|
1086
|
+
elif ind>=23 and ind<=40: #Shift
|
|
1087
|
+
w.setCurrentIndex(w.findText(ImInt_items[5]))
|
|
1088
|
+
p.setCurrentIndex(3)
|
|
1089
|
+
q=p.widget(p.currentIndex())
|
|
1090
|
+
qlabel:QLabel=q.findChild(QLabel)
|
|
1091
|
+
qlabel.setText('Kernel width')
|
|
1092
|
+
qspin:MyQSpin=q.findChild(MyQSpin)
|
|
1093
|
+
qspin.setMinimum(3)
|
|
1094
|
+
qspin.setMaximum(20)
|
|
1095
|
+
qspin.setValue(ind-20)
|
|
1096
|
+
ImInt_ind_list[0]=ind-20
|
|
1097
|
+
elif ind>=41 and ind<=50: #Sinc
|
|
1098
|
+
w.setCurrentIndex(w.findText(ImInt_items[6]))
|
|
1099
|
+
p.setCurrentIndex(3)
|
|
1100
|
+
q=p.widget(p.currentIndex())
|
|
1101
|
+
qlabel=q.findChild(QLabel)
|
|
1102
|
+
qlabel.setText('Kernel half-width')
|
|
1103
|
+
qspin=q.findChild(MyQSpin)
|
|
1104
|
+
qspin.setMinimum(1)
|
|
1105
|
+
qspin.setMaximum(10)
|
|
1106
|
+
qspin.setValue(ind-40)
|
|
1107
|
+
ImInt_ind_list[1]=ind-40
|
|
1108
|
+
elif ind>=52 and ind<=70: #BSpline
|
|
1109
|
+
w.setCurrentIndex(w.findText(ImInt_items[7]))
|
|
1110
|
+
p.setCurrentIndex(3)
|
|
1111
|
+
q=p.widget(p.currentIndex())
|
|
1112
|
+
qlabel=q.findChild(QLabel)
|
|
1113
|
+
qlabel.setText('Order (=Kernel width-1)')
|
|
1114
|
+
qspin=q.findChild(MyQSpin)
|
|
1115
|
+
qspin.setMinimum(2)
|
|
1116
|
+
qspin.setMaximum(20)
|
|
1117
|
+
qspin.setValue(ind-50)
|
|
1118
|
+
ImInt_ind_list[2]=ind-50
|
|
1119
|
+
|
|
1120
|
+
def spin_final_it_set(self):
|
|
1121
|
+
self.ui.spin_final_it.setValue(self.PROpar.FlagInt)
|
|
839
1122
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
1123
|
+
def combo_int_vel_set_gen(self,par:str,w:QComboBox,p:QStackedWidget):
|
|
1124
|
+
ind=getattr(self.PROpar,par)
|
|
1125
|
+
if ind>=1 and ind<=5:
|
|
1126
|
+
indeff=(-1, 0,2,3,4,1)
|
|
1127
|
+
w.setCurrentIndex(w.findText(VelInt_items[indeff[ind]])) #così se scelgo un nome diverso è automatico
|
|
1128
|
+
p.setCurrentIndex(0)
|
|
1129
|
+
elif ind>=52 and ind<=70: #BSpline
|
|
1130
|
+
w.setCurrentIndex(w.findText(VelInt_items[5]))
|
|
1131
|
+
p.setCurrentIndex(1)
|
|
1132
|
+
q=p.widget(p.currentIndex())
|
|
1133
|
+
qspin:QSpinBox=q.findChild(QSpinBox)
|
|
1134
|
+
qspin.setMinimum(2)
|
|
1135
|
+
qspin.setMaximum(20)
|
|
1136
|
+
qspin.setValue(ind-50)
|
|
1137
|
+
|
|
1138
|
+
#******************** Layout
|
|
1139
|
+
def setPROlayout_Int(self):
|
|
1140
|
+
max_it=len(self.PROpar.Vect[0])+self.PROpar.NIterazioni
|
|
1141
|
+
if max_it==1:
|
|
1142
|
+
self.ui.button_more_iter.hide()
|
|
1143
|
+
else:
|
|
1144
|
+
self.ui.label_max_it.setText("of " +str(max_it)+ " iterations")
|
|
1145
|
+
self.ui.button_more_iter.show()
|
|
1146
|
+
if self.PROpar.FlagInt:
|
|
1147
|
+
self.ui.button_more_iter.setIcon(self.icon_minus)
|
|
1148
|
+
self.ui.w_ImInt_2.show()
|
|
1149
|
+
self.ui.w_ImInt_par_2.show()
|
|
1150
|
+
else:
|
|
1151
|
+
self.ui.button_more_iter.setIcon(self.icon_plus)
|
|
1152
|
+
self.ui.w_ImInt_2.hide()
|
|
1153
|
+
self.ui.w_ImInt_par_2.hide()
|
|
1154
|
+
|
|
1155
|
+
#*************************************************** VALIDATION
|
|
1156
|
+
#******************** Actions
|
|
1157
|
+
def radio_MedTest_action(self):
|
|
1158
|
+
if self.ui.radio_MedTest.isChecked():
|
|
1159
|
+
self.PROpar.FlagNogTest=0
|
|
1160
|
+
|
|
1161
|
+
def radio_SNTest_action(self):
|
|
1162
|
+
if self.ui.radio_SNTest.isChecked():
|
|
1163
|
+
self.PROpar.FlagNogTest=0
|
|
1164
|
+
|
|
1165
|
+
def radio_CPTest_action(self):
|
|
1166
|
+
if self.ui.radio_CPTest.isChecked():
|
|
1167
|
+
self.PROpar.FlagNogTest=0
|
|
848
1168
|
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
1169
|
+
def radio_Nogueira_action(self):
|
|
1170
|
+
if self.ui.radio_Nogueira.isChecked():
|
|
1171
|
+
self.PROpar.FlagMedTest=0
|
|
1172
|
+
self.PROpar.FlagSNTest=0
|
|
1173
|
+
self.PROpar.FlagCPTest=0
|
|
853
1174
|
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
tooltip=f'Maximum allowed displacement = 1/{-maxDisp:d} of the interrogation window size'
|
|
858
|
-
else:
|
|
859
|
-
item_name=f'{maxDisp} pix'
|
|
860
|
-
tooltip=f'Maximum allowed displacement = {maxDisp:d} pixels'
|
|
861
|
-
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1175
|
+
#******************** Settings
|
|
1176
|
+
def combo_TypeMed_set(self):
|
|
1177
|
+
self.ui.w_MedTest_eps.setVisible(self.PROpar.TypeMed==1 and self.PROpar.FlagMedTest)
|
|
862
1178
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
1179
|
+
#******************** Layout
|
|
1180
|
+
def setPROlayout_Valid(self):
|
|
1181
|
+
self.showMedTestwid()
|
|
1182
|
+
self.showSNTestwid()
|
|
1183
|
+
self.showCPTestwid()
|
|
1184
|
+
self.showNogTestwid()
|
|
866
1185
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
1186
|
+
def showMedTestwid(self):
|
|
1187
|
+
self.ui.label_MedTest_box.setVisible(self.PROpar.FlagMedTest)
|
|
1188
|
+
self.ui.w_MedTest_type.setVisible(self.PROpar.FlagMedTest)
|
|
1189
|
+
self.ui.w_MedTest_ker.setVisible(self.PROpar.FlagMedTest)
|
|
1190
|
+
self.ui.w_MedTest_alfa.setVisible(self.PROpar.FlagMedTest)
|
|
1191
|
+
self.ui.w_MedTest_jump.setVisible(self.PROpar.FlagMedTest)
|
|
1192
|
+
self.ui.w_MedTest_eps.setVisible(self.PROpar.TypeMed==1 and self.PROpar.FlagMedTest)
|
|
870
1193
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
self.ui.
|
|
874
|
-
self.ui.table_iter.setMaximumHeight((nWind+1)*22)
|
|
875
|
-
self.ui.CollapBox_Windowing.heightArea=(nWind+1)*22+200
|
|
876
|
-
self.ui.CollapBox_Windowing.heightOpened=self.ui.CollapBox_Windowing.heightArea+20
|
|
877
|
-
self.ui.CollapBox_Windowing.on_click()
|
|
878
|
-
self.FlagTableSetting=False
|
|
1194
|
+
def showSNTestwid(self):
|
|
1195
|
+
self.ui.label_SNTest.setVisible(self.PROpar.FlagSNTest)
|
|
1196
|
+
self.ui.w_SNTest_thres.setVisible(self.PROpar.FlagSNTest)
|
|
879
1197
|
|
|
880
|
-
|
|
1198
|
+
def showCPTestwid(self):
|
|
1199
|
+
self.ui.label_CPTest.setVisible(self.PROpar.FlagCPTest)
|
|
1200
|
+
self.ui.w_CPTest_thres.setVisible(self.PROpar.FlagCPTest)
|
|
881
1201
|
|
|
882
|
-
def
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
#FlagIntVel=(self.PROpar.IntVel==1) or (52<=self.PROpar.IntVel<=70)
|
|
887
|
-
#if FlagIntVel:
|
|
888
|
-
for j in range(2):
|
|
889
|
-
Niter=np.array([self.PROpar.NIterazioni, np.inf])
|
|
890
|
-
nPointPlot=1000
|
|
891
|
-
# A correlation window
|
|
892
|
-
Wa=self.PROpar.Vect[j*2][kVect]
|
|
893
|
-
WBase=1.5*Wa
|
|
894
|
-
FlagWindowing=self.PROpar.vFlagWindowing[k] # Weighting window for the correlation map (0=TopHat 1= Nogueira 2=Blackmann 3=top hat at 50#).
|
|
895
|
-
# B weighted average
|
|
896
|
-
FlagCalcVel=self.PROpar.vFlagCalcVel[k] # Weighting window for absolute velocity (0=TopHat, 1=Nogueira, 2=Blackmann,...)
|
|
897
|
-
hWb=self.PROpar.vSemiDimCalcVel[k]# Half-width of the filtering window (0=window dimension).
|
|
898
|
-
# C dense predictor
|
|
899
|
-
IntVel=self.PROpar.IntVel # Type of interpolation of the velocity (1=bilinear, 52-70 Bspline)
|
|
900
|
-
Wc=self.PROpar.Vect[1+j*2][kVect]# Grid distance (overlap)
|
|
901
|
-
# end input *********************************************
|
|
902
|
-
oMax=0.5 # frequenza massima per c (legata all'overlap ov/lambda) non penso che abbia senso oltre 0,5 perchè
|
|
903
|
-
# andremmo oltre Nyquist
|
|
904
|
-
|
|
905
|
-
(_,_,_,_,_,_,_,_,_,flagUnstable,_,lam,MTF,_,_,_)= mtfPIV1(Wa,FlagWindowing,hWb, FlagCalcVel,Wc, IntVel, oMax, WBase,nPointPlot,Niter,flagLambda)
|
|
906
|
-
FlagStable=FlagStable and not flagUnstable
|
|
907
|
-
if k==self.PROpar.Nit-1:
|
|
908
|
-
if j==0:
|
|
909
|
-
if self.father: Res=self.father.w_Export.OUTpar.xres
|
|
910
|
-
else: Res=0
|
|
911
|
-
self.MTF=[lam,MTF.T,f'IW size-spacing: {Wa:d}-{Wc:d}. Vel.-correl. windowing: {VelWin}-{CorrWin}.',Res]
|
|
912
|
-
|
|
913
|
-
else:
|
|
914
|
-
if self.PROpar.Vect[j*2][kVect]>self.PROpar.Vect[(j-1)*2][kVect]:
|
|
915
|
-
if self.father: Res=self.father.w_Export.OUTpar.xres*self.father.w_Export.OUTpar.pixAR
|
|
916
|
-
else: Res=0
|
|
917
|
-
self.MTF=[lam,MTF.T,f'IW size-spacing: {Wa:d}-{Wc:d}. Vel.-correl. windowing: {VelWin}-{CorrWin}.',Res]
|
|
918
|
-
if FlagStable:
|
|
919
|
-
name='stable'
|
|
920
|
-
tooltip='Stable process through an infinite number of iterations'
|
|
921
|
-
else:
|
|
922
|
-
name='⚠ unstable'
|
|
923
|
-
tooltip='Unstable process through an infinite number of iterations'
|
|
924
|
-
#else:
|
|
925
|
-
# name='-'
|
|
926
|
-
# tooltip='No information on stability available'
|
|
927
|
-
return name, tooltip
|
|
928
|
-
|
|
929
|
-
def showMTF(self):
|
|
930
|
-
self.fig_MTF, self.ax_MTF= plt.subplots()
|
|
931
|
-
self.ax_MTF.grid()
|
|
932
|
-
line_NIt=self.ax_MTF.plot(self.MTF[0],self.MTF[1][:,0],color='k',label=f'{self.PROpar.NIterazioni+1:d} iterations')
|
|
933
|
-
line_inf=self.ax_MTF.plot(self.MTF[0],self.MTF[1][:,1],color='r',linestyle='--',label='∞ iterations')
|
|
934
|
-
lgnd=self.ax_MTF.legend(loc='lower right')
|
|
935
|
-
self.ax_MTF.set(xlim=(1, np.max(self.MTF[0])),ylim=(-.30, 1.1))
|
|
936
|
-
self.ax_MTF.set_title(self.MTF[2])
|
|
937
|
-
self.ax_MTF.set_xlabel("wavelength (pixels)")
|
|
938
|
-
self.ax_MTF.set_ylabel("Modulation Transfer Function (MTF)")
|
|
939
|
-
|
|
940
|
-
self.ax_MTF.grid(which='minor', linestyle='-', alpha=0.25)
|
|
941
|
-
self.ax_MTF.minorticks_on()
|
|
942
|
-
|
|
943
|
-
if self.MTF[3]:
|
|
944
|
-
def forward(x):
|
|
945
|
-
return x/self.MTF[3]
|
|
946
|
-
def inverse(x):
|
|
947
|
-
return x*self.MTF[3]
|
|
1202
|
+
def showNogTestwid(self):
|
|
1203
|
+
self.ui.label_Nogueira.setVisible(self.PROpar.FlagNogTest)
|
|
1204
|
+
self.ui.w_Nog_tol.setVisible(self.PROpar.FlagNogTest)
|
|
1205
|
+
self.ui.w_Nog_numvec.setVisible(self.PROpar.FlagNogTest)
|
|
948
1206
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
1207
|
+
#*************************************************** WINDOWING
|
|
1208
|
+
#******************** Actions
|
|
1209
|
+
def combo_Wind_Vel_action_gen(self,par:str,w:QComboBox,p:QStackedWidget):
|
|
1210
|
+
if w.currentText()==Wind_items[0]: # top-hat/rectangular
|
|
1211
|
+
q=p.widget(1)
|
|
1212
|
+
qcombo:QComboBox=q.findChild(QComboBox)
|
|
1213
|
+
indeff=(0,3,4)
|
|
1214
|
+
ind=indeff[qcombo.currentIndex()]
|
|
1215
|
+
elif w.currentText()==Wind_items[1]: # Nogueira
|
|
1216
|
+
q=p.widget(2)
|
|
1217
|
+
qcombo=q.findChild(QComboBox)
|
|
1218
|
+
indeff=(1,21)
|
|
1219
|
+
ind=indeff[qcombo.currentIndex()]
|
|
1220
|
+
elif w.currentText()==Wind_items[2]: # Blackman
|
|
1221
|
+
"""
|
|
1222
|
+
#Blackman options
|
|
1223
|
+
q=p.widget(3)
|
|
1224
|
+
qcombo=q.findChild(QComboBox)
|
|
1225
|
+
indeff=(5,2,6)
|
|
1226
|
+
ind=indeff[qcombo.currentIndex()]
|
|
1227
|
+
"""
|
|
1228
|
+
ind=2
|
|
1229
|
+
elif w.currentText()==Wind_items[3]: # Blackman-Harris
|
|
1230
|
+
q=p.widget(4)
|
|
1231
|
+
qcombo=q.findChild(QComboBox)
|
|
1232
|
+
indeff=(7,8,9,10)
|
|
1233
|
+
ind=indeff[qcombo.currentIndex()]
|
|
1234
|
+
elif w.currentText()==Wind_items[4]: # Triangular
|
|
1235
|
+
ind=22
|
|
1236
|
+
elif w.currentText()==Wind_items[5]: # Hann
|
|
1237
|
+
ind=23
|
|
1238
|
+
elif w.currentText()==Wind_items[6]: # Gaussian
|
|
1239
|
+
q=p.widget(5)
|
|
1240
|
+
qspin:MyQDoubleSpin=q.findChild(MyQDoubleSpin)
|
|
1241
|
+
ind=int(qspin.value()*10+100)
|
|
1242
|
+
setattr(self.PROpar,par,ind)
|
|
1243
|
+
if w.objectName()=='combo_Wind_Corr_type':
|
|
1244
|
+
self.PROpar.vFlagWindowing[self.PROpar.row]=self.PROpar.FlagWindowing
|
|
1245
|
+
self.PROpar.col=1
|
|
952
1246
|
else:
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
for item in ([self.ax_MTF.title, self.ax_MTF.xaxis.label, self.ax_MTF.yaxis.label] +self.ax_MTF.get_xticklabels() + self.ax_MTF.get_yticklabels()+addTexts+lgnd.get_texts()):
|
|
956
|
-
item.set_fontsize(self.font().pixelSize())
|
|
957
|
-
self.fig_MTF.tight_layout()
|
|
958
|
-
|
|
959
|
-
self.window().setEnabled(False)
|
|
960
|
-
self.fig_MTF.canvas.mpl_connect('close_event', lambda e: self.window().setEnabled(True))
|
|
961
|
-
self.fig_MTF.canvas.manager.set_window_title('Modulation Transfer Function')
|
|
962
|
-
self.fig_MTF.canvas.manager.window.setWindowIcon(self.windowIcon())
|
|
963
|
-
self.fig_MTF.show()
|
|
964
|
-
return
|
|
965
|
-
|
|
966
|
-
def adjustPar(self):
|
|
967
|
-
Nit=self.PROpar.Nit
|
|
968
|
-
fields=['vFlagCalcVel','vFlagWindowing','vSemiDimCalcVel','vDC','vMaxDisp']
|
|
969
|
-
for f in fields:
|
|
970
|
-
v=getattr(self.PROpar,f)
|
|
971
|
-
nWind=len(v)
|
|
972
|
-
if nWind>Nit:
|
|
973
|
-
for k in range(nWind-1,Nit-1,-1):
|
|
974
|
-
v.pop(k)
|
|
975
|
-
elif nWind<Nit:
|
|
976
|
-
for k in range(nWind,Nit):
|
|
977
|
-
v.append(v[-1])
|
|
978
|
-
if self.PROpar.FlagAdaptative:
|
|
979
|
-
self.PROpar.vSemiDimCalcVel[-1]=self.PROpar.LarMin
|
|
980
|
-
self.PROpar.vFlagCalcVel+=[self.PROpar.vFlagCalcVel[-1]] #+=[2] per BL
|
|
981
|
-
self.PROpar.vFlagWindowing+=[self.PROpar.vFlagWindowing[-1]] #+=[2] per BL
|
|
982
|
-
self.PROpar.vSemiDimCalcVel+=[self.PROpar.LarMax]
|
|
983
|
-
self.PROpar.vMaxDisp+=[self.PROpar.vMaxDisp[-1]]
|
|
984
|
-
self.PROpar.vDC+=[self.PROpar.vDC[-1]]
|
|
985
|
-
if not self.PROpar.FlagDirectCorr:
|
|
986
|
-
self.PROpar.vDC=[0]*len(self.PROpar.vDC)
|
|
987
|
-
self.PROpar.row=len(self.PROpar.vFlagCalcVel)-1 if self.PROpar.row>=len(self.PROpar.vFlagCalcVel)-1 else self.PROpar.row
|
|
1247
|
+
self.PROpar.vFlagCalcVel[self.PROpar.row]=self.PROpar.FlagCalcVel
|
|
1248
|
+
self.PROpar.col=2
|
|
988
1249
|
return
|
|
1250
|
+
|
|
1251
|
+
def spin_Wind_halfwidth_action(self):
|
|
1252
|
+
self.PROpar.SemiDimCalcVel=self.ui.spin_Wind_halfwidth.value()
|
|
1253
|
+
self.PROpar.vSemiDimCalcVel[self.PROpar.row]=self.PROpar.SemiDimCalcVel
|
|
1254
|
+
self.PROpar.col=2
|
|
989
1255
|
|
|
990
|
-
def
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
self.
|
|
995
|
-
|
|
1256
|
+
def combo_MaxDisp_type_action(self):
|
|
1257
|
+
ind=self.ui.combo_MaxDisp_type.currentIndex()
|
|
1258
|
+
k=min([self.PROpar.row,self.PROpar.Nit-1])
|
|
1259
|
+
if self.PROpar.MaxDisp<0 and ind==1:
|
|
1260
|
+
self.PROpar.MaxDisp=int(1/(-self.PROpar.MaxDisp)*min( [self.PROpar.Vect[0][k], self.PROpar.Vect[2][k]] ))
|
|
1261
|
+
elif self.PROpar.MaxDisp>0 and ind==0:
|
|
1262
|
+
maxDisp=round(min( [self.PROpar.Vect[0][k], self.PROpar.Vect[2][k]] )/self.PROpar.MaxDisp)
|
|
1263
|
+
if maxDisp in [2,3,4,5]:
|
|
1264
|
+
self.PROpar.MaxDisp=-maxDisp
|
|
1265
|
+
elif maxDisp<2:
|
|
1266
|
+
self.PROpar.MaxDisp=-2
|
|
1267
|
+
else:
|
|
1268
|
+
self.PROpar.MaxDisp=-5
|
|
1269
|
+
self.PROpar.vMaxDisp[self.PROpar.row]=self.PROpar.MaxDisp
|
|
1270
|
+
self.PROpar.col=3
|
|
1271
|
+
|
|
1272
|
+
def combo_MaxDisp_action(self):
|
|
1273
|
+
ind=self.ui.combo_MaxDisp_type.currentIndex()
|
|
1274
|
+
if ind:
|
|
1275
|
+
self.PROpar.MaxDisp=self.ui.spin_MaxDisp_absolute.value()
|
|
1276
|
+
else:
|
|
1277
|
+
self.PROpar.MaxDisp=-[2,3,4,5][self.ui.combo_MaxDisp_relative.currentIndex()]
|
|
1278
|
+
self.PROpar.vMaxDisp[self.PROpar.row]=self.PROpar.MaxDisp
|
|
1279
|
+
self.PROpar.col=3
|
|
996
1280
|
|
|
997
|
-
def
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
self.ui.table_iter.resizeInfoLabel()
|
|
1001
|
-
pri.Callback.green(f'{"*"*10} Table selection: r={self.PROpar.row}, c={self.PROpar.col}')
|
|
1281
|
+
def check_DC_it_action(self):
|
|
1282
|
+
self.PROpar.vDC[self.PROpar.row]=int(self.ui.check_DC_it.isChecked())
|
|
1283
|
+
self.PROpar.col=4
|
|
1002
1284
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
vectStr=', '.join(vect)
|
|
1006
|
-
self.ui.line_edit_IW.setText(vectStr)
|
|
1285
|
+
def radio_Adaptative_action(self):
|
|
1286
|
+
self.PROpar.NIterazioni=minNIterAdaptative if self.PROpar.NIterazioni<minNIterAdaptative else self.PROpar.NIterazioni
|
|
1007
1287
|
|
|
1008
|
-
|
|
1009
|
-
self.PROpar.
|
|
1010
|
-
|
|
1011
|
-
self.PROpar.MaxDisp=self.PROpar.vMaxDisp[self.PROpar.row]
|
|
1012
|
-
self.PROpar.DC=self.PROpar.vDC[self.PROpar.row]
|
|
1013
|
-
pri.Callback.green(f'{" "*10} FlagCalcVel={self.PROpar.FlagCalcVel}, FlagWindowing={self.PROpar.FlagWindowing}, SemiDimCalcVel={self.PROpar.SemiDimCalcVel}, MaxDisp={self.PROpar.MaxDisp}, DC={self.PROpar.DC}')
|
|
1014
|
-
self.VelWindIndex2UiOptions(self.PROpar.FlagCalcVel,self.ui.combo_Wind_Vel_type,self.ui.w_Wind_par)
|
|
1015
|
-
self.VelWindIndex2UiOptions(self.PROpar.FlagWindowing,self.ui.combo_Wind_Corr_type,self.ui.w_Wind_par_2)
|
|
1016
|
-
self.ui.spin_Wind_halfwidth.setValue(self.PROpar.SemiDimCalcVel)
|
|
1017
|
-
self.MaxDisp2UiOptions()
|
|
1018
|
-
self.ui.check_DC_it.setChecked(self.PROpar.vDC[self.PROpar.row])
|
|
1019
|
-
|
|
1020
|
-
self.ui.button_mtf.setVisible(r==self.PROpar.Nit-1)
|
|
1021
|
-
FlagAdaptativeNotSelected=self.PROpar.row<self.PROpar.Nit
|
|
1022
|
-
self.ui.edit_IW.setEnabled(FlagAdaptativeNotSelected)
|
|
1023
|
-
self.ui.button_add.setEnabled(FlagAdaptativeNotSelected)
|
|
1024
|
-
FlagDeleteEnabled=(FlagAdaptativeNotSelected and self.PROpar.Nit>1) or self.PROpar.row>=self.PROpar.Nit
|
|
1025
|
-
self.ui.button_delete.setEnabled(FlagDeleteEnabled)
|
|
1288
|
+
def spin_LarMin_changing(self):
|
|
1289
|
+
if self.PROpar.FlagAdaptative and self.PROpar.row==self.PROpar.Nit-1:
|
|
1290
|
+
self.ui.spin_Wind_halfwidth.setValue(self.ui.spin_LarMin.value())
|
|
1026
1291
|
|
|
1027
|
-
|
|
1028
|
-
self.ui.w_Wind_par.setEnabled(FlagAdaptativeNotSelected)
|
|
1029
|
-
self.ui.combo_Wind_Corr_type.setEnabled(FlagAdaptativeNotSelected)
|
|
1030
|
-
self.ui.w_Wind_par_2.setEnabled(FlagAdaptativeNotSelected)
|
|
1031
|
-
self.ui.spin_Wind_halfwidth.setEnabled(FlagAdaptativeNotSelected and not(self.PROpar.FlagAdaptative and self.PROpar.row==self.PROpar.Nit-1))
|
|
1032
|
-
self.ui.combo_MaxDisp_type.setEnabled(FlagAdaptativeNotSelected)
|
|
1033
|
-
self.ui.combo_MaxDisp_relative.setEnabled(FlagAdaptativeNotSelected)
|
|
1034
|
-
self.ui.spin_MaxDisp_absolute.setEnabled(FlagAdaptativeNotSelected)
|
|
1035
|
-
self.ui.check_DC_it.setEnabled(FlagAdaptativeNotSelected and self.PROpar.FlagDirectCorr)
|
|
1036
|
-
self.ui.w_Adaptative.setVisible(self.PROpar.FlagAdaptative)
|
|
1037
|
-
self.ui.w_adaptative_iter.setVisible(self.PROpar.FlagAdaptative)
|
|
1038
|
-
return
|
|
1039
|
-
|
|
1040
|
-
def table_iter_selection(self):
|
|
1041
|
-
if not self.FlagTableSetting:
|
|
1042
|
-
r=self.ui.table_iter.currentRow()
|
|
1043
|
-
c=self.ui.table_iter.currentColumn()
|
|
1044
|
-
if r!=-1 and c!=-1:
|
|
1045
|
-
self.PROpar.row=r
|
|
1046
|
-
self.PROpar.col=c
|
|
1047
|
-
self.set_table_widgets()
|
|
1048
|
-
return [0, None]
|
|
1049
|
-
|
|
1050
|
-
def line_edit_IW_callback(self):
|
|
1292
|
+
def line_edit_IW_action(self):
|
|
1051
1293
|
text=self.ui.line_edit_IW.text()
|
|
1052
|
-
split_text=re.split('(\d+)', text)[1:-1:2]
|
|
1294
|
+
split_text=re.split(r'(\d+)', text)[1:-1:2]
|
|
1053
1295
|
vect=[int(split_text[i]) for i in (0,2,1,3)]
|
|
1054
1296
|
if len(vect)==4:
|
|
1055
1297
|
k=self.PROpar.row
|
|
@@ -1058,14 +1300,14 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
1058
1300
|
if k<self.PROpar.Nit-1 and FlagValid: FlagValid=FlagValid and all([vect[i]>=self.PROpar.Vect[i][k+1] for i in range(4)])
|
|
1059
1301
|
if FlagValid:
|
|
1060
1302
|
for i in range(4):
|
|
1061
|
-
self.PROpar.Vect[i][k]=np.array([vect[i]])
|
|
1303
|
+
self.PROpar.Vect[i][k]=vect[i] #np.array([vect[i]])
|
|
1062
1304
|
else:
|
|
1063
|
-
message='IW sizes
|
|
1305
|
+
message='IW sizes o r spacings were assigned inconsistently! Please, retry!'
|
|
1064
1306
|
showTip(self,message)
|
|
1065
|
-
self.PROpar.flag_rect_wind=any(self.PROpar.Vect[0]
|
|
1307
|
+
self.PROpar.flag_rect_wind=any([v!=w for v,w in zip(self.PROpar.Vect[0],self.PROpar.Vect[2])]) or any([v!=w for v,w in zip(self.PROpar.Vect[1],self.PROpar.Vect[3])])
|
|
1066
1308
|
return
|
|
1067
|
-
|
|
1068
|
-
def
|
|
1309
|
+
|
|
1310
|
+
def line_edit_IW_addfuncin(self):
|
|
1069
1311
|
k=self.PROpar.row
|
|
1070
1312
|
label=[]
|
|
1071
1313
|
if k<self.PROpar.Nit-1:
|
|
@@ -1078,79 +1320,10 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
1078
1320
|
tip="<br>".join([label,rowInfo])
|
|
1079
1321
|
self.ui.table_iter.InfoLabel.setText(tip)
|
|
1080
1322
|
|
|
1081
|
-
def
|
|
1082
|
-
|
|
1083
|
-
self.ui.
|
|
1084
|
-
self.
|
|
1085
|
-
if not ind:
|
|
1086
|
-
ind_rel=[2,3,4,5].index(-self.PROpar.MaxDisp)
|
|
1087
|
-
self.ui.combo_MaxDisp_relative.setCurrentIndex(ind_rel)
|
|
1088
|
-
else:
|
|
1089
|
-
k=min([self.PROpar.row,self.PROpar.Nit-1])
|
|
1090
|
-
maxVal=int( 0.5*min( [self.PROpar.Vect[0][k], self.PROpar.Vect[2][k]] ) )
|
|
1091
|
-
self.ui.spin_MaxDisp_absolute.setMaximum(maxVal)
|
|
1092
|
-
self.PROpar.MaxDisp=self.PROpar.vMaxDisp[self.PROpar.row]=maxVal if self.PROpar.MaxDisp>maxVal else self.PROpar.MaxDisp
|
|
1093
|
-
self.ui.spin_MaxDisp_absolute.setValue(self.PROpar.MaxDisp)
|
|
1094
|
-
|
|
1095
|
-
def UiOptions2MaxDisp(self):
|
|
1096
|
-
ind=self.ui.combo_MaxDisp_type.currentIndex()
|
|
1097
|
-
if ind:
|
|
1098
|
-
self.PROpar.MaxDisp=self.ui.spin_MaxDisp_absolute.value()
|
|
1099
|
-
else:
|
|
1100
|
-
self.PROpar.MaxDisp=-[2,3,4,5][self.ui.combo_MaxDisp_relative.currentIndex()]
|
|
1101
|
-
self.PROpar.vMaxDisp[self.PROpar.row]=self.PROpar.MaxDisp
|
|
1102
|
-
if self.ui.combo_MaxDisp_type.hasFocus() or self.ui.combo_MaxDisp_relative.hasFocus() or self.ui.spin_MaxDisp_absolute.hasFocus():
|
|
1103
|
-
self.PROpar.col=3
|
|
1104
|
-
|
|
1105
|
-
def combo_MaxDisp_type_callback(self):
|
|
1106
|
-
ind=self.ui.combo_MaxDisp_type.currentIndex()
|
|
1107
|
-
k=min([self.PROpar.row,self.PROpar.Nit-1])
|
|
1108
|
-
if self.PROpar.MaxDisp<0 and ind==1:
|
|
1109
|
-
self.PROpar.MaxDisp=int(1/(-self.PROpar.MaxDisp)*min( [self.PROpar.Vect[0][k], self.PROpar.Vect[2][k]] ))
|
|
1110
|
-
elif self.PROpar.MaxDisp>0 and ind==0:
|
|
1111
|
-
maxDisp=round(min( [self.PROpar.Vect[0][k], self.PROpar.Vect[2][k]] )/self.PROpar.MaxDisp)
|
|
1112
|
-
if maxDisp in [2,3,4,5]:
|
|
1113
|
-
self.PROpar.MaxDisp=-maxDisp
|
|
1114
|
-
elif maxDisp<2:
|
|
1115
|
-
self.PROpar.MaxDisp=-2
|
|
1116
|
-
else:
|
|
1117
|
-
self.PROpar.MaxDisp=-5
|
|
1118
|
-
self.PROpar.vMaxDisp[self.PROpar.row]=self.PROpar.MaxDisp
|
|
1119
|
-
if self.ui.combo_MaxDisp_type.hasFocus() or self.ui.combo_MaxDisp_relative.hasFocus() or self.ui.spin_MaxDisp_absolute.hasFocus():
|
|
1120
|
-
self.PROpar.col=3
|
|
1121
|
-
|
|
1122
|
-
def check_DC_it_callback(self):
|
|
1123
|
-
self.PROpar.vDC[self.PROpar.row]=self.PROpar.DC=int(self.ui.check_DC_it.isChecked())
|
|
1124
|
-
if self.ui.check_DC_it.hasFocus():
|
|
1125
|
-
self.PROpar.col=4
|
|
1126
|
-
return [1, None]
|
|
1127
|
-
else:
|
|
1128
|
-
return [0, None]
|
|
1129
|
-
|
|
1130
|
-
def button_add_callback(self):
|
|
1131
|
-
k=self.PROpar.row
|
|
1132
|
-
for i in range(4):
|
|
1133
|
-
self.PROpar.Vect[i]=np.insert(self.PROpar.Vect[i],k,self.PROpar.Vect[i][k].copy())
|
|
1134
|
-
self.PROpar.Nit+=1
|
|
1135
|
-
fields=['vFlagCalcVel','vFlagWindowing','vSemiDimCalcVel','vDC','vMaxDisp']
|
|
1136
|
-
for f in fields:
|
|
1137
|
-
v=getattr(self.PROpar,f)
|
|
1138
|
-
v.insert(k,v[k])
|
|
1139
|
-
self.PROpar.row=k+1
|
|
1140
|
-
|
|
1141
|
-
def button_delete_callback(self):
|
|
1142
|
-
k=self.PROpar.row
|
|
1143
|
-
if k<self.PROpar.Nit:
|
|
1144
|
-
for i in range(4):
|
|
1145
|
-
self.PROpar.Vect[i]=np.delete(self.PROpar.Vect[i],k)
|
|
1146
|
-
self.PROpar.Nit-=1
|
|
1147
|
-
fields=['vFlagCalcVel','vFlagWindowing','vSemiDimCalcVel','vDC','vMaxDisp']
|
|
1148
|
-
for f in fields:
|
|
1149
|
-
v=getattr(self.PROpar,f)
|
|
1150
|
-
v.pop(k)
|
|
1151
|
-
self.PROpar.row=k-1
|
|
1152
|
-
else:
|
|
1153
|
-
self.PROpar.FlagAdaptative=0
|
|
1323
|
+
def table_iter_action(self):
|
|
1324
|
+
self.PROpar.row=self.ui.table_iter.currentRow()
|
|
1325
|
+
self.PROpar.col=self.ui.table_iter.currentColumn()
|
|
1326
|
+
pri.Callback.green(f'{"*"*10} Table selection: r={self.PROpar.row}, c={self.PROpar.col}')
|
|
1154
1327
|
|
|
1155
1328
|
def tableContextMenuEvent(self, table_iter:QTableWidget, event):
|
|
1156
1329
|
item=table_iter.currentItem()
|
|
@@ -1185,609 +1358,99 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
1185
1358
|
else:
|
|
1186
1359
|
toolTip=item.toolTip()
|
|
1187
1360
|
item.setToolTip('')
|
|
1361
|
+
item.setStatusTip('')
|
|
1188
1362
|
|
|
1189
1363
|
message='No context menu available! Please, pause processing.'
|
|
1190
|
-
tip=QToolTip(self)
|
|
1191
1364
|
toolTipDuration=self.toolTipDuration()
|
|
1192
1365
|
self.setToolTipDuration(3000)
|
|
1193
|
-
|
|
1366
|
+
QToolTip.showText(QCursor.pos(),message)
|
|
1194
1367
|
self.setToolTipDuration(toolTipDuration)
|
|
1195
1368
|
item.setToolTip(toolTip)
|
|
1369
|
+
item.setStatusTip(toolTip)
|
|
1370
|
+
|
|
1371
|
+
def button_mtf_action(self):
|
|
1372
|
+
self.fig_MTF, self.ax_MTF= plt.subplots()
|
|
1373
|
+
self.ax_MTF.grid()
|
|
1374
|
+
line_NIt=self.ax_MTF.plot(self.MTF[0],self.MTF[1][:,0],color='k',label=f'{self.PROpar.NIterazioni+1:d} iterations')
|
|
1375
|
+
line_inf=self.ax_MTF.plot(self.MTF[0],self.MTF[1][:,1],color='r',linestyle='--',label='∞ iterations')
|
|
1376
|
+
lgnd=self.ax_MTF.legend(loc='lower right')
|
|
1377
|
+
self.ax_MTF.set(xlim=(1, np.max(self.MTF[0])),ylim=(-.30, 1.1))
|
|
1378
|
+
self.ax_MTF.set_title(self.MTF[2])
|
|
1379
|
+
self.ax_MTF.set_xlabel("wavelength (pixels)")
|
|
1380
|
+
self.ax_MTF.set_ylabel("Modulation Transfer Function (MTF)")
|
|
1196
1381
|
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
self.
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1382
|
+
self.ax_MTF.grid(which='minor', linestyle='-', alpha=0.25)
|
|
1383
|
+
self.ax_MTF.minorticks_on()
|
|
1384
|
+
|
|
1385
|
+
if self.MTF[3]:
|
|
1386
|
+
def forward(x):
|
|
1387
|
+
return x/self.MTF[3]
|
|
1388
|
+
def inverse(x):
|
|
1389
|
+
return x*self.MTF[3]
|
|
1390
|
+
|
|
1391
|
+
secax = self.ax_MTF.secondary_xaxis('top', functions=(forward, inverse))
|
|
1392
|
+
secax.set_xlabel('wavelength (mm)')
|
|
1393
|
+
addTexts=[secax.xaxis.label]+secax.get_xticklabels()
|
|
1206
1394
|
else:
|
|
1207
|
-
|
|
1395
|
+
addTexts=[]
|
|
1396
|
+
|
|
1397
|
+
for item in ([self.ax_MTF.title, self.ax_MTF.xaxis.label, self.ax_MTF.yaxis.label] +self.ax_MTF.get_xticklabels() + self.ax_MTF.get_yticklabels()+addTexts+lgnd.get_texts()):
|
|
1398
|
+
item.set_fontsize(self.font().pixelSize())
|
|
1399
|
+
self.fig_MTF.tight_layout()
|
|
1400
|
+
|
|
1401
|
+
self.gui.setEnabled(False)
|
|
1402
|
+
self.fig_MTF.canvas.mpl_connect('close_event', lambda e: self.gui.setEnabled(True))
|
|
1403
|
+
self.fig_MTF.canvas.manager.set_window_title('Modulation Transfer Function')
|
|
1404
|
+
self.fig_MTF.canvas.manager.window.setWindowIcon(self.windowIcon())
|
|
1405
|
+
self.fig_MTF.show()
|
|
1208
1406
|
return
|
|
1209
|
-
|
|
1210
|
-
#*************************************************** MODE
|
|
1211
|
-
def combo_mode_callback(self):
|
|
1212
|
-
index=self.ui.combo_mode.currentIndex()
|
|
1213
|
-
PROpar.mode=mode_items[index]
|
|
1214
|
-
self.setMode()
|
|
1215
|
-
#for PRO in self.PROpar_prev:
|
|
1216
|
-
# PRO.mode=self.PROpar.mode
|
|
1217
|
-
return [-1,None]
|
|
1218
|
-
|
|
1219
|
-
def setMode(self):
|
|
1220
|
-
index=mode_items.index(PROpar.mode)
|
|
1221
|
-
if index==0:
|
|
1222
|
-
self.ui.CollapBox_Interp.hide()
|
|
1223
|
-
self.ui.CollapBox_Validation.hide()
|
|
1224
|
-
self.ui.CollapBox_Windowing.hide()
|
|
1225
|
-
elif index==1:
|
|
1226
|
-
self.ui.CollapBox_Interp.show()
|
|
1227
|
-
self.ui.CollapBox_Validation.hide()
|
|
1228
|
-
self.ui.CollapBox_Windowing.hide()
|
|
1229
|
-
elif index==2:
|
|
1230
|
-
self.ui.CollapBox_Interp.show()
|
|
1231
|
-
self.ui.CollapBox_Validation.show()
|
|
1232
|
-
self.ui.CollapBox_Windowing.show()
|
|
1233
1407
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
for i in range(
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
l.setToolTip('')
|
|
1245
|
-
else:
|
|
1246
|
-
l.setPixmap(self.Lab_redx)
|
|
1247
|
-
self.check_more_iter()
|
|
1248
|
-
|
|
1249
|
-
def button_more_size_callback(self):
|
|
1250
|
-
self.PROpar.flag_rect_wind=not self.PROpar.flag_rect_wind
|
|
1251
|
-
if not self.PROpar.flag_rect_wind:
|
|
1252
|
-
self.PROpar.Vect[2]=self.PROpar.Vect[0].copy()
|
|
1253
|
-
self.PROpar.Vect[3]=self.PROpar.Vect[1].copy()
|
|
1254
|
-
self.setVect()
|
|
1255
|
-
self.button_more_size_check()
|
|
1256
|
-
|
|
1257
|
-
def button_more_size_check(self):
|
|
1258
|
-
if self.PROpar.flag_rect_wind:
|
|
1259
|
-
self.ui.button_more_size.setIcon(self.icon_minus)
|
|
1260
|
-
self.ui.w_IW_size_2.show()
|
|
1261
|
-
#self.ui.label_size.setText("Width")
|
|
1262
|
-
#self.ui.label_spacing.setText("Horizontal")
|
|
1263
|
-
self.ui.label_size.setText("Height")
|
|
1264
|
-
self.ui.label_spacing.setText("Vertical")
|
|
1265
|
-
else:
|
|
1266
|
-
self.ui.button_more_size.setIcon(self.icon_plus)
|
|
1267
|
-
self.ui.w_IW_size_2.hide()
|
|
1268
|
-
self.ui.label_size.setText("Size")
|
|
1269
|
-
self.ui.label_spacing.setText("Spacing")
|
|
1270
|
-
|
|
1271
|
-
def edit_Wind_vectors(self,wedit,wlab):
|
|
1272
|
-
text=wedit.text()
|
|
1273
|
-
split_text=re.split('(\d+)', text)[1:-1:2]
|
|
1274
|
-
vect=np.array([int(i) for i in split_text],dtype=np.intc)
|
|
1275
|
-
tip=QToolTip(wedit)
|
|
1276
|
-
FlagEmpty=len(vect)==0
|
|
1277
|
-
if FlagEmpty: FlagError=True
|
|
1278
|
-
else: FlagError=not np.all(vect[:-1] >= vect[1:])
|
|
1279
|
-
if FlagError:
|
|
1280
|
-
wlab.setPixmap(self.Lab_warning)
|
|
1281
|
-
if FlagEmpty:
|
|
1282
|
-
message="Please, insert at least one element!"
|
|
1283
|
-
else:
|
|
1284
|
-
message="Items must be inserted in decreasing order!"
|
|
1285
|
-
tip=QToolTip(wedit)
|
|
1286
|
-
tip.showText(QCursor.pos(),message)
|
|
1287
|
-
wlab.setToolTip(message)
|
|
1288
|
-
else:
|
|
1289
|
-
wlab.setPixmap(QPixmap())
|
|
1290
|
-
tip.hideText()
|
|
1291
|
-
self.PROpar.VectFlag[self.Vect_widgets.index(wedit)]=not FlagError
|
|
1292
|
-
return split_text, vect, tip, FlagError
|
|
1293
|
-
|
|
1294
|
-
def set_Wind_vectors(self,wedit,wlab,i):
|
|
1295
|
-
_, vect, tip, FlagError=self.edit_Wind_vectors(wedit,wlab)
|
|
1296
|
-
self.set_Wind_vectors_new(i,vect,tip,FlagError)
|
|
1297
|
-
|
|
1298
|
-
def set_Wind_vectors_new(self,i,vect,tip=QToolTip(),FlagError=False):
|
|
1299
|
-
tip.hideText()
|
|
1300
|
-
if not FlagError:
|
|
1301
|
-
Nit_i=len(vect)
|
|
1302
|
-
if Nit_i>self.PROpar.Nit:
|
|
1303
|
-
self.PROpar.Nit=Nit_i
|
|
1304
|
-
else:
|
|
1305
|
-
if np.all(vect[:Nit_i]==self.PROpar.Vect[i][:Nit_i]):
|
|
1306
|
-
self.PROpar.Nit=Nit_i
|
|
1307
|
-
Vect2=[]
|
|
1308
|
-
for j in range(4):
|
|
1309
|
-
if self.PROpar.flag_rect_wind:
|
|
1310
|
-
k=j
|
|
1311
|
-
else:
|
|
1312
|
-
k=j%2
|
|
1313
|
-
if k==i:
|
|
1314
|
-
Vect2.append(vect)
|
|
1315
|
-
else:
|
|
1316
|
-
Vect2.append(self.PROpar.Vect[k].copy())
|
|
1317
|
-
self.PROpar.Vect=self.adjustVect(Vect2)
|
|
1318
|
-
self.setVect()
|
|
1319
|
-
|
|
1320
|
-
def adjustVect(self,Vect):
|
|
1321
|
-
for i,v in enumerate(Vect):
|
|
1322
|
-
if self.PROpar.Nit<len(v):
|
|
1323
|
-
Vect[i]=v[:self.PROpar.Nit]
|
|
1324
|
-
elif self.PROpar.Nit>len(v):
|
|
1325
|
-
Vect[i]=np.append(v,np.repeat(v[-1],self.PROpar.Nit-len(v)))
|
|
1326
|
-
"""
|
|
1327
|
-
rep=np.array([0,0,0,0])
|
|
1328
|
-
for i,v in enumerate(Vect):
|
|
1329
|
-
if len(v)>1:
|
|
1330
|
-
while rep[i]<len(v)-1:
|
|
1331
|
-
if v[-1-rep[i]]==v[-2-rep[i]]: rep[i]+=1
|
|
1332
|
-
else: break
|
|
1333
|
-
#si potrebbe programmare meglio...
|
|
1334
|
-
dit=np.min(rep)
|
|
1335
|
-
if dit:
|
|
1336
|
-
self.PROpar.Nit-=dit
|
|
1337
|
-
for i in range(4):
|
|
1338
|
-
Vect[i]=Vect[i][:self.PROpar.Nit]
|
|
1339
|
-
self.ui.spin_final_iter.setValue(self.ui.spin_final_iter.value()+dit)
|
|
1340
|
-
"""
|
|
1341
|
-
self.setVect()
|
|
1342
|
-
return Vect
|
|
1343
|
-
|
|
1344
|
-
def check_flag_boundary_callback(self):
|
|
1345
|
-
if self.ui.check_flag_boundary.isChecked():
|
|
1346
|
-
self.PROpar.FlagBordo=1
|
|
1347
|
-
else:
|
|
1348
|
-
self.PROpar.FlagBordo=0
|
|
1349
|
-
pass
|
|
1350
|
-
|
|
1351
|
-
#*************************************************** FINAL ITERATIONS
|
|
1352
|
-
def spin_final_iter_callback(self):
|
|
1353
|
-
self.PROpar.NIterazioni=self.ui.spin_final_iter.value()
|
|
1354
|
-
self.check_more_iter()
|
|
1355
|
-
|
|
1356
|
-
def check_DC_callback(self):
|
|
1357
|
-
if self.ui.check_DC.isChecked():
|
|
1358
|
-
self.PROpar.FlagDirectCorr=1
|
|
1359
|
-
else:
|
|
1360
|
-
self.PROpar.FlagDirectCorr=0
|
|
1361
|
-
self.PROpar.vDC=[self.PROpar.FlagDirectCorr]*len(self.PROpar.vDC)
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
#*************************************************** INTERPOLATION
|
|
1365
|
-
def ImIntIndex2UiOptions(self,ind,w,p):
|
|
1366
|
-
self.Flag_setImIntIndex=False
|
|
1367
|
-
w.setCurrentIndex(-1) # necessary because the call to w.setCurrentIndex() evocates the callback function only if the index is changed!
|
|
1368
|
-
if ind==0:
|
|
1369
|
-
w.setCurrentIndex(w.findText(ImInt_items[0])) #none #così se scelgo un nome diverso è automatico
|
|
1370
|
-
self.combo_ImInt_action(w,p)
|
|
1371
|
-
elif ind==1: #Quad4Simplex
|
|
1372
|
-
w.setCurrentIndex(w.findText(ImInt_items[4]))
|
|
1373
|
-
self.combo_ImInt_action(w,p)
|
|
1374
|
-
elif ind in (3,4): #Moving S, aS
|
|
1375
|
-
w.setCurrentIndex(w.findText(ImInt_items[1]))
|
|
1376
|
-
self.combo_ImInt_action(w,p)
|
|
1377
|
-
q=p.widget(p.currentIndex())
|
|
1378
|
-
qcombo=q.findChild(QComboBox)
|
|
1379
|
-
qcombo.setCurrentIndex(ind-3)
|
|
1380
|
-
elif ind in (5,2,7,6): #BiLinear, BiQuad, BiCubic, BiCubic Matlab
|
|
1381
|
-
w.setCurrentIndex(w.findText(ImInt_items[3]))
|
|
1382
|
-
self.combo_ImInt_action(w,p)
|
|
1383
|
-
q=p.widget(p.currentIndex())
|
|
1384
|
-
qcombo=q.findChild(QComboBox)
|
|
1385
|
-
indeff=(-1,-1, 1 ,-1,-1, 0,3,2)
|
|
1386
|
-
qcombo.setCurrentIndex(indeff[ind])
|
|
1387
|
-
elif ind==10: #Linear revitalized
|
|
1388
|
-
w.setCurrentIndex(w.findText(ImInt_items[2]))
|
|
1389
|
-
self.combo_ImInt_action(w,p)
|
|
1390
|
-
elif ind>=23 and ind<=40: #Shift
|
|
1391
|
-
w.setCurrentIndex(w.findText(ImInt_items[5]))
|
|
1392
|
-
self.combo_ImInt_action(w,p)
|
|
1393
|
-
q=p.widget(p.currentIndex())
|
|
1394
|
-
qspin=q.findChild(QSpinBox)
|
|
1395
|
-
qspin.setValue(ind-20)
|
|
1396
|
-
elif ind>=41 and ind<=50: #Sinc
|
|
1397
|
-
w.setCurrentIndex(w.findText(ImInt_items[6]))
|
|
1398
|
-
self.combo_ImInt_action(w,p)
|
|
1399
|
-
q=p.widget(p.currentIndex())
|
|
1400
|
-
qspin=q.findChild(QSpinBox)
|
|
1401
|
-
qspin.setValue(ind-40)
|
|
1402
|
-
elif ind>=52 and ind<=70: #BSpline
|
|
1403
|
-
w.setCurrentIndex(w.findText(ImInt_items[7]))
|
|
1404
|
-
self.combo_ImInt_action(w,p)
|
|
1405
|
-
q=p.widget(p.currentIndex())
|
|
1406
|
-
qspin=q.findChild(QSpinBox)
|
|
1407
|
-
qspin.setValue(ind-50)
|
|
1408
|
-
self.Flag_setImIntIndex=True
|
|
1409
|
-
|
|
1410
|
-
def ImIntUiOptions2Index(self,w,p):
|
|
1411
|
-
if w.currentText()==ImInt_items[0]: #none
|
|
1412
|
-
ind=0
|
|
1413
|
-
elif w.currentText()==ImInt_items[4]: #Quad4Simplex
|
|
1414
|
-
ind=1
|
|
1415
|
-
elif w.currentText()==ImInt_items[1]: #Moving S, aS
|
|
1416
|
-
q=p.widget(p.currentIndex())
|
|
1417
|
-
qcombo=q.findChild(QComboBox)
|
|
1418
|
-
ind=qcombo.currentIndex()+3
|
|
1419
|
-
elif w.currentText()==ImInt_items[3]: #BiLinear, BiQuad, BiCubic, BiCubic Matlab
|
|
1420
|
-
q=p.widget(p.currentIndex())
|
|
1421
|
-
qcombo=q.findChild(QComboBox)
|
|
1422
|
-
indeff=(5,2,7,6)
|
|
1423
|
-
ind=indeff[qcombo.currentIndex()]
|
|
1424
|
-
elif w.currentText()==ImInt_items[2]: #Linear revitalized
|
|
1425
|
-
ind=10
|
|
1426
|
-
elif w.currentText()==ImInt_items[5]: #Shift
|
|
1427
|
-
q=p.widget(p.currentIndex())
|
|
1428
|
-
qspin=q.findChild(QSpinBox)
|
|
1429
|
-
ind=qspin.value()+20
|
|
1430
|
-
elif w.currentText()==ImInt_items[6]: #Sinc
|
|
1431
|
-
q=p.widget(p.currentIndex())
|
|
1432
|
-
qspin=q.findChild(QSpinBox)
|
|
1433
|
-
ind=qspin.value()+40
|
|
1434
|
-
elif w.currentText()==ImInt_items[7]: #BSpline
|
|
1435
|
-
q=p.widget(p.currentIndex())
|
|
1436
|
-
qspin=q.findChild(QSpinBox)
|
|
1437
|
-
ind=qspin.value()+50
|
|
1438
|
-
return ind
|
|
1439
|
-
|
|
1440
|
-
def ImIntComboBox_selection(self,w,p):
|
|
1441
|
-
if w.currentText() in (ImInt_items[j] for j in(0,2,4)):
|
|
1442
|
-
p.setCurrentIndex(0)
|
|
1443
|
-
elif w.currentText()==ImInt_items[1]:
|
|
1444
|
-
p.setCurrentIndex(1)
|
|
1445
|
-
elif w.currentText()==ImInt_items[3]:
|
|
1446
|
-
p.setCurrentIndex(2)
|
|
1447
|
-
elif w.currentText() in ImInt_items[5]:
|
|
1448
|
-
p.setCurrentIndex(3)
|
|
1449
|
-
q=p.widget(p.currentIndex())
|
|
1450
|
-
qlabel=q.findChild(QLabel)
|
|
1451
|
-
qlabel.setText('Kernel width')
|
|
1452
|
-
qspin=q.findChild(MyQSpin)
|
|
1453
|
-
qspin.setMinimum(3)
|
|
1454
|
-
qspin.setMaximum(20)
|
|
1455
|
-
qspin.setValue(3)
|
|
1456
|
-
elif w.currentText() in ImInt_items[6]:
|
|
1457
|
-
p.setCurrentIndex(3)
|
|
1458
|
-
q=p.widget(p.currentIndex())
|
|
1459
|
-
qlabel=q.findChild(QLabel)
|
|
1460
|
-
qlabel.setText('Kernel half-width')
|
|
1461
|
-
qspin=q.findChild(MyQSpin)
|
|
1462
|
-
qspin.setMinimum(1)
|
|
1463
|
-
qspin.setMaximum(10)
|
|
1464
|
-
qspin.setValue(3)
|
|
1465
|
-
elif w.currentText() in ImInt_items[7]:
|
|
1466
|
-
p.setCurrentIndex(3)
|
|
1467
|
-
q=p.widget(p.currentIndex())
|
|
1468
|
-
qlabel=q.findChild(QLabel)
|
|
1469
|
-
qlabel.setText('Order (=Kernel width-1)')
|
|
1470
|
-
qspin=q.findChild(MyQSpin)
|
|
1471
|
-
qspin.setMinimum(2)
|
|
1472
|
-
qspin.setMaximum(20)
|
|
1473
|
-
qspin.setValue(3)
|
|
1474
|
-
|
|
1475
|
-
def combo_ImInt_action(self,w,p):
|
|
1476
|
-
self.ImIntComboBox_selection(w,p)
|
|
1477
|
-
self.setImIntIndex(w,p)
|
|
1478
|
-
|
|
1479
|
-
def setImIntIndex(self,w,p):
|
|
1480
|
-
if self.Flag_setImIntIndex:
|
|
1481
|
-
ind=self.ImIntUiOptions2Index(w,p)
|
|
1482
|
-
if w.objectName()=='combo_ImInt':
|
|
1483
|
-
self.PROpar.IntIniz=ind
|
|
1484
|
-
else:
|
|
1485
|
-
self.PROpar.IntFin=ind
|
|
1486
|
-
#self.PROpar.printPar()
|
|
1487
|
-
|
|
1488
|
-
def VelIntIndex2UiOptions(self,ind,w,p):
|
|
1489
|
-
if ind>=1 and ind<=5:
|
|
1490
|
-
indeff=(-1, 0,2,3,4,1)
|
|
1491
|
-
w.setCurrentIndex(w.findText(VelInt_items[indeff[ind]])) #così se scelgo un nome diverso è automatico
|
|
1492
|
-
self.combo_VelInt_action(w,p)
|
|
1493
|
-
elif ind>=52 and ind<=70: #BSpline
|
|
1494
|
-
w.setCurrentIndex(w.findText(VelInt_items[5]))
|
|
1495
|
-
self.combo_VelInt_action(w,p)
|
|
1496
|
-
q=p.widget(p.currentIndex())
|
|
1497
|
-
qspin=q.findChild(QSpinBox)
|
|
1498
|
-
qspin.setValue(ind-50)
|
|
1499
|
-
|
|
1500
|
-
def VelIntUiOptions2Index(self,w,p):
|
|
1501
|
-
for j in range(5):
|
|
1502
|
-
if w.currentText()==VelInt_items[j]: #none
|
|
1503
|
-
indeff=(1,5,2,3,4)
|
|
1504
|
-
ind=indeff[j]
|
|
1505
|
-
break
|
|
1506
|
-
if w.currentText()==VelInt_items[5]: #BSpline
|
|
1507
|
-
q=p.widget(p.currentIndex())
|
|
1508
|
-
qspin=q.findChild(QSpinBox)
|
|
1509
|
-
ind=qspin.value()+50
|
|
1510
|
-
return ind
|
|
1511
|
-
|
|
1512
|
-
def VelIntComboBox_selection(self,w,p):
|
|
1513
|
-
if w.currentText() in VelInt_items[:5]:
|
|
1514
|
-
p.setCurrentIndex(0)
|
|
1515
|
-
elif w.currentText()==VelInt_items[5]:
|
|
1516
|
-
p.setCurrentIndex(1)
|
|
1517
|
-
q=p.widget(p.currentIndex())
|
|
1518
|
-
qlabel=q.findChild(QLabel)
|
|
1519
|
-
qlabel.setText('Order (=Kernel width-1)')
|
|
1520
|
-
qspin=q.findChild(MyQSpin)
|
|
1521
|
-
qspin.setMinimum(2)
|
|
1522
|
-
qspin.setMaximum(20)
|
|
1523
|
-
qspin.setValue(3)
|
|
1524
|
-
|
|
1525
|
-
def combo_VelInt_action(self,w,p):
|
|
1526
|
-
self.VelIntComboBox_selection(w,p)
|
|
1527
|
-
self.setVelIntIndex(w,p)
|
|
1528
|
-
|
|
1529
|
-
def setVelIntIndex(self,w,p):
|
|
1530
|
-
self.PROpar.IntVel=self.VelIntUiOptions2Index(w,p)
|
|
1531
|
-
#self.PROpar.printPar()
|
|
1532
|
-
|
|
1533
|
-
def button_more_iter_callback(self):
|
|
1534
|
-
if self.PROpar.FlagInt==0:
|
|
1535
|
-
self.PROpar.FlagInt=1
|
|
1536
|
-
else:
|
|
1537
|
-
self.PROpar.FlagInt=0
|
|
1538
|
-
self.button_more_iter_check()
|
|
1539
|
-
|
|
1540
|
-
def button_more_iter_check(self):
|
|
1541
|
-
if self.PROpar.FlagInt==0:
|
|
1542
|
-
self.ui.spin_final_it.setValue(self.PROpar.FlagInt)
|
|
1543
|
-
self.ui.button_more_iter.setIcon(self.icon_plus)
|
|
1544
|
-
self.ui.w_ImInt_2.hide()
|
|
1545
|
-
self.ui.w_ImInt_par_2.hide()
|
|
1546
|
-
else:
|
|
1547
|
-
self.ui.spin_final_it.setValue(self.PROpar.FlagInt)
|
|
1548
|
-
self.ui.button_more_iter.setIcon(self.icon_minus)
|
|
1549
|
-
self.ui.w_ImInt_2.show()
|
|
1550
|
-
self.ui.w_ImInt_par_2.show()
|
|
1551
|
-
|
|
1552
|
-
def check_more_iter(self):
|
|
1553
|
-
max_it=len(self.PROpar.Vect[0])+self.PROpar.NIterazioni
|
|
1554
|
-
if max_it==1:
|
|
1555
|
-
self.PROpar.FlagInt=0
|
|
1556
|
-
#self.ui.button_more_iter.setEnabled(False)
|
|
1557
|
-
self.ui.button_more_iter.hide()
|
|
1558
|
-
else:
|
|
1559
|
-
self.ui.label_max_it.setText("of " +str(max_it)+ " iterations")
|
|
1560
|
-
self.ui.spin_final_it.setMaximum(max_it-1)
|
|
1561
|
-
#self.ui.button_more_iter.setEnabled(True)
|
|
1562
|
-
self.ui.button_more_iter.show()
|
|
1563
|
-
if self.PROpar.FlagInt:
|
|
1564
|
-
self.ui.button_more_iter.setIcon(self.icon_minus)
|
|
1565
|
-
self.ui.w_ImInt_2.show()
|
|
1566
|
-
self.ui.w_ImInt_par_2.show()
|
|
1567
|
-
else:
|
|
1568
|
-
self.ui.button_more_iter.setIcon(self.icon_plus)
|
|
1569
|
-
self.ui.w_ImInt_2.hide()
|
|
1570
|
-
self.ui.w_ImInt_par_2.hide()
|
|
1571
|
-
|
|
1572
|
-
def spin_final_it_callback(self):
|
|
1573
|
-
self.PROpar.FlagInt=self.ui.spin_final_it.value()
|
|
1574
|
-
#self.check_more_iter()
|
|
1575
|
-
|
|
1576
|
-
def combo_correlation_callback(self):
|
|
1577
|
-
self.PROpar.IntCorr=self.ui.combo_correlation.currentIndex()
|
|
1578
|
-
#self.PROpar.printPar()
|
|
1579
|
-
|
|
1580
|
-
#*************************************************** VALIDATION
|
|
1581
|
-
def radio_MedTest_callback(self):
|
|
1582
|
-
if self.ui.radio_MedTest.isChecked():
|
|
1583
|
-
self.PROpar.FlagNogTest=0
|
|
1584
|
-
self.ui.radio_Nogueira.setChecked(False)
|
|
1585
|
-
self.PROpar.FlagMedTest=1
|
|
1586
|
-
else:
|
|
1587
|
-
self.PROpar.FlagMedTest=0
|
|
1588
|
-
self.showValTestBoxed()
|
|
1589
|
-
|
|
1590
|
-
def radio_SNTest_callback(self):
|
|
1591
|
-
if self.ui.radio_SNTest.isChecked():
|
|
1592
|
-
self.PROpar.FlagNogTest=0
|
|
1593
|
-
self.ui.radio_Nogueira.setChecked(False)
|
|
1594
|
-
self.PROpar.FlagSNTest=1
|
|
1595
|
-
else:
|
|
1596
|
-
self.PROpar.FlagSNTest=0
|
|
1597
|
-
self.showValTestBoxed()
|
|
1598
|
-
|
|
1599
|
-
def radio_CPTest_callback(self):
|
|
1600
|
-
if self.ui.radio_CPTest.isChecked():
|
|
1601
|
-
self.PROpar.FlagNogTest=0
|
|
1602
|
-
self.ui.radio_Nogueira.setChecked(False)
|
|
1603
|
-
self.PROpar.FlagCPTest=1
|
|
1604
|
-
else:
|
|
1605
|
-
self.PROpar.FlagCPTest=0
|
|
1606
|
-
self.showValTestBoxed()
|
|
1607
|
-
|
|
1608
|
-
def radio_Nogueira_callback(self):
|
|
1609
|
-
if self.ui.radio_Nogueira.isChecked():
|
|
1610
|
-
self.PROpar.FlagMedTest=0
|
|
1611
|
-
self.ui.radio_MedTest.setChecked(False)
|
|
1612
|
-
self.PROpar.FlagSNTest=0
|
|
1613
|
-
self.ui.radio_SNTest.setChecked(False)
|
|
1614
|
-
self.PROpar.FlagCPTest=0
|
|
1615
|
-
self.ui.radio_CPTest.setChecked(False)
|
|
1616
|
-
self.PROpar.FlagNogTest=1
|
|
1617
|
-
else:
|
|
1618
|
-
self.PROpar.FlagNogTest=0
|
|
1619
|
-
self.showValTestBoxed()
|
|
1620
|
-
|
|
1621
|
-
def setValidationType(self):
|
|
1622
|
-
self.checkValidationType()
|
|
1623
|
-
self.showValTestBoxed()
|
|
1624
|
-
self.ui.combo_MedTest_type.setCurrentIndex(self.PROpar.TypeMed)
|
|
1625
|
-
self.ui.spin_MedTest_ker.setValue(self.PROpar.KernMed)
|
|
1626
|
-
self.ui.spin_MedTest_alfa.setValue(self.PROpar.SogliaMed)
|
|
1627
|
-
self.ui.spin_MedTest_eps.setValue(self.PROpar.ErroreMed)
|
|
1628
|
-
self.ui.spin_MedTest_jump.setValue(self.PROpar.JumpMed)
|
|
1629
|
-
self.ui.spin_SNTest_thres.setValue(self.PROpar.SogliaSN)
|
|
1630
|
-
self.ui.spin_CPTest_thres.setValue(self.PROpar.SogliaCP)
|
|
1631
|
-
self.ui.spin_Nog_tol.setValue(self.PROpar.SogliaMedia)
|
|
1632
|
-
self.ui.spin_Nog_numvec.setValue(self.PROpar.SogliaNumVet)
|
|
1633
|
-
|
|
1634
|
-
def checkValidationType(self):
|
|
1635
|
-
self.ui.radio_MedTest.setChecked(self.PROpar.FlagMedTest)
|
|
1636
|
-
self.ui.radio_SNTest.setChecked(self.PROpar.FlagSNTest)
|
|
1637
|
-
self.ui.radio_CPTest.setChecked(self.PROpar.FlagCPTest)
|
|
1638
|
-
self.ui.radio_Nogueira.setChecked(self.PROpar.FlagNogTest)
|
|
1639
|
-
|
|
1640
|
-
def showValTestBoxed(self):
|
|
1641
|
-
self.showMedTestwid()
|
|
1642
|
-
self.showSNTestwid()
|
|
1643
|
-
self.showCPTestwid()
|
|
1644
|
-
self.showNogTestwid()
|
|
1645
|
-
|
|
1646
|
-
def showMedTestwid(self):
|
|
1647
|
-
if self.PROpar.FlagMedTest:
|
|
1648
|
-
self.ui.label_MedTest_box.show()
|
|
1649
|
-
self.ui.w_MedTest_type.show()
|
|
1650
|
-
self.ui.w_MedTest_ker.show()
|
|
1651
|
-
self.ui.w_MedTest_alfa.show()
|
|
1652
|
-
self.ui.w_MedTest_jump.show()
|
|
1653
|
-
if self.PROpar.TypeMed==1:
|
|
1654
|
-
self.ui.w_MedTest_eps.show()
|
|
1655
|
-
else:
|
|
1656
|
-
self.ui.label_MedTest_box.hide()
|
|
1657
|
-
self.ui.w_MedTest_type.hide()
|
|
1658
|
-
self.ui.w_MedTest_ker.hide()
|
|
1659
|
-
self.ui.w_MedTest_alfa.hide()
|
|
1660
|
-
self.ui.w_MedTest_eps.hide()
|
|
1661
|
-
self.ui.w_MedTest_jump.hide()
|
|
1662
|
-
|
|
1663
|
-
def showSNTestwid(self):
|
|
1664
|
-
if self.PROpar.FlagSNTest:
|
|
1665
|
-
self.ui.label_SNTest.show()
|
|
1666
|
-
self.ui.w_SNTest_thres.show()
|
|
1667
|
-
else:
|
|
1668
|
-
self.ui.label_SNTest.hide()
|
|
1669
|
-
self.ui.w_SNTest_thres.hide()
|
|
1670
|
-
|
|
1671
|
-
def showCPTestwid(self):
|
|
1672
|
-
if self.PROpar.FlagCPTest:
|
|
1673
|
-
self.ui.label_CPTest.show()
|
|
1674
|
-
self.ui.w_CPTest_thres.show()
|
|
1675
|
-
else:
|
|
1676
|
-
self.ui.label_CPTest.hide()
|
|
1677
|
-
self.ui.w_CPTest_thres.hide()
|
|
1678
|
-
|
|
1679
|
-
def showNogTestwid(self):
|
|
1680
|
-
if self.PROpar.FlagNogTest:
|
|
1681
|
-
self.ui.label_Nogueira.show()
|
|
1682
|
-
self.ui.w_Nog_tol.show()
|
|
1683
|
-
self.ui.w_Nog_numvec.show()
|
|
1684
|
-
else:
|
|
1685
|
-
self.ui.label_Nogueira.hide()
|
|
1686
|
-
self.ui.w_Nog_tol.hide()
|
|
1687
|
-
self.ui.w_Nog_numvec.hide()
|
|
1688
|
-
|
|
1689
|
-
def combo_MedTest_type_callback(self):
|
|
1690
|
-
self.PROpar.TypeMed=self.ui.combo_MedTest_type.currentIndex()
|
|
1691
|
-
if self.PROpar.TypeMed==1:
|
|
1692
|
-
self.ui.w_MedTest_eps.show()
|
|
1693
|
-
else:
|
|
1694
|
-
self.ui.w_MedTest_eps.hide()
|
|
1695
|
-
|
|
1696
|
-
def spin_MedTest_ker_callback(self):
|
|
1697
|
-
self.PROpar.KernMed=self.ui.spin_MedTest_ker.value()
|
|
1698
|
-
|
|
1699
|
-
def spin_MedTest_alfa_callback(self):
|
|
1700
|
-
self.PROpar.SogliaMed=self.ui.spin_MedTest_alfa.value()
|
|
1701
|
-
|
|
1702
|
-
def spin_MedTest_eps_callback(self):
|
|
1703
|
-
self.PROpar.ErroreMed=self.ui.spin_MedTest_eps.value()
|
|
1704
|
-
|
|
1705
|
-
def spin_MedTest_jump_callback(self):
|
|
1706
|
-
self.PROpar.JumpMed=self.ui.spin_MedTest_jump.value()
|
|
1707
|
-
|
|
1708
|
-
def spin_SNTest_thres_callback(self):
|
|
1709
|
-
self.PROpar.SogliaSN=self.ui.spin_SNTest_thres.value()
|
|
1710
|
-
|
|
1711
|
-
def spin_CPTest_thres_callback(self):
|
|
1712
|
-
self.PROpar.SogliaCP=self.ui.spin_CPTest_thres.value()
|
|
1713
|
-
|
|
1714
|
-
def spin_Nog_tol_callback(self):
|
|
1715
|
-
self.PROpar.SogliaMedia=self.ui.spin_Nog_tol.value()
|
|
1716
|
-
|
|
1717
|
-
def spin_Nog_numvec_callback(self):
|
|
1718
|
-
self.PROpar.SogliaNumVet=self.ui.spin_Nog_numvec.value()
|
|
1719
|
-
|
|
1720
|
-
def spin_MinVal_callback(self):
|
|
1721
|
-
self.PROpar.SogliaNoise=self.ui.spin_MinVal.value()
|
|
1722
|
-
|
|
1723
|
-
def spin_MinStD_callback(self):
|
|
1724
|
-
self.PROpar.SogliaStd=self.ui.spin_MinStD.value()
|
|
1725
|
-
|
|
1726
|
-
def combo_Correction_type_callback(self):
|
|
1727
|
-
self.PROpar.FlagCorrezioneVel=self.ui.combo_Correction_type.currentIndex()
|
|
1728
|
-
|
|
1729
|
-
def check_second_peak_callback(self):
|
|
1730
|
-
if self.ui.check_second_peak.isChecked():
|
|
1731
|
-
self.PROpar.FlagSecMax=1
|
|
1732
|
-
else:
|
|
1733
|
-
self.PROpar.FlagSecMax=0
|
|
1408
|
+
def button_add_action(self):
|
|
1409
|
+
k=self.PROpar.row
|
|
1410
|
+
for i in range(4):
|
|
1411
|
+
self.PROpar.Vect[i].insert(k,self.PROpar.Vect[i][k]) #=np.insert(self.PROpar.Vect[i],k,self.PROpar.Vect[i][k].copy())
|
|
1412
|
+
self.PROpar.Nit+=1
|
|
1413
|
+
fields=['vFlagCalcVel','vFlagWindowing','vSemiDimCalcVel','vDC','vMaxDisp']
|
|
1414
|
+
for f in fields:
|
|
1415
|
+
v=getattr(self.PROpar,f)
|
|
1416
|
+
v.insert(k,v[k])
|
|
1417
|
+
self.PROpar.row=k+1
|
|
1734
1418
|
|
|
1735
|
-
def
|
|
1736
|
-
|
|
1737
|
-
|
|
1419
|
+
def button_delete_action(self):
|
|
1420
|
+
k=self.PROpar.row
|
|
1421
|
+
if k<self.PROpar.Nit:
|
|
1422
|
+
for i in range(4):
|
|
1423
|
+
self.PROpar.Vect[i].pop(k) #=np.delete(self.PROpar.Vect[i],k)
|
|
1424
|
+
self.PROpar.Nit-=1
|
|
1425
|
+
fields=['vFlagCalcVel','vFlagWindowing','vSemiDimCalcVel','vDC','vMaxDisp']
|
|
1426
|
+
for f in fields:
|
|
1427
|
+
v=getattr(self.PROpar,f)
|
|
1428
|
+
v.pop(k)
|
|
1429
|
+
self.PROpar.row=k-1
|
|
1738
1430
|
else:
|
|
1739
|
-
self.PROpar.
|
|
1740
|
-
|
|
1741
|
-
#*************************************************** WINDOWING
|
|
1742
|
-
def VelWindIndex2UiOptionText(self,ind):
|
|
1743
|
-
optionText=''
|
|
1744
|
-
self.Flag_setWindIndex=False
|
|
1745
|
-
if ind in (0,3,4): # top-hat
|
|
1746
|
-
acr=Wind_abbrev[0]
|
|
1747
|
-
optionText+=Wind_items[0]
|
|
1748
|
-
qcombo=self.ui.combo_par_tophat
|
|
1749
|
-
indeff=(0, -1,-1, 1, 2)
|
|
1750
|
-
optionText+=f' [{qcombo.itemText(indeff[ind])}]'
|
|
1751
|
-
elif ind in (1,21):
|
|
1752
|
-
acr=Wind_abbrev[1]
|
|
1753
|
-
optionText+=Wind_items[1]
|
|
1754
|
-
qcombo=self.ui.combo_par_Nog
|
|
1755
|
-
if ind==1: optionText+=f' [{qcombo.itemText(0)}]'
|
|
1756
|
-
else: optionText+=f' [{qcombo.itemText(1)}]'
|
|
1757
|
-
elif ind in (5,2,6):
|
|
1758
|
-
acr=Wind_abbrev[2]
|
|
1759
|
-
optionText+=Wind_items[2]
|
|
1760
|
-
elif ind in (7,8,9,10): # Blackman-Harris
|
|
1761
|
-
acr=Wind_abbrev[3]
|
|
1762
|
-
optionText+=Wind_items[3]
|
|
1763
|
-
qcombo=self.ui.combo_par_Har
|
|
1764
|
-
optionText+=f' [{qcombo.itemText(ind-7)}]'
|
|
1765
|
-
elif ind==22: # Triangular
|
|
1766
|
-
acr=Wind_abbrev[4]
|
|
1767
|
-
optionText+=Wind_items[4]
|
|
1768
|
-
elif ind==23: # Hann
|
|
1769
|
-
acr=Wind_abbrev[5]
|
|
1770
|
-
optionText+=Wind_items[5]
|
|
1771
|
-
elif ind>100 and ind<=200: #Gaussian
|
|
1772
|
-
acr=Wind_abbrev[6]
|
|
1773
|
-
optionText+=Wind_items[6]
|
|
1774
|
-
alpha=float(ind-100)/10
|
|
1775
|
-
optionText+=f' [α thresh.={alpha}]'
|
|
1776
|
-
return acr,optionText
|
|
1431
|
+
self.PROpar.FlagAdaptative=0
|
|
1777
1432
|
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1433
|
+
#******************** Settings
|
|
1434
|
+
def combo_Wind_Vel_set_gen(self,par:str,w:QComboBox,p:QStackedWidget):
|
|
1435
|
+
ind=getattr(self.PROpar,par)
|
|
1436
|
+
if Flag_type_of_DCs:
|
|
1437
|
+
if w.objectName()=='combo_Wind_Corr_type':
|
|
1438
|
+
if w.currentText()==Wind_items[0]:
|
|
1439
|
+
self.ui.w_type_of_DCs.hide()
|
|
1440
|
+
else:
|
|
1441
|
+
self.ui.w_type_of_DCs.show()
|
|
1781
1442
|
if ind in (0,3,4): # top-hat
|
|
1782
1443
|
w.setCurrentIndex(w.findText(Wind_items[0]))
|
|
1783
|
-
|
|
1444
|
+
p.setCurrentIndex(1)
|
|
1445
|
+
p.show()
|
|
1784
1446
|
q=p.widget(p.currentIndex())
|
|
1785
|
-
qcombo=q.findChild(QComboBox)
|
|
1447
|
+
qcombo:QComboBox=q.findChild(QComboBox)
|
|
1786
1448
|
indeff=(0, -1,-1, 1, 2)
|
|
1787
1449
|
qcombo.setCurrentIndex(indeff[ind])
|
|
1788
1450
|
elif ind in (1,21): # Nogueira
|
|
1789
1451
|
w.setCurrentIndex(w.findText(Wind_items[1]))
|
|
1790
|
-
|
|
1452
|
+
p.setCurrentIndex(2)
|
|
1453
|
+
p.show()
|
|
1791
1454
|
q=p.widget(p.currentIndex())
|
|
1792
1455
|
qcombo=q.findChild(QComboBox)
|
|
1793
1456
|
if ind==1:
|
|
@@ -1796,135 +1459,291 @@ class Process_Tab(gPaIRS_Tab):
|
|
|
1796
1459
|
qcombo.setCurrentIndex(1)
|
|
1797
1460
|
elif ind in (5,2,6): # Blackman
|
|
1798
1461
|
w.setCurrentIndex(w.findText(Wind_items[2]))
|
|
1799
|
-
|
|
1462
|
+
p.hide()
|
|
1800
1463
|
"""
|
|
1801
1464
|
#Blackman options
|
|
1465
|
+
p.setCurrentIndex(3)
|
|
1802
1466
|
q=p.widget(p.currentIndex())
|
|
1803
1467
|
qcombo=q.findChild(QComboBox)
|
|
1804
1468
|
indeff=(-1,-1, 1, -1,-1, 0,2)
|
|
1805
1469
|
qcombo.setCurrentIndex(indeff[ind])
|
|
1806
1470
|
"""
|
|
1807
1471
|
elif ind in (7,8,9,10): # Blackman-Harris
|
|
1808
|
-
w.setCurrentIndex(w.findText(Wind_items[3]))
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
qcombo.
|
|
1472
|
+
w.setCurrentIndex(w.findText(Wind_items[3]))
|
|
1473
|
+
p.setCurrentIndex(4)
|
|
1474
|
+
p.show()
|
|
1475
|
+
q=p.widget(p.currentIndex())
|
|
1476
|
+
qcombo=q.findChild(QComboBox)
|
|
1477
|
+
qcombo.setCurrentIndex(ind-7)
|
|
1478
|
+
elif ind==22: # Triangular
|
|
1479
|
+
w.setCurrentIndex(w.findText(Wind_items[4]))
|
|
1480
|
+
p.hide()
|
|
1481
|
+
elif ind==23: # Hann
|
|
1482
|
+
w.setCurrentIndex(w.findText(Wind_items[5]))
|
|
1483
|
+
p.hide()
|
|
1484
|
+
elif ind>100 and ind<=200: #Gaussian
|
|
1485
|
+
w.setCurrentIndex(w.findText(Wind_items[6]))
|
|
1486
|
+
p.setCurrentIndex(5)
|
|
1487
|
+
p.show()
|
|
1488
|
+
q=p.widget(p.currentIndex())
|
|
1489
|
+
qspin:MyQDoubleSpin=q.findChild(MyQDoubleSpin)
|
|
1490
|
+
qspin.setValue(float(ind-100)/10)
|
|
1491
|
+
|
|
1492
|
+
def combo_Wind_Vel_acr_optionText(self,ind):
|
|
1493
|
+
optionText=''
|
|
1494
|
+
if ind in (0,3,4): # top-hat
|
|
1495
|
+
acr=Wind_abbrev[0]
|
|
1496
|
+
optionText+=Wind_items[0]
|
|
1497
|
+
qcombo=self.ui.combo_par_tophat
|
|
1498
|
+
indeff=(0, -1,-1, 1, 2)
|
|
1499
|
+
optionText+=f' [{qcombo.itemText(indeff[ind])}]'
|
|
1500
|
+
elif ind in (1,21):
|
|
1501
|
+
acr=Wind_abbrev[1]
|
|
1502
|
+
optionText+=Wind_items[1]
|
|
1503
|
+
qcombo=self.ui.combo_par_Nog
|
|
1504
|
+
if ind==1: optionText+=f' [{qcombo.itemText(0)}]'
|
|
1505
|
+
else: optionText+=f' [{qcombo.itemText(1)}]'
|
|
1506
|
+
elif ind in (5,2,6):
|
|
1507
|
+
acr=Wind_abbrev[2]
|
|
1508
|
+
optionText+=Wind_items[2]
|
|
1509
|
+
elif ind in (7,8,9,10): # Blackman-Harris
|
|
1510
|
+
acr=Wind_abbrev[3]
|
|
1511
|
+
optionText+=Wind_items[3]
|
|
1512
|
+
qcombo=self.ui.combo_par_Har
|
|
1513
|
+
optionText+=f' [{qcombo.itemText(ind-7)}]'
|
|
1813
1514
|
elif ind==22: # Triangular
|
|
1814
|
-
|
|
1815
|
-
|
|
1515
|
+
acr=Wind_abbrev[4]
|
|
1516
|
+
optionText+=Wind_items[4]
|
|
1816
1517
|
elif ind==23: # Hann
|
|
1817
|
-
|
|
1818
|
-
|
|
1518
|
+
acr=Wind_abbrev[5]
|
|
1519
|
+
optionText+=Wind_items[5]
|
|
1819
1520
|
elif ind>100 and ind<=200: #Gaussian
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
self.Flag_setWindIndex=True
|
|
1521
|
+
acr=Wind_abbrev[6]
|
|
1522
|
+
optionText+=Wind_items[6]
|
|
1523
|
+
alpha=float(ind-100)/10
|
|
1524
|
+
optionText+=f' [α thresh.={alpha}]'
|
|
1525
|
+
return acr,optionText
|
|
1826
1526
|
|
|
1827
|
-
def
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
ind=2
|
|
1847
|
-
elif w.currentText()==Wind_items[3]: # Blackman-Harris
|
|
1848
|
-
q=p.widget(p.currentIndex())
|
|
1849
|
-
qcombo=q.findChild(QComboBox)
|
|
1850
|
-
indeff=(7,8,9,10)
|
|
1851
|
-
ind=indeff[qcombo.currentIndex()]
|
|
1852
|
-
elif w.currentText()==Wind_items[4]: # Triangular
|
|
1853
|
-
ind=22
|
|
1854
|
-
elif w.currentText()==Wind_items[5]: # Hann
|
|
1855
|
-
ind=23
|
|
1856
|
-
elif w.currentText()==Wind_items[6]: # Gaussian
|
|
1857
|
-
q=p.widget(p.currentIndex())
|
|
1858
|
-
qspin=q.findChild(MyQDoubleSpin)
|
|
1859
|
-
ind=int(qspin.value()*10+100)
|
|
1860
|
-
return ind
|
|
1527
|
+
def spin_Wind_halfwidth_set(self):
|
|
1528
|
+
self.ui.spin_Wind_halfwidth.setValue(self.PROpar.SemiDimCalcVel)
|
|
1529
|
+
|
|
1530
|
+
def combo_MaxDisp_type_set(self):
|
|
1531
|
+
ind=0 if self.PROpar.MaxDisp<0 else 1
|
|
1532
|
+
self.ui.combo_MaxDisp_type.setCurrentIndex(ind)
|
|
1533
|
+
self.ui.w_MaxDisp_par.setCurrentIndex(ind)
|
|
1534
|
+
if not ind:
|
|
1535
|
+
ind_rel=[2,3,4,5].index(-self.PROpar.MaxDisp)
|
|
1536
|
+
self.ui.combo_MaxDisp_relative.setCurrentIndex(ind_rel)
|
|
1537
|
+
else:
|
|
1538
|
+
k=min([self.PROpar.row,self.PROpar.Nit-1])
|
|
1539
|
+
maxVal=int( 0.5*min( [self.PROpar.Vect[0][k], self.PROpar.Vect[2][k]] ) )
|
|
1540
|
+
self.ui.spin_MaxDisp_absolute.setMaximum(maxVal)
|
|
1541
|
+
self.PROpar.MaxDisp=self.PROpar.vMaxDisp[self.PROpar.row]=maxVal if self.PROpar.MaxDisp>maxVal else self.PROpar.MaxDisp
|
|
1542
|
+
self.ui.spin_MaxDisp_absolute.setValue(self.PROpar.MaxDisp)
|
|
1543
|
+
|
|
1544
|
+
def spin_MaxC_preset(self):
|
|
1545
|
+
self.ui.spin_MaxC.setMinimum(self.PROpar.MinC+0.01)
|
|
1861
1546
|
|
|
1862
|
-
def
|
|
1863
|
-
|
|
1864
|
-
if w.objectName()=='combo_Wind_Corr_type':
|
|
1865
|
-
if w.currentText()==Wind_items[0]:
|
|
1866
|
-
self.ui.w_type_of_DCs.hide()
|
|
1867
|
-
else:
|
|
1868
|
-
self.ui.w_type_of_DCs.show()
|
|
1869
|
-
for i in range(4):
|
|
1870
|
-
if w.currentText()==Wind_items[i] and i!=2: #!!! Blackman options: delete i!=2 and 2 from in(2,4,5) below (triang./Hann)
|
|
1871
|
-
p.show()
|
|
1872
|
-
p.setCurrentIndex(i+1)
|
|
1873
|
-
break
|
|
1874
|
-
if w.currentText() in (Wind_items[j] for j in(2,4,5)): #triang./Hann no parameters needed
|
|
1875
|
-
p.hide()
|
|
1876
|
-
if w.currentText()==Wind_items[6]:
|
|
1877
|
-
p.show()
|
|
1878
|
-
p.setCurrentIndex(5)
|
|
1547
|
+
def spin_MinC_preset(self):
|
|
1548
|
+
self.ui.spin_MinC.setMaximum(self.PROpar.MaxC-0.01)
|
|
1879
1549
|
|
|
1880
|
-
def
|
|
1881
|
-
self.
|
|
1882
|
-
|
|
1550
|
+
def spin_LarMax_preset(self):
|
|
1551
|
+
self.ui.spin_LarMax.setMinimum(self.PROpar.LarMin+1)
|
|
1552
|
+
|
|
1553
|
+
def spin_LarMin_preset(self):
|
|
1554
|
+
self.ui.spin_LarMin.setMaximum(self.PROpar.LarMax-1)
|
|
1555
|
+
|
|
1556
|
+
def line_edit_IW_set(self):
|
|
1557
|
+
r=self.PROpar.row
|
|
1558
|
+
#c=self.PROpar.col
|
|
1559
|
+
|
|
1560
|
+
kVect=min([r,self.PROpar.Nit-1])
|
|
1561
|
+
vect=[f'{self.PROpar.Vect[i][kVect]}' for i in (0,2,1,3)]
|
|
1562
|
+
vectStr=', '.join(vect)
|
|
1563
|
+
self.ui.line_edit_IW.setText(vectStr)
|
|
1564
|
+
|
|
1565
|
+
def table_iter_set(self):
|
|
1566
|
+
nRow=self.ui.table_iter.rowCount()
|
|
1567
|
+
for k in range(len(self.PROpar.vFlagCalcVel),nRow):
|
|
1568
|
+
self.ui.table_iter.removeRow(self.ui.table_iter.rowAt(k))
|
|
1569
|
+
|
|
1570
|
+
nWind=len(self.PROpar.vFlagCalcVel)
|
|
1571
|
+
Nit=self.PROpar.Nit
|
|
1572
|
+
NIterazioni=self.PROpar.NIterazioni
|
|
1573
|
+
self.ui.table_iter.RowInfo=['']*nWind
|
|
1574
|
+
|
|
1575
|
+
flagFocus=not self.ui.line_edit_IW.hasFocus()
|
|
1576
|
+
|
|
1577
|
+
def genTableCell(item_name,tooltip,c,cc):
|
|
1578
|
+
if c<0: return cc
|
|
1579
|
+
item=QTableWidgetItem(item_name)
|
|
1580
|
+
item.setFlags(Qt.ItemIsSelectable|Qt.ItemIsEnabled)
|
|
1581
|
+
item.setTextAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
1582
|
+
item.setToolTip(tooltip)
|
|
1583
|
+
item.setStatusTip(tooltip)
|
|
1584
|
+
cc+=1
|
|
1585
|
+
self.ui.table_iter.setItem(c, cc, item)
|
|
1586
|
+
if self.PROpar.row==c and self.PROpar.col==cc:
|
|
1587
|
+
item.setSelected(True)
|
|
1588
|
+
self.ui.table_iter.setCurrentItem(item)
|
|
1589
|
+
return cc
|
|
1590
|
+
|
|
1591
|
+
for k in range(nWind):
|
|
1592
|
+
if k==self.ui.table_iter.rowCount():
|
|
1593
|
+
self.ui.table_iter.insertRow(k)
|
|
1594
|
+
c=k
|
|
1595
|
+
cc=-1
|
|
1596
|
+
|
|
1597
|
+
it=k-Nit+1
|
|
1598
|
+
if k==Nit-1 and it!=NIterazioni:
|
|
1599
|
+
item_name=f'{it}:{NIterazioni}'
|
|
1600
|
+
tooltip=f'iterations from {it} to {NIterazioni}'
|
|
1601
|
+
str_adapt=''
|
|
1602
|
+
elif k==Nit:
|
|
1603
|
+
item_name=f'{NIterazioni+1}:{NIterazioni+self.PROpar.NItAdaptative}'
|
|
1604
|
+
tooltip=f'iterations from {NIterazioni+1} to {NIterazioni+self.PROpar.NItAdaptative}'
|
|
1605
|
+
str_adapt=' (adaptative)'
|
|
1606
|
+
else:
|
|
1607
|
+
item_name=f'{it}'
|
|
1608
|
+
tooltip=f'iteration {it}'
|
|
1609
|
+
str_adapt=''
|
|
1610
|
+
kVect=min([k,self.PROpar.Nit-1])
|
|
1611
|
+
IWSize=f'{self.PROpar.Vect[0][kVect]} x {self.PROpar.Vect[2][kVect]}'
|
|
1612
|
+
IWSize_max=max([self.PROpar.Vect[0][kVect],self.PROpar.Vect[2][kVect]])
|
|
1613
|
+
IWSpac=f'{self.PROpar.Vect[1][kVect]} x {self.PROpar.Vect[3][kVect]}'
|
|
1614
|
+
self.ui.table_iter.RowInfo[k]=f'{item_name} Window size: {IWSize}, grid distance: {IWSpac}'+str_adapt
|
|
1615
|
+
|
|
1616
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1883
1617
|
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1618
|
+
"""
|
|
1619
|
+
item_name=IWSize
|
|
1620
|
+
tooltip=f'Window size: {IWSize}'
|
|
1621
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1622
|
+
|
|
1623
|
+
item_name=IWSpac
|
|
1624
|
+
tooltip=f'Window size: {IWSize}'
|
|
1625
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1626
|
+
"""
|
|
1627
|
+
|
|
1628
|
+
acr,optionText=self.combo_Wind_Vel_acr_optionText(self.PROpar.vFlagWindowing[k])
|
|
1629
|
+
item_name=CorrWin=f'{acr}{IWSize_max:d}'
|
|
1630
|
+
tooltip=f'{optionText} window'
|
|
1631
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1632
|
+
|
|
1633
|
+
acr,optionText=self.combo_Wind_Vel_acr_optionText(self.PROpar.vFlagCalcVel[k])
|
|
1634
|
+
if k==Nit:
|
|
1635
|
+
CorrWinWidth0=self.PROpar.vSemiDimCalcVel[k-1]*2+IWSize_max%2 if self.PROpar.vSemiDimCalcVel[k-1] else IWSize_max
|
|
1636
|
+
CorrWinWidth1=self.PROpar.vSemiDimCalcVel[k]*2+IWSize_max%2 if self.PROpar.vSemiDimCalcVel[k] else IWSize_max
|
|
1637
|
+
item_name=f'{acr}{CorrWinWidth0:d}-{CorrWinWidth1:d}'
|
|
1638
|
+
tooltip=f'{optionText} window; half-width = {self.PROpar.vSemiDimCalcVel[k-1]:d}-{self.PROpar.vSemiDimCalcVel[k]:d}'
|
|
1891
1639
|
else:
|
|
1892
|
-
self.PROpar.
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1640
|
+
CorrWinWidth=self.PROpar.vSemiDimCalcVel[k]*2+IWSize_max%2 if self.PROpar.vSemiDimCalcVel[k] else IWSize_max
|
|
1641
|
+
item_name=VelWin=f'{acr}{CorrWinWidth:d}'
|
|
1642
|
+
tooltip=f'{optionText} window; size = {CorrWinWidth:d}'
|
|
1643
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1896
1644
|
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1645
|
+
maxDisp=self.PROpar.vMaxDisp[k]
|
|
1646
|
+
if maxDisp<0:
|
|
1647
|
+
item_name=f'1/{-maxDisp:d} IW'
|
|
1648
|
+
tooltip=f'Maximum allowed displacement = 1/{-maxDisp:d} of the interrogation window size'
|
|
1649
|
+
else:
|
|
1650
|
+
item_name=f'{maxDisp} pix'
|
|
1651
|
+
tooltip=f'Maximum allowed displacement = {maxDisp:d} pixels'
|
|
1652
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1653
|
+
|
|
1654
|
+
item_name=f'{"❌✅"[self.PROpar.vDC[k]]}'
|
|
1655
|
+
tooltip=f'Direct correlations: {["disactivated","activated"][self.PROpar.vDC[k]]}'
|
|
1656
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1657
|
+
|
|
1658
|
+
item_name, tooltip=self.calcStability(k,VelWin,CorrWin)
|
|
1659
|
+
if k==Nit-1: item_name+='⭐'
|
|
1660
|
+
cc=genTableCell(item_name,tooltip,c,cc)
|
|
1661
|
+
|
|
1662
|
+
continue
|
|
1901
1663
|
|
|
1902
|
-
def
|
|
1903
|
-
self.PROpar.
|
|
1904
|
-
|
|
1664
|
+
def calcStability(self,k,VelWin,CorrWin):
|
|
1665
|
+
kVect=min([k,self.PROpar.Nit-1])
|
|
1666
|
+
FlagStable=True
|
|
1667
|
+
flagLambda=True
|
|
1668
|
+
#FlagIntVel=(self.PROpar.IntVel==1) or (52<=self.PROpar.IntVel<=70)
|
|
1669
|
+
#if FlagIntVel:
|
|
1670
|
+
for j in range(2):
|
|
1671
|
+
Niter=np.array([self.PROpar.NIterazioni, np.inf])
|
|
1672
|
+
nPointPlot=1000
|
|
1673
|
+
# A correlation window
|
|
1674
|
+
Wa=self.PROpar.Vect[j*2][kVect]
|
|
1675
|
+
WBase=1.5*Wa
|
|
1676
|
+
FlagWindowing=self.PROpar.vFlagWindowing[k] # Weighting window for the correlation map (0=TopHat 1= Nogueira 2=Blackman 3=top hat at 50#).
|
|
1677
|
+
# B weighted average
|
|
1678
|
+
FlagCalcVel=self.PROpar.vFlagCalcVel[k] # Weighting window for absolute velocity (0=TopHat, 1=Nogueira, 2=Blackman,...)
|
|
1679
|
+
hWb=self.PROpar.vSemiDimCalcVel[k]# Half-width of the filtering window (0=window dimension).
|
|
1680
|
+
# C dense predictor
|
|
1681
|
+
IntVel=self.PROpar.IntVel # Type of interpolation of the velocity (1=bilinear, 52-70 Bspline)
|
|
1682
|
+
Wc=self.PROpar.Vect[1+j*2][kVect]# Grid distance (overlap)
|
|
1683
|
+
# end input *********************************************
|
|
1684
|
+
oMax=0.5 # frequenza massima per c (legata all'overlap ov/lambda) non penso che abbia senso oltre 0,5 perchè
|
|
1685
|
+
# andremmo oltre Nyquist
|
|
1686
|
+
|
|
1687
|
+
(_,_,_,_,_,_,_,_,_,flagUnstable,_,lam,MTF,_,_,_)= mtfPIV1(Wa,FlagWindowing,hWb, FlagCalcVel,Wc, IntVel, oMax, WBase,nPointPlot,Niter,flagLambda)
|
|
1688
|
+
FlagStable=FlagStable and not flagUnstable
|
|
1689
|
+
if k==self.PROpar.Nit-1:
|
|
1690
|
+
if j==0:
|
|
1691
|
+
if self.father and hasattr(self.father,'w_Export'): Res=self.father.w_Export.OUTpar.xres
|
|
1692
|
+
else: Res=0
|
|
1693
|
+
self.MTF=[lam,MTF.T,f'IW size-spacing: {Wa:d}-{Wc:d}. Vel.-correl. windowing: {VelWin}-{CorrWin}.',Res]
|
|
1694
|
+
|
|
1695
|
+
else:
|
|
1696
|
+
if self.PROpar.Vect[j*2][kVect]>self.PROpar.Vect[(j-1)*2][kVect]:
|
|
1697
|
+
if self.father: Res=self.father.w_Export.OUTpar.xres*self.father.w_Export.OUTpar.pixAR
|
|
1698
|
+
else: Res=0
|
|
1699
|
+
self.MTF=[lam,MTF.T,f'IW size-spacing: {Wa:d}-{Wc:d}. Vel.-correl. windowing: {VelWin}-{CorrWin}.',Res]
|
|
1700
|
+
if FlagStable:
|
|
1701
|
+
name='stable'
|
|
1702
|
+
tooltip='Stable process through an infinite number of iterations'
|
|
1703
|
+
else:
|
|
1704
|
+
name='⚠ unstable'
|
|
1705
|
+
tooltip='Unstable process through an infinite number of iterations'
|
|
1706
|
+
#else:
|
|
1707
|
+
# name='-'
|
|
1708
|
+
# tooltip='No information on stability available'
|
|
1709
|
+
return name, tooltip
|
|
1905
1710
|
|
|
1906
|
-
|
|
1907
|
-
|
|
1711
|
+
#******************** Layout
|
|
1712
|
+
def setPROlayout_Wind(self):
|
|
1713
|
+
self.ui.w_adaptative_iter.setVisible(self.PROpar.FlagAdaptative)
|
|
1714
|
+
self.ui.w_Adaptative.setVisible(self.PROpar.FlagAdaptative)
|
|
1908
1715
|
|
|
1909
|
-
|
|
1910
|
-
self.PROpar.
|
|
1911
|
-
self.
|
|
1716
|
+
self.ui.table_iter.resizeInfoLabel()
|
|
1717
|
+
r=self.PROpar.row
|
|
1718
|
+
#c=self.PROpar.col
|
|
1719
|
+
self.ui.button_mtf.setVisible(r==self.PROpar.Nit-1)
|
|
1912
1720
|
|
|
1913
|
-
|
|
1914
|
-
self.
|
|
1915
|
-
self.ui.
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
self.ui.
|
|
1721
|
+
FlagAdaptativeNotSelected=self.PROpar.row<self.PROpar.Nit
|
|
1722
|
+
self.ui.edit_IW.setEnabled(FlagAdaptativeNotSelected)
|
|
1723
|
+
self.ui.button_add.setEnabled(FlagAdaptativeNotSelected)
|
|
1724
|
+
FlagDeleteEnabled=(FlagAdaptativeNotSelected and self.PROpar.Nit>1) or self.PROpar.row>=self.PROpar.Nit
|
|
1725
|
+
self.ui.button_delete.setEnabled(FlagDeleteEnabled)
|
|
1726
|
+
|
|
1727
|
+
self.ui.combo_Wind_Vel_type.setEnabled(FlagAdaptativeNotSelected)
|
|
1728
|
+
self.ui.w_Wind_par.setEnabled(FlagAdaptativeNotSelected)
|
|
1729
|
+
self.ui.combo_Wind_Corr_type.setEnabled(FlagAdaptativeNotSelected)
|
|
1730
|
+
self.ui.w_Wind_par_2.setEnabled(FlagAdaptativeNotSelected)
|
|
1731
|
+
self.ui.spin_Wind_halfwidth.setEnabled(FlagAdaptativeNotSelected and not(self.PROpar.FlagAdaptative and self.PROpar.row==self.PROpar.Nit-1))
|
|
1732
|
+
self.ui.combo_MaxDisp_type.setEnabled(FlagAdaptativeNotSelected)
|
|
1733
|
+
self.ui.combo_MaxDisp_relative.setEnabled(FlagAdaptativeNotSelected)
|
|
1734
|
+
self.ui.spin_MaxDisp_absolute.setEnabled(FlagAdaptativeNotSelected)
|
|
1735
|
+
self.ui.check_DC_it.setEnabled(FlagAdaptativeNotSelected and self.PROpar.FlagDirectCorr)
|
|
1736
|
+
self.ui.w_Adaptative.setVisible(self.PROpar.FlagAdaptative)
|
|
1737
|
+
self.ui.w_adaptative_iter.setVisible(self.PROpar.FlagAdaptative)
|
|
1920
1738
|
|
|
1921
|
-
|
|
1922
|
-
self.
|
|
1923
|
-
self.ui.
|
|
1739
|
+
nWind=len(self.PROpar.vFlagCalcVel)
|
|
1740
|
+
self.ui.table_iter.setMinimumHeight((nWind+1)*22)
|
|
1741
|
+
self.ui.table_iter.setMaximumHeight((nWind+1)*22)
|
|
1742
|
+
self.ui.CollapBox_Windowing.heightArea=(nWind+1)*22+200
|
|
1743
|
+
self.ui.CollapBox_Windowing.heightOpened=self.ui.CollapBox_Windowing.heightArea+20
|
|
1744
|
+
self.ui.CollapBox_Windowing.on_click()
|
|
1745
|
+
return
|
|
1924
1746
|
|
|
1925
|
-
def combo_type_of_DCs_callback(self):
|
|
1926
|
-
self.PROpar.FlagSommaProd=self.ui.combo_type_of_DCs.currentIndex()
|
|
1927
|
-
|
|
1928
1747
|
|
|
1929
1748
|
if __name__ == "__main__":
|
|
1930
1749
|
import sys
|