@@ -34,7 +34,6 class Figure: | |||
|
34 | 34 | |
|
35 | 35 | path = '%s%03d' %(self.PREFIX, self.id) |
|
36 | 36 | filename = '%s_%s%s' %(self.PREFIX, name, ext) |
|
37 | filename = '%s%s' %(name, ext) | |
|
38 | 37 | return os.path.join(path, filename) |
|
39 | 38 | |
|
40 | 39 | def getAxesObjList(self): |
@@ -23,7 +23,7 class CrossSpectraPlot(Figure): | |||
|
23 | 23 | |
|
24 | 24 | self.__isConfig = False |
|
25 | 25 | self.__nsubplots = 4 |
|
26 | ||
|
26 | self.counter_imagwr = 0 | |
|
27 | 27 | self.WIDTH = 250 |
|
28 | 28 | self.HEIGHT = 250 |
|
29 | 29 | self.WIDTHPROF = 0 |
@@ -59,9 +59,9 class CrossSpectraPlot(Figure): | |||
|
59 | 59 | |
|
60 | 60 | counter += 1 |
|
61 | 61 | |
|
62 |
def run(self, dataOut, id, wintitle="", pairsList=None, |
|
|
62 | def run(self, dataOut, id, wintitle="", pairsList=None, | |
|
63 | 63 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
64 | save=False, figpath='./', figfile=None, | |
|
64 | save=False, figpath='./', figfile=None, ftp=False, res_imagwr=1, | |
|
65 | 65 | power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True): |
|
66 | 66 | |
|
67 | 67 | """ |
@@ -120,7 +120,7 class CrossSpectraPlot(Figure): | |||
|
120 | 120 | self.setup(id=id, |
|
121 | 121 | nplots=nplots, |
|
122 | 122 | wintitle=wintitle, |
|
123 |
showprofile= |
|
|
123 | showprofile=False, | |
|
124 | 124 | show=show) |
|
125 | 125 | |
|
126 | 126 | if xmin == None: xmin = numpy.nanmin(x) |
@@ -136,8 +136,8 class CrossSpectraPlot(Figure): | |||
|
136 | 136 | |
|
137 | 137 | for i in range(self.nplots): |
|
138 | 138 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
139 | ||
|
140 |
title = "Ch |
|
|
139 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | |
|
140 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime) | |
|
141 | 141 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]/factor) |
|
142 | 142 | axes0 = self.axesList[i*self.__nsubplots] |
|
143 | 143 | axes0.pcolor(x, y, zdB, |
@@ -145,7 +145,7 class CrossSpectraPlot(Figure): | |||
|
145 | 145 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
146 | 146 | ticksize=9, colormap=power_cmap, cblabel='') |
|
147 | 147 | |
|
148 |
title = "Ch |
|
|
148 | title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[pair[1]], str_datetime) | |
|
149 | 149 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor) |
|
150 | 150 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
151 | 151 | axes0.pcolor(x, y, zdB, |
@@ -177,11 +177,37 class CrossSpectraPlot(Figure): | |||
|
177 | 177 | self.draw() |
|
178 | 178 | |
|
179 | 179 | if save: |
|
180 | date = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
181 | if figfile == None: | |
|
182 | figfile = self.getFilename(name = date) | |
|
183 | 180 | |
|
184 | self.saveFigure(figpath, figfile) | |
|
181 | self.counter_imagwr += 1 | |
|
182 | if (self.counter_imagwr==res_imagwr): | |
|
183 | if figfile == None: | |
|
184 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
185 | figfile = self.getFilename(name = str_datetime) | |
|
186 | ||
|
187 | self.saveFigure(figpath, figfile) | |
|
188 | ||
|
189 | if ftp: | |
|
190 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
|
191 | name = '%4d%3d00010001100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
192 | path = '%s%03d' %(self.PREFIX, self.id) | |
|
193 | ftp_file = os.path.join(path,'ftp','%s.png'%name) | |
|
194 | self.saveFigure(figpath, ftp_file) | |
|
195 | ftp_filename = os.path.join(figpath,ftp_file) | |
|
196 | ||
|
197 | try: | |
|
198 | self.sendByFTP(ftp_filename) | |
|
199 | except: | |
|
200 | raise ValueError, 'Error FTP' | |
|
201 | ||
|
202 | self.counter_imagwr = 0 | |
|
203 | ||
|
204 | ||
|
205 | # if save: | |
|
206 | # date = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
207 | # if figfile == None: | |
|
208 | # figfile = self.getFilename(name = date) | |
|
209 | # | |
|
210 | # self.saveFigure(figpath, figfile) | |
|
185 | 211 | |
|
186 | 212 | |
|
187 | 213 | class RTIPlot(Figure): |
@@ -294,7 +320,7 class RTIPlot(Figure): | |||
|
294 | 320 | |
|
295 | 321 | # thisDatetime = dataOut.datatime |
|
296 | 322 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
297 |
title = wintitle + " RTI |
|
|
323 | title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) | |
|
298 | 324 | xlabel = "" |
|
299 | 325 | ylabel = "Range (Km)" |
|
300 | 326 | |
@@ -315,14 +341,13 class RTIPlot(Figure): | |||
|
315 | 341 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 |
|
316 | 342 | |
|
317 | 343 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
318 | self.name = '%4d%3d00010000000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
319 | 344 | self.__isConfig = True |
|
320 | 345 | |
|
321 | 346 | |
|
322 | 347 | self.setWinTitle(title) |
|
323 | 348 | |
|
324 | 349 | for i in range(self.nplots): |
|
325 |
title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%d |
|
|
350 | title = "Channel %d: %s" %(dataOut.channelList[i]+1, thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) | |
|
326 | 351 | axes = self.axesList[i*self.__nsubplots] |
|
327 | 352 | zdB = avgdB[i].reshape((1,-1)) |
|
328 | 353 | axes.pcolorbuffer(x, y, zdB, |
@@ -344,17 +369,24 class RTIPlot(Figure): | |||
|
344 | 369 | |
|
345 | 370 | self.counter_imagwr += 1 |
|
346 | 371 | if (self.counter_imagwr==res_imagwr): |
|
372 | if figfile == None: | |
|
373 | figfile = self.getFilename(name = self.name) | |
|
374 | self.saveFigure(figpath, figfile) | |
|
347 | 375 | |
|
348 | ||
|
349 | fig_file = self.getFilename(name = self.name) | |
|
350 | self.saveFigure(figpath, fig_file) | |
|
351 | 376 | if ftp: |
|
352 | # self.saveFigure(figpath, figfile) | |
|
353 | figfilename = os.path.join(figpath,fig_file) | |
|
354 | self.sendByFTP(figfilename) | |
|
377 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
|
378 | name = '%4d%3d00010000000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
379 | path = '%s%03d' %(self.PREFIX, self.id) | |
|
380 | ftp_file = os.path.join(path,'ftp','%s.png'%name) | |
|
381 | self.saveFigure(figpath, ftp_file) | |
|
382 | ftp_filename = os.path.join(figpath,ftp_file) | |
|
383 | try: | |
|
384 | self.sendByFTP(ftp_filename) | |
|
385 | except: | |
|
386 | raise ValueError, 'Error FTP' | |
|
355 | 387 | |
|
356 | 388 | self.counter_imagwr = 0 |
|
357 | ||
|
389 | ||
|
358 | 390 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
359 | 391 | self.__isConfig = False |
|
360 | 392 | |
@@ -372,7 +404,7 class SpectraPlot(Figure): | |||
|
372 | 404 | self.__isConfig = False |
|
373 | 405 | self.__nsubplots = 1 |
|
374 | 406 | |
|
375 |
self.WIDTH = 2 |
|
|
407 | self.WIDTH = 280 | |
|
376 | 408 | self.HEIGHT = 250 |
|
377 | 409 | self.WIDTHPROF = 120 |
|
378 | 410 | self.HEIGHTPROF = 0 |
@@ -462,7 +494,7 class SpectraPlot(Figure): | |||
|
462 | 494 | |
|
463 | 495 | #thisDatetime = dataOut.datatime |
|
464 | 496 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
465 |
title = wintitle + " Spectra |
|
|
497 | title = wintitle + " Spectra" | |
|
466 | 498 | xlabel = "Velocity (m/s)" |
|
467 | 499 | ylabel = "Range (Km)" |
|
468 | 500 | |
@@ -488,7 +520,8 class SpectraPlot(Figure): | |||
|
488 | 520 | self.setWinTitle(title) |
|
489 | 521 | |
|
490 | 522 | for i in range(self.nplots): |
|
491 | title = "Channel %d: %4.2fdB" %(dataOut.channelList[i]+1, noisedB[i]) | |
|
523 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | |
|
524 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i]+1, noisedB[i], str_datetime) | |
|
492 | 525 | axes = self.axesList[i*self.__nsubplots] |
|
493 | 526 | axes.pcolor(x, y, zdB[i,:,:], |
|
494 | 527 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
@@ -512,26 +545,26 class SpectraPlot(Figure): | |||
|
512 | 545 | |
|
513 | 546 | self.counter_imagwr += 1 |
|
514 | 547 | if (self.counter_imagwr==res_imagwr): |
|
515 | date = '%4d%3d00010000100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
548 | if figfile == None: | |
|
549 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
550 | figfile = self.getFilename(name = str_datetime) | |
|
516 | 551 | |
|
517 | fig_file = self.getFilename(name = date) | |
|
518 | self.saveFigure(figpath, fig_file) | |
|
552 | self.saveFigure(figpath, figfile) | |
|
519 | 553 | |
|
520 | 554 | if ftp: |
|
521 | # self.saveFigure(figpath, figfile) | |
|
522 | figfilename = os.path.join(figpath,fig_file) | |
|
523 | self.sendByFTP(figfilename) | |
|
555 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
|
556 | name = '%4d%3d00010000100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
557 | path = '%s%03d' %(self.PREFIX, self.id) | |
|
558 | ftp_file = os.path.join(path,'ftp','%s.png'%name) | |
|
559 | self.saveFigure(figpath, ftp_file) | |
|
560 | ftp_filename = os.path.join(figpath,ftp_file) | |
|
561 | try: | |
|
562 | self.sendByFTP(ftp_filename) | |
|
563 | except: | |
|
564 | raise ValueError, 'Error FTP' | |
|
524 | 565 | |
|
525 | 566 | self.counter_imagwr = 0 |
|
526 | ||
|
527 | ||
|
528 | # if save: | |
|
529 | # date = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
530 | # date = '%4d%3d00010000100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
531 | # if figfile == None: | |
|
532 | # figfile = self.getFilename(name = date) | |
|
533 | # | |
|
534 | # self.saveFigure(figpath, figfile) | |
|
567 | ||
|
535 | 568 | |
|
536 | 569 | class Scope(Figure): |
|
537 | 570 | |
@@ -907,14 +940,24 class CoherenceMap(Figure): | |||
|
907 | 940 | |
|
908 | 941 | self.counter_imagwr += 1 |
|
909 | 942 | if (self.counter_imagwr==res_imagwr): |
|
910 | fig_file = self.getFilename(name = self.name) | |
|
911 | self.saveFigure(figpath, fig_file) | |
|
943 | if figfile == None: | |
|
944 | figfile = self.getFilename(name = self.name) | |
|
945 | self.saveFigure(figpath, figfile) | |
|
946 | ||
|
912 | 947 | if ftp: |
|
913 | self.saveFigure(figpath, figfile) | |
|
914 | figfilename = os.path.join(figpath,figfile) | |
|
915 | self.sendByFTP(figfilename) | |
|
948 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
|
949 | name = '%4d%3d00010001000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
|
950 | path = '%s%03d' %(self.PREFIX, self.id) | |
|
951 | ftp_file = os.path.join(path,'ftp','%s.png'%name) | |
|
952 | self.saveFigure(figpath, ftp_file) | |
|
953 | ftp_filename = os.path.join(figpath,ftp_file) | |
|
954 | try: | |
|
955 | self.sendByFTP(ftp_filename) | |
|
956 | except: | |
|
957 | raise ValueError, 'Error FTP' | |
|
916 | 958 | |
|
917 | 959 | self.counter_imagwr = 0 |
|
960 | ||
|
918 | 961 | |
|
919 | 962 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
920 | 963 | self.__isConfig = False |
General Comments 0
You need to be logged in to leave comments.
Login now