##// END OF EJS Templates
Se corrigen bugs en el eje x de los graficos RTI y CoherenceMap, se reduce el numero de puntos o pixeles en X e Y....
Daniel Valdez -
r471:087ce30f3ac5
parent child
Show More
@@ -64,6 +64,9 class Figure:
64 64 HEIGHT = None
65 65 PREFIX = 'fig'
66 66
67 xmin = None
68 xmax = None
69
67 70 def __init__(self):
68 71
69 72 raise ValueError, "This method is not implemented"
@@ -95,39 +98,73 class Figure:
95 98
96 99 return widthscreen, heightscreen
97 100
98 def getTimeLim(self, x, xmin, xmax):
101 def getTimeLim(self, x, xmin=None, xmax=None, timerange=None):
99 102
100 if self.timerange != None:
101 txmin = x[0] - x[0]%self.timerange
102 else:
103 txmin = numpy.min(x)
103 if self.xmin != None and self.xmax != None:
104 if timerange == None:
105 timerange = self.xmax - self.xmin
106 xmin = self.xmin + timerange
107 xmax = self.xmax + timerange
104 108
109 return xmin, xmax
110
111
112 if timerange != None and self.xmin == None and self.xmax == None:
113 txmin = x[0] - x[0]%timerange
105 114 thisdatetime = datetime.datetime.utcfromtimestamp(txmin)
106 115 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
116 xmin = (thisdatetime - thisdate).seconds/(60*60.)
117 xmax = xmin + timerange/(60*60.)
107 118
108 ####################################################
109 #If the x is out of xrange
110 if xmax != None:
111 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
112 xmin = None
113 xmax = None
114
115 if xmin == None:
116 td = thisdatetime - thisdate
117 xmin = td.seconds/(60*60.)
118 119
119 if xmax == None:
120 xmax = xmin + self.timerange/(60*60.)
120 if timerange == None:
121 txmin = numpy.min(x)
122 thisdatetime = datetime.datetime.utcfromtimestamp(txmin)
123 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
121 124
122 125 mindt = thisdate + datetime.timedelta(hours=xmin) - datetime.timedelta(seconds=time.timezone)
123 tmin = time.mktime(mindt.timetuple())
126 xmin_sec = time.mktime(mindt.timetuple())
124 127
125 128 maxdt = thisdate + datetime.timedelta(hours=xmax) - datetime.timedelta(seconds=time.timezone)
126 tmax = time.mktime(maxdt.timetuple())
127
128 self.timerange = tmax - tmin
129
130 return tmin, tmax
129 xmax_sec = time.mktime(maxdt.timetuple())
130
131 return xmin_sec, xmax_sec
132
133
134
135
136
137 # if timerange != None:
138 # txmin = x[0] - x[0]%timerange
139 # else:
140 # txmin = numpy.min(x)
141 #
142 # thisdatetime = datetime.datetime.utcfromtimestamp(txmin)
143 # thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
144 #
145 # ####################################################
146 # #If the x is out of xrange
147 # if xmax != None:
148 # if xmax < (thisdatetime - thisdate).seconds/(60*60.):
149 # xmin = None
150 # xmax = None
151 #
152 # if xmin == None:
153 # td = thisdatetime - thisdate
154 # xmin = td.seconds/(60*60.)
155 #
156 # if xmax == None:
157 # xmax = xmin + self.timerange/(60*60.)
158 #
159 # mindt = thisdate + datetime.timedelta(hours=xmin) - datetime.timedelta(seconds=time.timezone)
160 # tmin = time.mktime(mindt.timetuple())
161 #
162 # maxdt = thisdate + datetime.timedelta(hours=xmax) - datetime.timedelta(seconds=time.timezone)
163 # tmax = time.mktime(maxdt.timetuple())
164 #
165 # #self.timerange = tmax - tmin
166 #
167 # return tmin, tmax
131 168
132 169 def init(self, id, nplots, wintitle):
133 170
@@ -278,8 +315,8 class Axes:
278 315 decimationx = None
279 316 decimationy = None
280 317
281 __MAXNUMX = 1000
282 __MAXNUMY = 500
318 __MAXNUMX = 300
319 __MAXNUMY = 150
283 320
284 321 def __init__(self, *args):
285 322
@@ -459,6 +459,11 class RTIPlot(Figure):
459 459 self.EXP_CODE = None
460 460 self.SUB_EXP_CODE = None
461 461 self.PLOT_POS = None
462 self.tmin = None
463 self.tmax = None
464
465 self.xmin = None
466 self.xmax = None
462 467
463 468 def getSubplots(self):
464 469
@@ -536,8 +541,8 class RTIPlot(Figure):
536 541 if timerange != None:
537 542 self.timerange = timerange
538 543
539 tmin = None
540 tmax = None
544 #tmin = None
545 #tmax = None
541 546 factor = dataOut.normFactor
542 547 x = dataOut.getTimeRange()
543 548 y = dataOut.getHeiRange()
@@ -565,7 +570,14 class RTIPlot(Figure):
565 570 showprofile=showprofile,
566 571 show=show)
567 572
568 tmin, tmax = self.getTimeLim(x, xmin, xmax)
573 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
574
575 # if timerange != None:
576 # self.timerange = timerange
577 # self.xmin, self.tmax = self.getTimeLim(x, xmin, xmax, timerange)
578
579
580
569 581 if ymin == None: ymin = numpy.nanmin(y)
570 582 if ymax == None: ymax = numpy.nanmax(y)
571 583 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
@@ -582,12 +594,15 class RTIPlot(Figure):
582 594
583 595 self.setWinTitle(title)
584 596
597 if ((self.xmax - x[1]) < (x[1]-x[0])):
598 x[1] = self.xmax
599
585 600 for i in range(self.nplots):
586 601 title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
587 602 axes = self.axesList[i*self.__nsubplots]
588 603 zdB = avgdB[i].reshape((1,-1))
589 604 axes.pcolorbuffer(x, y, zdB,
590 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
605 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
591 606 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
592 607 ticksize=9, cblabel='', cbsize="1%")
593 608
@@ -601,49 +616,54 class RTIPlot(Figure):
601 616
602 617 self.draw()
603 618
604 if lastone:
605 if dataOut.blocknow >= dataOut.last_block:
606 if figfile == None:
607 figfile = self.getFilename(name = self.name)
608 self.saveFigure(figpath, figfile)
609
610 if (save and not(lastone)):
619 # if lastone:
620 # if dataOut.blocknow >= dataOut.last_block:
621 # if figfile == None:
622 # figfile = self.getFilename(name = self.name)
623 # self.saveFigure(figpath, figfile)
624 #
625 # if (save and not(lastone)):
626 #
627 # self.counter_imagwr += 1
628 # if (self.counter_imagwr==wr_period):
629 # if figfile == None:
630 # figfile = self.getFilename(name = self.name)
631 # self.saveFigure(figpath, figfile)
632 #
633 # if ftp:
634 # #provisionalmente envia archivos en el formato de la web en tiempo real
635 # name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
636 # path = '%s%03d' %(self.PREFIX, self.id)
637 # ftp_file = os.path.join(path,'ftp','%s.png'%name)
638 # self.saveFigure(figpath, ftp_file)
639 # ftp_filename = os.path.join(figpath,ftp_file)
640 # self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
641 # self.counter_imagwr = 0
642 #
643 # self.counter_imagwr = 0
611 644
612 self.counter_imagwr += 1
613 if (self.counter_imagwr==wr_period):
614 if figfile == None:
615 figfile = self.getFilename(name = self.name)
645 #if ((dataOut.utctime-time.timezone) >= self.axesList[0].xmax):
646 if x[1] >= self.axesList[0].xmax:
616 647 self.saveFigure(figpath, figfile)
617
618 if ftp:
619 #provisionalmente envia archivos en el formato de la web en tiempo real
620 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
621 path = '%s%03d' %(self.PREFIX, self.id)
622 ftp_file = os.path.join(path,'ftp','%s.png'%name)
623 self.saveFigure(figpath, ftp_file)
624 ftp_filename = os.path.join(figpath,ftp_file)
625 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
626 self.counter_imagwr = 0
627
628 self.counter_imagwr = 0
629
630 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
631
632 648 self.__isConfig = False
633 649
634 if lastone:
635 if figfile == None:
636 figfile = self.getFilename(name = self.name)
637 self.saveFigure(figpath, figfile)
650 # if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
651 #
652 # self.__isConfig = False
638 653
639 if ftp:
640 #provisionalmente envia archivos en el formato de la web en tiempo real
641 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
642 path = '%s%03d' %(self.PREFIX, self.id)
643 ftp_file = os.path.join(path,'ftp','%s.png'%name)
644 self.saveFigure(figpath, ftp_file)
645 ftp_filename = os.path.join(figpath,ftp_file)
646 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
654 # if lastone:
655 # if figfile == None:
656 # figfile = self.getFilename(name = self.name)
657 # self.saveFigure(figpath, figfile)
658 #
659 # if ftp:
660 # #provisionalmente envia archivos en el formato de la web en tiempo real
661 # name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
662 # path = '%s%03d' %(self.PREFIX, self.id)
663 # ftp_file = os.path.join(path,'ftp','%s.png'%name)
664 # self.saveFigure(figpath, ftp_file)
665 # ftp_filename = os.path.join(figpath,ftp_file)
666 # self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
647 667
648 668
649 669 class SpectraPlot(Figure):
@@ -1091,6 +1111,9 class CoherenceMap(Figure):
1091 1111 self.PLOT_POS = None
1092 1112 self.counter_imagwr = 0
1093 1113
1114 self.xmin = None
1115 self.xmax = None
1116
1094 1117 def getSubplots(self):
1095 1118 ncol = 1
1096 1119 nrow = self.nplots*2
@@ -1150,8 +1173,8 class CoherenceMap(Figure):
1150 1173 if len(pairsIndexList) > 4:
1151 1174 pairsIndexList = pairsIndexList[0:4]
1152 1175
1153 tmin = None
1154 tmax = None
1176 # tmin = None
1177 # tmax = None
1155 1178 x = dataOut.getTimeRange()
1156 1179 y = dataOut.getHeiRange()
1157 1180
@@ -1169,7 +1192,10 class CoherenceMap(Figure):
1169 1192 showprofile=showprofile,
1170 1193 show=show)
1171 1194
1172 tmin, tmax = self.getTimeLim(x, xmin, xmax)
1195 #tmin, tmax = self.getTimeLim(x, xmin, xmax)
1196
1197 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
1198
1173 1199 if ymin == None: ymin = numpy.nanmin(y)
1174 1200 if ymax == None: ymax = numpy.nanmax(y)
1175 1201 if zmin == None: zmin = 0.
@@ -1186,6 +1212,9 class CoherenceMap(Figure):
1186 1212
1187 1213 self.setWinTitle(title)
1188 1214
1215 if ((self.xmax - x[1]) < (x[1]-x[0])):
1216 x[1] = self.xmax
1217
1189 1218 for i in range(self.nplots):
1190 1219
1191 1220 pair = dataOut.pairsList[pairsIndexList[i]]
@@ -1211,7 +1240,7 class CoherenceMap(Figure):
1211 1240 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1212 1241 axes = self.axesList[i*self.__nsubplots*2]
1213 1242 axes.pcolorbuffer(x, y, z,
1214 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
1243 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
1215 1244 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
1216 1245 ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%")
1217 1246
@@ -1233,7 +1262,7 class CoherenceMap(Figure):
1233 1262 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
1234 1263 axes = self.axesList[i*self.__nsubplots*2 + counter]
1235 1264 axes.pcolorbuffer(x, y, z,
1236 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
1265 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
1237 1266 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
1238 1267 ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%")
1239 1268
@@ -1248,30 +1277,34 class CoherenceMap(Figure):
1248 1277
1249 1278 self.draw()
1250 1279
1251 if save:
1252
1253 self.counter_imagwr += 1
1254 if (self.counter_imagwr==wr_period):
1255 if figfile == None:
1256 figfile = self.getFilename(name = self.name)
1280 if x[1] >= self.axesList[0].xmax:
1257 1281 self.saveFigure(figpath, figfile)
1258
1259 if ftp:
1260 #provisionalmente envia archivos en el formato de la web en tiempo real
1261 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1262 path = '%s%03d' %(self.PREFIX, self.id)
1263 ftp_file = os.path.join(path,'ftp','%s.png'%name)
1264 self.saveFigure(figpath, ftp_file)
1265 ftp_filename = os.path.join(figpath,ftp_file)
1266 self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1267 self.counter_imagwr = 0
1268
1269 self.counter_imagwr = 0
1270
1271
1272 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1273 1282 self.__isConfig = False
1274 1283
1284 # if save:
1285 #
1286 # self.counter_imagwr += 1
1287 # if (self.counter_imagwr==wr_period):
1288 # if figfile == None:
1289 # figfile = self.getFilename(name = self.name)
1290 # self.saveFigure(figpath, figfile)
1291 #
1292 # if ftp:
1293 # #provisionalmente envia archivos en el formato de la web en tiempo real
1294 # name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
1295 # path = '%s%03d' %(self.PREFIX, self.id)
1296 # ftp_file = os.path.join(path,'ftp','%s.png'%name)
1297 # self.saveFigure(figpath, ftp_file)
1298 # ftp_filename = os.path.join(figpath,ftp_file)
1299 # self.sendByFTP_Thread(ftp_filename, server, folder, username, password)
1300 # self.counter_imagwr = 0
1301 #
1302 # self.counter_imagwr = 0
1303 #
1304 #
1305 # if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
1306 # self.__isConfig = False
1307
1275 1308 class BeaconPhase(Figure):
1276 1309
1277 1310 __isConfig = None
@@ -1428,11 +1461,11 class BeaconPhase(Figure):
1428 1461 path = '%s%03d' %(self.PREFIX, self.id)
1429 1462 beacon_file = os.path.join(path,'%s.txt'%self.name)
1430 1463 self.filename_phase = os.path.join(figpath,beacon_file)
1431 self.save_phase(self.filename_phase)
1464 #self.save_phase(self.filename_phase)
1432 1465
1433 1466
1434 1467 #store data beacon phase
1435 self.save_data(self.filename_phase, phase_beacon, thisDatetime)
1468 #self.save_data(self.filename_phase, phase_beacon, thisDatetime)
1436 1469
1437 1470 self.setWinTitle(title)
1438 1471
@@ -919,8 +919,12 class SpectraProc(ProcessingUnit):
919 919
920 920 return 1
921 921
922 def getBeaconSignal(self, tauindex = 0, channelindex = 0):
922 def getBeaconSignal(self, tauindex = 0, channelindex = 0, hei_ref=None):
923 923 newheis = numpy.where(self.dataOut.heightList>self.dataOut.radarControllerHeaderObj.Taus[tauindex])
924
925 if hei_ref != None:
926 newheis = numpy.where(self.dataOut.heightList>hei_ref)
927
924 928 minIndex = min(newheis[0])
925 929 maxIndex = max(newheis[0])
926 930 data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1]
General Comments 0
You need to be logged in to leave comments. Login now