##// END OF EJS Templates
Fix LT issue in plots add snr option in jrodata
Juan C. Espinoza -
r1219:a84ca1922528
parent child
Show More
@@ -1103,7 +1103,7 class PlotterData(object):
1103 1103 MAXNUMX = 100
1104 1104 MAXNUMY = 100
1105 1105
1106 def __init__(self, code, throttle_value, exp_code, buffering=True):
1106 def __init__(self, code, throttle_value, exp_code, buffering=True, snr=False):
1107 1107
1108 1108 self.throttle = throttle_value
1109 1109 self.exp_code = exp_code
@@ -1123,7 +1123,10 class PlotterData(object):
1123 1123 self.plottypes = ['noise', 'rti']
1124 1124 else:
1125 1125 self.plottypes = [code]
1126
1126
1127 if 'snr' not in self.plottypes and snr:
1128 self.plottypes.append('snr')
1129
1127 1130 for plot in self.plottypes:
1128 1131 self.data[plot] = {}
1129 1132
@@ -227,7 +227,7 class Plot(Operation):
227 227 self.sender_period = kwargs.get('sender_period', 2)
228 228 self.__throttle_plot = apply_throttle(self.throttle)
229 229 self.data = PlotterData(
230 self.CODE, self.throttle, self.exp_code, self.buffering)
230 self.CODE, self.throttle, self.exp_code, self.buffering, snr=self.showSNR)
231 231
232 232 if self.plot_server:
233 233 if not self.plot_server.startswith('tcp://'):
@@ -303,15 +303,13 class Plot(Operation):
303 303 cmap = plt.get_cmap(self.colormap)
304 304 cmap.set_bad(self.bgcolor, 1.)
305 305 self.cmaps.append(cmap)
306
306
307 307 for fig in self.figures:
308 308 fig.canvas.mpl_connect('key_press_event', self.OnKeyPress)
309 309 fig.canvas.mpl_connect('scroll_event', self.OnBtnScroll)
310 310 fig.canvas.mpl_connect('button_press_event', self.onBtnPress)
311 311 fig.canvas.mpl_connect('motion_notify_event', self.onMotion)
312 312 fig.canvas.mpl_connect('button_release_event', self.onBtnRelease)
313 if self.show:
314 fig.show()
315 313
316 314 def OnKeyPress(self, event):
317 315 '''
@@ -604,6 +602,9 class Plot(Operation):
604 602 fig.canvas.manager.set_window_title('{} - {}'.format(self.title,
605 603 self.getDateTime(self.data.max_time).strftime('%Y/%m/%d')))
606 604 fig.canvas.draw()
605 if self.show:
606 fig.show()
607 figpause(0.1)
607 608
608 609 if self.save:
609 610 self.save_figure(n)
@@ -739,13 +740,21 class Plot(Operation):
739 740
740 741 if dataOut.useLocalTime:
741 742 self.getDateTime = datetime.datetime.fromtimestamp
743 if not self.localtime:
744 t += time.timezone
742 745 else:
743 746 self.getDateTime = datetime.datetime.utcfromtimestamp
747 if self.localtime:
748 t -= time.timezone
744 749
745 750 if self.xmin is None:
746 751 self.tmin = t
747 752 else:
748 self.tmin = (self.getDateTime(t).replace(hour=self.xmin, minute=0, second=0) - datetime.datetime(1970, 1, 1)).total_seconds()
753 self.tmin = (
754 self.getDateTime(t).replace(
755 hour=self.xmin,
756 minute=0,
757 second=0) - self.getDateTime(0)).total_seconds()
749 758
750 759 self.data.setup()
751 760 self.isConfig = True
@@ -765,7 +774,7 class Plot(Operation):
765 774 tm -= time.timezone
766 775 if dataOut.useLocalTime and not self.localtime:
767 776 tm += time.timezone
768
777
769 778 if self.xaxis is 'time' and self.data and (tm - self.tmin) >= self.xrange*60*60:
770 779 self.save_counter = self.save_period
771 780 self.__plot()
@@ -787,8 +796,6 class Plot(Operation):
787 796 else:
788 797 self.__throttle_plot(self.__plot)#, coerce=coerce)
789 798
790 figpause(0.01)
791
792 799 def close(self):
793 800
794 801 if self.data:
@@ -144,12 +144,13 class BLTRParamReader(JRODataReader, ProcessingUnit):
144 144 Get last file and add it to the list
145 145 '''
146 146
147 for n in range(self.nTries):
148 log.warning(
149 "Waiting %0.2f seconds for the next file, try %03d ..." % (self.delay, n+1),
150 self.name
151 )
152 time.sleep(self.delay)
147 for n in range(self.nTries+1):
148 if n>0:
149 log.warning(
150 "Waiting %0.2f seconds for the next file, try %03d ..." % (self.delay, n+1),
151 self.name
152 )
153 time.sleep(self.delay)
153 154 file_list = os.listdir(self.path)
154 155 file_list.sort()
155 156 if file_list:
@@ -230,6 +231,7 class BLTRParamReader(JRODataReader, ProcessingUnit):
230 231 self.counter_records = 0
231 232 self.flagIsNewFile = 0
232 233 self.fileIndex += 1
234 time.sleep(2)
233 235
234 236 return 1
235 237
@@ -245,7 +247,7 class BLTRParamReader(JRODataReader, ProcessingUnit):
245 247 pointer = self.fp.tell()
246 248 self.readBlock()
247 249 except:
248 if self.waitDataBlock(pointer, 38512) == 1:
250 if self.online and self.waitDataBlock(pointer, 38512) == 1:
249 251 continue
250 252 else:
251 253 if not self.setNextFile():
General Comments 0
You need to be logged in to leave comments. Login now