@@ -50,14 +50,14 class PlotData(Operation, Process): | |||||
50 | __missing = 1E30 |
|
50 | __missing = 1E30 | |
51 |
|
51 | |||
52 | __attrs__ = ['show', 'save', 'xmin', 'xmax', 'ymin', 'ymax', 'zmin', 'zmax', |
|
52 | __attrs__ = ['show', 'save', 'xmin', 'xmax', 'ymin', 'ymax', 'zmin', 'zmax', | |
53 |
'zlimits', 'xlabel', 'ylabel', 'cb_label', 'title', |
|
53 | 'zlimits', 'xlabel', 'ylabel', 'xaxis','cb_label', 'title', | |
54 |
'bgcolor', 'width', 'height', 'localtime', 'oneFigure', |
|
54 | 'colorbar', 'bgcolor', 'width', 'height', 'localtime', 'oneFigure', | |
|
55 | 'showprofile', 'decimation'] | |||
55 |
|
56 | |||
56 | def __init__(self, **kwargs): |
|
57 | def __init__(self, **kwargs): | |
57 |
|
58 | |||
58 | Operation.__init__(self, plot=True, **kwargs) |
|
59 | Operation.__init__(self, plot=True, **kwargs) | |
59 | Process.__init__(self) |
|
60 | Process.__init__(self) | |
60 | self.contador = 0 |
|
|||
61 | self.kwargs['code'] = self.CODE |
|
61 | self.kwargs['code'] = self.CODE | |
62 | self.mp = False |
|
62 | self.mp = False | |
63 | self.data = None |
|
63 | self.data = None | |
@@ -87,7 +87,7 class PlotData(Operation, Process): | |||||
87 | self.ymin = kwargs.get('ymin', None) |
|
87 | self.ymin = kwargs.get('ymin', None) | |
88 | self.ymax = kwargs.get('ymax', None) |
|
88 | self.ymax = kwargs.get('ymax', None) | |
89 | self.xlabel = kwargs.get('xlabel', None) |
|
89 | self.xlabel = kwargs.get('xlabel', None) | |
90 |
self.__MAXNUMY = kwargs.get('decimation', |
|
90 | self.__MAXNUMY = kwargs.get('decimation', 200) | |
91 | self.showSNR = kwargs.get('showSNR', False) |
|
91 | self.showSNR = kwargs.get('showSNR', False) | |
92 | self.oneFigure = kwargs.get('oneFigure', True) |
|
92 | self.oneFigure = kwargs.get('oneFigure', True) | |
93 | self.width = kwargs.get('width', None) |
|
93 | self.width = kwargs.get('width', None) | |
@@ -359,7 +359,7 class PlotData(Operation, Process): | |||||
359 | if self.xaxis is 'time': |
|
359 | if self.xaxis is 'time': | |
360 | dt = self.getDateTime(self.max_time) |
|
360 | dt = self.getDateTime(self.max_time) | |
361 | xmax = (dt.replace(hour=int(self.xmax), minute=59, second=59) - |
|
361 | xmax = (dt.replace(hour=int(self.xmax), minute=59, second=59) - | |
362 | datetime.datetime(1970, 1, 1)).total_seconds() |
|
362 | datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=1)).total_seconds() | |
363 | if self.data.localtime: |
|
363 | if self.data.localtime: | |
364 | xmax += time.timezone |
|
364 | xmax += time.timezone | |
365 | else: |
|
365 | else: | |
@@ -369,9 +369,8 class PlotData(Operation, Process): | |||||
369 | ymax = self.ymax if self.ymax else numpy.nanmax(self.y) |
|
369 | ymax = self.ymax if self.ymax else numpy.nanmax(self.y) | |
370 |
|
370 | |||
371 | Y = numpy.array([10, 20, 50, 100, 200, 500, 1000, 2000]) |
|
371 | Y = numpy.array([10, 20, 50, 100, 200, 500, 1000, 2000]) | |
372 | i = 1 if numpy.where(ymax < Y)[ |
|
372 | i = 1 if numpy.where(ymax-ymin < Y)[0][0] < 0 else numpy.where(ymax-ymin < Y)[0][0] | |
373 | 0][0] < 0 else numpy.where(ymax < Y)[0][0] |
|
373 | ystep = Y[i] / 5 | |
374 | ystep = Y[i - 1] / 5 |
|
|||
375 |
|
374 | |||
376 | for n, ax in enumerate(self.axes): |
|
375 | for n, ax in enumerate(self.axes): | |
377 | if ax.firsttime: |
|
376 | if ax.firsttime: | |
@@ -429,6 +428,7 class PlotData(Operation, Process): | |||||
429 | if self.nrows == 0 or self.nplots == 0: |
|
428 | if self.nrows == 0 or self.nplots == 0: | |
430 | log.warning('No data', self.name) |
|
429 | log.warning('No data', self.name) | |
431 | fig.text(0.5, 0.5, 'No Data', fontsize='large', ha='center') |
|
430 | fig.text(0.5, 0.5, 'No Data', fontsize='large', ha='center') | |
|
431 | fig.canvas.manager.set_window_title(self.CODE) | |||
432 | continue |
|
432 | continue | |
433 |
|
433 | |||
434 | fig.tight_layout() |
|
434 | fig.tight_layout() | |
@@ -436,8 +436,7 class PlotData(Operation, Process): | |||||
436 | self.getDateTime(self.max_time).strftime('%Y/%m/%d'))) |
|
436 | self.getDateTime(self.max_time).strftime('%Y/%m/%d'))) | |
437 | # fig.canvas.draw() |
|
437 | # fig.canvas.draw() | |
438 |
|
438 | |||
439 |
if self.save: |
|
439 | if self.save and self.data.ended: | |
440 | self.contador += 1 |
|
|||
441 | channels = range(self.nrows) |
|
440 | channels = range(self.nrows) | |
442 | if self.oneFigure: |
|
441 | if self.oneFigure: | |
443 | label = '' |
|
442 | label = '' | |
@@ -445,12 +444,10 class PlotData(Operation, Process): | |||||
445 | label = '_{}'.format(channels[n]) |
|
444 | label = '_{}'.format(channels[n]) | |
446 | figname = os.path.join( |
|
445 | figname = os.path.join( | |
447 | self.save, |
|
446 | self.save, | |
448 |
'{}{}_{} |
|
447 | '{}{}_{}.png'.format( | |
449 | self.CODE, |
|
448 | self.CODE, | |
450 | label, |
|
449 | label, | |
451 | self.getDateTime(self.saveTime).strftime( |
|
450 | self.getDateTime(self.saveTime).strftime('%y%m%d_%H%M%S') | |
452 | '%y%m%d_%H%M%S'), |
|
|||
453 | str(self.contador), |
|
|||
454 | ) |
|
451 | ) | |
455 | ) |
|
452 | ) | |
456 | log.log('Saving figure: {}'.format(figname), self.name) |
|
453 | log.log('Saving figure: {}'.format(figname), self.name) |
General Comments 0
You need to be logged in to leave comments.
Login now