PaIRS-UniNa 0.2.4__cp311-cp311-macosx_10_9_universal2.whl → 0.2.5__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.

Files changed (57) hide show
  1. PaIRS_UniNa/Changes.txt +23 -0
  2. PaIRS_UniNa/Custom_Top.py +1 -1
  3. PaIRS_UniNa/Explorer.py +3059 -3049
  4. PaIRS_UniNa/FolderLoop.py +371 -371
  5. PaIRS_UniNa/Input_Tab.py +714 -709
  6. PaIRS_UniNa/Input_Tab_tools.py +3017 -3009
  7. PaIRS_UniNa/Output_Tab.py +2 -2
  8. PaIRS_UniNa/PaIRS.py +17 -17
  9. PaIRS_UniNa/PaIRS_PIV.py +56 -1
  10. PaIRS_UniNa/PaIRS_pypacks.py +143 -6
  11. PaIRS_UniNa/Process_Tab.py +6 -11
  12. PaIRS_UniNa/Process_Tab_Disp.py +8 -3
  13. PaIRS_UniNa/Saving_tools.py +277 -277
  14. PaIRS_UniNa/TabTools.py +56 -17
  15. PaIRS_UniNa/Vis_Tab.py +237 -78
  16. PaIRS_UniNa/Whatsnew.py +2 -0
  17. PaIRS_UniNa/_PaIRS_PIV.so +0 -0
  18. PaIRS_UniNa/__init__.py +2 -2
  19. PaIRS_UniNa/gPaIRS.py +3745 -3600
  20. PaIRS_UniNa/icons/pylog.png +0 -0
  21. PaIRS_UniNa/icons/python_warning.png +0 -0
  22. PaIRS_UniNa/icons/queue.png +0 -0
  23. PaIRS_UniNa/icons/uninitialized.png +0 -0
  24. PaIRS_UniNa/icons/window.png +0 -0
  25. PaIRS_UniNa/listLib.py +301 -301
  26. PaIRS_UniNa/parForMulti.py +433 -433
  27. PaIRS_UniNa/parForWorkers.py +46 -1
  28. PaIRS_UniNa/procTools.py +17 -7
  29. PaIRS_UniNa/rqrdpckgs.txt +8 -0
  30. PaIRS_UniNa/stereo.py +683 -683
  31. PaIRS_UniNa/tabSplitter.py +606 -606
  32. PaIRS_UniNa/ui_Calibration_Tab.py +542 -542
  33. PaIRS_UniNa/ui_Custom_Top.py +294 -294
  34. PaIRS_UniNa/ui_Input_Tab.py +1098 -1098
  35. PaIRS_UniNa/ui_Input_Tab_CalVi.py +1280 -1280
  36. PaIRS_UniNa/ui_Log_Tab.py +261 -261
  37. PaIRS_UniNa/ui_Output_Tab.py +2360 -2360
  38. PaIRS_UniNa/ui_Process_Tab.py +3808 -3808
  39. PaIRS_UniNa/ui_Process_Tab_CalVi.py +1547 -1547
  40. PaIRS_UniNa/ui_Process_Tab_Disp.py +1139 -968
  41. PaIRS_UniNa/ui_Process_Tab_Min.py +435 -435
  42. PaIRS_UniNa/ui_ResizePopup.py +203 -203
  43. PaIRS_UniNa/ui_Vis_Tab.py +1626 -1533
  44. PaIRS_UniNa/ui_Vis_Tab_CalVi.py +1249 -1249
  45. PaIRS_UniNa/ui_Whatsnew.py +131 -131
  46. PaIRS_UniNa/ui_gPairs.py +867 -849
  47. PaIRS_UniNa/ui_infoPaIRS.py +550 -428
  48. PaIRS_UniNa/whatsnew.txt +5 -4
  49. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/METADATA +38 -26
  50. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/RECORD +52 -52
  51. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.dist-info}/WHEEL +1 -1
  52. PaIRS_UniNa/icons/order.png +0 -0
  53. PaIRS_UniNa/icons/order_reverse.png +0 -0
  54. PaIRS_UniNa/icons/pencil_bw.png +0 -0
  55. PaIRS_UniNa/icons/run_piv.png +0 -0
  56. PaIRS_UniNa-0.2.4.dist-info/LICENSE +0 -19
  57. {PaIRS_UniNa-0.2.4.dist-info → pairs_unina-0.2.5.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
- img=NamesPIV().img
313
- self.vcolorMap={img: 'gray'}
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):
@@ -538,6 +556,9 @@ class Vis_Tab(gPaIRS_Tab):
538
556
  self.image_file_Min=''
539
557
  self.image_Min_raw=None
540
558
  self.image_Min=None
559
+ self.image_file_Disp=''
560
+ self.image_Disp_raw=None
561
+ self.image_Disp=None
541
562
  self.nbits=0
