@@ -34,7 +34,6 class Figure: | |||||
34 |
|
34 | |||
35 | path = '%s%03d' %(self.PREFIX, self.id) |
|
35 | path = '%s%03d' %(self.PREFIX, self.id) | |
36 | filename = '%s_%s%s' %(self.PREFIX, name, ext) |
|
36 | filename = '%s_%s%s' %(self.PREFIX, name, ext) | |
37 | filename = '%s%s' %(name, ext) |
|
|||
38 | return os.path.join(path, filename) |
|
37 | return os.path.join(path, filename) | |
39 |
|
38 | |||
40 | def getAxesObjList(self): |
|
39 | def getAxesObjList(self): |
@@ -23,7 +23,7 class CrossSpectraPlot(Figure): | |||||
23 |
|
23 | |||
24 | self.__isConfig = False |
|
24 | self.__isConfig = False | |
25 | self.__nsubplots = 4 |
|
25 | self.__nsubplots = 4 | |
26 |
|
26 | self.counter_imagwr = 0 | ||
27 | self.WIDTH = 250 |
|
27 | self.WIDTH = 250 | |
28 | self.HEIGHT = 250 |
|
28 | self.HEIGHT = 250 | |
29 | self.WIDTHPROF = 0 |
|
29 | self.WIDTHPROF = 0 | |
@@ -59,9 +59,9 class CrossSpectraPlot(Figure): | |||||
59 |
|
59 | |||
60 | counter += 1 |
|
60 | counter += 1 | |
61 |
|
61 | |||
62 |
def run(self, dataOut, id, wintitle="", pairsList=None, |
|
62 | def run(self, dataOut, id, wintitle="", pairsList=None, | |
63 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
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 | power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True): |
|
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 | self.setup(id=id, |
|
120 | self.setup(id=id, | |
121 | nplots=nplots, |
|
121 | nplots=nplots, | |
122 | wintitle=wintitle, |
|
122 | wintitle=wintitle, | |
123 |
showprofile= |
|
123 | showprofile=False, | |
124 | show=show) |
|
124 | show=show) | |
125 |
|
125 | |||
126 | if xmin == None: xmin = numpy.nanmin(x) |
|
126 | if xmin == None: xmin = numpy.nanmin(x) | |
@@ -136,8 +136,8 class CrossSpectraPlot(Figure): | |||||
136 |
|
136 | |||
137 | for i in range(self.nplots): |
|
137 | for i in range(self.nplots): | |
138 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
138 | pair = dataOut.pairsList[pairsIndexList[i]] | |
139 |
|
139 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) | ||
140 |
title = "Ch |
|
140 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[pair[0]], str_datetime) | |
141 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]/factor) |
|
141 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]/factor) | |
142 | axes0 = self.axesList[i*self.__nsubplots] |
|
142 | axes0 = self.axesList[i*self.__nsubplots] | |
143 | axes0.pcolor(x, y, zdB, |
|
143 | axes0.pcolor(x, y, zdB, | |
@@ -145,7 +145,7 class CrossSpectraPlot(Figure): | |||||
145 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
145 | xlabel=xlabel, ylabel=ylabel, title=title, | |
146 | ticksize=9, colormap=power_cmap, cblabel='') |
|
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 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor) |
|
149 | zdB = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]/factor) | |
150 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
150 | axes0 = self.axesList[i*self.__nsubplots+1] | |
151 | axes0.pcolor(x, y, zdB, |
|
151 | axes0.pcolor(x, y, zdB, | |
@@ -177,11 +177,37 class CrossSpectraPlot(Figure): | |||||
177 | self.draw() |
|
177 | self.draw() | |
178 |
|
178 | |||
179 | if save: |
|
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 | class RTIPlot(Figure): |
|
213 | class RTIPlot(Figure): | |
@@ -294,7 +320,7 class RTIPlot(Figure): | |||||
294 |
|
320 | |||
295 | # thisDatetime = dataOut.datatime |
|
321 | # thisDatetime = dataOut.datatime | |
296 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
322 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) | |
297 |
title = wintitle + " RTI |
|
323 | title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) | |
298 | xlabel = "" |
|
324 | xlabel = "" | |
299 | ylabel = "Range (Km)" |
|
325 | ylabel = "Range (Km)" | |
300 |
|
326 | |||
@@ -315,14 +341,13 class RTIPlot(Figure): | |||||
315 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 |
|
341 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 | |
316 |
|
342 | |||
317 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
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 | self.__isConfig = True |
|
344 | self.__isConfig = True | |
320 |
|
345 | |||
321 |
|
346 | |||
322 | self.setWinTitle(title) |
|
347 | self.setWinTitle(title) | |
323 |
|
348 | |||
324 | for i in range(self.nplots): |
|
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 | axes = self.axesList[i*self.__nsubplots] |
|
351 | axes = self.axesList[i*self.__nsubplots] | |
327 | zdB = avgdB[i].reshape((1,-1)) |
|
352 | zdB = avgdB[i].reshape((1,-1)) | |
328 | axes.pcolorbuffer(x, y, zdB, |
|
353 | axes.pcolorbuffer(x, y, zdB, | |
@@ -344,17 +369,24 class RTIPlot(Figure): | |||||
344 |
|
369 | |||
345 | self.counter_imagwr += 1 |
|
370 | self.counter_imagwr += 1 | |
346 | if (self.counter_imagwr==res_imagwr): |
|
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 | if ftp: |
|
376 | if ftp: | |
352 | # self.saveFigure(figpath, figfile) |
|
377 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
353 | figfilename = os.path.join(figpath,fig_file) |
|
378 | name = '%4d%3d00010000000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
354 | self.sendByFTP(figfilename) |
|
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 | self.counter_imagwr = 0 |
|
388 | self.counter_imagwr = 0 | |
357 |
|
389 | |||
358 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
390 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: | |
359 | self.__isConfig = False |
|
391 | self.__isConfig = False | |
360 |
|
392 | |||
@@ -372,7 +404,7 class SpectraPlot(Figure): | |||||
372 | self.__isConfig = False |
|
404 | self.__isConfig = False | |
373 | self.__nsubplots = 1 |
|
405 | self.__nsubplots = 1 | |
374 |
|
406 | |||
375 |
self.WIDTH = 2 |
|
407 | self.WIDTH = 280 | |
376 | self.HEIGHT = 250 |
|
408 | self.HEIGHT = 250 | |
377 | self.WIDTHPROF = 120 |
|
409 | self.WIDTHPROF = 120 | |
378 | self.HEIGHTPROF = 0 |
|
410 | self.HEIGHTPROF = 0 | |
@@ -462,7 +494,7 class SpectraPlot(Figure): | |||||
462 |
|
494 | |||
463 | #thisDatetime = dataOut.datatime |
|
495 | #thisDatetime = dataOut.datatime | |
464 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
496 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) | |
465 |
title = wintitle + " Spectra |
|
497 | title = wintitle + " Spectra" | |
466 | xlabel = "Velocity (m/s)" |
|
498 | xlabel = "Velocity (m/s)" | |
467 | ylabel = "Range (Km)" |
|
499 | ylabel = "Range (Km)" | |
468 |
|
500 | |||
@@ -488,7 +520,8 class SpectraPlot(Figure): | |||||
488 | self.setWinTitle(title) |
|
520 | self.setWinTitle(title) | |
489 |
|
521 | |||
490 | for i in range(self.nplots): |
|
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 | axes = self.axesList[i*self.__nsubplots] |
|
525 | axes = self.axesList[i*self.__nsubplots] | |
493 | axes.pcolor(x, y, zdB[i,:,:], |
|
526 | axes.pcolor(x, y, zdB[i,:,:], | |
494 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
527 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
@@ -512,26 +545,26 class SpectraPlot(Figure): | |||||
512 |
|
545 | |||
513 | self.counter_imagwr += 1 |
|
546 | self.counter_imagwr += 1 | |
514 | if (self.counter_imagwr==res_imagwr): |
|
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) |
|
552 | self.saveFigure(figpath, figfile) | |
518 | self.saveFigure(figpath, fig_file) |
|
|||
519 |
|
553 | |||
520 | if ftp: |
|
554 | if ftp: | |
521 | # self.saveFigure(figpath, figfile) |
|
555 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
522 | figfilename = os.path.join(figpath,fig_file) |
|
556 | name = '%4d%3d00010000100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
523 | self.sendByFTP(figfilename) |
|
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 | self.counter_imagwr = 0 |
|
566 | self.counter_imagwr = 0 | |
526 |
|
567 | |||
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) |
|
|||
535 |
|
568 | |||
536 | class Scope(Figure): |
|
569 | class Scope(Figure): | |
537 |
|
570 | |||
@@ -907,14 +940,24 class CoherenceMap(Figure): | |||||
907 |
|
940 | |||
908 | self.counter_imagwr += 1 |
|
941 | self.counter_imagwr += 1 | |
909 | if (self.counter_imagwr==res_imagwr): |
|
942 | if (self.counter_imagwr==res_imagwr): | |
910 | fig_file = self.getFilename(name = self.name) |
|
943 | if figfile == None: | |
911 | self.saveFigure(figpath, fig_file) |
|
944 | figfile = self.getFilename(name = self.name) | |
|
945 | self.saveFigure(figpath, figfile) | |||
|
946 | ||||
912 | if ftp: |
|
947 | if ftp: | |
913 | self.saveFigure(figpath, figfile) |
|
948 | #provisionalmente envia archivos en el formato de la web en tiempo real | |
914 | figfilename = os.path.join(figpath,figfile) |
|
949 | name = '%4d%3d00010001000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday) | |
915 | self.sendByFTP(figfilename) |
|
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 | self.counter_imagwr = 0 |
|
959 | self.counter_imagwr = 0 | |
|
960 | ||||
918 |
|
961 | |||
919 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
962 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: | |
920 | self.__isConfig = False |
|
963 | self.__isConfig = False |
General Comments 0
You need to be logged in to leave comments.
Login now