##// END OF EJS Templates
Fix bugs in SpectraCutPlot, GenericRTIPlot and saving when using throttle
jespinoza -
r1359:7cde62c34a28
parent child
Show More
@@ -231,7 +231,6 class Plot(Operation):
231 231 self.attr_time = kwargs.get('attr_time', 'utctime')
232 232 self.attr_data = kwargs.get('attr_data', 'data_param')
233 233 self.decimation = kwargs.get('decimation', None)
234 self.showSNR = kwargs.get('showSNR', False)
235 234 self.oneFigure = kwargs.get('oneFigure', True)
236 235 self.width = kwargs.get('width', None)
237 236 self.height = kwargs.get('height', None)
@@ -262,6 +261,9 class Plot(Operation):
262 261 self.name
263 262 )
264 263
264 if isinstance(self.attr_data, str):
265 self.attr_data = [self.attr_data]
266
265 267 def __setup_plot(self):
266 268 '''
267 269 Common setup for all figures, here figures and axes are created
@@ -322,6 +324,7 class Plot(Operation):
322 324 self.pf_axes.append(cax)
323 325
324 326 for n in range(self.nrows):
327 print(self.nrows)
325 328 if self.colormaps is not None:
326 329 cmap = plt.get_cmap(self.colormaps[n])
327 330 else:
@@ -503,33 +506,33 class Plot(Operation):
503 506
504 507 fig = self.figures[n]
505 508
506 figname = os.path.join(
507 self.save,
508 self.save_code,
509 '{}_{}.png'.format(
510 self.save_code,
511 self.getDateTime(self.data.max_time).strftime(
512 '%Y%m%d_%H%M%S'
513 ),
514 )
515 )
516 log.log('Saving figure: {}'.format(figname), self.name)
517 if not os.path.isdir(os.path.dirname(figname)):
518 os.makedirs(os.path.dirname(figname))
519 fig.savefig(figname)
520
521 509 if self.throttle == 0:
522 510 figname = os.path.join(
523 511 self.save,
524 '{}_{}.png'.format(
512 self.save_code,
513 '{}_{}.png'.format(
525 514 self.save_code,
526 self.getDateTime(self.data.min_time).strftime(
527 '%Y%m%d'
515 self.getDateTime(self.data.max_time).strftime(
516 '%Y%m%d_%H%M%S'
528 517 ),
529 518 )
530 519 )
520 log.log('Saving figure: {}'.format(figname), self.name)
521 if not os.path.isdir(os.path.dirname(figname)):
522 os.makedirs(os.path.dirname(figname))
531 523 fig.savefig(figname)
532 524
525 figname = os.path.join(
526 self.save,
527 '{}_{}.png'.format(
528 self.save_code,
529 self.getDateTime(self.data.min_time).strftime(
530 '%Y%m%d'
531 ),
532 )
533 )
534 fig.savefig(figname)
535
533 536 def send_to_server(self):
534 537 '''
535 538 '''
@@ -163,7 +163,7 class GenericRTIPlot(Plot):
163 163 def setup(self):
164 164 self.xaxis = 'time'
165 165 self.ncols = 1
166 self.nrows = self.data.shape(self.attr_data)[0]
166 self.nrows = self.data.shape('param')[0]
167 167 self.nplots = self.nrows
168 168 self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.08, 'right':0.95, 'top': 0.95})
169 169
@@ -178,7 +178,7 class GenericRTIPlot(Plot):
178 178 def update(self, dataOut):
179 179
180 180 data = {
181 self.attr_data : getattr(dataOut, self.attr_data)
181 'param' : numpy.concatenate([getattr(dataOut, attr) for attr in self.attr_data], axis=0)
182 182 }
183 183
184 184 meta = {}
@@ -189,7 +189,7 class GenericRTIPlot(Plot):
189 189 # self.data.normalize_heights()
190 190 self.x = self.data.times
191 191 self.y = self.data.yrange
192 self.z = self.data[self.attr_data]
192 self.z = self.data['param']
193 193
194 194 self.z = numpy.ma.masked_invalid(self.z)
195 195
@@ -75,7 +75,7 class SpectraPlot(Plot):
75 75 for n, ax in enumerate(self.axes):
76 76 noise = data['noise'][n]
77 77 if self.CODE == 'spc_moments':
78 mean = data['moments'][n, 2]
78 mean = data['moments'][n, 1]
79 79 if ax.firsttime:
80 80 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
81 81 self.xmin = self.xmin if self.xmin else -self.xmax
@@ -466,7 +466,7 class SpectraCutPlot(Plot):
466 466 self.figures[0].legend(ax.plt, labels, loc='center right')
467 467 else:
468 468 for i, line in enumerate(ax.plt):
469 line.set_data(x, z[n, :, i])
469 line.set_data(x, z[n, :, index[i]])
470 470 self.titles.append('CH {}'.format(n))
471 471
472 472
General Comments 0
You need to be logged in to leave comments. Login now