542
563
  self.result_file=''
543
564
  self.result=None
@@ -605,7 +626,7 @@ class Vis_Tab(gPaIRS_Tab):
605
626
  if self.VISpar.ncam and not self.VISpar.cam: self.VISpar.cam=1
606
627
  self.VISpar.nimg=len(self.VISpar.imList[0][0]) if len(self.VISpar.imList[0]) else 0 if self.VISpar.ncam else 0
607
628
  if not self.VISpar.nimg and self.VISpar.img:
608
- FlagResults=self.image_file_Min!='' or self.result_file_Mean!=''
629
+ FlagResults=self.image_file_Min!='' or self.result_file_Mean!='' or self.image_file_Disp!=''
609
630
  self.VISpar.img=0 if FlagResults else -1
610
631
 
611
632
  FlagNewImage, FlagNewResult = self.adjustImport()
@@ -634,10 +655,17 @@ class Vis_Tab(gPaIRS_Tab):
634
655
  self.adjustFieldRep()
635
656
 
636
657
  def adjustImport(self):
637
- self.VISpar.image_file=self.VISpar.image_file_Min=''
658
+ self.VISpar.image_file=self.VISpar.image_file_Min=self.VISpar.image_file_Disp=''
638
659
  if self.VISpar.img%2==0 and self.VISpar.FlagTR and not self.VISpar.LaserType:
639
660
  f=[1,0][self.VISpar.frame-1]
640
661
  else: f=self.VISpar.frame-1
662
+ self.VISpar.image_file_Disp=''
663
+ FlagDisparity=self.VISpar.Step==StepTypes.disp and (resultCheck(self,self.VISpar,ind=self.VISpar.ind) or self.VISpar.FlagView)
664
+ if FlagDisparity:
665
+ dispMap_filename=self.VISpar.resF(f'it{self.VISpar.it}',string='dispMap')
666
+ if os.path.exists(dispMap_filename):
667
+ self.VISpar.image_file_Disp=dispMap_filename
668
+ self.VISpar.image_file_Min=''
641
669
  ITEs=self.gui.ui.Explorer.ITEsfromInd(self.VISpar.ind)
642
670
  ind_min=list(ITEs[0].children).index(StepTypes.min)
643
671
  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 +673,10 @@ class Vis_Tab(gPaIRS_Tab):
645
673
  if 0<=self.VISpar.cam-1<self.VISpar.ncam:
646
674
  if 0<=f<len(self.VISpar.imListMin[self.VISpar.cam-1]):
647
675
  self.VISpar.image_file_Min=self.VISpar.imListMin[self.VISpar.cam-1][f]
648
- else: self.VISpar.image_file_Min=''
649
676
  if self.VISpar.img>0:
650
677
  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
678
  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
679
+ self.VISpar.image_file=self.VISpar.image_file_Current if self.VISpar.flagRun==-2 else self.VISpar.image_file_Disp if self.VISpar.variableKey==self.namesPIV.dispMap else self.VISpar.image_file_Min
653
680
  else:
654
681
  self.VISpar.image_file=self.image_file_Load
655
682
 
@@ -680,6 +707,8 @@ class Vis_Tab(gPaIRS_Tab):
680
707
  def importFiles(self):
681
708
  if self.VISpar.image_file_Min!=self.image_file_Min or self.VISpar.FlagMIN!=self.VISpar_old.FlagMIN or self.FlagReset:
682
709
  self.image_file_Min,self.image_Min_raw=self.readImageFile(self.VISpar.image_file_Min)
710
+ if self.VISpar.image_file_Disp!=self.image_file_Disp or self.FlagReset:
711
+ self.image_file_Disp,self.image_Disp_raw=self.readImageFile(self.VISpar.image_file_Disp)
683
712
  if self.VISpar.result_file_Mean!=self.result_file_Mean or self.VISpar.FlagResult!=self.VISpar_old.FlagResult or self.FlagReset:
684
713
  self.result_file_Mean,self.result_Mean=self.readResultFile(self.VISpar.result_file_Mean)
685
714
 
@@ -690,11 +719,14 @@ class Vis_Tab(gPaIRS_Tab):
690
719
  if self.VISpar.flagRun==-2:
691
720
  self.image_raw=self.image_Current_raw[self.VISpar.frame] if self.image_Current_raw else None
692
721
  else:
693
- self.image_raw=self.image_Min_raw
722
+ self.image_raw=self.image_Disp_raw if self.VISpar.variableKey==self.namesPIV.dispMap else self.image_Min_raw
694
723
  else:
695
724
  self.image_file,self.image_raw=self.readImageFile(self.VISpar.image_file)
