PaIRS-UniNa 0.2.7__cp310-cp310-macosx_11_0_universal2.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.
Potentially problematic release.
This version of PaIRS-UniNa might be problematic. Click here for more details.
- PaIRS_UniNa/Calibration_Tab.py +331 -0
- PaIRS_UniNa/Changes.txt +135 -0
- PaIRS_UniNa/Custom_Top.py +303 -0
- PaIRS_UniNa/Explorer.py +3086 -0
- PaIRS_UniNa/FolderLoop.py +372 -0
- PaIRS_UniNa/Input_Tab.py +722 -0
- PaIRS_UniNa/Input_Tab_CalVi.py +788 -0
- PaIRS_UniNa/Input_Tab_tools.py +3024 -0
- PaIRS_UniNa/Log_Tab.py +110 -0
- PaIRS_UniNa/Output_Tab.py +924 -0
- PaIRS_UniNa/PaIRS.py +18 -0
- PaIRS_UniNa/PaIRS_PIV.py +873 -0
- PaIRS_UniNa/PaIRS_pypacks.py +1376 -0
- PaIRS_UniNa/Process_Tab.py +1757 -0
- PaIRS_UniNa/Process_Tab_CalVi.py +313 -0
- PaIRS_UniNa/Process_Tab_Disp.py +163 -0
- PaIRS_UniNa/Process_Tab_Min.py +120 -0
- PaIRS_UniNa/ResizePopup.py +55 -0
- PaIRS_UniNa/Saving_tools.py +296 -0
- PaIRS_UniNa/TabTools.py +1254 -0
- PaIRS_UniNa/Vis_Tab.py +2148 -0
- PaIRS_UniNa/Vis_Tab_CalVi.py +983 -0
- PaIRS_UniNa/Whatsnew.py +129 -0
- PaIRS_UniNa/_PaIRS_PIV.so +0 -0
- PaIRS_UniNa/__init__.py +6 -0
- PaIRS_UniNa/__main__.py +45 -0
- PaIRS_UniNa/addwidgets_ps.py +1133 -0
- PaIRS_UniNa/calib.py +1488 -0
- PaIRS_UniNa/calibView.py +833 -0
- PaIRS_UniNa/gPaIRS.py +3856 -0
- PaIRS_UniNa/gPalette.py +189 -0
- PaIRS_UniNa/icons/abort.png +0 -0
- PaIRS_UniNa/icons/about.png +0 -0
- 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/axes.png +0 -0
- PaIRS_UniNa/icons/background.png +0 -0
- PaIRS_UniNa/icons/background_vectors.png +0 -0
- PaIRS_UniNa/icons/bin_off.png +0 -0
- PaIRS_UniNa/icons/bin_on.png +0 -0
- PaIRS_UniNa/icons/browse_file_c.png +0 -0
- PaIRS_UniNa/icons/browse_folder_c.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/calibrate.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/checklist.png +0 -0
- PaIRS_UniNa/icons/clean.png +0 -0
- PaIRS_UniNa/icons/clean_run.png +0 -0
- PaIRS_UniNa/icons/close.png +0 -0
- PaIRS_UniNa/icons/close_all.png +0 -0
- PaIRS_UniNa/icons/close_project.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/copygrid.png +0 -0
- PaIRS_UniNa/icons/cursor_lamp.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/debug_run.png +0 -0
- PaIRS_UniNa/icons/delete.png +0 -0
- PaIRS_UniNa/icons/deleteErr.png +0 -0
- PaIRS_UniNa/icons/disp_step.png +0 -0
- PaIRS_UniNa/icons/disp_step_off.png +0 -0
- PaIRS_UniNa/icons/down.png +0 -0
- PaIRS_UniNa/icons/edit_list.png +0 -0
- PaIRS_UniNa/icons/editing.png +0 -0
- PaIRS_UniNa/icons/example_list.png +0 -0
- PaIRS_UniNa/icons/find_all_planes.png +0 -0
- PaIRS_UniNa/icons/find_plane.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_beta.png +0 -0
- PaIRS_UniNa/icons/flaticon_PaIRS_download.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/focusErrr.png +0 -0
- PaIRS_UniNa/icons/gear.gif +0 -0
- PaIRS_UniNa/icons/gear.png +0 -0
- PaIRS_UniNa/icons/ger.png +0 -0
- PaIRS_UniNa/icons/greenv.png +0 -0
- PaIRS_UniNa/icons/guide.png +0 -0
- PaIRS_UniNa/icons/icon_CalVi.png +0 -0
- PaIRS_UniNa/icons/icon_PaIRS.png +0 -0
- PaIRS_UniNa/icons/import.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/loaded.png +0 -0
- PaIRS_UniNa/icons/loading_2.gif +0 -0
- PaIRS_UniNa/icons/log_logo.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi_completo.png +0 -0
- PaIRS_UniNa/icons/logo_CalVi_party.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_completo.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_download.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_party_rect.png +0 -0
- PaIRS_UniNa/icons/logo_PaIRS_rect.png +0 -0
- PaIRS_UniNa/icons/logo_opaco.png +0 -0
- PaIRS_UniNa/icons/mask.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/minus.png +0 -0
- PaIRS_UniNa/icons/mirror_u.png +0 -0
- PaIRS_UniNa/icons/mirror_v.png +0 -0
- PaIRS_UniNa/icons/mirror_x.png +0 -0
- PaIRS_UniNa/icons/mirror_y.png +0 -0
- PaIRS_UniNa/icons/mtplt.png +0 -0
- PaIRS_UniNa/icons/new.png +0 -0
- PaIRS_UniNa/icons/new_workspace.png +0 -0
- PaIRS_UniNa/icons/news.png +0 -0
- PaIRS_UniNa/icons/normal_run.png +0 -0
- PaIRS_UniNa/icons/open.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/pause.png +0 -0
- PaIRS_UniNa/icons/paused.png +0 -0
- PaIRS_UniNa/icons/pencil_bw.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/plane.png +0 -0
- PaIRS_UniNa/icons/play.png +0 -0
- PaIRS_UniNa/icons/plus.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/quit.png +0 -0
- PaIRS_UniNa/icons/read.png +0 -0
- PaIRS_UniNa/icons/read_list.png +0 -0
- PaIRS_UniNa/icons/redo.png +0 -0
- PaIRS_UniNa/icons/redx.png +0 -0
- PaIRS_UniNa/icons/reset.png +0 -0
- PaIRS_UniNa/icons/reset_levels.png +0 -0
- PaIRS_UniNa/icons/resize_icon.png +0 -0
- PaIRS_UniNa/icons/restore.png +0 -0
- PaIRS_UniNa/icons/restore_undo.png +0 -0
- PaIRS_UniNa/icons/rotate_clock.png +0 -0
- PaIRS_UniNa/icons/rotate_counter.png +0 -0
- PaIRS_UniNa/icons/rotate_v_clock.png +0 -0
- PaIRS_UniNa/icons/rotate_v_counter.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/sandglass.png +0 -0
- PaIRS_UniNa/icons/save.png +0 -0
- PaIRS_UniNa/icons/save_and_stop.png +0 -0
- PaIRS_UniNa/icons/save_cfg.png +0 -0
- PaIRS_UniNa/icons/saveas.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/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/tom.png +0 -0
- PaIRS_UniNa/icons/trash.png +0 -0
- PaIRS_UniNa/icons/undo.png +0 -0
- PaIRS_UniNa/icons/unedited.png +0 -0
- PaIRS_UniNa/icons/unina_dii.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/up.png +0 -0
- PaIRS_UniNa/icons/updating_import.gif +0 -0
- PaIRS_UniNa/icons/updating_pairs.gif +0 -0
- PaIRS_UniNa/icons/vectorColor.png +0 -0
- PaIRS_UniNa/icons/vettore.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/waiting_circle.png +0 -0
- PaIRS_UniNa/icons/warning.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 +256 -0
- PaIRS_UniNa/parForMulti.py +435 -0
- PaIRS_UniNa/parForWorkers.py +593 -0
- PaIRS_UniNa/pivParFor.py +235 -0
- PaIRS_UniNa/plt_util.py +141 -0
- PaIRS_UniNa/preProcParFor.py +155 -0
- PaIRS_UniNa/procTools.py +1394 -0
- PaIRS_UniNa/readcfg.py +52 -0
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereoPivParFor.py +227 -0
- PaIRS_UniNa/tAVarie.py +215 -0
- PaIRS_UniNa/tabSplitter.py +612 -0
- PaIRS_UniNa/ui_Calibration_Tab.py +545 -0
- PaIRS_UniNa/ui_Custom_Top.py +296 -0
- PaIRS_UniNa/ui_Input_Tab.py +1101 -0
- PaIRS_UniNa/ui_Input_Tab_CalVi.py +1283 -0
- PaIRS_UniNa/ui_Log_Tab.py +263 -0
- PaIRS_UniNa/ui_Output_Tab.py +2362 -0
- PaIRS_UniNa/ui_Process_Tab.py +3810 -0
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1549 -0
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1141 -0
- PaIRS_UniNa/ui_Process_Tab_Min.py +437 -0
- PaIRS_UniNa/ui_ResizePopup.py +204 -0
- PaIRS_UniNa/ui_Vis_Tab.py +1628 -0
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1251 -0
- PaIRS_UniNa/ui_Whatsnew.py +132 -0
- PaIRS_UniNa/ui_gPairs.py +877 -0
- PaIRS_UniNa/ui_infoPaIRS.py +551 -0
- PaIRS_UniNa/whatsnew.txt +5 -0
- pairs_unina-0.2.7.dist-info/METADATA +160 -0
- pairs_unina-0.2.7.dist-info/RECORD +325 -0
- pairs_unina-0.2.7.dist-info/WHEEL +5 -0
- pairs_unina-0.2.7.dist-info/top_level.txt +2 -0
PaIRS_UniNa/readcfg.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
''' helper functions for reading cfg files'''
|
|
2
|
+
from typing import Tuple,Callable,TextIO,Union
|
|
3
|
+
def readNumCfg(f,ind:int,convFun:Callable,separator=',',comment='%')->Tuple[int,Union [int,float]]:
|
|
4
|
+
''' reads a number from a cfg file'''
|
|
5
|
+
|
|
6
|
+
while (line:=f.readline())[0]==comment:
|
|
7
|
+
ind+=1
|
|
8
|
+
|
|
9
|
+
return ind+1,convFun(line.strip().split(separator)[0])
|
|
10
|
+
|
|
11
|
+
def readCfgTag(f:TextIO)->str:
|
|
12
|
+
''' returns the cfg tag'''
|
|
13
|
+
return f.readline()[0:8]
|
|
14
|
+
|
|
15
|
+
def readNumVecCfg(f,ind:int,convFun,separator=',',comment='%')->Tuple[int,list[Union [int,float]]]:
|
|
16
|
+
''' reads a vector of numbers from a cfg file'''
|
|
17
|
+
|
|
18
|
+
while (line:=f.readline())[0]==comment:
|
|
19
|
+
ind+=1
|
|
20
|
+
nums=line.strip().split(separator)[0].split('[')[1].split(']')[0].strip()
|
|
21
|
+
|
|
22
|
+
return ind+1,[convFun(num) for num in nums.split(' ')]
|
|
23
|
+
def readCalFile(buffer:str)->Tuple[int,int ,list[float]]:
|
|
24
|
+
''' reads the calibration constants from a file
|
|
25
|
+
buffer is the name of the file
|
|
26
|
+
if numCostCalib is different from none it is used regardless of the value in the file
|
|
27
|
+
In output returns flagCal,numCostCalib,cost
|
|
28
|
+
'''
|
|
29
|
+
try:
|
|
30
|
+
with open(buffer,'r') as f:
|
|
31
|
+
tag=readCfgTag(f)
|
|
32
|
+
|
|
33
|
+
if tag != "%SP00015":
|
|
34
|
+
raise RuntimeError(f'Wrong tag in file: {buffer}')
|
|
35
|
+
ind=1
|
|
36
|
+
ind,flagCal=readNumCfg(f,ind,int)
|
|
37
|
+
ind,numCostCalib=readNumCfg(f,ind,int)
|
|
38
|
+
|
|
39
|
+
cost=[0]*numCostCalib
|
|
40
|
+
for i in range(numCostCalib):# dati->NumCostCalib; i++):
|
|
41
|
+
ind,cost[i]=readNumCfg(f,ind,float)
|
|
42
|
+
return flagCal,numCostCalib,cost
|
|
43
|
+
#if "%SP00015"
|
|
44
|
+
#for index, line in enumerate(f): pri.Info.white("Line {}: {}".format(index, line.strip()))
|
|
45
|
+
#except Exception as exc:
|
|
46
|
+
except IOError as exc:
|
|
47
|
+
raise RuntimeError(f'Error opening the calibration constants file: {buffer}') from exc
|
|
48
|
+
except ValueError as exc:
|
|
49
|
+
raise RuntimeError(f'Error reading line:{ind+1} of file: {buffer}') from exc
|
|
50
|
+
except IndexError as exc:
|
|
51
|
+
raise RuntimeError(f'Error reading array in line:{ind+1} of file: {buffer}') from exc
|
|
52
|
+
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
from typing import Tuple#,Callable
|
|
2
|
+
from .PaIRS_pypacks import *
|
|
3
|
+
from .procTools import *
|
|
4
|
+
from .pivParFor import WrapperOutFromPIV
|
|
5
|
+
from .readcfg import readCalFile
|
|
6
|
+
#if Flag_DEBUG_PARPOOL: import debugpy
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def initStereoPIV(eventFerma,iImg,procId,data:dataTreePar,*args,**kwargs):
|
|
11
|
+
''' this function is called once per processor before the main function
|
|
12
|
+
eventferma is passed to the function called by PIV in order to stop the processing '''
|
|
13
|
+
#prTimeLock(0,f" initPIV")
|
|
14
|
+
|
|
15
|
+
StereoPIV=data2StereoPIV(data)
|
|
16
|
+
try:
|
|
17
|
+
StereoPIV.evalCommonZone() #todo maybe this should be done also before for plotting the common zone
|
|
18
|
+
except ValueError as exc:
|
|
19
|
+
pri.Error.white(f"{exc=}, {type(exc)=}")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
StereoPIV.Inp.FlagLog=0
|
|
23
|
+
#vect=[]
|
|
24
|
+
#for v in data.PRO.Vect: vect.append(v.astype(np.intc))
|
|
25
|
+
|
|
26
|
+
#StereoPIV.SetVect([v.astype(np.intc) for v in data.PRO.Vect])
|
|
27
|
+
if data.FlagMIN:
|
|
28
|
+
data.compMin.Imin=[[np.zeros(1) for _ in range(data.nframe)] for _ in range(data.ncam)]
|
|
29
|
+
for c,Iminc in enumerate(data.Imin):
|
|
30
|
+
for k,filename in enumerate(Iminc):
|
|
31
|
+
try:
|
|
32
|
+
data.compMin.Imin[c][k]=np.ascontiguousarray(Image.open(filename))
|
|
33
|
+
except Exception as inst:
|
|
34
|
+
raise (inst)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
#fatto in modo esplicito da vedere
|
|
38
|
+
#StereoPIV.Inp.FlagNumThreads=1# of threads used in the processing use 0 for the number of logical processors
|
|
39
|
+
StereoPIV.Media=MediaPIV(stepType=StepTypes.spiv)#data.mediaPIV
|
|
40
|
+
StereoPIV.WraOut =WrapperOutFromPIV(0,eventExit=eventFerma)
|
|
41
|
+
StereoPIV.fun=PaIRS_lib.GetPyFunction(StereoPIV.WraOut)
|
|
42
|
+
StereoPIV.initAlloc(StereoPIV.fun)
|
|
43
|
+
(flagOut,VarOut) =procStereoPIV(iImg,procId ,StereoPIV,data,*args,**kwargs)
|
|
44
|
+
return (flagOut,VarOut,StereoPIV)
|
|
45
|
+
def exitNoLog(flagOut,varOut):
|
|
46
|
+
''' exit without printing the log '''
|
|
47
|
+
varOut[0]=-1
|
|
48
|
+
return (flagOut,varOut)
|
|
49
|
+
def procStereoPIV(i,procId ,StereoPIV,data:dataTreePar,numUsedProcs,*args,**kwargs):
|
|
50
|
+
''' main proc function called for all the images one time per processor
|
|
51
|
+
k=0 always
|
|
52
|
+
In output flagOut and varOut[0] can be:
|
|
53
|
+
Already processed: varOut[0]=-1 flagOut=FLAG_PROC[k]|FLAG_READ[k]|FLAG_FINALIZED[k]
|
|
54
|
+
Error reading: varOut[0]=i flagOut=FLAG_READ_ERR[k]
|
|
55
|
+
Error processing: varOut[0]=i flagOut=FLAG_READ[k]
|
|
56
|
+
Process stoped by user: varOut[0]=-1 flagOut=FLAG_READ[k]
|
|
57
|
+
Error saving: varOut[0]=i flagOut=FLAG_PROC[k]|FLAG_READ[k]
|
|
58
|
+
Read and processed: varOut[0]=i flagOut=FLAG_PROC[k]|FLAG_READ[k]|FLAG_FINALIZED[k]|FLAG_CALLBACK_INTERNAL
|
|
59
|
+
Use:
|
|
60
|
+
numCallBackTotOk+=sum(1 if x&FLAG_CALLBACK_INTERNAL else 0 for x in flagOut)
|
|
61
|
+
to evaluate the number of total internal callbacks
|
|
62
|
+
numProcOrErrTot=sum(1 if f else 0 for f in flagOut)
|
|
63
|
+
to evaluate the number of total images processed (after a possible pause)
|
|
64
|
+
numFinalized=sum(1 if f&FLAG_FINALIZED[0] else 0 for f in flagOut)
|
|
65
|
+
to evaluate the number of total images correctly processed
|
|
66
|
+
|
|
67
|
+
where FLAG_FINALIZED_OR_ERR = [ p|e for (p,e) in zip(FLAG_FINALIZED,FLAG_READ_ERR)]
|
|
68
|
+
numProcOrErrTot=sum(1 if (f&FLAG_FINALIZED_OR_ERR[0])or(not f&FLAG_PROC[0]) else 0 for f in flagOut)
|
|
69
|
+
to delete images
|
|
70
|
+
pa='C:\\desk\\dl\\apairs\\jetcross\\'
|
|
71
|
+
no='zR2jet0_0004a'
|
|
72
|
+
I =imread([pa no '.png']);
|
|
73
|
+
I=I*0+1;
|
|
74
|
+
imwrite(I,[pa no 'black.png']);
|
|
75
|
+
'''
|
|
76
|
+
|
|
77
|
+
flagOut=0#data.list_pim[i] #0 to be processed, -1 error, 1 correctly processed
|
|
78
|
+
|
|
79
|
+
varOut=[i,'',[]] # The log will be written unless exitNoLog. If FLAG_CALLBACK_INTERNAL will be set then also the internal part will be called.
|
|
80
|
+
|
|
81
|
+
#if PIV.WraOut.flagFerma!=0: return (flagOut,VarOut)
|
|
82
|
+
j=i*2
|
|
83
|
+
kConst=0#useless. In preProc the flags are different for the first and second image in this case we only use the first (i.e. k=0)
|
|
84
|
+
try:
|
|
85
|
+
varOut[1]+=f'{data.list_Image_Files[j]}-{data.list_Image_Files[j+1]}'
|
|
86
|
+
if data.list_eim[j] and data.list_eim[j+1]:
|
|
87
|
+
if data.list_pim[i]&FLAG_FINALIZED[kConst]:
|
|
88
|
+
flagOut=FLAG_READ[kConst]|FLAG_PROC[kConst]|FLAG_FINALIZED[kConst] # It has been already processed. Exit without calling the callback core part
|
|
89
|
+
#☻prTimeLock(0,f"{i} --> {data.list_Image_Files[j]} {data.list_Image_Files[j+1]} {hex(flagOut)}")
|
|
90
|
+
return exitNoLog(flagOut,varOut)
|
|
91
|
+
else:
|
|
92
|
+
if StereoPIV.WraOut.eventExit.is_set(): return exitNoLog(flagOut,varOut)# non si può mettere prima
|
|
93
|
+
# reading images and transforming
|
|
94
|
+
#prTimeLock(0,f"{i} --> {data.list_Image_Files[j]} {data.list_Image_Files[j+1]}")
|
|
95
|
+
imgs = [[None] * 2 for i in range(2)]
|
|
96
|
+
# tbd
|
|
97
|
+
#if i==2:1/0
|
|
98
|
+
try:
|
|
99
|
+
for c in range(2):
|
|
100
|
+
for k in range(2):
|
|
101
|
+
if StereoPIV.WraOut.eventExit.is_set(): return exitNoLog(flagOut,varOut)
|
|
102
|
+
if c==0:
|
|
103
|
+
nameImg=data.inpPath+data.list_Image_Files[j+k]
|
|
104
|
+
else:
|
|
105
|
+
nameImg=data.inpPath+data.list_Image_Files[j+k].replace('_cam0','_cam1')
|
|
106
|
+
imgs[c][k]=np.ascontiguousarray(Image.open(nameImg),dtype= np.uint16)
|
|
107
|
+
if data.FlagMIN:
|
|
108
|
+
if data.FlagTR and i%2:
|
|
109
|
+
imgs[c][k]=imgs[c][k]-data.compMin.Imin[c][[1,0][k]]
|
|
110
|
+
else:
|
|
111
|
+
imgs[c][k]=imgs[c][k]-data.compMin.Imin[c][k]
|
|
112
|
+
imgs[c][k]=np.ascontiguousarray(imgs[c][k],dtype= np.uint16)
|
|
113
|
+
#iProc=transfIm(data.OUT,flagTransf=0,Images=I1)
|
|
114
|
+
except Exception as inst:
|
|
115
|
+
flagOut|=FLAG_READ_ERR[kConst]
|
|
116
|
+
if data.list_pim[i]&FLAG_READ_ERR[kConst]:varOut[0]=-1# no log already written
|
|
117
|
+
varOut[1]+=f"\n!!!!!!!!!! Error while reading the image {data.list_Image_Files[j+k]}:\n{inst}\n"
|
|
118
|
+
prLock(f'{varOut[1]}')
|
|
119
|
+
return (flagOut,varOut) #we can exit directly! Not calling the internal part of the callback in case of error
|
|
120
|
+
|
|
121
|
+
# no exception reading images and transforming running the process
|
|
122
|
+
flagOut|=FLAG_READ[kConst]
|
|
123
|
+
#infoPrint.white(os.getpid())
|
|
124
|
+
try:
|
|
125
|
+
if StereoPIV.WraOut.eventExit.is_set(): return (flagOut,varOut)
|
|
126
|
+
err=StereoPIV.run(imgs)
|
|
127
|
+
except Exception as inst:
|
|
128
|
+
#raise (inst)
|
|
129
|
+
if ( data.list_pim[i] &FLAG_READ[kConst]):varOut[0]=-1# no log already written
|
|
130
|
+
#dum=str(inst.__cause__).split('\n')[3] #solved
|
|
131
|
+
dum='\n'.join(str(inst.args[0]).split('\n')[3:])
|
|
132
|
+
#varOut[1]+=f"\n!!!!!!!!!! Error while processing the above image pair: {dum}"
|
|
133
|
+
varOut[1]+=f"\n!!!!!!!!!! Error while processing data:\n{dum}\n"
|
|
134
|
+
#prLock(f'{varOut[1]}')
|
|
135
|
+
return (flagOut,varOut) #we can exit directly! Not calling the internal part of the callback in case of error
|
|
136
|
+
try:# no exception running the process
|
|
137
|
+
if err==-1000: #interrotto
|
|
138
|
+
return exitNoLog(flagOut,varOut) #we can exit directly no log !
|
|
139
|
+
else:
|
|
140
|
+
# Finalizing the process (means transformations and saving data)
|
|
141
|
+
flagOut|=FLAG_PROC[kConst]# per completezza aggiungo anche processato
|
|
142
|
+
#x,y,u,v=transfVect(data.OUT,StereoPIV) # No transformation for Spiv #[StereoPIV.x,StereoPIV.y,StereoPIV.z,StereoPIV.u,StereoPIV.v,StereoPIV.w]
|
|
143
|
+
nameFields=StereoPIV.Media.namesPIV.instVelFields
|
|
144
|
+
#otherVars=[getattr(StereoPIV,f) for f in nameFields[4:] ]
|
|
145
|
+
#campoVel=[x,y,u,v] +transfIm(data.OUT,flagTransf=1,Images=otherVars,flagRot=1)
|
|
146
|
+
campoVel=[getattr(StereoPIV,f) for f in nameFields ]
|
|
147
|
+
nameVar=StereoPIV.Media.namesPIV.instVel
|
|
148
|
+
StereoPIV.Media.sum(campoVel)
|
|
149
|
+
try:
|
|
150
|
+
saveResults(data,i+1,campoVel,nameVar)
|
|
151
|
+
except Exception as inst:
|
|
152
|
+
varOut[1]+=f"\n!!!!!!!!!! Error while saving the results:\n{str(inst)}\n"
|
|
153
|
+
#prLock(f'{varOut[1]}')
|
|
154
|
+
varOut[0]=i# In any case the log will be written. If FLAG_CALLBACK_INTERNAL will be set then also the internal part will be called.
|
|
155
|
+
return (flagOut,varOut) #we can exit directly! Not calling the internal part of the callback in case of error
|
|
156
|
+
varOut[1]+="\n"+printPIVLog(StereoPIV.PD0)+printPIVLog(StereoPIV.PD1)
|
|
157
|
+
flagOut|=FLAG_FINALIZED[kConst]
|
|
158
|
+
varOut[0]=i# In any case the log will be written. If FLAG_CALLBACK_INTERNAL will be set then also the internal part will be called.
|
|
159
|
+
flagOut|=FLAG_CALLBACK_INTERNAL# Verrà chiamata la callback
|
|
160
|
+
except Exception as inst:
|
|
161
|
+
varOut[1]+=f"\n!!!!!!!!!! Error while finalizing the PIV process:\n{str(inst)}\n"
|
|
162
|
+
#prLock(f'{varOut[1]}')
|
|
163
|
+
return (flagOut,varOut)
|
|
164
|
+
else:#if data.list_eim[j] and data.list_eim[j+1]:
|
|
165
|
+
flagOut|=FLAG_READ_ERR[kConst]
|
|
166
|
+
if data.list_pim[i]&FLAG_READ_ERR[kConst]:varOut[0]=-1# no log already written
|
|
167
|
+
jj=j+1 if data.list_eim[j] else j
|
|
168
|
+
varOut[1]+=f"\n!!!!!!!!!! Error while reading the image {data.list_Image_Files[jj]}:\nThe image file is missing!\n"
|
|
169
|
+
#prLock(f'{varOut[1]}')
|
|
170
|
+
except :
|
|
171
|
+
flagOut|=FLAG_GENERIC_ERROR
|
|
172
|
+
varOut[0]=i# In any case the log will be written. If FLAG_CALLBACK_INTERNAL will be set then also the internal part will be called.
|
|
173
|
+
varOut[1]+=printException(flagMessage=True)
|
|
174
|
+
|
|
175
|
+
# to del ma il resto dove va
|
|
176
|
+
#varOut=[i,stampa,[]] if flagOut&FLAG_FINALIZING_PROC_OK[0] else [-1,stampa,[]]
|
|
177
|
+
if (not procId%numUsedProcs) and flagOut&FLAG_FINALIZED[0]: # copiare l'img nella coda è un operazione onerosa. TA ha deciso che si copia solo quando serve
|
|
178
|
+
#prLock(f'procMIN Main proc i={i}')
|
|
179
|
+
varOut[2]=campoVel#VarOut=[i,stampa,Var]
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
return (flagOut,varOut)
|
|
184
|
+
|
|
185
|
+
def finalStereoPIV(procId, PIV,data,*args,finalPIVPIppo=4 ,**kwargs):
|
|
186
|
+
#prLock(f'finalPIV procId={procId}')
|
|
187
|
+
return PIV.Media
|
|
188
|
+
|
|
189
|
+
def saveAndMean(procId,flagHasWorked,med,data,*args,**kwargs):
|
|
190
|
+
''' saveAndMean is the wrapUp function called once per processor '''
|
|
191
|
+
if flagHasWorked:
|
|
192
|
+
data.mediaPIV.sumMedia(med)
|
|
193
|
+
return data.mediaPIV
|
|
194
|
+
|
|
195
|
+
def callBackStereoPIV(flag,perc,procId,flagOut,name,VarOut,signal_res):
|
|
196
|
+
'''
|
|
197
|
+
flag=true new data False just check exit
|
|
198
|
+
perc= precentage done
|
|
199
|
+
flagOutFromTasks,varOutFromTask Out varibles from task e.g.:
|
|
200
|
+
flagOut=1 #0 to be processed, -1 error, 1 correctly processed
|
|
201
|
+
varOutFromTask whatever for now a string
|
|
202
|
+
name current element in names
|
|
203
|
+
to stop the process the return value should be True otherwise sleep
|
|
204
|
+
'''
|
|
205
|
+
global FlagStopWorkers
|
|
206
|
+
|
|
207
|
+
if flag:
|
|
208
|
+
i=VarOut[0]
|
|
209
|
+
stampa=VarOut[1]
|
|
210
|
+
Var=VarOut[2]
|
|
211
|
+
#pr(f'Callback {i} getpid {os.getpid()} {len(Var)}')
|
|
212
|
+
#prLock(f'Callback {i} getpid {os.getpid()} ')
|
|
213
|
+
signal_res.emit(procId,i,flagOut,Var,stampa)
|
|
214
|
+
VarOut[2]=[]#altrimenti salvo le img
|
|
215
|
+
'''
|
|
216
|
+
if i==0:
|
|
217
|
+
callBackPIV.flagStop=True
|
|
218
|
+
if(callBackPIV.flagStop):
|
|
219
|
+
if i>=2:
|
|
220
|
+
callBackPIV.flagStop=False
|
|
221
|
+
FlagStopWorkers[0]=True
|
|
222
|
+
return True
|
|
223
|
+
#'''
|
|
224
|
+
if FlagStopWorkers[0]:
|
|
225
|
+
return True
|
|
226
|
+
else:
|
|
227
|
+
return False
|
PaIRS_UniNa/tAVarie.py
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
''' printing routines'''
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from time import time
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def commenti():
|
|
8
|
+
'''
|
|
9
|
+
## Descrizione di alcuni commenti (Doppio ## per titolo Anche singolo #)
|
|
10
|
+
### Sotto titolo (###)
|
|
11
|
+
#### Sotto titolo (####)
|
|
12
|
+
|
|
13
|
+
Questo è un link interno [commenti] o esterno [https://dartdoc.takyam.com/articles/doc-comment-guidelines/#markup].
|
|
14
|
+
|
|
15
|
+
L'editor fa un wrap automatico Per andare a capo mettere una linea vuota altrimenti il testo della linea successiva si attacca a quella precedente.
|
|
16
|
+
|
|
17
|
+
Lista formattata * o numero seguito da punto
|
|
18
|
+
1. item continues until next list item or blank line
|
|
19
|
+
2. next item
|
|
20
|
+
|
|
21
|
+
Non funzionano per python:
|
|
22
|
+
* Per il corsivo utilizzare _single underscore_ or *single asterisk*. Per Boldface **double asterisk** or __double underscore__
|
|
23
|
+
* Inserire 5 spazi ed una linea vuota per mettere del codice che poi verrà formattato
|
|
24
|
+
|
|
25
|
+
$ def commenti():
|
|
26
|
+
void commenti(){}
|
|
27
|
+
|
|
28
|
+
in alternativa usare (alt96) anche se non mi sembra che funzioni `def commenti()` (note the backquotes)
|
|
29
|
+
'''
|
|
30
|
+
return
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
PrintTAPriority=Enum('PrintTAPriority' ,['never', 'veryLow', 'low', 'medium', 'mediumHigh', 'high', 'always' ])
|
|
35
|
+
'''
|
|
36
|
+
* never non stampa nulla
|
|
37
|
+
* always stampa sempre
|
|
38
|
+
* Altro stampa solo se la priorità impostata durante la fase di stampa è maggiore uguale di quella impostata nella classe (eccezione per PrintTAPriority.always)
|
|
39
|
+
* quindi impostando PrintTA.flagPriority=PrintTAPriority.always non stampa nulla
|
|
40
|
+
* quindi impostando PrintTA.flagPriority=PrintTAPriority.never stampa tutto
|
|
41
|
+
'''
|
|
42
|
+
|
|
43
|
+
class PrintTA ():
|
|
44
|
+
'''
|
|
45
|
+
## Usare al posto di Print con qualcosa del tipo
|
|
46
|
+
|
|
47
|
+
* printTA = PrintTA(PrintTA.blue, PrintTA.faceStd, PrintTAPriority.medium)
|
|
48
|
+
* printTA.pr('blue',color=printTA.blue)
|
|
49
|
+
* printTA.pr('green',color=printTA.green)
|
|
50
|
+
* printTA.pr('yellow',color=printTA.yellow)
|
|
51
|
+
* printTA.pr('magenta',color=printTA.magenta)
|
|
52
|
+
* printTA.pr('cyan',color=printTA.cyan)
|
|
53
|
+
* printTA.pr('white faceUnderline plus faceItalic',color=printTA.white,face=printTA.faceUnderline+printTA.faceItalic)
|
|
54
|
+
* printTA.err('Error always bold and','red')
|
|
55
|
+
* printTA.pri.Time('cyan with time',color=printTA.cyan)
|
|
56
|
+
|
|
57
|
+
Per disattivare la stampa:
|
|
58
|
+
* PrintTA.flagPriority=PrintTAPriority.always
|
|
59
|
+
|
|
60
|
+
'''
|
|
61
|
+
|
|
62
|
+
faceBold = ';1'
|
|
63
|
+
faceItalic = ';3'
|
|
64
|
+
faceUnderline = ';4'
|
|
65
|
+
faceStd = ''
|
|
66
|
+
|
|
67
|
+
stdCol = '0'
|
|
68
|
+
red = '31'
|
|
69
|
+
green = '32'
|
|
70
|
+
yellow = '33'
|
|
71
|
+
blue = '34'
|
|
72
|
+
magenta = '35'
|
|
73
|
+
cyan = '36'
|
|
74
|
+
white = '37'
|
|
75
|
+
_tAPrintESC = '\x1B['
|
|
76
|
+
_tAPrintLAST = 'm'
|
|
77
|
+
_tAPrintRESET = '\x1B[0m'
|
|
78
|
+
flagPriority=PrintTAPriority.medium
|
|
79
|
+
startTime=time()
|
|
80
|
+
def __init__(self,color='37',face='',flagPriority=PrintTAPriority.medium, prefix='',suffix=''):
|
|
81
|
+
self.face =face
|
|
82
|
+
self.color=color
|
|
83
|
+
self.prefix=prefix
|
|
84
|
+
self.flagPriority=flagPriority
|
|
85
|
+
self.suffix=suffix
|
|
86
|
+
|
|
87
|
+
def internalPrint(self, *args,**kwargs):
|
|
88
|
+
''' change for a different print function'''
|
|
89
|
+
print(*args,**kwargs,flush=True)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
# [https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters]
|
|
93
|
+
# print in color with priority
|
|
94
|
+
# msg text to print
|
|
95
|
+
# color one of PrintTA.color (e.g. PrintTA.red)
|
|
96
|
+
# face one of PrintTA.bold, PrintTA.italic, PrintTA.underline or PrintTA.stdFace
|
|
97
|
+
# pri one of PrintTAPriority
|
|
98
|
+
|
|
99
|
+
def pr(self, *args,color=None, face=None, pri=None,**kwargs):
|
|
100
|
+
''' the printing function '''
|
|
101
|
+
#if self.flagPriority is PrintTAPriority.never:
|
|
102
|
+
if PrintTA.flagPriority is PrintTAPriority.always:
|
|
103
|
+
return
|
|
104
|
+
if color is None:
|
|
105
|
+
color=self.color
|
|
106
|
+
if face is None:
|
|
107
|
+
face=self.face
|
|
108
|
+
if pri is None :
|
|
109
|
+
pri=self.flagPriority
|
|
110
|
+
if pri.value < PrintTA.flagPriority.value:
|
|
111
|
+
return
|
|
112
|
+
self.internalPrint(f'{self._tAPrintESC}{color}{face}{self._tAPrintLAST}{self.prefix}',end='')
|
|
113
|
+
self.internalPrint(*args,f'{self.suffix}{self._tAPrintRESET}',**kwargs)
|
|
114
|
+
|
|
115
|
+
#self.internalPrint(f'{self._tAPrintESC}{color}{face}{self._tAPrintLAST}{self.prefix}',*args,f'{self.suffix}{self._tAPrintRESET}',**kwargs)
|
|
116
|
+
|
|
117
|
+
def err(self, *args,**kwargs):
|
|
118
|
+
''' print error always bold and red'''
|
|
119
|
+
self.pr( color= PrintTA.red, face= PrintTA.faceBold, pri= PrintTAPriority.medium,*args,**kwargs)
|
|
120
|
+
|
|
121
|
+
def prTime(self, *args,flagReset=0,color=None, face=None, pri=None,**kwargs):
|
|
122
|
+
'''
|
|
123
|
+
flagreset==0 stampa senza reset (tempo incremetale )
|
|
124
|
+
flagreset==1 stampa e reset origin (tempo incremetale riazzera l'origine dei tempi)
|
|
125
|
+
flagreset==2 stampa senza tempo e reset origin
|
|
126
|
+
flagreset==3 fa solo il reset dei tempi origin
|
|
127
|
+
'''
|
|
128
|
+
if PrintTA.flagPriority is PrintTAPriority.always:
|
|
129
|
+
return
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
if 0<=flagReset<=1:
|
|
133
|
+
self.pr(f'Deltat={time()-PrintTA.startTime} -- ',*args, color=color, face=face, pri=pri,**kwargs)
|
|
134
|
+
elif flagReset==2:
|
|
135
|
+
self.pr(*args, color=color, face=face, pri=pri,**kwargs)
|
|
136
|
+
if flagReset>0:
|
|
137
|
+
PrintTA.startTime=time()
|
|
138
|
+
def printEvidenced(self,*args,sep='*', numLinee=4,numSep=20,color=None, face=None, pri=None,**kwargs):
|
|
139
|
+
if PrintTA.flagPriority is PrintTAPriority.always:
|
|
140
|
+
return
|
|
141
|
+
dum=sep*numSep
|
|
142
|
+
separator=f'{dum}\n'*(numLinee-1)+dum
|
|
143
|
+
self.pr(separator,color=color, face=face, pri=pri)
|
|
144
|
+
self.pr(*args, color=color, face=face, pri=pri,**kwargs)
|
|
145
|
+
self.pr(separator,color=color, face=face, pri=pri)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def testPr():
|
|
150
|
+
''' can be used to test the priorities'''
|
|
151
|
+
PrintTA(PrintTA.white, PrintTA.faceStd, PrintTAPriority.never).pr ('never')
|
|
152
|
+
PrintTA(PrintTA.white, PrintTA.faceStd, PrintTAPriority.medium).pr ('medium')
|
|
153
|
+
PrintTA(PrintTA.white, PrintTA.faceStd, PrintTAPriority.high).pr ('high')
|
|
154
|
+
PrintTA(PrintTA.white, PrintTA.faceStd, PrintTAPriority.always).pr ('always')
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class ColorPrint:
|
|
159
|
+
def __init__(self,flagTime=False,prio=PrintTAPriority.medium,faceStd=PrintTA.faceStd,flagFullDebug=False):
|
|
160
|
+
self.flagTime=flagTime
|
|
161
|
+
self.prio=prio
|
|
162
|
+
self.faceStd=faceStd
|
|
163
|
+
self.flagFullDebug=flagFullDebug
|
|
164
|
+
self.setPrints()
|
|
165
|
+
|
|
166
|
+
def setPrints(self):
|
|
167
|
+
if self.flagTime:
|
|
168
|
+
self.white = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.white, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
169
|
+
self.red = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.red, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
170
|
+
self.green = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.green, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
171
|
+
self.blue = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.blue, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
172
|
+
self.cyan = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.cyan, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
173
|
+
self.magenta = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.magenta, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
174
|
+
self.yellow = lambda flagReset=0, *args, **kwargs: PrintTA(PrintTA.yellow, self.faceStd, self.prio).prTime(flagReset,*args,**kwargs)
|
|
175
|
+
else:
|
|
176
|
+
self.white = PrintTA(PrintTA.white, self.faceStd, self.prio).pr
|
|
177
|
+
self.red = PrintTA(PrintTA.red, self.faceStd, self.prio).pr
|
|
178
|
+
self.green = PrintTA(PrintTA.green, self.faceStd, self.prio).pr
|
|
179
|
+
self.blue = PrintTA(PrintTA.blue, self.faceStd, self.prio).pr
|
|
180
|
+
self.cyan = PrintTA(PrintTA.cyan, self.faceStd, self.prio).pr
|
|
181
|
+
self.magenta = PrintTA(PrintTA.magenta, self.faceStd, self.prio).pr
|
|
182
|
+
self.yellow = PrintTA(PrintTA.yellow, self.faceStd, self.prio).pr
|
|
183
|
+
|
|
184
|
+
#if prio is assigned to never, in the gPaIRS initializiation the printing is deactivated, otherwise activated
|
|
185
|
+
#if prio is > veryLow, then by default the printing is activated after gPaIRS initialization
|
|
186
|
+
#flagFullDebug=True means that the printing is available only if fullDebug mode is active
|
|
187
|
+
class GPaIRSPrint:
|
|
188
|
+
def __init__(self):
|
|
189
|
+
self.General=ColorPrint(prio=PrintTAPriority.medium)
|
|
190
|
+
self.Info=ColorPrint(prio=PrintTAPriority.medium)
|
|
191
|
+
self.Time=ColorPrint(prio=PrintTAPriority.veryLow,flagTime=True,faceStd=PrintTA.faceUnderline)
|
|
192
|
+
self.Error=ColorPrint(prio=PrintTAPriority.medium,faceStd=PrintTA.faceBold)
|
|
193
|
+
self.Process=ColorPrint(prio=PrintTAPriority.veryLow)
|
|
194
|
+
self.Callback=ColorPrint(prio=PrintTAPriority.veryLow)
|
|
195
|
+
self.Geometry=ColorPrint(prio=PrintTAPriority.veryLow,flagFullDebug=True)
|
|
196
|
+
|
|
197
|
+
pri=GPaIRSPrint()
|
|
198
|
+
|
|
199
|
+
if __name__ == '__main__':
|
|
200
|
+
printTA = PrintTA(PrintTA.blue, PrintTA.faceStd, PrintTAPriority.medium)
|
|
201
|
+
printTA.pr('blue',color=printTA.blue)
|
|
202
|
+
printTA.pr('green',color=printTA.green)
|
|
203
|
+
printTA.pr('yellow',color=printTA.yellow)
|
|
204
|
+
printTA.pr('magenta',color=printTA.magenta)
|
|
205
|
+
printTA.pr('cyan',color=printTA.cyan)
|
|
206
|
+
printTA.pr('white faceUnderline plus faceItalic',color=printTA.white,face=printTA.faceUnderline+printTA.faceItalic)
|
|
207
|
+
|
|
208
|
+
printTA.err('Error always bold and','red')
|
|
209
|
+
printTA.pri.Time('cyan with time',color=printTA.cyan)
|
|
210
|
+
pri.Time.blue(0,'taPrintTime')
|
|
211
|
+
printTA.flagPriority=PrintTAPriority.always
|
|
212
|
+
printTA.pri.Time('Non è stampato',color=printTA.cyan)
|
|
213
|
+
#/// Stampa in rosso bold ed a PrintTAPriority.Always
|
|
214
|
+
#void err(msg) => pr(msg, color: red, face: faceBold, pri: PrintTAPriority.always);
|
|
215
|
+
|