@@ -231,7 +231,6 class Plot(Operation): | |||||
231 | self.attr_time = kwargs.get('attr_time', 'utctime') |
|
231 | self.attr_time = kwargs.get('attr_time', 'utctime') | |
232 | self.attr_data = kwargs.get('attr_data', 'data_param') |
|
232 | self.attr_data = kwargs.get('attr_data', 'data_param') | |
233 | self.decimation = kwargs.get('decimation', None) |
|
233 | self.decimation = kwargs.get('decimation', None) | |
234 | self.showSNR = kwargs.get('showSNR', False) |
|
|||
235 | self.oneFigure = kwargs.get('oneFigure', True) |
|
234 | self.oneFigure = kwargs.get('oneFigure', True) | |
236 | self.width = kwargs.get('width', None) |
|
235 | self.width = kwargs.get('width', None) | |
237 | self.height = kwargs.get('height', None) |
|
236 | self.height = kwargs.get('height', None) | |
@@ -262,6 +261,9 class Plot(Operation): | |||||
262 | self.name |
|
261 | self.name | |
263 | ) |
|
262 | ) | |
264 |
|
263 | |||
|
264 | if isinstance(self.attr_data, str): | |||
|
265 | self.attr_data = [self.attr_data] | |||
|
266 | ||||
265 | def __setup_plot(self): |
|
267 | def __setup_plot(self): | |
266 | ''' |
|
268 | ''' | |
267 | Common setup for all figures, here figures and axes are created |
|
269 | Common setup for all figures, here figures and axes are created | |
@@ -322,6 +324,7 class Plot(Operation): | |||||
322 | self.pf_axes.append(cax) |
|
324 | self.pf_axes.append(cax) | |
323 |
|
325 | |||
324 | for n in range(self.nrows): |
|
326 | for n in range(self.nrows): | |
|
327 | print(self.nrows) | |||
325 | if self.colormaps is not None: |
|
328 | if self.colormaps is not None: | |
326 | cmap = plt.get_cmap(self.colormaps[n]) |
|
329 | cmap = plt.get_cmap(self.colormaps[n]) | |
327 | else: |
|
330 | else: | |
@@ -503,33 +506,33 class Plot(Operation): | |||||
503 |
|
506 | |||
504 | fig = self.figures[n] |
|
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 | if self.throttle == 0: |
|
509 | if self.throttle == 0: | |
522 | figname = os.path.join( |
|
510 | figname = os.path.join( | |
523 | self.save, |
|
511 | self.save, | |
524 | '{}_{}.png'.format( |
|
512 | self.save_code, | |
|
513 | '{}_{}.png'.format( | |||
525 | self.save_code, |
|
514 | self.save_code, | |
526 |
self.getDateTime(self.data.m |
|
515 | self.getDateTime(self.data.max_time).strftime( | |
527 | '%Y%m%d' |
|
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 | fig.savefig(figname) |
|
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 | def send_to_server(self): |
|
536 | def send_to_server(self): | |
534 | ''' |
|
537 | ''' | |
535 | ''' |
|
538 | ''' |
@@ -163,7 +163,7 class GenericRTIPlot(Plot): | |||||
163 | def setup(self): |
|
163 | def setup(self): | |
164 | self.xaxis = 'time' |
|
164 | self.xaxis = 'time' | |
165 | self.ncols = 1 |
|
165 | self.ncols = 1 | |
166 |
self.nrows = self.data.shape( |
|
166 | self.nrows = self.data.shape('param')[0] | |
167 | self.nplots = self.nrows |
|
167 | self.nplots = self.nrows | |
168 | self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.08, 'right':0.95, 'top': 0.95}) |
|
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 | def update(self, dataOut): |
|
178 | def update(self, dataOut): | |
179 |
|
179 | |||
180 | data = { |
|
180 | data = { | |
181 |
|
|
181 | 'param' : numpy.concatenate([getattr(dataOut, attr) for attr in self.attr_data], axis=0) | |
182 | } |
|
182 | } | |
183 |
|
183 | |||
184 | meta = {} |
|
184 | meta = {} | |
@@ -189,7 +189,7 class GenericRTIPlot(Plot): | |||||
189 | # self.data.normalize_heights() |
|
189 | # self.data.normalize_heights() | |
190 | self.x = self.data.times |
|
190 | self.x = self.data.times | |
191 | self.y = self.data.yrange |
|
191 | self.y = self.data.yrange | |
192 |
self.z = self.data[ |
|
192 | self.z = self.data['param'] | |
193 |
|
193 | |||
194 | self.z = numpy.ma.masked_invalid(self.z) |
|
194 | self.z = numpy.ma.masked_invalid(self.z) | |
195 |
|
195 |
@@ -75,7 +75,7 class SpectraPlot(Plot): | |||||
75 | for n, ax in enumerate(self.axes): |
|
75 | for n, ax in enumerate(self.axes): | |
76 | noise = data['noise'][n] |
|
76 | noise = data['noise'][n] | |
77 | if self.CODE == 'spc_moments': |
|
77 | if self.CODE == 'spc_moments': | |
78 |
mean = data['moments'][n, |
|
78 | mean = data['moments'][n, 1] | |
79 | if ax.firsttime: |
|
79 | if ax.firsttime: | |
80 | self.xmax = self.xmax if self.xmax else numpy.nanmax(x) |
|
80 | self.xmax = self.xmax if self.xmax else numpy.nanmax(x) | |
81 | self.xmin = self.xmin if self.xmin else -self.xmax |
|
81 | self.xmin = self.xmin if self.xmin else -self.xmax | |
@@ -466,7 +466,7 class SpectraCutPlot(Plot): | |||||
466 | self.figures[0].legend(ax.plt, labels, loc='center right') |
|
466 | self.figures[0].legend(ax.plt, labels, loc='center right') | |
467 | else: |
|
467 | else: | |
468 | for i, line in enumerate(ax.plt): |
|
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 | self.titles.append('CH {}'.format(n)) |
|
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