696
- if self.image_raw is None and self.VISpar.img==0: mapVariableList=[]
697
- else: mapVariableList=[self.namesPIV.img]
725
+ mapVariableList=[]
726
+ #if self.image_raw is None and self.VISpar.img==0: mapVariableList=[]
727
+ #else:
728
+ if self.image_Disp_raw is not None and self.VISpar.img==0: mapVariableList+=[self.namesPIV.dispMap]
729
+ if (self.image_Min_raw is not None and self.VISpar.img==0) or self.VISpar.img!=0: mapVariableList+=[self.namesPIV.img]
698
730
 
699
731
  FlagNewResult=self.VISpar.result_file!=self.result_file or self.VISpar.ind[:-1]!=self.VISpar_old.ind[:-1]
700
732
  if FlagNewResult or self.FlagReset:
@@ -708,7 +740,7 @@ class Vis_Tab(gPaIRS_Tab):
708
740
  self.result_file,self.result=self.readResultFile(self.VISpar.result_file)
709
741
 
710
742
  if self.image_raw is not None:
711
- if self.VISpar.img>=0:
743
+ if self.VISpar.img>=0 and self.VISpar.variableKey!=self.namesPIV.dispMap:
712
744
  self.image=transfIm(self.VISpar.Out,Images=[self.image_raw])[0]
713
745
  else:
714
746
  self.image=self.image_raw
@@ -719,6 +751,10 @@ class Vis_Tab(gPaIRS_Tab):
719
751
  self.image_Min=transfIm(self.VISpar.Out,Images=[self.image_Min_raw])[0]
720
752
  else:
721
753
  self.image_Min=None
754
+ if self.image_Disp_raw is not None:
755
+ self.image_Disp=self.image_Disp_raw #transfIm(self.VISpar.Out,Images=[self.image_Disp_raw])[0]
756
+ else:
757
+ self.image_Disp=None
722
758
  if self.result is not None:
723
759
  self.getResultInfo()
724
760
 
@@ -726,15 +762,26 @@ class Vis_Tab(gPaIRS_Tab):
726
762
  [mapVariableList.append(r) for r in list(self.result)]
727
763
  self.FlagReset=False
728
764
 
729
- if self.namesPIV.img in mapVariableList: comboItemsList=[self.namesPIV.combo_dict[self.namesPIV.img]]
730
- else: comboItemsList=[]
731
- for f in list(self.namesPIV.combo_dict)[1:]:
765
+ comboItemsList=[]
766
+ if self.namesPIV.img in mapVariableList: comboItemsList+=[self.namesPIV.combo_dict[self.namesPIV.img]]
767
+ if self.namesPIV.dispMap in mapVariableList: comboItemsList+=[self.namesPIV.combo_dict[self.namesPIV.dispMap]]
768
+ for f in list(self.namesPIV.combo_dict)[2:]:
732
769
  if f in mapVariableList: comboItemsList.append(self.namesPIV.combo_dict[f])
733
770
  if len(comboItemsList)==0: comboItemsList=[self.namesPIV.combo_dict[self.namesPIV.img]]
734
771
  if self.VISpar.variable not in comboItemsList:
735
772
  self.VISpar.variable=comboItemsList[0]
736
773
  self.VISpar.variableKey=self.namesPIV.combo_dict_keys[self.VISpar.variable]
737
- self.VISpar.type=int(self.VISpar.variableKey!=self.namesPIV.img)
774
+ if self.VISpar.variableKey==self.namesPIV.img and self.VISpar.img==0:
775
+ if self.VISpar.image_file!=self.VISpar.image_file_Min:
776
+ self.VISpar.image_file=self.VISpar.image_file_Min
777
+ self.image=self.image_Min
778
+ self.getImageInfo()
779
+ elif self.VISpar.variableKey==self.namesPIV.dispMap and self.VISpar.img==0:
780
+ if self.VISpar.image_file!=self.VISpar.image_file_Disp:
781
+ self.VISpar.image_file=self.VISpar.image_file_Disp
782
+ self.image=self.image_Disp
783
+ self.getImageInfo()
784
+ self.VISpar.type=int(self.VISpar.variableKey not in (self.namesPIV.img, self.namesPIV.dispMap) )
738
785
 
739
786
  return FlagNewImage, FlagNewResult, comboItemsList
740
787
 
@@ -770,18 +817,19 @@ class Vis_Tab(gPaIRS_Tab):
770
817
  self.checkResVariables()
771
818
 
772
819
  FlagLoad=self.image_file_Load!='' or self.result_file_Load!=''
773
- FlagResults=self.image_file_Min!='' or self.result_file_Mean!=''
820
+ FlagResults=self.image_file_Min!='' or self.result_file_Mean!='' or self.image_file_Disp!=''
774
821
  FlagSpinsEnabled=self.VISpar.nimg or FlagLoad
822
+ FlagDispMap=self.VISpar.variableKey==self.namesPIV.dispMap
775
823
  #self.ui.Plot_tools.setEnabled(FlagSpinsEnabled)
