PaIRS-UniNa 0.2.4__cp311-cp311-macosx_10_9_universal2.whl → 0.2.6__cp311-cp311-macosx_10_9_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/Changes.txt +35 -0
- PaIRS_UniNa/Custom_Top.py +1 -1
- PaIRS_UniNa/Explorer.py +3063 -3049
- PaIRS_UniNa/FolderLoop.py +371 -371
- PaIRS_UniNa/Input_Tab.py +717 -709
- PaIRS_UniNa/Input_Tab_CalVi.py +4 -4
- PaIRS_UniNa/Input_Tab_tools.py +3018 -3009
- PaIRS_UniNa/Output_Tab.py +2 -2
- PaIRS_UniNa/PaIRS.py +17 -17
- PaIRS_UniNa/PaIRS_PIV.py +56 -1
- PaIRS_UniNa/PaIRS_pypacks.py +323 -60
- PaIRS_UniNa/Process_Tab.py +8 -13
- PaIRS_UniNa/Process_Tab_Disp.py +9 -4
- PaIRS_UniNa/Saving_tools.py +277 -277
- PaIRS_UniNa/TabTools.py +63 -21
- PaIRS_UniNa/Vis_Tab.py +293 -115
- PaIRS_UniNa/Whatsnew.py +13 -0
- PaIRS_UniNa/_PaIRS_PIV.so +0 -0
- PaIRS_UniNa/__init__.py +3 -3
- PaIRS_UniNa/gPaIRS.py +3825 -3600
- PaIRS_UniNa/icons/flaticon_PaIRS_download_warning.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/uninitialized.png +0 -0
- PaIRS_UniNa/icons/window.png +0 -0
- PaIRS_UniNa/listLib.py +301 -301
- PaIRS_UniNa/parForMulti.py +433 -433
- PaIRS_UniNa/parForWorkers.py +46 -1
- PaIRS_UniNa/pivParFor.py +1 -1
- PaIRS_UniNa/procTools.py +17 -7
- PaIRS_UniNa/rqrdpckgs.txt +9 -0
- PaIRS_UniNa/stereo.py +683 -683
- PaIRS_UniNa/stereoPivParFor.py +1 -1
- PaIRS_UniNa/tabSplitter.py +606 -606
- PaIRS_UniNa/ui_Calibration_Tab.py +542 -542
- PaIRS_UniNa/ui_Custom_Top.py +294 -294
- PaIRS_UniNa/ui_Input_Tab.py +1098 -1098
- PaIRS_UniNa/ui_Input_Tab_CalVi.py +1280 -1280
- PaIRS_UniNa/ui_Log_Tab.py +261 -261
- PaIRS_UniNa/ui_Output_Tab.py +2360 -2360
- PaIRS_UniNa/ui_Process_Tab.py +3808 -3808
- PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1547
- PaIRS_UniNa/ui_Process_Tab_Disp.py +1139 -968
- PaIRS_UniNa/ui_Process_Tab_Min.py +435 -435
- PaIRS_UniNa/ui_ResizePopup.py +203 -203
- PaIRS_UniNa/ui_Vis_Tab.py +1626 -1533
- PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
- PaIRS_UniNa/ui_Whatsnew.py +131 -131
- PaIRS_UniNa/ui_gPairs.py +873 -849
- PaIRS_UniNa/ui_infoPaIRS.py +550 -428
- PaIRS_UniNa/whatsnew.txt +4 -4
- {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.6.dist-info}/METADATA +47 -30
- {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.6.dist-info}/RECORD +56 -54
- {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.6.dist-info}/WHEEL +1 -1
- PaIRS_UniNa/icons/order.png +0 -0
- PaIRS_UniNa/icons/order_reverse.png +0 -0
- PaIRS_UniNa/icons/run_piv.png +0 -0
- PaIRS_UniNa-0.2.4.dist-info/LICENSE +0 -19
- {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.6.dist-info}/top_level.txt +0 -0
PaIRS_UniNa/Vis_Tab.py
CHANGED
|
@@ -55,6 +55,11 @@ button_tips={
|
|
|
55
55
|
'cvec': 'Color of vectors/streamlines',
|
|
56
56
|
'view': 'Inspect pre-existing results',
|
|
57
57
|
'ShowCR': 'Show common region',
|
|
58
|
+
'dx_left': 'View zone moved to left',
|
|
59
|
+
'dx_right': 'View zone moved to right',
|
|
60
|
+
'dy_down': 'View zone moved down',
|
|
61
|
+
'dy_up': 'View zone moved up',
|
|
62
|
+
'FocusIW': 'Resize to interrogation window size',
|
|
58
63
|
}
|
|
59
64
|
combo_tips={
|
|
60
65
|
'map_var': 'Map variable',
|
|
@@ -102,6 +107,7 @@ class NamesPIV(TABpar):
|
|
|
102
107
|
self.Step = Step
|
|
103
108
|
|
|
104
109
|
self.img='img'
|
|
110
|
+
self.dispMap='dispMap'
|
|
105
111
|
self.X='X'
|
|
106
112
|
self.Y='Y'
|
|
107
113
|
self.Z='Z'
|
|
@@ -130,6 +136,7 @@ class NamesPIV(TABpar):
|
|
|
130
136
|
self.allFields=allFields
|
|
131
137
|
self.combo_dict={
|
|
132
138
|
self.img: 'image intesity',
|
|
139
|
+
self.dispMap: 'disparity maps',
|
|
133
140
|
self.Mod: 'magnitude',
|
|
134
141
|
self.z: 'z',
|
|
135
142
|
self.u: 'U',
|
|
@@ -152,6 +159,7 @@ class NamesPIV(TABpar):
|
|
|
152
159
|
for k,v in self.combo_dict.items(): self.combo_dict_keys[v]=k
|
|
153
160
|
self.titles_dict={
|
|
154
161
|
self.img: 'intensity',
|
|
162
|
+
self.dispMap: 'disparity maps',
|
|
155
163
|
self.Mod: "velocity magnitude",
|
|
156
164
|
self.z: "z coordinate",
|
|
157
165
|
self.u: "x-velocity component",
|
|
@@ -172,6 +180,7 @@ class NamesPIV(TABpar):
|
|
|
172
180
|
}
|
|
173
181
|
self.titles_cb_dict={
|
|
174
182
|
self.img: '',
|
|
183
|
+
self.dispMap: '',
|
|
175
184
|
self.Mod: "|Vel|",
|
|
176
185
|
self.z: "z",
|
|
177
186
|
self.u: "U",
|
|
@@ -293,6 +302,7 @@ class VISpar(TABpar):
|
|
|
293
302
|
self.imListMin=[[[],[]]*self.ncam]
|
|
294
303
|
|
|
295
304
|
self.image_file_Min=''
|
|
305
|
+
self.image_file_Disp=''
|
|
296
306
|
self.result_file_Mean=''
|
|
297
307
|
self.image_file_Current=''
|
|
298
308
|
self.result_file_Current=''
|
|
@@ -309,20 +319,22 @@ class VISpar(TABpar):
|
|
|
309
319
|
self.FlagResetSizes=True
|
|
310
320
|
self.setPage=0
|
|
311
321
|
|
|
312
|
-
|
|
313
|
-
|
|
322
|
+
namesPIV=NamesPIV()
|
|
323
|
+
img=namesPIV.img
|
|
324
|
+
dispMap=namesPIV.dispMap
|
|
325
|
+
self.vcolorMap={img: 'gray', dispMap: 'gray'}
|
|
314
326
|
self.colorMap='gray'
|
|
315
|
-
self.vvectorColor={img: 'green'}
|
|
327
|
+
self.vvectorColor={img: 'green', dispMap: 'green'}
|
|
316
328
|
self.vectorColor='green'
|
|
317
|
-
self.vLim={img: 1}
|
|
318
|
-
self.vmin_default={img: 0}
|
|
319
|
-
self.vmax_default={img: 1}
|
|
320
|
-
self.vmean_default={img: 0.5}
|
|
321
|
-
self.vrange_default={img: 1}
|
|
322
|
-
self.vmin={img: 0}
|
|
323
|
-
self.vmax={img: 1}
|
|
324
|
-
self.vmean={img: 0.5}
|
|
325
|
-
self.vrange={img: 1}
|
|
329
|
+
self.vLim={img: 1, dispMap: 1}
|
|
330
|
+
self.vmin_default={img: 0, dispMap: 0}
|
|
331
|
+
self.vmax_default={img: 1, dispMap: 0}
|
|
332
|
+
self.vmean_default={img: 0.5, dispMap: 0.5}
|
|
333
|
+
self.vrange_default={img: 1, dispMap: 1}
|
|
334
|
+
self.vmin={img: 0, dispMap: 0}
|
|
335
|
+
self.vmax={img: 1, dispMap: 1}
|
|
336
|
+
self.vmean={img: 0.5, dispMap: 0.5}
|
|
337
|
+
self.vrange={img: 1, dispMap: 1}
|
|
326
338
|
self.min=0
|
|
327
339
|
self.max=1
|
|
328
340
|
self.mean=0.5
|
|
@@ -356,10 +368,15 @@ class VISpar(TABpar):
|
|
|
356
368
|
#self.FlagDISP = Step==StepTypes.disp
|
|
357
369
|
#self.dispFile = ''
|
|
358
370
|
|
|
359
|
-
def resF(self,i):
|
|
371
|
+
def resF(self,i,string=''):
|
|
360
372
|
fres=self.fres
|
|
361
373
|
if not fres: return ''
|
|
362
374
|
outPathRoot=fres[0]
|
|
375
|
+
if string=='dispMap':
|
|
376
|
+
fold=os.path.dirname(self.outPathRoot)
|
|
377
|
+
rad=os.path.splitext(os.path.basename(self.outPathRoot))[0]
|
|
378
|
+
if rad[-1]!='_': rad+='_'
|
|
379
|
+
return myStandardRoot(os.path.join(fold, f'dispMap_rot_{rad}{i}.png'))
|
|
363
380
|
ndig=fres[1]
|
|
364
381
|
outExt=fres[2]
|
|
365
382
|
if type(i)==str:
|
|
@@ -382,6 +399,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
382
399
|
self.ui: Ui_VisTab
|
|
383
400
|
self.Ptoolbar=None
|
|
384
401
|
self.addPlotToolBar()
|
|
402
|
+
self.ui.plot.axes.format_coord=lambda x,y: self.custom_format_coord(x,y)
|
|
385
403
|
|
|
386
404
|
self.ui.sliders=self.findChildren(QSlider)
|
|
387
405
|
for slider in (self.ui.slider_min,self.ui.slider_max,self.ui.slider_mean,self.ui.slider_range):
|
|
@@ -402,6 +420,9 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
402
420
|
#------------------------------------- Graphical interface: miscellanea
|
|
403
421
|
self.brush_cursor= QCursor(QPixmap(icons_path+"brush_cursor.png").scaled(24,24,mode=Qt.TransformationMode.SmoothTransformation))
|
|
404
422
|
self.FlagNormalCursor=True
|
|
423
|
+
self.CursorTimer = QTimer(self)
|
|
424
|
+
self.CursorTimer.setSingleShot(True)
|
|
425
|
+
self.CursorTimer.timeout.connect(self.forceRestoreArrowCursor)
|
|
405
426
|
|
|
406
427
|
self.img=None
|
|
407
428
|
self.imgshow=None
|
|
@@ -538,6 +559,9 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
538
559
|
self.image_file_Min=''
|
|
539
560
|
self.image_Min_raw=None
|
|
540
561
|
self.image_Min=None
|
|
562
|
+
self.image_file_Disp=''
|
|
563
|
+
self.image_Disp_raw=None
|
|
564
|
+
self.image_Disp=None
|
|
541
565
|
self.nbits=0
|
|
542
566
|
self.result_file=''
|
|
543
567
|
self.result=None
|
|
@@ -605,7 +629,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
605
629
|
if self.VISpar.ncam and not self.VISpar.cam: self.VISpar.cam=1
|
|
606
630
|
self.VISpar.nimg=len(self.VISpar.imList[0][0]) if len(self.VISpar.imList[0]) else 0 if self.VISpar.ncam else 0
|
|
607
631
|
if not self.VISpar.nimg and self.VISpar.img:
|
|
608
|
-
FlagResults=self.image_file_Min!='' or self.result_file_Mean!=''
|
|
632
|
+
FlagResults=self.image_file_Min!='' or self.result_file_Mean!='' or self.image_file_Disp!=''
|
|
609
633
|
self.VISpar.img=0 if FlagResults else -1
|
|
610
634
|
|
|
611
635
|
FlagNewImage, FlagNewResult = self.adjustImport()
|
|
@@ -634,10 +658,17 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
634
658
|
self.adjustFieldRep()
|
|
635
659
|
|
|
636
660
|
def adjustImport(self):
|
|
637
|
-
self.VISpar.image_file=self.VISpar.image_file_Min=''
|
|
661
|
+
self.VISpar.image_file=self.VISpar.image_file_Min=self.VISpar.image_file_Disp=''
|
|
638
662
|
if self.VISpar.img%2==0 and self.VISpar.FlagTR and not self.VISpar.LaserType:
|
|
639
663
|
f=[1,0][self.VISpar.frame-1]
|
|
640
664
|
else: f=self.VISpar.frame-1
|
|
665
|
+
self.VISpar.image_file_Disp=''
|
|
666
|
+
FlagDisparity=self.VISpar.Step==StepTypes.disp and (resultCheck(self,self.VISpar,ind=self.VISpar.ind) or self.VISpar.FlagView)
|
|
667
|
+
if FlagDisparity:
|
|
668
|
+
dispMap_filename=self.VISpar.resF(f'it{self.VISpar.it}',string='dispMap')
|
|
669
|
+
if os.path.exists(dispMap_filename):
|
|
670
|
+
self.VISpar.image_file_Disp=dispMap_filename
|
|
671
|
+
self.VISpar.image_file_Min=''
|
|
641
672
|
ITEs=self.gui.ui.Explorer.ITEsfromInd(self.VISpar.ind)
|
|
642
673
|
ind_min=list(ITEs[0].children).index(StepTypes.min)
|
|
643
674
|
FlagMinimum=(self.VISpar.FlagMIN or self.VISpar.Step==StepTypes.min) and (resultCheck(self,self.VISpar,ind=ITEs[ind_min+1].ind) or self.VISpar.FlagView)
|
|
@@ -645,11 +676,10 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
645
676
|
if 0<=self.VISpar.cam-1<self.VISpar.ncam:
|
|
646
677
|
if 0<=f<len(self.VISpar.imListMin[self.VISpar.cam-1]):
|
|
647
678
|
self.VISpar.image_file_Min=self.VISpar.imListMin[self.VISpar.cam-1][f]
|
|
648
|
-
else: self.VISpar.image_file_Min=''
|
|
649
679
|
if self.VISpar.img>0:
|
|
650
680
|
self.VISpar.image_file=self.VISpar.path+self.VISpar.imList[self.VISpar.cam-1][self.VISpar.frame-1][self.VISpar.img-1] if len(self.VISpar.imList[self.VISpar.cam-1][self.VISpar.frame-1]) else ''
|
|
651
681
|
elif self.VISpar.img==0:
|
|
652
|
-
self.VISpar.image_file=self.VISpar.image_file_Current if self.VISpar.flagRun==-2 else self.VISpar.image_file_Min
|
|
682
|
+
self.VISpar.image_file=self.VISpar.image_file_Current if self.VISpar.flagRun==-2 and self.VISpar.variableKey!=self.namesPIV.dispMap else self.VISpar.image_file_Disp if self.VISpar.variableKey==self.namesPIV.dispMap else self.VISpar.image_file_Min
|
|
653
683
|
else:
|
|
654
684
|
self.VISpar.image_file=self.image_file_Load
|
|
655
685
|
|
|
@@ -680,6 +710,8 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
680
710
|
def importFiles(self):
|
|
681
711
|
if self.VISpar.image_file_Min!=self.image_file_Min or self.VISpar.FlagMIN!=self.VISpar_old.FlagMIN or self.FlagReset:
|
|
682
712
|
self.image_file_Min,self.image_Min_raw=self.readImageFile(self.VISpar.image_file_Min)
|
|
713
|
+
if self.VISpar.image_file_Disp!=self.image_file_Disp or self.FlagReset:
|
|
714
|
+
self.image_file_Disp,self.image_Disp_raw=self.readImageFile(self.VISpar.image_file_Disp)
|
|
683
715
|
if self.VISpar.result_file_Mean!=self.result_file_Mean or self.VISpar.FlagResult!=self.VISpar_old.FlagResult or self.FlagReset:
|
|
684
716
|
self.result_file_Mean,self.result_Mean=self.readResultFile(self.VISpar.result_file_Mean)
|
|
685
717
|
|
|
@@ -688,13 +720,16 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
688
720
|
self.image_file=self.VISpar.image_file
|
|
689
721
|
if self.VISpar.img==0:
|
|
690
722
|
if self.VISpar.flagRun==-2:
|
|
691
|
-
self.image_raw=self.image_Current_raw[self.VISpar.frame] if self.image_Current_raw else None
|
|
723
|
+
self.image_raw=self.image_Disp_raw if self.VISpar.variableKey==self.namesPIV.dispMap else self.image_Current_raw[self.VISpar.frame] if self.image_Current_raw else None
|
|
692
724
|
else:
|
|
693
|
-
self.image_raw=self.image_Min_raw
|
|
725
|
+
self.image_raw=self.image_Disp_raw if self.VISpar.variableKey==self.namesPIV.dispMap else self.image_Min_raw
|
|
694
726
|
else:
|
|
695
727
|
self.image_file,self.image_raw=self.readImageFile(self.VISpar.image_file)
|
|
696
|
-
|
|
697
|
-
|
|
728
|
+
mapVariableList=[]
|
|
729
|
+
#if self.image_raw is None and self.VISpar.img==0: mapVariableList=[]
|
|
730
|
+
#else:
|
|
731
|
+
if self.image_Disp_raw is not None and self.VISpar.img==0: mapVariableList+=[self.namesPIV.dispMap]
|
|
732
|
+
if (self.image_Min_raw is not None and self.VISpar.img==0) or self.VISpar.img!=0: mapVariableList+=[self.namesPIV.img]
|
|
698
733
|
|
|
699
734
|
FlagNewResult=self.VISpar.result_file!=self.result_file or self.VISpar.ind[:-1]!=self.VISpar_old.ind[:-1]
|
|
700
735
|
if FlagNewResult or self.FlagReset:
|
|
@@ -708,7 +743,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
708
743
|
self.result_file,self.result=self.readResultFile(self.VISpar.result_file)
|
|
709
744
|
|
|
710
745
|
if self.image_raw is not None:
|
|
711
|
-
if self.VISpar.img>=0:
|
|
746
|
+
if self.VISpar.img>=0 and self.VISpar.variableKey!=self.namesPIV.dispMap:
|
|
712
747
|
self.image=transfIm(self.VISpar.Out,Images=[self.image_raw])[0]
|
|
713
748
|
else:
|
|
714
749
|
self.image=self.image_raw
|
|
@@ -719,6 +754,10 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
719
754
|
self.image_Min=transfIm(self.VISpar.Out,Images=[self.image_Min_raw])[0]
|
|
720
755
|
else:
|
|
721
756
|
self.image_Min=None
|
|
757
|
+
if self.image_Disp_raw is not None:
|
|
758
|
+
self.image_Disp=self.image_Disp_raw #transfIm(self.VISpar.Out,Images=[self.image_Disp_raw])[0]
|
|
759
|
+
else:
|
|
760
|
+
self.image_Disp=None
|
|
722
761
|
if self.result is not None:
|
|
723
762
|
self.getResultInfo()
|
|
724
763
|
|
|
@@ -726,15 +765,26 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
726
765
|
[mapVariableList.append(r) for r in list(self.result)]
|
|
727
766
|
self.FlagReset=False
|
|
728
767
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
768
|
+
comboItemsList=[]
|
|
769
|
+
if self.namesPIV.img in mapVariableList: comboItemsList+=[self.namesPIV.combo_dict[self.namesPIV.img]]
|
|
770
|
+
if self.namesPIV.dispMap in mapVariableList: comboItemsList+=[self.namesPIV.combo_dict[self.namesPIV.dispMap]]
|
|
771
|
+
for f in list(self.namesPIV.combo_dict)[2:]:
|
|
732
772
|
if f in mapVariableList: comboItemsList.append(self.namesPIV.combo_dict[f])
|
|
733
773
|
if len(comboItemsList)==0: comboItemsList=[self.namesPIV.combo_dict[self.namesPIV.img]]
|
|
734
774
|
if self.VISpar.variable not in comboItemsList:
|
|
735
775
|
self.VISpar.variable=comboItemsList[0]
|
|
736
776
|
self.VISpar.variableKey=self.namesPIV.combo_dict_keys[self.VISpar.variable]
|
|
737
|
-
self.VISpar.
|
|
777
|
+
if self.VISpar.variableKey==self.namesPIV.img and self.VISpar.img==0:
|
|
778
|
+
if self.VISpar.image_file!=self.VISpar.image_file_Min:
|
|
779
|
+
self.VISpar.image_file=self.VISpar.image_file_Min
|
|
780
|
+
self.image=self.image_Min
|
|
781
|
+
self.getImageInfo()
|
|
782
|
+
elif self.VISpar.variableKey==self.namesPIV.dispMap and self.VISpar.img==0:
|
|
783
|
+
if self.VISpar.image_file!=self.VISpar.image_file_Disp:
|
|
784
|
+
self.VISpar.image_file=self.VISpar.image_file_Disp
|
|
785
|
+
self.image=self.image_Disp
|
|
786
|
+
self.getImageInfo()
|
|
787
|
+
self.VISpar.type=int(self.VISpar.variableKey not in (self.namesPIV.img, self.namesPIV.dispMap) )
|
|
738
788
|
|
|
739
789
|
return FlagNewImage, FlagNewResult, comboItemsList
|
|
740
790
|
|
|
@@ -770,18 +820,19 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
770
820
|
self.checkResVariables()
|
|
771
821
|
|
|
772
822
|
FlagLoad=self.image_file_Load!='' or self.result_file_Load!=''
|
|
773
|
-
FlagResults=self.image_file_Min!='' or self.result_file_Mean!=''
|
|
823
|
+
FlagResults=self.image_file_Min!='' or self.result_file_Mean!='' or self.image_file_Disp!=''
|
|
774
824
|
FlagSpinsEnabled=self.VISpar.nimg or FlagLoad
|
|
825
|
+
FlagDispMap=self.VISpar.variableKey==self.namesPIV.dispMap
|
|
775
826
|
#self.ui.Plot_tools.setEnabled(FlagSpinsEnabled)
|
|
776
827
|
|
|
777
|
-
FlagIW=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.piv,StepTypes.disp,StepTypes.spiv)
|
|
828
|
+
FlagIW=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.piv,StepTypes.disp,StepTypes.spiv) and not FlagDispMap
|
|
778
829
|
self.ui.button_ShowIW.setVisible(FlagIW)
|
|
779
830
|
if FlagIW:
|
|
780
831
|
tip=f"{'Hide' if self.ui.button_ShowIW.isChecked() else 'Show'} Interrogation Window scheme"
|
|
781
832
|
self.ui.button_ShowIW.setToolTip(tip)
|
|
782
833
|
self.ui.button_ShowIW.setStatusTip(tip)
|
|
783
834
|
|
|
784
|
-
FlagCR=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.disp,StepTypes.spiv)
|
|
835
|
+
FlagCR=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.disp,StepTypes.spiv) and not FlagDispMap
|
|
785
836
|
self.ui.button_ShowCR.setVisible(FlagCR)
|
|
786
837
|
if FlagCR:
|
|
787
838
|
tip=f"{'Hide' if self.ui.button_ShowCR.isChecked() else 'Show'} common region"
|
|
@@ -823,16 +874,20 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
823
874
|
self.ui.image_levels.setCurrentIndex(i)
|
|
824
875
|
self.ui.label_title.setText(f"Settings ({i+1}/{c+1})")
|
|
825
876
|
|
|
826
|
-
|
|
877
|
+
if self.VISpar.variableKey in self.VISpar.vLim:
|
|
878
|
+
Lim=self.VISpar.vLim[self.VISpar.variableKey]
|
|
879
|
+
else:
|
|
880
|
+
Lim=1.0
|
|
827
881
|
step=Lim/nStepsSlider
|
|
828
|
-
|
|
882
|
+
FlagLim= self.VISpar.type or FlagDispMap
|
|
883
|
+
self.ui.spin_min.setMinimum(-Lim if FlagLim else 0)
|
|
829
884
|
self.ui.spin_min.setMaximum(Lim-2*step)
|
|
830
|
-
self.ui.spin_max.setMinimum(-Lim+2*step if
|
|
885
|
+
self.ui.spin_max.setMinimum(-Lim+2*step if FlagLim else 2*step)
|
|
831
886
|
self.ui.spin_max.setMaximum(Lim)
|
|
832
|
-
self.ui.spin_mean.setMinimum(-Lim+step if
|
|
887
|
+
self.ui.spin_mean.setMinimum(-Lim+step if FlagLim else step)
|
|
833
888
|
self.ui.spin_mean.setMaximum(Lim-step)
|
|
834
889
|
self.ui.spin_range.setMinimum(2*step)
|
|
835
|
-
self.ui.spin_range.setMaximum(2*Lim if
|
|
890
|
+
self.ui.spin_range.setMaximum(2*Lim if FlagLim else step)
|
|
836
891
|
self.ui.spin_vecspac.setMaximum(self.VISpar.size[1][4])
|
|
837
892
|
|
|
838
893
|
self.ui.label_vecspac.setVisible(self.VISpar.field_rep==1)
|
|
@@ -856,12 +911,12 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
856
911
|
self.ui.spin_cam.setMaximum(self.VISpar.ncam)
|
|
857
912
|
self.ui.spin_cam.setEnabled(FlagSpinsEnabled and self.VISpar.ncam>1)
|
|
858
913
|
|
|
859
|
-
FlagCamFrame=self.VISpar.img>-1 and self.VISpar.type==0
|
|
914
|
+
FlagCamFrame=self.VISpar.img>-1 and self.VISpar.type==0 and not FlagDispMap
|
|
860
915
|
self.ui.label_frame.setVisible(FlagCamFrame)
|
|
861
916
|
self.ui.spin_frame.setVisible(FlagCamFrame)
|
|
862
917
|
self.ui.label_cam.setVisible(FlagCamFrame)
|
|
863
918
|
self.ui.spin_cam.setVisible(FlagCamFrame)
|
|
864
|
-
FlagDispResult=self.VISpar.img==0 and self.VISpar.Step==StepTypes.disp and self.VISpar.type==1
|
|
919
|
+
FlagDispResult=self.VISpar.img==0 and self.VISpar.Step==StepTypes.disp #and self.VISpar.variableKey is not self.namesPIV.img #and self.VISpar.type==1
|
|
865
920
|
self.ui.label_it.setVisible(FlagDispResult)
|
|
866
921
|
self.ui.spin_it.setVisible(FlagDispResult)
|
|
867
922
|
self.ui.spin_it.setMinimum(1)
|
|
@@ -880,8 +935,10 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
880
935
|
self.ui.name_var.setToolTip(f'{dataType} file: {dataName}')
|
|
881
936
|
self.ui.name_var.setStatusTip(self.ui.name_var.toolTip())
|
|
882
937
|
|
|
883
|
-
self.VISpar.
|
|
884
|
-
|
|
938
|
+
if self.VISpar.variableKey in self.VISpar.vcolorMap:
|
|
939
|
+
self.VISpar.colorMap=self.VISpar.vcolorMap[self.VISpar.variableKey]
|
|
940
|
+
if self.VISpar.variableKey in self.VISpar.vvectorColor:
|
|
941
|
+
self.VISpar.vectorColor=self.VISpar.vvectorColor[self.VISpar.variableKey]
|
|
885
942
|
|
|
886
943
|
self.ui.button_cmap.setIcon(QIcon(icons_path+'colormaps/'+self.VISpar.colorMap+'.png'))
|
|
887
944
|
self.ui.button_cvec.setIcon(QIcon(icons_path+'colormaps/'+self.VISpar.vectorColor+'Vector.png'))
|
|
@@ -901,17 +958,19 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
901
958
|
return
|
|
902
959
|
|
|
903
960
|
def setLevels(self):
|
|
904
|
-
self.VISpar.
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
961
|
+
if self.VISpar.variableKey in self.VISpar.vmin:
|
|
962
|
+
self.VISpar.min=self.VISpar.vmin[self.VISpar.variableKey]
|
|
963
|
+
self.VISpar.max=self.VISpar.vmax[self.VISpar.variableKey]
|
|
964
|
+
self.VISpar.mean=self.VISpar.vmean[self.VISpar.variableKey]
|
|
965
|
+
self.VISpar.range=self.VISpar.vrange[self.VISpar.variableKey]
|
|
908
966
|
|
|
909
967
|
def resetLevels(self):
|
|
910
|
-
self.VISpar.
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
968
|
+
if self.VISpar.variableKey in self.VISpar.vmin_default:
|
|
969
|
+
self.VISpar.vmin[self.VISpar.variableKey]=self.VISpar.vmin_default[self.VISpar.variableKey]
|
|
970
|
+
self.VISpar.vmax[self.VISpar.variableKey]=self.VISpar.vmax_default[self.VISpar.variableKey]
|
|
971
|
+
self.VISpar.vmean[self.VISpar.variableKey]=self.VISpar.vmean_default[self.VISpar.variableKey]
|
|
972
|
+
self.VISpar.vrange[self.VISpar.variableKey]=self.VISpar.vrange_default[self.VISpar.variableKey]
|
|
973
|
+
#self.setLevels()
|
|
915
974
|
|
|
916
975
|
def resetAllLevels(self, ind=None):
|
|
917
976
|
if ind is None: VIS:VISpar=self.VISpar
|
|
@@ -958,22 +1017,35 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
958
1017
|
def getImageInfo(self,image=None,ind=None):
|
|
959
1018
|
if image is None: I=self.image
|
|
960
1019
|
else: I=image
|
|
1020
|
+
if I is None: return
|
|
961
1021
|
if ind is None: VIS:VISpar=self.VISpar
|
|
962
1022
|
else: VIS:VISpar=self.TABpar_at(ind)
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1023
|
+
variableKey=self.VISpar.variableKey
|
|
1024
|
+
if variableKey is self.namesPIV.dispMap:
|
|
1025
|
+
variableKey=self.namesPIV.dispMap
|
|
1026
|
+
if image is None:
|
|
1027
|
+
CC_16bit=self.image.astype(np.float64) # Convert back to float
|
|
1028
|
+
I=(CC_16bit / 65535.0) * 2.0 - 1.0 # Reverse the normalization
|
|
1029
|
+
self.image=I
|
|
1030
|
+
mean=np.mean(I).item()
|
|
1031
|
+
std=np.std(I).item()
|
|
1032
|
+
VIS.vLim[variableKey]=1.0
|
|
1033
|
+
VIS.vmin_default[variableKey]=max([mean-2*std,-1.0])
|
|
1034
|
+
VIS.vmax_default[variableKey]=min([mean+2*std,1.0])
|
|
1035
|
+
else:
|
|
1036
|
+
mean=np.mean(I).item()
|
|
1037
|
+
std=np.std(I).item()
|
|
1038
|
+
VIS.vLim[variableKey]=min([2*I.max().item(),2**(self.nbits+1)])
|
|
1039
|
+
VIS.vmin_default[variableKey]=np.round(max([mean-2*std,0])).item()
|
|
1040
|
+
VIS.vmax_default[variableKey]=np.round(min([mean+2*std,VIS.vLim[variableKey]])).item()
|
|
1041
|
+
|
|
1042
|
+
VIS.vmean_default[variableKey]=0.5*(VIS.vmin_default[variableKey]+VIS.vmax_default[variableKey])
|
|
1043
|
+
VIS.vrange_default[variableKey]=VIS.vmax_default[variableKey]-VIS.vmin_default[variableKey]
|
|
972
1044
|
VIS.size_default[0]=[0,np.size(I,1),0,np.size(I,0),1]
|
|
973
|
-
if
|
|
974
|
-
VIS.vcolorMap[
|
|
975
|
-
if
|
|
976
|
-
VIS.vvectorColor[
|
|
1045
|
+
if variableKey not in VIS.vcolorMap:
|
|
1046
|
+
VIS.vcolorMap[variableKey]='gray' if variableKey in ('img','dispMap') else 'jet'
|
|
1047
|
+
if variableKey not in VIS.vvectorColor:
|
|
1048
|
+
VIS.vvectorColor[variableKey]='green' if variableKey in ('img','dispMap') else 'black'
|
|
977
1049
|
|
|
978
1050
|
def readResultFile(self,filename):
|
|
979
1051
|
res=None
|
|
@@ -1021,10 +1093,11 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1021
1093
|
def getResultInfo(self,result=None,ind=None):
|
|
1022
1094
|
if result is None: res=self.result
|
|
1023
1095
|
else: res=result
|
|
1096
|
+
if res is None: return
|
|
1024
1097
|
if ind is None: VIS:VISpar=self.VISpar
|
|
1025
1098
|
else: VIS:VISpar=self.TABpar_at(ind)
|
|
1026
1099
|
for i in list(VIS.vmin_default):
|
|
1027
|
-
if i
|
|
1100
|
+
if i not in (self.namesPIV.img,self.namesPIV.dispMap):
|
|
1028
1101
|
del VIS.vmin_default[i]
|
|
1029
1102
|
del VIS.vmax_default[i]
|
|
1030
1103
|
del VIS.vmean_default[i]
|
|
@@ -1032,7 +1105,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1032
1105
|
del VIS.vLim[i]
|
|
1033
1106
|
|
|
1034
1107
|
for f in list(res):
|
|
1035
|
-
V:np=res[f]
|
|
1108
|
+
V:np=res[f][~np.isnan(res[f])]
|
|
1036
1109
|
#m=np.mean(V).item()
|
|
1037
1110
|
#r=np.std(V).item()
|
|
1038
1111
|
#VIS.vLim[f]=max([m+5*r,abs(m-5*r)])
|
|
@@ -1080,7 +1153,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1080
1153
|
|
|
1081
1154
|
def button_ShowIW_action(self):
|
|
1082
1155
|
self.VISpar.FlagShowIW=self.ui.button_ShowIW.isChecked()
|
|
1083
|
-
self.resetXYLims()
|
|
1156
|
+
#if self.VISpar.FlagShowIW: self.resetXYLims()
|
|
1084
1157
|
|
|
1085
1158
|
def button_SubMIN_action(self):
|
|
1086
1159
|
self.VISpar.FlagSubMIN=self.ui.button_SubMIN.isChecked()
|
|
@@ -1216,7 +1289,59 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1216
1289
|
spin_value=getattr(self.VISpar,n)
|
|
1217
1290
|
res=self.xres if k<2 else self.yres
|
|
1218
1291
|
self.VISpar.size[self.VISpar.type][k]=spin_value/res
|
|
1219
|
-
|
|
1292
|
+
|
|
1293
|
+
def button_dx_left_action(self):
|
|
1294
|
+
dx=(self.VISpar.xmax-self.VISpar.xmin)/self.xres
|
|
1295
|
+
self.VISpar.size[self.VISpar.type][0]-=dx
|
|
1296
|
+
self.VISpar.size[self.VISpar.type][1]-=dx
|
|
1297
|
+
|
|
1298
|
+
def button_dx_right_action(self):
|
|
1299
|
+
dx=(self.VISpar.xmax-self.VISpar.xmin)/self.xres
|
|
1300
|
+
self.VISpar.size[self.VISpar.type][0]+=dx
|
|
1301
|
+
self.VISpar.size[self.VISpar.type][1]+=dx
|
|
1302
|
+
|
|
1303
|
+
def button_dy_down_action(self):
|
|
1304
|
+
dy=(self.VISpar.ymax-self.VISpar.ymin)/self.yres
|
|
1305
|
+
self.VISpar.size[self.VISpar.type][2]-=dy
|
|
1306
|
+
self.VISpar.size[self.VISpar.type][3]-=dy
|
|
1307
|
+
|
|
1308
|
+
def button_dy_up_action(self):
|
|
1309
|
+
dy=(self.VISpar.ymax-self.VISpar.ymin)/self.yres
|
|
1310
|
+
self.VISpar.size[self.VISpar.type][2]+=dy
|
|
1311
|
+
self.VISpar.size[self.VISpar.type][3]+=dy
|
|
1312
|
+
|
|
1313
|
+
def button_FocusIW_action(self):
|
|
1314
|
+
ve=self.VISpar.Pro.Vect if isinstance(self.VISpar.Pro.Vect[0],list) else [[v] for v in self.VISpar.Pro.Vect]
|
|
1315
|
+
Vect = [[val for val in v] for v in ve]
|
|
1316
|
+
if self.VISpar.unit[self.VISpar.type] and self.VISpar.type!=0:
|
|
1317
|
+
yres=self.VISpar.Out.xres*self.VISpar.Out.pixAR
|
|
1318
|
+
for k in range(2): Vect[k]=[val/self.VISpar.Out.xres for val in Vect[k]]
|
|
1319
|
+
for k in range(2,4): Vect[k]=[val/yres for val in Vect[k]]
|
|
1320
|
+
else: yres=1.0
|
|
1321
|
+
W=Vect[2][-1]
|
|
1322
|
+
FlagDisp=self.VISpar.variableKey is self.namesPIV.dispMap
|
|
1323
|
+
if FlagDisp:
|
|
1324
|
+
H=self.gui.w_Process_Disp.PROpar.SemiWidth_Epipolar*2+1
|
|
1325
|
+
H/=yres
|
|
1326
|
+
FlagBordo=False
|
|
1327
|
+
else:
|
|
1328
|
+
H=Vect[0][-1]
|
|
1329
|
+
FlagBordo=self.VISpar.Pro.FlagBordo
|
|
1330
|
+
if abs(self.VISpar.size[self.VISpar.type][1]-self.VISpar.size[self.VISpar.type][0]-W)<1 and abs(self.VISpar.size[self.VISpar.type][3]-self.VISpar.size[self.VISpar.type][2]-H)<1:
|
|
1331
|
+
dW=W if FlagDisp else Vect[3][-1]
|
|
1332
|
+
boundDist=W/2 if not FlagBordo else dW
|
|
1333
|
+
x0=int((self.VISpar.size[self.VISpar.type][0]-boundDist+W/2)/dW)*dW+boundDist-W/2 if self.VISpar.size[self.VISpar.type][0]>boundDist else boundDist-W/2
|
|
1334
|
+
dH=H if FlagDisp else Vect[1][-1]
|
|
1335
|
+
boundDist=H/2 if not FlagBordo else dH
|
|
1336
|
+
y0=int((self.VISpar.size[self.VISpar.type][2]-boundDist+H/2)/dH)*dH+boundDist-H/2 if self.VISpar.size[self.VISpar.type][2]>boundDist else boundDist-H/2
|
|
1337
|
+
self.VISpar.size[self.VISpar.type][0]=x0
|
|
1338
|
+
self.VISpar.size[self.VISpar.type][2]=y0
|
|
1339
|
+
self.VISpar.size[self.VISpar.type][1]=x0+W
|
|
1340
|
+
self.VISpar.size[self.VISpar.type][3]=y0+H
|
|
1341
|
+
else:
|
|
1342
|
+
self.VISpar.size[self.VISpar.type][1]=self.VISpar.size[self.VISpar.type][0]+W
|
|
1343
|
+
self.VISpar.size[self.VISpar.type][3]=self.VISpar.size[self.VISpar.type][2]+H
|
|
1344
|
+
|
|
1220
1345
|
#******************** Settings
|
|
1221
1346
|
def button_view_set(self):
|
|
1222
1347
|
self.ui.button_view.setChecked(self.VISpar.FlagView)
|
|
@@ -1271,14 +1396,18 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1271
1396
|
self.VISpar.size[self.VISpar.type][:2]=[xmin/self.xres,xmax/self.xres]
|
|
1272
1397
|
self.VISpar.size[self.VISpar.type][2:4]=[ymin/self.yres,ymax/self.yres]
|
|
1273
1398
|
|
|
1399
|
+
def forceRestoreArrowCursor(self):
|
|
1400
|
+
if self.CursorTimer.isActive():
|
|
1401
|
+
self.CursorTimer.stop()
|
|
1402
|
+
while QApplication.overrideCursor() is not None:
|
|
1403
|
+
QApplication.restoreOverrideCursor()
|
|
1404
|
+
self.FlagNormalCursor = True
|
|
1405
|
+
|
|
1274
1406
|
def brushCursor(self):
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
QApplication.restoreOverrideCursor()
|
|
1280
|
-
self.FlagNormalCursor=True
|
|
1281
|
-
QTimer.singleShot(250,lambda: restoreCursor())
|
|
1407
|
+
self.forceRestoreArrowCursor()
|
|
1408
|
+
self.FlagNormalCursor=False
|
|
1409
|
+
QApplication.setOverrideCursor(self.brush_cursor)
|
|
1410
|
+
self.CursorTimer.start(250)
|
|
1282
1411
|
|
|
1283
1412
|
def setMapVar(self):
|
|
1284
1413
|
pri.PlotTime.magenta(f'{"/"*25} Plotting image - start')
|
|
@@ -1295,7 +1424,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1295
1424
|
FlagIW=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagShowIW','Pro'])
|
|
1296
1425
|
if FlagIW or FlagDraw: self.showRect()
|
|
1297
1426
|
FlagDraw=FlagDraw or FlagIW
|
|
1298
|
-
if self.image is not None and self.VISpar.FlagShowCR:
|
|
1427
|
+
if self.image is not None and self.VISpar.FlagShowCR and self.VISpar.variableKey!=self.namesPIV.dispMap:
|
|
1299
1428
|
self.showCommonRegion()
|
|
1300
1429
|
FlagDraw=FlagDraw or self.CR is not None
|
|
1301
1430
|
else:
|
|
@@ -1304,12 +1433,13 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1304
1433
|
if self.orect: self.cleanRect()
|
|
1305
1434
|
self.cleanCommonRegion()
|
|
1306
1435
|
fields=['result_file','variable','unit','min','max','nclev','FlagContourf','colorMap']
|
|
1436
|
+
if self.VISpar.variableKey not in self.result: raise('Variable not found in result structure!')
|
|
1307
1437
|
V=self.result[self.VISpar.variableKey]
|
|
1308
1438
|
if not self.VISpar.FlagContourf:
|
|
1309
1439
|
self.img,Ximg,Yimg,FlagInterp,size=self.calcMap(V,size_pixels=[np.size(V,0), np.size(V,1)])
|
|
1310
1440
|
FlagDraw=self.showImg(fields,size)
|
|
1311
1441
|
else:
|
|
1312
|
-
self.img,Ximg,Yimg,FlagInterp,size=self.calcMap(
|
|
1442
|
+
self.img,Ximg,Yimg,FlagInterp,size=self.calcMap(V)
|
|
1313
1443
|
if FlagInterp:
|
|
1314
1444
|
FlagDraw=self.showImg(fields,size)
|
|
1315
1445
|
else:
|
|
@@ -1353,6 +1483,7 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1353
1483
|
if self.imgshow is None or self.VISpar_old.FlagContourf!=self.VISpar.FlagContourf or FlagOut:
|
|
1354
1484
|
self.cleanAxes()
|
|
1355
1485
|
self.imgshow=self.ui.plot.axes.imshow(img,extent=self.imgExtent(size), origin='lower', vmin=self.VISpar.min,vmax=self.VISpar.max,zorder=0)
|
|
1486
|
+
self.imgshow.format_cursor_data=lambda v: self.custom_format_cursor_data(v)
|
|
1356
1487
|
cmap,_=self.colorMap()
|
|
1357
1488
|
self.imgshow.set_cmap(cmap)
|
|
1358
1489
|
divider = make_axes_locatable(self.ui.plot.axes)
|
|
@@ -1444,44 +1575,40 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1444
1575
|
FlagCLim=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['min','max'])
|
|
1445
1576
|
|
|
1446
1577
|
if FlagNewPlot or self.VISpar_old.FlagContourf!=self.VISpar.FlagContourf or self.VISpar_old.nclev!=self.VISpar.nclev:
|
|
1447
|
-
|
|
1448
|
-
self.imgshow.remove()
|
|
1449
|
-
self.imgshow=None
|
|
1578
|
+
self.cleanAxes()
|
|
1450
1579
|
if not self.VISpar.unit[self.VISpar.type]:
|
|
1451
1580
|
xres,yres=self.getXYRes(type=1)
|
|
1452
1581
|
else: xres=yres=1.0
|
|
1453
1582
|
X=result[self.namesPIV.x]*xres
|
|
1454
1583
|
Y=result[self.namesPIV.y]*yres
|
|
1584
|
+
if self.VISpar.variableKey not in self.result: raise('Variable not found in result structure!')
|
|
1455
1585
|
V=result[self.VISpar.variableKey]
|
|
1456
|
-
self.map=V
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
if self.contour:
|
|
1460
|
-
for coll in self.contour.collections:
|
|
1461
|
-
coll.remove()
|
|
1586
|
+
self.map=[X,Y,V]
|
|
1587
|
+
|
|
1462
1588
|
cmap,levs=self.colorMap()
|
|
1463
1589
|
try:
|
|
1464
1590
|
self.contour=self.ui.plot.axes.contourf(X, Y, V, levs, \
|
|
1465
1591
|
cmap=cmap, origin='lower', extend='both', zorder=0)
|
|
1592
|
+
self.contour.format_cursor_data=lambda v: self.custom_format_cursor_data(v)
|
|
1466
1593
|
except:
|
|
1467
1594
|
pri.Error.red(f'Error while generating contour lines:\n{traceback.format_exc()}\n\n')
|
|
1468
1595
|
self.contour=None
|
|
1469
1596
|
return
|
|
1470
1597
|
self.contour.set_clim(levs[0],levs[-1])
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
self.cb=self.ui.plot.fig.colorbar(self.contour,cax=cax)
|
|
1598
|
+
divider = make_axes_locatable(self.ui.plot.axes)
|
|
1599
|
+
cax = divider.append_axes("right", size="5%", pad=0.05)
|
|
1600
|
+
self.cb=self.ui.plot.fig.colorbar(self.contour,cax=cax)
|
|
1475
1601
|
self.setTitleLabels()
|
|
1602
|
+
FlagXLim=True
|
|
1476
1603
|
else:
|
|
1477
1604
|
if FlagCMap:
|
|
1478
1605
|
cmap,_=self.colorMap()
|
|
1479
1606
|
self.contour.set_cmap(cmap)
|
|
1480
1607
|
if FlagCLim:
|
|
1481
1608
|
self.contour.set_clim(self.VISpar.min,self.VISpar.max)
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1609
|
+
if FlagXLim:
|
|
1610
|
+
self.setAxisLim()
|
|
1611
|
+
self.Ptoolbar.update()
|
|
1485
1612
|
|
|
1486
1613
|
FlagDraw=FlagNewPlot or FlagXLim or FlagCMap or FlagCLim
|
|
1487
1614
|
return FlagDraw
|
|
@@ -1506,37 +1633,55 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1506
1633
|
x = self.mylinspace(xmin,xmax, np.size(V,1))
|
|
1507
1634
|
ystep_half=(ymax-ymin)/(np.size(V,0)-1)*0.5
|
|
1508
1635
|
y = self.mylinspace(ymin,ymax, np.size(V,0))
|
|
1509
|
-
FlagInterp=
|
|
1510
|
-
if np.size(V,1)<size_pixels[1] or np.size(V,0)<size_pixels[0]:
|
|
1636
|
+
FlagInterp=False
|
|
1637
|
+
if (np.size(V,1)<size_pixels[1] or np.size(V,0)<size_pixels[0]) and not bool(np.any(np.isnan(V))):
|
|
1511
1638
|
x_new = self.mylinspace(xmin, xmax, size_pixels[0])
|
|
1512
1639
|
y_new = self.mylinspace(ymin, ymax, size_pixels[1])
|
|
1513
1640
|
try:
|
|
1514
1641
|
f = scipy.interpolate.RectBivariateSpline(y, x, V)
|
|
1515
|
-
|
|
1642
|
+
V_new = f(y_new, x_new)
|
|
1643
|
+
FlagInterp=True
|
|
1516
1644
|
except:
|
|
1517
1645
|
try:
|
|
1518
1646
|
x_flat, y_flat = np.meshgrid(x, y) # Griglia 2D
|
|
1519
1647
|
points = np.column_stack((x_flat.ravel(), y_flat.ravel())) # Punti 2D
|
|
1520
1648
|
X_new, Y_new = np.meshgrid(x_new, y_new)
|
|
1521
|
-
|
|
1649
|
+
V_new = scipy.interpolate.griddata(points, V.ravel(), (X_new, Y_new), method='cubic') #'nearest', 'linear', 'cubic'
|
|
1650
|
+
FlagInterp=True
|
|
1651
|
+
pass
|
|
1522
1652
|
except:
|
|
1523
1653
|
pri.Error.red(f'Error while interpolating map variable field for contour representation:\n{traceback.format_exc()}\n\n')
|
|
1524
1654
|
x_new=x
|
|
1525
1655
|
y_new=y
|
|
1656
|
+
V_new=V
|
|
1526
1657
|
FlagInterp=False
|
|
1527
1658
|
pass
|
|
1528
1659
|
else:
|
|
1529
1660
|
x_new=x
|
|
1530
1661
|
y_new=y
|
|
1662
|
+
V_new=V
|
|
1663
|
+
FlagInterp=not bool(np.any(np.isnan(V)))
|
|
1531
1664
|
X_new, Y_new = np.meshgrid(x_new, y_new)
|
|
1532
|
-
return
|
|
1665
|
+
return V_new, X_new, Y_new, FlagInterp, (xmin-xstep_half,xmax+ystep_half,ymin-ystep_half,ymax+ystep_half)
|
|
1533
1666
|
|
|
1534
1667
|
def mylinspace(self,xmin,xmax,N):
|
|
1535
1668
|
step=(xmax-xmin)/(N-1)
|
|
1536
1669
|
return xmin+np.arange(0,N,1)*step
|
|
1537
1670
|
|
|
1671
|
+
def cleanVecField(self):
|
|
1672
|
+
if self.qui!=None:
|
|
1673
|
+
self.qui.remove()
|
|
1674
|
+
self.qui=None
|
|
1675
|
+
if self.stream is not None:
|
|
1676
|
+
self.stream.lines.remove()
|
|
1677
|
+
for ax in self.ui.plot.axes.get_children():
|
|
1678
|
+
if isinstance(ax, mpl.patches.FancyArrowPatch):
|
|
1679
|
+
ax.remove()
|
|
1680
|
+
self.stream=None
|
|
1681
|
+
|
|
1538
1682
|
def showVecField(self):
|
|
1539
1683
|
ind=self.VISpar.field_rep
|
|
1684
|
+
self.cleanVecField()
|
|
1540
1685
|
if self.qui!=None:
|
|
1541
1686
|
self.qui.remove()
|
|
1542
1687
|
self.qui=None
|
|
@@ -1583,17 +1728,49 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1583
1728
|
self.stream=self.ui.plot.axes.streamplot(Xp,Yp,Up,Vp,color=VIS_VectorColors[self.VISpar.vectorColor],density=self.VISpar.streamdens,zorder=10)
|
|
1584
1729
|
|
|
1585
1730
|
def cleanAxes(self,FlagAxis=True):
|
|
1586
|
-
self.imgshow=self.contour=None
|
|
1587
|
-
self.
|
|
1731
|
+
self.imgshow=self.contour=self.CR=self.RF=None
|
|
1732
|
+
self.orect=[]
|
|
1733
|
+
self.qui=self.stream=None
|
|
1734
|
+
"""
|
|
1735
|
+
self.cleanCommonRegion()
|
|
1736
|
+
self.cleanReferenceFrame()
|
|
1737
|
+
self.cleanRect()
|
|
1738
|
+
self.cleanVecField()
|
|
1739
|
+
if self.contour:
|
|
1740
|
+
for coll in self.contour.collections:
|
|
1741
|
+
coll.remove()
|
|
1742
|
+
"""
|
|
1588
1743
|
if self.cb:
|
|
1589
|
-
|
|
1590
|
-
self.cb.remove()
|
|
1591
|
-
except:
|
|
1592
|
-
pass
|
|
1744
|
+
self.cb.remove()
|
|
1593
1745
|
self.cb=None
|
|
1746
|
+
self.ui.plot.axes.cla()
|
|
1594
1747
|
self.ui.plot.axes.axis('on' if FlagAxis else 'off')
|
|
1595
1748
|
#self.ui.Plot_tools.setEnabled(FlagAxis)
|
|
1596
1749
|
|
|
1750
|
+
def custom_format_coord(self,x,y):
|
|
1751
|
+
if self.contour is not None:
|
|
1752
|
+
X=self.map[0]
|
|
1753
|
+
Y=self.map[1]
|
|
1754
|
+
|
|
1755
|
+
if X.min() <= x <= X.max() and Y.min() <= y <= Y.max():
|
|
1756
|
+
# Trova l'indice più vicino nella matrice
|
|
1757
|
+
col = np.searchsorted(X[0,:],x) - 1
|
|
1758
|
+
row = np.searchsorted(Y[:,0],y) - 1
|
|
1759
|
+
Z=self.map[2]
|
|
1760
|
+
|
|
1761
|
+
# Estrai il valore dal dato Z
|
|
1762
|
+
if 0 <= row < Z.shape[0] and 0 <= col < Z.shape[1]:
|
|
1763
|
+
value = Z[row, col]
|
|
1764
|
+
formatted_value = f"{value:.4f}".rstrip('0').rstrip('.')
|
|
1765
|
+
return f"(x, y)=({x:.2f}, {y:.2f})\n[{formatted_value}]"
|
|
1766
|
+
return f"(x, y)=({x:.2f}, {y:.2f})"
|
|
1767
|
+
else:
|
|
1768
|
+
return f"(x, y)=({x:.2f}, {y:.2f})"
|
|
1769
|
+
|
|
1770
|
+
def custom_format_cursor_data(self,value):
|
|
1771
|
+
formatted_value = f"{value:.4f}".rstrip('0').rstrip('.')
|
|
1772
|
+
return f"[{formatted_value}]"
|
|
1773
|
+
|
|
1597
1774
|
def cleanRect(self):
|
|
1598
1775
|
if len(self.orect):
|
|
1599
1776
|
for r in self.orect:
|
|
@@ -1677,21 +1854,22 @@ class Vis_Tab(gPaIRS_Tab):
|
|
|
1677
1854
|
else:
|
|
1678
1855
|
yin0=0
|
|
1679
1856
|
xin0=xmax
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1857
|
+
if self.VISpar.FlagShowIW and self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagShowIW']):
|
|
1858
|
+
xlim=self.ui.plot.axes.get_xlim()
|
|
1859
|
+
xlim_min=min([xlim[0],xlim_min])
|
|
1860
|
+
xlim_max=max([xlim[1],xlim_max])
|
|
1861
|
+
self.ui.plot.axes.set_xlim(xlim_min,xlim_max)
|
|
1862
|
+
if self.VISpar.FlagYInvert[self.VISpar.type]:
|
|
1863
|
+
ylim=self.ui.plot.axes.get_ylim()
|
|
1864
|
+
ylim_max=min([ylim[1],ylim_min])
|
|
1865
|
+
ylim_min=max([ylim[0],ylim_max])
|
|
1866
|
+
else:
|
|
1867
|
+
ylim=self.ui.plot.axes.get_ylim()
|
|
1868
|
+
ylim_min=min([ylim[0],ylim_min])
|
|
1869
|
+
ylim_max=max([ylim[1],ylim_max])
|
|
1870
|
+
self.ui.plot.axes.set_ylim(ylim_min,ylim_max)
|
|
1871
|
+
self.VISpar.xmin,self.VISpar.xmax=list(self.ui.plot.axes.get_xlim())
|
|
1872
|
+
self.VISpar.ymin,self.VISpar.ymax=list(self.ui.plot.axes.get_ylim())
|
|
1695
1873
|
|
|
1696
1874
|
def cleanCommonRegion(self):
|
|
1697
1875
|
if self.CR:
|