##// END OF EJS Templates
Decimating data for Spectra and RTI plot
Miguel Valdez -
r813:0ca7674ca107
parent child
Show More
@@ -72,3 +72,7 properly but the next days did not.
72 -jroproc_spectra_lags.py added to schainpy
72 -jroproc_spectra_lags.py added to schainpy
73 -Bug fixed in schainGUI: ProcUnit was created with the same id in some cases.
73 -Bug fixed in schainGUI: ProcUnit was created with the same id in some cases.
74 -Bug fixed in jroHeaderIO: Header size validation.
74 -Bug fixed in jroHeaderIO: Header size validation.
75
76 2.2.4.1:
77 -jroIO_usrp.py is update to read Sandra's data
78 -decimation in Spectra and RTI plots is always enabled. No newline at end of file
@@ -618,11 +618,19 class ProcUnitConf():
618
618
619 kwargs[parmConfObj.name] = parmConfObj.getValue()
619 kwargs[parmConfObj.name] = parmConfObj.getValue()
620
620
621 ini = time.time()
622
621 #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id)
623 #print "\tRunning the '%s' operation with %s" %(opConfObj.name, opConfObj.id)
622 sts = self.procUnitObj.call(opType = opConfObj.type,
624 sts = self.procUnitObj.call(opType = opConfObj.type,
623 opName = opConfObj.name,
625 opName = opConfObj.name,
624 opId = opConfObj.id,
626 opId = opConfObj.id,
625 **kwargs)
627 **kwargs)
628
629 # total_time = time.time() - ini
630 #
631 # if total_time > 0.002:
632 # print "%s::%s took %f seconds" %(self.name, opConfObj.name, total_time)
633
626 is_ok = is_ok or sts
634 is_ok = is_ok or sts
627
635
628 return is_ok
636 return is_ok
@@ -309,8 +309,10 class Axes:
309 decimationx = None
309 decimationx = None
310 decimationy = None
310 decimationy = None
311
311
312 __MAXNUMX = 300
312 __MAXNUMX = 200
313 __MAXNUMY = 150
313 __MAXNUMY = 400
314
315 __MAXNUMTIME = 500
314
316
315 def __init__(self, *args):
317 def __init__(self, *args):
316
318
@@ -471,7 +473,7 class Axes:
471 ymin=None, ymax=None,
473 ymin=None, ymax=None,
472 zmin=None, zmax=None,
474 zmin=None, zmax=None,
473 xlabel='', ylabel='',
475 xlabel='', ylabel='',
474 title='', rti = False, colormap='jet',
476 title='', colormap='jet',
475 **kwargs):
477 **kwargs):
476
478
477 """
479 """
@@ -491,8 +493,19 class Axes:
491 **kwargs : Los parametros aceptados son
493 **kwargs : Los parametros aceptados son
492 ticksize=9,
494 ticksize=9,
493 cblabel=''
495 cblabel=''
494 rti = True or False
495 """
496 """
497
498 #Decimating data
499 xlen = len(x)
500 ylen = len(y)
501
502 decimationx = numpy.floor(xlen/self.__MAXNUMX) + 1
503 decimationy = numpy.floor(ylen/self.__MAXNUMY) + 1
504
505 x_buffer = x[::decimationx]
506 y_buffer = y[::decimationy]
507 z_buffer = z[::decimationx, ::decimationy]
508 #===================================================
496
509
497 if self.__firsttime:
510 if self.__firsttime:
498
511
@@ -504,7 +517,9 class Axes:
504 if zmax == None: zmax = numpy.nanmax(z)
517 if zmax == None: zmax = numpy.nanmax(z)
505
518
506
519
507 self.plot = self.__driver.createPcolor(self.ax, x, y, z,
520 self.plot = self.__driver.createPcolor(self.ax, x_buffer,
521 y_buffer,
522 z_buffer,
508 xmin, xmax,
523 xmin, xmax,
509 ymin, ymax,
524 ymin, ymax,
510 zmin, zmax,
525 zmin, zmax,
@@ -524,15 +539,8 class Axes:
524 self.__firsttime = False
539 self.__firsttime = False
525 return
540 return
526
541
527 if rti:
542 self.__driver.pcolor(self.plot,
528 self.__driver.addpcolor(self.ax, x, y, z, self.zmin, self.zmax,
543 z_buffer,
529 xlabel=xlabel,
530 ylabel=ylabel,
531 title=title,
532 colormap=colormap)
533 return
534
535 self.__driver.pcolor(self.plot, z,
536 xlabel=xlabel,
544 xlabel=xlabel,
537 ylabel=ylabel,
545 ylabel=ylabel,
538 title=title)
546 title=title)
@@ -549,7 +557,7 class Axes:
549 **kwargs):
557 **kwargs):
550
558
551 if maxNumX == None:
559 if maxNumX == None:
552 maxNumX = self.__MAXNUMX
560 maxNumX = self.__MAXNUMTIME
553
561
554 if maxNumY == None:
562 if maxNumY == None:
555 maxNumY = self.__MAXNUMY
563 maxNumY = self.__MAXNUMY
@@ -588,22 +596,18 class Axes:
588
596
589 self.x_buffer = numpy.hstack((self.x_buffer[:-1], x[0], x[-1]))
597 self.x_buffer = numpy.hstack((self.x_buffer[:-1], x[0], x[-1]))
590 self.z_buffer = numpy.hstack((self.z_buffer, z))
598 self.z_buffer = numpy.hstack((self.z_buffer, z))
599 z_buffer = self.z_buffer.reshape(-1,len(y))
591
600
592 if self.decimationx == None:
601 #Decimating data
593 deltax = float(self.xmax - self.xmin)/maxNumX
602 xlen = len(self.x_buffer)
594 deltay = float(self.ymax - self.ymin)/maxNumY
603 ylen = len(y)
595
596 resolutionx = self.x_buffer[2]-self.x_buffer[0]
597 resolutiony = y[1]-y[0]
598
599 self.decimationx = numpy.ceil(deltax / resolutionx)
600 self.decimationy = numpy.ceil(deltay / resolutiony)
601
604
602 z_buffer = self.z_buffer.reshape(-1,len(y))
605 decimationx = numpy.floor(xlen/maxNumX) + 1
606 decimationy = numpy.floor(ylen/maxNumY) + 1
603
607
604 x_buffer = self.x_buffer[::self.decimationx]
608 x_buffer = self.x_buffer[::decimationx]
605 y_buffer = y[::self.decimationy]
609 y_buffer = y[::decimationy]
606 z_buffer = z_buffer[::self.decimationx, ::self.decimationy]
610 z_buffer = z_buffer[::decimationx, ::decimationy]
607 #===================================================
611 #===================================================
608
612
609 x_buffer, y_buffer, z_buffer = self.__fillGaps(x_buffer, y_buffer, z_buffer)
613 x_buffer, y_buffer, z_buffer = self.__fillGaps(x_buffer, y_buffer, z_buffer)
General Comments 0
You need to be logged in to leave comments. Login now