776
824
 
777
- FlagIW=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.piv,StepTypes.disp,StepTypes.spiv)
825
+ FlagIW=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.piv,StepTypes.disp,StepTypes.spiv) and not FlagDispMap
778
826
  self.ui.button_ShowIW.setVisible(FlagIW)
779
827
  if FlagIW:
780
828
  tip=f"{'Hide' if self.ui.button_ShowIW.isChecked() else 'Show'} Interrogation Window scheme"
781
829
  self.ui.button_ShowIW.setToolTip(tip)
782
830
  self.ui.button_ShowIW.setStatusTip(tip)
783
831
 
784
- FlagCR=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.disp,StepTypes.spiv)
832
+ FlagCR=self.VISpar.type==0 and self.VISpar.Step in (StepTypes.disp,StepTypes.spiv) and not FlagDispMap
785
833
  self.ui.button_ShowCR.setVisible(FlagCR)
786
834
  if FlagCR:
787
835
  tip=f"{'Hide' if self.ui.button_ShowCR.isChecked() else 'Show'} common region"
@@ -825,14 +873,15 @@ class Vis_Tab(gPaIRS_Tab):
825
873
 
826
874
  Lim=self.VISpar.vLim[self.VISpar.variableKey]
827
875
  step=Lim/nStepsSlider
828
- self.ui.spin_min.setMinimum(-Lim if self.VISpar.type else 0)
876
+ FlagLim= self.VISpar.type or FlagDispMap
877
+ self.ui.spin_min.setMinimum(-Lim if FlagLim else 0)
829
878
  self.ui.spin_min.setMaximum(Lim-2*step)
830
- self.ui.spin_max.setMinimum(-Lim+2*step if self.VISpar.type else 2*step)
879
+ self.ui.spin_max.setMinimum(-Lim+2*step if FlagLim else 2*step)
831
880
  self.ui.spin_max.setMaximum(Lim)
832
- self.ui.spin_mean.setMinimum(-Lim+step if self.VISpar.type else step)
881
+ self.ui.spin_mean.setMinimum(-Lim+step if FlagLim else step)
833
882
  self.ui.spin_mean.setMaximum(Lim-step)
834
883
  self.ui.spin_range.setMinimum(2*step)
835
- self.ui.spin_range.setMaximum(2*Lim if self.VISpar.type else step)
884
+ self.ui.spin_range.setMaximum(2*Lim if FlagLim else step)
836
885
  self.ui.spin_vecspac.setMaximum(self.VISpar.size[1][4])
837
886
 
838
887
  self.ui.label_vecspac.setVisible(self.VISpar.field_rep==1)
@@ -856,12 +905,12 @@ class Vis_Tab(gPaIRS_Tab):
856
905
  self.ui.spin_cam.setMaximum(self.VISpar.ncam)
857
906
  self.ui.spin_cam.setEnabled(FlagSpinsEnabled and self.VISpar.ncam>1)
858
907
 
859
- FlagCamFrame=self.VISpar.img>-1 and self.VISpar.type==0
908
+ FlagCamFrame=self.VISpar.img>-1 and self.VISpar.type==0 and not FlagDispMap
860
909
  self.ui.label_frame.setVisible(FlagCamFrame)
861
910
  self.ui.spin_frame.setVisible(FlagCamFrame)
862
911
  self.ui.label_cam.setVisible(FlagCamFrame)
863
912
  self.ui.spin_cam.setVisible(FlagCamFrame)
864
- FlagDispResult=self.VISpar.img==0 and self.VISpar.Step==StepTypes.disp and self.VISpar.type==1
913
+ 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
914
  self.ui.label_it.setVisible(FlagDispResult)
866
915
  self.ui.spin_it.setVisible(FlagDispResult)
867
916
  self.ui.spin_it.setMinimum(1)
@@ -960,20 +1009,32 @@ class Vis_Tab(gPaIRS_Tab):
960
1009
  else: I=image
961
1010
  if ind is None: VIS:VISpar=self.VISpar
962
1011
  else: VIS:VISpar=self.TABpar_at(ind)
