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