##// END OF EJS Templates
Se agrega parametro de entrada 'show', por defecto (True) muestra la figuras, caso contrario (False) matplotlib no muestra la figuras
Daniel Valdez -
r342:de907111a31d
parent child
Show More
@@ -86,7 +86,7 class Figure:
86
86
87 raise ValueError, "This method has been replaced with createFigure"
87 raise ValueError, "This method has been replaced with createFigure"
88
88
89 def createFigure(self, idfigure, wintitle, widthplot=None, heightplot=None):
89 def createFigure(self, idfigure, wintitle, widthplot=None, heightplot=None, show=True):
90
90
91 """
91 """
92 Crea la figura de acuerdo al driver y parametros seleccionados seleccionados.
92 Crea la figura de acuerdo al driver y parametros seleccionados seleccionados.
@@ -111,10 +111,11 class Figure:
111
111
112 self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot)
112 self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot)
113
113
114 self.fig = self.__driver.createFigure(self.idfigure,
114 self.fig = self.__driver.createFigure(idfigure=self.idfigure,
115 self.wintitle,
115 wintitle=self.wintitle,
116 self.widthscreen,
116 width=self.widthscreen,
117 self.heightscreen)
117 height=self.heightscreen,
118 show=show)
118
119
119 self.axesObjList = []
120 self.axesObjList = []
120
121
@@ -18,21 +18,23 from matplotlib.ticker import *
18 #Actualizacion de las funciones del driver
18 #Actualizacion de las funciones del driver
19 ###########################################
19 ###########################################
20
20
21 def createFigure(idfigure, wintitle, width, height, facecolor="w"):
21 def createFigure(idfigure, wintitle, width, height, facecolor="w", show=True):
22
22
23 matplotlib.pyplot.ioff()
23 matplotlib.pyplot.ioff()
24 fig = matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor)
24 fig = matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor)
25 fig.canvas.manager.set_window_title(wintitle)
25 fig.canvas.manager.set_window_title(wintitle)
26 fig.canvas.manager.resize(width, height)
26 fig.canvas.manager.resize(width, height)
27 matplotlib.pyplot.ion()
27 matplotlib.pyplot.ion()
28 matplotlib.pyplot.show()
28 if show:
29 matplotlib.pyplot.show()
29
30
30 return fig
31 return fig
31
32
32 def closeFigure():
33 def closeFigure(show=True):
33
34
34 matplotlib.pyplot.ioff()
35 matplotlib.pyplot.ioff()
35 matplotlib.pyplot.show()
36 if show:
37 matplotlib.pyplot.show()
36
38
37 return
39 return
38
40
@@ -30,7 +30,7 class CrossSpectraPlot(Figure):
30
30
31 return nrow, ncol
31 return nrow, ncol
32
32
33 def setup(self, idfigure, nplots, wintitle, showprofile=True):
33 def setup(self, idfigure, nplots, wintitle, showprofile=True, show=True):
34
34
35 self.__showprofile = showprofile
35 self.__showprofile = showprofile
36 self.nplots = nplots
36 self.nplots = nplots
@@ -41,7 +41,8 class CrossSpectraPlot(Figure):
41 self.createFigure(idfigure = idfigure,
41 self.createFigure(idfigure = idfigure,
42 wintitle = wintitle,
42 wintitle = wintitle,
43 widthplot = self.WIDTH + self.WIDTHPROF,
43 widthplot = self.WIDTH + self.WIDTHPROF,
44 heightplot = self.HEIGHT + self.HEIGHTPROF)
44 heightplot = self.HEIGHT + self.HEIGHTPROF,
45 show=True)
45
46
46 nrow, ncol = self.getSubplots()
47 nrow, ncol = self.getSubplots()
47
48
@@ -55,7 +56,7 class CrossSpectraPlot(Figure):
55 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
56 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
56 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
57 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
57 save=False, figpath='./', figfile=None,
58 save=False, figpath='./', figfile=None,
58 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r'):
59 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True):
59
60
60 """
61 """
61
62
@@ -112,7 +113,8 class CrossSpectraPlot(Figure):
112 self.setup(idfigure=idfigure,
113 self.setup(idfigure=idfigure,
113 nplots=nplots,
114 nplots=nplots,
114 wintitle=wintitle,
115 wintitle=wintitle,
115 showprofile=showprofile)
116 showprofile=showprofile,
117 show=show)
116
118
117 if xmin == None: xmin = numpy.nanmin(x)
119 if xmin == None: xmin = numpy.nanmin(x)
118 if xmax == None: xmax = numpy.nanmax(x)
120 if xmax == None: xmax = numpy.nanmax(x)
@@ -203,7 +205,7 class RTIPlot(Figure):
203
205
204 return nrow, ncol
206 return nrow, ncol
205
207
206 def setup(self, idfigure, nplots, wintitle, showprofile=True):
208 def setup(self, idfigure, nplots, wintitle, showprofile=True, show=True):
207
209
208 self.__showprofile = showprofile
210 self.__showprofile = showprofile
209 self.nplots = nplots
211 self.nplots = nplots
@@ -218,7 +220,8 class RTIPlot(Figure):
218 self.createFigure(idfigure = idfigure,
220 self.createFigure(idfigure = idfigure,
219 wintitle = wintitle,
221 wintitle = wintitle,
220 widthplot = self.WIDTH + self.WIDTHPROF,
222 widthplot = self.WIDTH + self.WIDTHPROF,
221 heightplot = self.HEIGHT + self.HEIGHTPROF)
223 heightplot = self.HEIGHT + self.HEIGHTPROF,
224 show=show)
222
225
223 nrow, ncol = self.getSubplots()
226 nrow, ncol = self.getSubplots()
224
227
@@ -239,7 +242,7 class RTIPlot(Figure):
239 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
242 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
240 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
243 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
241 timerange=None,
244 timerange=None,
242 save=False, figpath='./', figfile=None, ftp=False, ftpratio=1):
245 save=False, figpath='./', figfile=None, ftp=False, ftpratio=1, show=True):
243
246
244 """
247 """
245
248
@@ -294,7 +297,8 class RTIPlot(Figure):
294 self.setup(idfigure=idfigure,
297 self.setup(idfigure=idfigure,
295 nplots=nplots,
298 nplots=nplots,
296 wintitle=wintitle,
299 wintitle=wintitle,
297 showprofile=showprofile)
300 showprofile=showprofile,
301 show=show)
298
302
299 tmin, tmax = self.getTimeLim(x, xmin, xmax)
303 tmin, tmax = self.getTimeLim(x, xmin, xmax)
300 if ymin == None: ymin = numpy.nanmin(y)
304 if ymin == None: ymin = numpy.nanmin(y)
@@ -369,7 +373,7 class SpectraPlot(Figure):
369
373
370 return nrow, ncol
374 return nrow, ncol
371
375
372 def setup(self, idfigure, nplots, wintitle, showprofile=True):
376 def setup(self, idfigure, nplots, wintitle, showprofile=True, show=True):
373
377
374 self.__showprofile = showprofile
378 self.__showprofile = showprofile
375 self.nplots = nplots
379 self.nplots = nplots
@@ -384,7 +388,8 class SpectraPlot(Figure):
384 self.createFigure(idfigure = idfigure,
388 self.createFigure(idfigure = idfigure,
385 wintitle = wintitle,
389 wintitle = wintitle,
386 widthplot = self.WIDTH + self.WIDTHPROF,
390 widthplot = self.WIDTH + self.WIDTHPROF,
387 heightplot = self.HEIGHT + self.HEIGHTPROF)
391 heightplot = self.HEIGHT + self.HEIGHTPROF,
392 show=show)
388
393
389 nrow, ncol = self.getSubplots()
394 nrow, ncol = self.getSubplots()
390
395
@@ -404,7 +409,7 class SpectraPlot(Figure):
404
409
405 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
410 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
406 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
411 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
407 save=False, figpath='./', figfile=None):
412 save=False, figpath='./', figfile=None, show=True):
408
413
409 """
414 """
410
415
@@ -455,7 +460,8 class SpectraPlot(Figure):
455 self.setup(idfigure=idfigure,
460 self.setup(idfigure=idfigure,
456 nplots=nplots,
461 nplots=nplots,
457 wintitle=wintitle,
462 wintitle=wintitle,
458 showprofile=showprofile)
463 showprofile=showprofile,
464 show=show)
459
465
460 if xmin == None: xmin = numpy.nanmin(x)
466 if xmin == None: xmin = numpy.nanmin(x)
461 if xmax == None: xmax = numpy.nanmax(x)
467 if xmax == None: xmax = numpy.nanmax(x)
@@ -512,11 +518,13 class Scope(Figure):
512 ncol = 3
518 ncol = 3
513 return nrow, ncol
519 return nrow, ncol
514
520
515 def setup(self, idfigure, nplots, wintitle):
521 def setup(self, idfigure, nplots, wintitle, show):
516
522
517 self.nplots = nplots
523 self.nplots = nplots
518
524
519 self.createFigure(idfigure, wintitle)
525 self.createFigure(idfigure=idfigure,
526 wintitle=wintitle,
527 show=show)
520
528
521 nrow,ncol = self.getSubplots()
529 nrow,ncol = self.getSubplots()
522 colspan = 3
530 colspan = 3
@@ -529,7 +537,7 class Scope(Figure):
529
537
530 def run(self, dataOut, idfigure, wintitle="", channelList=None,
538 def run(self, dataOut, idfigure, wintitle="", channelList=None,
531 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
539 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
532 figpath='./', figfile=None):
540 figpath='./', figfile=None, show=True):
533
541
534 """
542 """
535
543
@@ -567,7 +575,8 class Scope(Figure):
567
575
568 self.setup(idfigure=idfigure,
576 self.setup(idfigure=idfigure,
569 nplots=nplots,
577 nplots=nplots,
570 wintitle=wintitle)
578 wintitle=wintitle,
579 show=show)
571
580
572 if xmin == None: xmin = numpy.nanmin(x)
581 if xmin == None: xmin = numpy.nanmin(x)
573 if xmax == None: xmax = numpy.nanmax(x)
582 if xmax == None: xmax = numpy.nanmax(x)
@@ -616,7 +625,7 class ProfilePlot(Figure):
616
625
617 return nrow, ncol
626 return nrow, ncol
618
627
619 def setup(self, idfigure, nplots, wintitle):
628 def setup(self, idfigure, nplots, wintitle, show):
620
629
621 self.nplots = nplots
630 self.nplots = nplots
622
631
@@ -626,7 +635,8 class ProfilePlot(Figure):
626 self.createFigure(idfigure = idfigure,
635 self.createFigure(idfigure = idfigure,
627 wintitle = wintitle,
636 wintitle = wintitle,
628 widthplot = self.WIDTH,
637 widthplot = self.WIDTH,
629 heightplot = self.HEIGHT)
638 heightplot = self.HEIGHT,
639 show=show)
630
640
631 nrow, ncol = self.getSubplots()
641 nrow, ncol = self.getSubplots()
632
642
@@ -637,7 +647,7 class ProfilePlot(Figure):
637
647
638 def run(self, dataOut, idfigure, wintitle="", channelList=None,
648 def run(self, dataOut, idfigure, wintitle="", channelList=None,
639 xmin=None, xmax=None, ymin=None, ymax=None,
649 xmin=None, xmax=None, ymin=None, ymax=None,
640 save=False, figpath='./', figfile=None):
650 save=False, figpath='./', figfile=None, show=True):
641
651
642 if channelList == None:
652 if channelList == None:
643 channelIndexList = dataOut.channelIndexList
653 channelIndexList = dataOut.channelIndexList
@@ -668,7 +678,8 class ProfilePlot(Figure):
668
678
669 self.setup(idfigure=idfigure,
679 self.setup(idfigure=idfigure,
670 nplots=nplots,
680 nplots=nplots,
671 wintitle=wintitle)
681 wintitle=wintitle,
682 show=show)
672
683
673 if ymin == None: ymin = numpy.nanmin(y)
684 if ymin == None: ymin = numpy.nanmin(y)
674 if ymax == None: ymax = numpy.nanmax(y)
685 if ymax == None: ymax = numpy.nanmax(y)
@@ -724,7 +735,7 class CoherenceMap(Figure):
724
735
725 return nrow, ncol
736 return nrow, ncol
726
737
727 def setup(self, idfigure, nplots, wintitle, showprofile=True):
738 def setup(self, idfigure, nplots, wintitle, showprofile=True, show=True):
728 self.__showprofile = showprofile
739 self.__showprofile = showprofile
729 self.nplots = nplots
740 self.nplots = nplots
730
741
@@ -738,7 +749,8 class CoherenceMap(Figure):
738 self.createFigure(idfigure = idfigure,
749 self.createFigure(idfigure = idfigure,
739 wintitle = wintitle,
750 wintitle = wintitle,
740 widthplot = self.WIDTH + self.WIDTHPROF,
751 widthplot = self.WIDTH + self.WIDTHPROF,
741 heightplot = self.HEIGHT + self.HEIGHTPROF)
752 heightplot = self.HEIGHT + self.HEIGHTPROF,
753 show=True)
742
754
743 nrow, ncol = self.getSubplots()
755 nrow, ncol = self.getSubplots()
744
756
@@ -754,7 +766,7 class CoherenceMap(Figure):
754 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
766 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
755 timerange=None,
767 timerange=None,
756 save=False, figpath='./', figfile=None, ftp=False, ftpratio=1,
768 save=False, figpath='./', figfile=None, ftp=False, ftpratio=1,
757 coherence_cmap='jet', phase_cmap='RdBu_r'):
769 coherence_cmap='jet', phase_cmap='RdBu_r', show=True):
758
770
759 if pairsList == None:
771 if pairsList == None:
760 pairsIndexList = dataOut.pairsIndexList
772 pairsIndexList = dataOut.pairsIndexList
@@ -789,7 +801,8 class CoherenceMap(Figure):
789 self.setup(idfigure=idfigure,
801 self.setup(idfigure=idfigure,
790 nplots=nplots,
802 nplots=nplots,
791 wintitle=wintitle,
803 wintitle=wintitle,
792 showprofile=showprofile)
804 showprofile=showprofile,
805 show=show)
793
806
794 tmin, tmax = self.getTimeLim(x, xmin, xmax)
807 tmin, tmax = self.getTimeLim(x, xmin, xmax)
795 if ymin == None: ymin = numpy.nanmin(y)
808 if ymin == None: ymin = numpy.nanmin(y)
@@ -897,7 +910,7 class RTIfromNoise(Figure):
897
910
898 return nrow, ncol
911 return nrow, ncol
899
912
900 def setup(self, idfigure, nplots, wintitle, showprofile=True):
913 def setup(self, idfigure, nplots, wintitle, showprofile=True, show=True):
901
914
902 self.__showprofile = showprofile
915 self.__showprofile = showprofile
903 self.nplots = nplots
916 self.nplots = nplots
@@ -909,7 +922,8 class RTIfromNoise(Figure):
909 self.createFigure(idfigure = idfigure,
922 self.createFigure(idfigure = idfigure,
910 wintitle = wintitle,
923 wintitle = wintitle,
911 widthplot = self.WIDTH+self.WIDTHPROF,
924 widthplot = self.WIDTH+self.WIDTHPROF,
912 heightplot = self.HEIGHT+self.HEIGHTPROF)
925 heightplot = self.HEIGHT+self.HEIGHTPROF,
926 show=show)
913
927
914 nrow, ncol = self.getSubplots()
928 nrow, ncol = self.getSubplots()
915
929
@@ -919,7 +933,7 class RTIfromNoise(Figure):
919 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
933 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
920 xmin=None, xmax=None, ymin=None, ymax=None,
934 xmin=None, xmax=None, ymin=None, ymax=None,
921 timerange=None,
935 timerange=None,
922 save=False, figpath='./', figfile=None):
936 save=False, figpath='./', figfile=None, show=True):
923
937
924 if channelList == None:
938 if channelList == None:
925 channelIndexList = dataOut.channelIndexList
939 channelIndexList = dataOut.channelIndexList
@@ -954,7 +968,8 class RTIfromNoise(Figure):
954 self.setup(idfigure=idfigure,
968 self.setup(idfigure=idfigure,
955 nplots=nplots,
969 nplots=nplots,
956 wintitle=wintitle,
970 wintitle=wintitle,
957 showprofile=showprofile)
971 showprofile=showprofile,
972 show=show)
958
973
959 tmin, tmax = self.getTimeLim(x, xmin, xmax)
974 tmin, tmax = self.getTimeLim(x, xmin, xmax)
960 if ymin == None: ymin = numpy.nanmin(noisedB)
975 if ymin == None: ymin = numpy.nanmin(noisedB)
@@ -1031,7 +1046,7 class SpectraHeisScope(Figure):
1031
1046
1032 return nrow, ncol
1047 return nrow, ncol
1033
1048
1034 def setup(self, idfigure, nplots, wintitle):
1049 def setup(self, idfigure, nplots, wintitle, show):
1035
1050
1036 showprofile = False
1051 showprofile = False
1037 self.__showprofile = showprofile
1052 self.__showprofile = showprofile
@@ -1047,7 +1062,8 class SpectraHeisScope(Figure):
1047 self.createFigure(idfigure = idfigure,
1062 self.createFigure(idfigure = idfigure,
1048 wintitle = wintitle,
1063 wintitle = wintitle,
1049 widthplot = self.WIDTH + self.WIDTHPROF,
1064 widthplot = self.WIDTH + self.WIDTHPROF,
1050 heightplot = self.HEIGHT + self.HEIGHTPROF)
1065 heightplot = self.HEIGHT + self.HEIGHTPROF,
1066 show = show)
1051
1067
1052 nrow, ncol = self.getSubplots()
1068 nrow, ncol = self.getSubplots()
1053
1069
@@ -1093,7 +1109,7 class SpectraHeisScope(Figure):
1093
1109
1094 def run(self, dataOut, idfigure, wintitle="", channelList=None,
1110 def run(self, dataOut, idfigure, wintitle="", channelList=None,
1095 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
1111 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
1096 figpath='./', figfile=None, ftp=False, ftpratio=1):
1112 figpath='./', figfile=None, ftp=False, ftpratio=1, show=True):
1097
1113
1098 """
1114 """
1099
1115
@@ -1138,7 +1154,8 class SpectraHeisScope(Figure):
1138
1154
1139 self.setup(idfigure=idfigure,
1155 self.setup(idfigure=idfigure,
1140 nplots=nplots,
1156 nplots=nplots,
1141 wintitle=wintitle)
1157 wintitle=wintitle,
1158 show=show)
1142
1159
1143 if xmin == None: xmin = numpy.nanmin(x)
1160 if xmin == None: xmin = numpy.nanmin(x)
1144 if xmax == None: xmax = numpy.nanmax(x)
1161 if xmax == None: xmax = numpy.nanmax(x)
@@ -1157,6 +1174,7 class SpectraHeisScope(Figure):
1157 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
1174 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
1158 xlabel=xlabel, ylabel=ylabel, title=title, grid='both')
1175 xlabel=xlabel, ylabel=ylabel, title=title, grid='both')
1159
1176
1177
1160 self.draw()
1178 self.draw()
1161
1179
1162 if save:
1180 if save:
@@ -1201,7 +1219,7 class RTIfromSpectraHeis(Figure):
1201
1219
1202 return nrow, ncol
1220 return nrow, ncol
1203
1221
1204 def setup(self, idfigure, nplots, wintitle, showprofile=True):
1222 def setup(self, idfigure, nplots, wintitle, showprofile=True, show=True):
1205
1223
1206 self.__showprofile = showprofile
1224 self.__showprofile = showprofile
1207 self.nplots = nplots
1225 self.nplots = nplots
@@ -1213,7 +1231,8 class RTIfromSpectraHeis(Figure):
1213 self.createFigure(idfigure = idfigure,
1231 self.createFigure(idfigure = idfigure,
1214 wintitle = wintitle,
1232 wintitle = wintitle,
1215 widthplot = self.WIDTH+self.WIDTHPROF,
1233 widthplot = self.WIDTH+self.WIDTHPROF,
1216 heightplot = self.HEIGHT+self.HEIGHTPROF)
1234 heightplot = self.HEIGHT+self.HEIGHTPROF,
1235 show = show)
1217
1236
1218 nrow, ncol = self.getSubplots()
1237 nrow, ncol = self.getSubplots()
1219
1238
@@ -1223,7 +1242,7 class RTIfromSpectraHeis(Figure):
1223 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
1242 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
1224 xmin=None, xmax=None, ymin=None, ymax=None,
1243 xmin=None, xmax=None, ymin=None, ymax=None,
1225 timerange=None,
1244 timerange=None,
1226 save=False, figpath='./', figfile=None, ftp=False, ftpratio=1):
1245 save=False, figpath='./', figfile=None, ftp=False, ftpratio=1, show=True):
1227
1246
1228 if channelList == None:
1247 if channelList == None:
1229 channelIndexList = dataOut.channelIndexList
1248 channelIndexList = dataOut.channelIndexList
@@ -1264,7 +1283,8 class RTIfromSpectraHeis(Figure):
1264 self.setup(idfigure=idfigure,
1283 self.setup(idfigure=idfigure,
1265 nplots=nplots,
1284 nplots=nplots,
1266 wintitle=wintitle,
1285 wintitle=wintitle,
1267 showprofile=showprofile)
1286 showprofile=showprofile,
1287 show=show)
1268
1288
1269 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1289 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1270 if ymin == None: ymin = numpy.nanmin(datadB)
1290 if ymin == None: ymin = numpy.nanmin(datadB)
General Comments 0
You need to be logged in to leave comments. Login now