963
-
964
- mean=np.mean(I).item()
965
- std=np.std(I).item()
966
- #self.VISpar.vLim[self.namesPIV.img]=2**self.nbits
967
- VIS.vLim[self.namesPIV.img]=min([2*I.max().item(),2**(self.nbits+1)])
968
- VIS.vmin_default[self.namesPIV.img]=np.round(max([mean-2*std,0])).item()
969
- VIS.vmax_default[self.namesPIV.img]=np.round(min([mean+2*std,VIS.vLim[self.namesPIV.img]])).item()
970
- VIS.vmean_default[self.namesPIV.img]=0.5*(VIS.vmin_default[self.namesPIV.img]+VIS.vmax_default[self.namesPIV.img])
971
- VIS.vrange_default[self.namesPIV.img]=VIS.vmax_default[self.namesPIV.img]-VIS.vmin_default[self.namesPIV.img]
1012
+ variableKey=self.VISpar.variableKey
1013
+ if variableKey is self.namesPIV.dispMap:
1014
+ variableKey=self.namesPIV.dispMap
1015
+ if image is None:
1016
+ CC_16bit=self.image.astype(np.float64) # Convert back to float
1017
+ I=(CC_16bit / 65535.0) * 2.0 - 1.0 # Reverse the normalization
1018
+ self.image=I
1019
+ mean=np.mean(I).item()
1020
+ std=np.std(I).item()
1021
+ VIS.vLim[variableKey]=1.0
1022
+ VIS.vmin_default[variableKey]=max([mean-2*std,-1.0])
1023
+ VIS.vmax_default[variableKey]=min([mean+2*std,1.0])
1024
+ else:
1025
+ mean=np.mean(I).item()
1026
+ std=np.std(I).item()
1027
+ VIS.vLim[variableKey]=min([2*I.max().item(),2**(self.nbits+1)])
1028
+ VIS.vmin_default[variableKey]=np.round(max([mean-2*std,0])).item()
1029
+ VIS.vmax_default[variableKey]=np.round(min([mean+2*std,VIS.vLim[variableKey]])).item()
1030
+
1031
+ VIS.vmean_default[variableKey]=0.5*(VIS.vmin_default[variableKey]+VIS.vmax_default[variableKey])
1032
+ VIS.vrange_default[variableKey]=VIS.vmax_default[variableKey]-VIS.vmin_default[variableKey]
972
1033
  VIS.size_default[0]=[0,np.size(I,1),0,np.size(I,0),1]
973
- if self.namesPIV.img not in VIS.vcolorMap:
974
- VIS.vcolorMap[self.namesPIV.img]='gray'
975
- if self.namesPIV.img not in VIS.vvectorColor:
976
- VIS.vvectorColor[self.namesPIV.img]='green'
1034
+ if variableKey not in VIS.vcolorMap:
1035
+ VIS.vcolorMap[variableKey]='gray' if variableKey in ('img','dispMap') else 'jet'
1036
+ if variableKey not in VIS.vvectorColor:
1037
+ VIS.vvectorColor[variableKey]='green' if variableKey in ('img','dispMap') else 'black'
977
1038
 
978
1039
  def readResultFile(self,filename):
979
1040
  res=None
@@ -1024,7 +1085,7 @@ class Vis_Tab(gPaIRS_Tab):
1024
1085
  if ind is None: VIS:VISpar=self.VISpar
1025
1086
  else: VIS:VISpar=self.TABpar_at(ind)
1026
1087
  for i in list(VIS.vmin_default):
1027
- if i!=self.namesPIV.img:
1088
+ if i not in (self.namesPIV.img,self.namesPIV.dispMap):
1028
1089
  del VIS.vmin_default[i]
1029
1090
  del VIS.vmax_default[i]
1030
1091
  del VIS.vmean_default[i]
@@ -1032,7 +1093,7 @@ class Vis_Tab(gPaIRS_Tab):
1032
1093
  del VIS.vLim[i]
1033
1094
 
1034
1095
  for f in list(res):
1035
- V:np=res[f]
1096
+ V:np=res[f][~np.isnan(res[f])]
1036
1097
  #m=np.mean(V).item()
1037
1098
  #r=np.std(V).item()
1038
1099
  #VIS.vLim[f]=max([m+5*r,abs(m-5*r)])
@@ -1216,7 +1277,59 @@ class Vis_Tab(gPaIRS_Tab):
1216
1277
  spin_value=getattr(self.VISpar,n)
1217
1278
  res=self.xres if k<2 else self.yres
1218
1279
  self.VISpar.size[self.VISpar.type][k]=spin_value/res
