@@ -204,6 +204,9 class Axes: | |||
|
204 | 204 | x_buffer = None |
|
205 | 205 | z_buffer = None |
|
206 | 206 | |
|
207 | decimationx = None | |
|
208 | decimationy = None | |
|
209 | ||
|
207 | 210 | __MAXNUMX = 1000 |
|
208 | 211 | __MAXNUMY = 500 |
|
209 | 212 | |
@@ -431,7 +434,7 class Axes: | |||
|
431 | 434 | ymin=None, ymax=None, |
|
432 | 435 | zmin=None, zmax=None, |
|
433 | 436 | xlabel='', ylabel='', |
|
434 |
title='', rti = |
|
|
437 | title='', rti = True, colormap='jet', | |
|
435 | 438 | maxNumX = None, maxNumY = None, |
|
436 | 439 | **kwargs): |
|
437 | 440 | |
@@ -470,50 +473,49 class Axes: | |||
|
470 | 473 | if self.zmin == None: self.zmin = zmin |
|
471 | 474 | if self.zmax == None: self.zmax = zmax |
|
472 | 475 | |
|
476 | self.__firsttime = False | |
|
477 | return | |
|
473 | 478 | |
|
474 | deltax = (xmax - xmin)/maxNumX | |
|
475 | deltay = (ymax - ymin)/maxNumY | |
|
479 | self.x_buffer = numpy.hstack((self.x_buffer, x[-1])) | |
|
480 | self.z_buffer = numpy.hstack((self.z_buffer, z)) | |
|
481 | ||
|
482 | if self.decimationx == None: | |
|
483 | deltax = (self.xmax - self.xmin)/maxNumX | |
|
484 | deltay = (self.ymax - self.ymin)/maxNumY | |
|
476 | 485 | |
|
477 |
resolutionx = x[ |
|
|
486 | resolutionx = self.x_buffer[2]-self.x_buffer[0] | |
|
478 | 487 | resolutiony = y[1]-y[0] |
|
479 | 488 | |
|
480 | 489 | self.decimationx = numpy.ceil(deltax / resolutionx) |
|
481 | 490 | self.decimationy = numpy.ceil(deltay / resolutiony) |
|
482 | ||
|
483 | self.__firsttime = False | |
|
484 | return | |
|
485 | 491 | |
|
486 | if rti: | |
|
487 | if x[0]>self.x_buffer[-1]: | |
|
488 | gap = z.copy() | |
|
489 | gap[:] = self.__missing | |
|
490 | self.z_buffer = numpy.hstack((self.z_buffer, gap)) | |
|
491 | self.z_buffer = numpy.ma.masked_inside(self.z_buffer,0.99*self.__missing,1.01*self.__missing) | |
|
492 | self.x_buffer = numpy.hstack((self.x_buffer, x)) | |
|
493 | ||
|
494 |
|
|
|
495 | self.x_buffer = numpy.hstack((self.x_buffer, x[-1])) | |
|
496 | ||
|
497 | self.z_buffer = numpy.hstack((self.z_buffer, z)) | |
|
498 | ||
|
499 | # self.z_buffer = numpy.ma.masked_inside(self.z_buffer,0.99*self.__missing,1.01*self.__missing) | |
|
500 | ydim = len(y) | |
|
501 | z_buffer = self.z_buffer.reshape(-1,ydim) | |
|
502 | ||
|
503 | x_buffer = self.x_buffer[::self.decimationx] | |
|
504 | y_buffer = y[::self.decimationy] | |
|
505 | z_buffer = z_buffer[::self.decimationx, ::self.decimationy] | |
|
506 | #=================================================== | |
|
507 | ||
|
508 | self.__driver.addpcolorbuffer(self.ax, x_buffer, y_buffer, z_buffer, self.zmin, self.zmax, | |
|
509 | xlabel=xlabel, | |
|
510 | ylabel=ylabel, | |
|
511 | title=title, | |
|
512 | colormap=colormap) | |
|
513 |
|
|
|
492 | z_buffer = self.z_buffer.reshape(-1,len(y)) | |
|
493 | ||
|
494 | x_buffer = self.x_buffer[::self.decimationx] | |
|
495 | y_buffer = y[::self.decimationy] | |
|
496 | z_buffer = z_buffer[::self.decimationx, ::self.decimationy] | |
|
497 | #=================================================== | |
|
498 | ||
|
499 | x_buffer, y_buffer, z_buffer = self.__fillGaps(x_buffer, y_buffer, z_buffer) | |
|
500 | ||
|
501 | self.__driver.addpcolorbuffer(self.ax, x_buffer, y_buffer, z_buffer, self.zmin, self.zmax, | |
|
502 | xlabel=xlabel, | |
|
503 | ylabel=ylabel, | |
|
504 | title=title, | |
|
505 | colormap=colormap) | |
|
506 | def __fillGaps(self, x_buffer, y_buffer, z_buffer): | |
|
507 | ||
|
508 | deltas = x_buffer[1:] - x_buffer[0:-1] | |
|
509 | x_median = numpy.median(deltas) | |
|
510 | ||
|
511 | index = numpy.where(deltas >= 2*x_median) | |
|
512 | ||
|
513 | if len(index[0]) != 0: | |
|
514 | z_buffer[index[0],::] = self.__missing | |
|
515 | z_buffer = numpy.ma.masked_inside(z_buffer,0.99*self.__missing,1.01*self.__missing) | |
|
516 | ||
|
517 | return x_buffer, y_buffer, z_buffer | |
|
518 | ||
|
519 | ||
|
514 | 520 | |
|
515 | self.__driver.pcolor(self.plot, z, | |
|
516 | xlabel=xlabel, | |
|
517 | ylabel=ylabel, | |
|
518 | title=title) | |
|
519 | 521 | No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now