1219
-
1280
+
1281
+ def button_dx_left_action(self):
1282
+ dx=(self.VISpar.xmax-self.VISpar.xmin)/self.xres
1283
+ self.VISpar.size[self.VISpar.type][0]-=dx
1284
+ self.VISpar.size[self.VISpar.type][1]-=dx
1285
+
1286
+ def button_dx_right_action(self):
1287
+ dx=(self.VISpar.xmax-self.VISpar.xmin)/self.xres
1288
+ self.VISpar.size[self.VISpar.type][0]+=dx
1289
+ self.VISpar.size[self.VISpar.type][1]+=dx
1290
+
1291
+ def button_dy_down_action(self):
1292
+ dy=(self.VISpar.ymax-self.VISpar.ymin)/self.yres
1293
+ self.VISpar.size[self.VISpar.type][2]-=dy
1294
+ self.VISpar.size[self.VISpar.type][3]-=dy
1295
+
1296
+ def button_dy_up_action(self):
1297
+ dy=(self.VISpar.ymax-self.VISpar.ymin)/self.yres
1298
+ self.VISpar.size[self.VISpar.type][2]+=dy
1299
+ self.VISpar.size[self.VISpar.type][3]+=dy
1300
+
1301
+ def button_FocusIW_action(self):
1302
+ ve=self.VISpar.Pro.Vect if isinstance(self.VISpar.Pro.Vect[0],list) else [[v] for v in self.VISpar.Pro.Vect]
1303
+ Vect = [[val for val in v] for v in ve]
1304
+ if self.VISpar.unit[self.VISpar.type] and self.VISpar.type!=0:
1305
+ yres=self.VISpar.Out.xres*self.VISpar.Out.pixAR
1306
+ for k in range(2): Vect[k]=[val/self.VISpar.Out.xres for val in Vect[k]]
1307
+ for k in range(2,4): Vect[k]=[val/yres for val in Vect[k]]
1308
+ else: yres=1.0
1309
+ W=Vect[2][-1]
1310
+ FlagDisp=self.VISpar.variableKey is self.namesPIV.dispMap
1311
+ if FlagDisp:
1312
+ H=self.gui.w_Process_Disp.PROpar.SemiWidth_Epipolar*2+1
1313
+ H/=yres
1314
+ FlagBordo=False
1315
+ else:
1316
+ H=Vect[0][-1]
1317
+ FlagBordo=self.VISpar.Pro.FlagBordo
1318
+ 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:
1319
+ dW=W if FlagDisp else Vect[3][-1]
1320
+ boundDist=W/2 if not FlagBordo else dW
1321
+ 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
1322
+ dH=H if FlagDisp else Vect[1][-1]
1323
+ boundDist=H/2 if not FlagBordo else dH
1324
+ 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
1325
+ self.VISpar.size[self.VISpar.type][0]=x0
1326
+ self.VISpar.size[self.VISpar.type][2]=y0
1327
+ self.VISpar.size[self.VISpar.type][1]=x0+W
1328
+ self.VISpar.size[self.VISpar.type][3]=y0+H
1329
+ else:
1330
+ self.VISpar.size[self.VISpar.type][1]=self.VISpar.size[self.VISpar.type][0]+W
1331
+ self.VISpar.size[self.VISpar.type][3]=self.VISpar.size[self.VISpar.type][2]+H
1332
+
1220
1333
  #******************** Settings
1221
1334
  def button_view_set(self):
1222
1335
  self.ui.button_view.setChecked(self.VISpar.FlagView)
@@ -1295,7 +1408,7 @@ class Vis_Tab(gPaIRS_Tab):
1295
1408
  FlagIW=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['FlagShowIW','Pro'])
1296
1409
  if FlagIW or FlagDraw: self.showRect()
1297
1410
  FlagDraw=FlagDraw or FlagIW
1298
- if self.image is not None and self.VISpar.FlagShowCR:
1411
+ if self.image is not None and self.VISpar.FlagShowCR and self.VISpar.variableKey!=self.namesPIV.dispMap:
1299
1412
  self.showCommonRegion()
1300
1413
  FlagDraw=FlagDraw or self.CR is not None
1301
1414
  else:
@@ -1353,6 +1466,7 @@ class Vis_Tab(gPaIRS_Tab):
1353
1466
  if self.imgshow is None or self.VISpar_old.FlagContourf!=self.VISpar.FlagContourf or FlagOut:
1354
1467
  self.cleanAxes()
1355
1468
  self.imgshow=self.ui.plot.axes.imshow(img,extent=self.imgExtent(size), origin='lower', vmin=self.VISpar.min,vmax=self.VISpar.max,zorder=0)
1469
+ self.imgshow.format_cursor_data=lambda v: self.custom_format_cursor_data(v)
1356
1470
  cmap,_=self.colorMap()
1357
1471
  self.imgshow.set_cmap(cmap)
1358
1472
  divider = make_axes_locatable(self.ui.plot.axes)
@@ -1444,44 +1558,39 @@ class Vis_Tab(gPaIRS_Tab):
1444
1558
  FlagCLim=self.VISpar.isDifferentFrom(self.VISpar_old,fields=['min','max'])
1445
1559
 
1446
1560
  if FlagNewPlot or self.VISpar_old.FlagContourf!=self.VISpar.FlagContourf or self.VISpar_old.nclev!=self.VISpar.nclev:
1447
- if self.imgshow:
1448
- self.imgshow.remove()
1449
- self.imgshow=None
1561
+ self.cleanAxes()
1450
1562
  if not self.VISpar.unit[self.VISpar.type]:
1451
1563
  xres,yres=self.getXYRes(type=1)
1452
1564
  else: xres=yres=1.0
1453
1565
  X=result[self.namesPIV.x]*xres
1454
1566
  Y=result[self.namesPIV.y]*yres
1455
1567
  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()
1568
+ self.map=[X,Y,V]
1569
+
1462
1570
  cmap,levs=self.colorMap()
1463
1571
  try:
1464
1572
  self.contour=self.ui.plot.axes.contourf(X, Y, V, levs, \
1465
1573
  cmap=cmap, origin='lower', extend='both', zorder=0)
1574
+ self.contour.format_cursor_data=lambda v: self.custom_format_cursor_data(v)
1466
1575
  except:
1467
1576
  pri.Error.red(f'Error while generating contour lines:\n{traceback.format_exc()}\n\n')
1468
1577
  self.contour=None
1469
1578
  return
1470
1579
  self.contour.set_clim(levs[0],levs[-1])
1471
- if self.cb is None:
1472
- divider = make_axes_locatable(self.ui.plot.axes)
1473
- cax = divider.append_axes("right", size="5%", pad=0.05)
1474
- self.cb=self.ui.plot.fig.colorbar(self.contour,cax=cax)
1580
+ divider = make_axes_locatable(self.ui.plot.axes)
1581
+ cax = divider.append_axes("right", size="5%", pad=0.05)
1582
+ self.cb=self.ui.plot.fig.colorbar(self.contour,cax=cax)
1475
1583
  self.setTitleLabels()
1584
+ FlagXLim=True
1476
1585
  else:
1477
1586
  if FlagCMap:
1478
1587
  cmap,_=self.colorMap()
1479
1588
  self.contour.set_cmap(cmap)
1480
1589
  if FlagCLim:
1481
1590
  self.contour.set_clim(self.VISpar.min,self.VISpar.max)
1482
- if FlagXLim:
1483
- self.setAxisLim()
1484
- self.Ptoolbar.update()
1591
+ if FlagXLim:
1592
+ self.setAxisLim()
1593
+ self.Ptoolbar.update()
1485
1594
 
1486
1595
  FlagDraw=FlagNewPlot or FlagXLim or FlagCMap or FlagCLim
1487
1596
  return FlagDraw
@@ -1506,37 +1615,55 @@ class Vis_Tab(gPaIRS_Tab):
1506
1615
  x = self.mylinspace(xmin,xmax, np.size(V,1))
1507
1616
  ystep_half=(ymax-ymin)/(np.size(V,0)-1)*0.5
1508
1617
  y = self.mylinspace(ymin,ymax, np.size(V,0))
1509
- FlagInterp=True
1510
- if np.size(V,1)<size_pixels[1] or np.size(V,0)<size_pixels[0]:
1618
+ FlagInterp=False
1619
+ 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
1620
  x_new = self.mylinspace(xmin, xmax, size_pixels[0])
1512
1621
  y_new = self.mylinspace(ymin, ymax, size_pixels[1])
1513
1622
  try:
1514
1623
  f = scipy.interpolate.RectBivariateSpline(y, x, V)
1515
- V = f(y_new, x_new)
1624
+ V_new = f(y_new, x_new)
1625
+ FlagInterp=True
1516
1626
  except:
1517
1627
  try:
1518
1628
  x_flat, y_flat = np.meshgrid(x, y) # Griglia 2D
1519
1629
  points = np.column_stack((x_flat.ravel(), y_flat.ravel())) # Punti 2D
1520
1630
  X_new, Y_new = np.meshgrid(x_new, y_new)
1521
- V = scipy.interpolate.griddata(points, V.ravel(), (X_new, Y_new), method='cubic') #'nearest', 'linear', 'cubic'
1631
+ V_new = scipy.interpolate.griddata(points, V.ravel(), (X_new, Y_new), method='cubic') #'nearest', 'linear', 'cubic'
1632
+ FlagInterp=True
1633
+ pass
1522
1634
  except:
1523
1635
  pri.Error.red(f'Error while interpolating map variable field for contour representation:\n{traceback.format_exc()}\n\n')
1524
1636
  x_new=x
1525
1637
  y_new=y
1638
+ V_new=V
1526
1639
  FlagInterp=False
1527
1640
  pass
1528
1641
  else:
1529
1642
  x_new=x
1530
1643
  y_new=y
1644
+ V_new=V
1645
+ FlagInterp=not bool(np.any(np.isnan(V)))
1531
1646
  X_new, Y_new = np.meshgrid(x_new, y_new)
1532
- return V, X_new, Y_new, FlagInterp, (xmin-xstep_half,xmax+ystep_half,ymin-ystep_half,ymax+ystep_half)
1647
+ return V_new, X_new, Y_new, FlagInterp, (xmin-xstep_half,xmax+ystep_half,ymin-ystep_half,ymax+ystep_half)
1533
1648
 
1534
1649
  def mylinspace(self,xmin,xmax,N):
1535
1650
  step=(xmax-xmin)/(N-1)
1536
1651
  return xmin+np.arange(0,N,1)*step
1537
1652
 
1653
+ def cleanVecField(self):
1654
+ if self.qui!=None:
1655
+ self.qui.remove()
1656
+ self.qui=None
1657
+ if self.stream is not None:
1658
+ self.stream.lines.remove()
1659
+ for ax in self.ui.plot.axes.get_children():
1660
+ if isinstance(ax, mpl.patches.FancyArrowPatch):
1661
+ ax.remove()
1662
+ self.stream=None
1663
+
1538
1664
  def showVecField(self):
1539
1665
  ind=self.VISpar.field_rep
1666
+ self.cleanVecField()
1540
1667
  if self.qui!=None:
1541
1668
  self.qui.remove()
1542
1669
  self.qui=None
@@ -1583,17 +1710,49 @@ class Vis_Tab(gPaIRS_Tab):
1583
1710
  self.stream=self.ui.plot.axes.streamplot(Xp,Yp,Up,Vp,color=VIS_VectorColors[self.VISpar.vectorColor],density=self.VISpar.streamdens,zorder=10)
1584
1711
 
1585
1712
  def cleanAxes(self,FlagAxis=True):
1586
- self.imgshow=self.contour=None
1587
- self.ui.plot.axes.cla()
1713
+ self.imgshow=self.contour=self.CR=self.RF=None
1714
+ self.orect=[]
1715
+ self.qui=self.stream=None
1716
+ """
1717
+ self.cleanCommonRegion()
1718
+ self.cleanReferenceFrame()
1719
+ self.cleanRect()
1720
+ self.cleanVecField()
1721
+ if self.contour:
1722
+ for coll in self.contour.collections:
1723
+ coll.remove()
1724
+ """
1588
1725
  if self.cb:
1589
- try:
1590
- self.cb.remove()
1591
- except:
1592
- pass
1726
+ self.cb.remove()
1593
1727
  self.cb=None
1728
+ self.ui.plot.axes.cla()
1594
1729
  self.ui.plot.axes.axis('on' if FlagAxis else 'off')
1595
1730
  #self.ui.Plot_tools.setEnabled(FlagAxis)
1596
1731
 
1732
+ def custom_format_coord(self,x,y):
1733
+ if self.contour is not None:
1734
+ X=self.map[0]
1735
+ Y=self.map[1]
1736
+
1737
+ if X.min() <= x <= X.max() and Y.min() <= y <= Y.max():
1738
+ # Trova l'indice più vicino nella matrice
1739
+ col = np.searchsorted(X[0,:],x) - 1
1740
+ row = np.searchsorted(Y[:,0],y) - 1
1741
+ Z=self.map[2]
1742
+
1743
+ # Estrai il valore dal dato Z
1744
+ if 0 <= row < Z.shape[0] and 0 <= col < Z.shape[1]:
1745
+ value = Z[row, col]
1746
+ formatted_value = f"{value:.4f}".rstrip('0').rstrip('.')
1747
+ return f"(x, y)=({x:.2f}, {y:.2f})\n[{formatted_value}]"
1748
+ return f"(x, y)=({x:.2f}, {y:.2f})"
1749
+ else:
1750
+ return f"(x, y)=({x:.2f}, {y:.2f})"
1751
+
1752
+ def custom_format_cursor_data(self,value):
1753
+ formatted_value = f"{value:.4f}".rstrip('0').rstrip('.')
1754
+ return f"[{formatted_value}]"
1755
+
1597
1756
  def cleanRect(self):
1598
1757
  if len(self.orect):
1599
1758
  for r in self.orect:
PaIRS_UniNa/Whatsnew.py CHANGED
@@ -84,6 +84,8 @@ def whatsNew(self):
84
84
  splitted_news[k]=formatBullet(icons_path+"announcement.png",text[1:])
85
85
  elif text[0]=='*':
86
86
  splitted_news[k]=formatBullet(icons_path+"star.png",text[1:])
87
+ elif text[0]=='§':
88
+ splitted_news[k]=formatBullet(icons_path+"pylog.png",text[1:])
87
89
  elif text[0]=='£':
88
90
  splitted_news[k]= f'<br/><span style="font-weight: 600; font-size: {fontPixelSize}px;">{text[1:]}</span><br/>'
89
91
  news="".join(splitted_news)
PaIRS_UniNa/_PaIRS_PIV.so CHANGED
Binary file
PaIRS_UniNa/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
- __version__="0.2.4"
1
+ __version__="0.2.5"
2
2
  __subversion__="0"
3
3
  __year__='2024'
4
- __date__='2024.12.01'
4
+ __date__='2025.07.18'
5
5
  __mail__='etfd@unina.it'
6
6
  __website__='https://pairs.unina.it'