@@ -1114,7 +1114,7 class PlotterData(object): | |||
|
1114 | 1114 | MAXNUMX = 200 |
|
1115 | 1115 | MAXNUMY = 200 |
|
1116 | 1116 | |
|
1117 | def __init__(self, code, throttle_value, exp_code, buffering=True, snr=False): | |
|
1117 | def __init__(self, code, throttle_value, exp_code, localtime=True, buffering=True, snr=False): | |
|
1118 | 1118 | |
|
1119 | 1119 | self.key = code |
|
1120 | 1120 | self.throttle = throttle_value |
@@ -1122,7 +1122,7 class PlotterData(object): | |||
|
1122 | 1122 | self.buffering = buffering |
|
1123 | 1123 | self.ready = False |
|
1124 | 1124 | self.flagNoData = False |
|
1125 |
self.localtime = |
|
|
1125 | self.localtime = localtime | |
|
1126 | 1126 | self.data = {} |
|
1127 | 1127 | self.meta = {} |
|
1128 | 1128 | self.__heights = [] |
@@ -1144,7 +1144,6 class PlotterData(object): | |||
|
1144 | 1144 | for plot in self.plottypes: |
|
1145 | 1145 | self.data[plot] = {} |
|
1146 | 1146 | |
|
1147 | ||
|
1148 | 1147 | def __str__(self): |
|
1149 | 1148 | dum = ['{}{}'.format(key, self.shape(key)) for key in self.data] |
|
1150 | 1149 | return 'Data[{}][{}]'.format(';'.join(dum), len(self.times)) |
@@ -1222,7 +1221,6 class PlotterData(object): | |||
|
1222 | 1221 | self.pairs = dataOut.pairsList |
|
1223 | 1222 | |
|
1224 | 1223 | self.interval = dataOut.getTimeInterval() |
|
1225 | self.localtime = dataOut.useLocalTime | |
|
1226 | 1224 | if True in ['spc' in ptype for ptype in self.plottypes]: |
|
1227 | 1225 | self.xrange = (dataOut.getFreqRange(1)/1000., |
|
1228 | 1226 | dataOut.getAcfRange(1), dataOut.getVelRange(1)) |
@@ -164,7 +164,7 class Plot(Operation): | |||
|
164 | 164 | self.sender_time = 0 |
|
165 | 165 | self.data = None |
|
166 | 166 | self.firsttime = True |
|
167 |
self.sender_queue = Queue(maxsize= |
|
|
167 | self.sender_queue = Queue(maxsize=60) | |
|
168 | 168 | self.plots_adjust = {'left': 0.125, 'right': 0.9, 'bottom': 0.15, 'top': 0.9, 'wspace': 0.2, 'hspace': 0.2} |
|
169 | 169 | |
|
170 | 170 | def __fmtTime(self, x, pos): |
@@ -185,7 +185,6 class Plot(Operation): | |||
|
185 | 185 | self.show = kwargs.get('show', True) |
|
186 | 186 | self.save = kwargs.get('save', False) |
|
187 | 187 | self.save_period = kwargs.get('save_period', 1) |
|
188 | self.ftp = kwargs.get('ftp', False) | |
|
189 | 188 | self.colormap = kwargs.get('colormap', self.colormap) |
|
190 | 189 | self.colormap_coh = kwargs.get('colormap_coh', 'jet') |
|
191 | 190 | self.colormap_phase = kwargs.get('colormap_phase', 'RdBu_r') |
@@ -223,7 +222,6 class Plot(Operation): | |||
|
223 | 222 | self.grid = kwargs.get('grid', False) |
|
224 | 223 | self.pause = kwargs.get('pause', False) |
|
225 | 224 | self.save_code = kwargs.get('save_code', None) |
|
226 | self.realtime = kwargs.get('realtime', True) | |
|
227 | 225 | self.throttle = kwargs.get('throttle', 0) |
|
228 | 226 | self.exp_code = kwargs.get('exp_code', None) |
|
229 | 227 | self.plot_server = kwargs.get('plot_server', False) |
@@ -232,7 +230,7 class Plot(Operation): | |||
|
232 | 230 | self.height_index = kwargs.get('height_index', None) |
|
233 | 231 | self.__throttle_plot = apply_throttle(self.throttle) |
|
234 | 232 | self.data = PlotterData( |
|
235 | self.CODE, self.throttle, self.exp_code, self.buffering, snr=self.showSNR) | |
|
233 | self.CODE, self.throttle, self.exp_code, self.localtime, self.buffering, snr=self.showSNR) | |
|
236 | 234 | |
|
237 | 235 | if self.plot_server: |
|
238 | 236 | if not self.plot_server.startswith('tcp://'): |
@@ -485,7 +483,7 class Plot(Operation): | |||
|
485 | 483 | for ax in self.axes+self.pf_axes+self.cb_axes: |
|
486 | 484 | ax.clear() |
|
487 | 485 | ax.firsttime = True |
|
488 | if ax.cbar: | |
|
486 | if hasattr(ax, 'cbar') and ax.cbar: | |
|
489 | 487 | ax.cbar.remove() |
|
490 | 488 | |
|
491 | 489 | def __plot(self): |
@@ -588,20 +586,27 class Plot(Operation): | |||
|
588 | 586 | self.data.meta['colormap'] = 'Viridis' |
|
589 | 587 | self.data.meta['interval'] = int(interval) |
|
590 | 588 | # msg = self.data.jsonify(self.data.tm, self.plot_name, self.plot_type) |
|
589 | try: | |
|
590 | self.sender_queue.put(self.data.tm, block=False) | |
|
591 | except: | |
|
592 | tm = self.sender_queue.get() | |
|
591 | 593 | self.sender_queue.put(self.data.tm) |
|
592 | 594 | |
|
593 | 595 | while True: |
|
594 | 596 | if self.sender_queue.empty(): |
|
595 | 597 | break |
|
596 | 598 | tm = self.sender_queue.get() |
|
599 | try: | |
|
597 | 600 | msg = self.data.jsonify(tm, self.plot_name, self.plot_type) |
|
601 | except: | |
|
602 | continue | |
|
598 | 603 | self.socket.send_string(msg) |
|
599 | 604 | socks = dict(self.poll.poll(5000)) |
|
600 | 605 | if socks.get(self.socket) == zmq.POLLIN: |
|
601 | 606 | reply = self.socket.recv_string() |
|
602 | 607 | if reply == 'ok': |
|
603 | 608 | log.log("Response from server ok", self.name) |
|
604 |
time.sleep(0. |
|
|
609 | time.sleep(0.2) | |
|
605 | 610 | continue |
|
606 | 611 | else: |
|
607 | 612 | log.warning( |
@@ -649,14 +654,10 class Plot(Operation): | |||
|
649 | 654 | |
|
650 | 655 | t = getattr(dataOut, self.attr_time) |
|
651 | 656 | |
|
652 |
if |
|
|
657 | if self.localtime: | |
|
653 | 658 | self.getDateTime = datetime.datetime.fromtimestamp |
|
654 | if not self.localtime: | |
|
655 | t += time.timezone | |
|
656 | 659 | else: |
|
657 | 660 | self.getDateTime = datetime.datetime.utcfromtimestamp |
|
658 | if self.localtime: | |
|
659 | t -= time.timezone | |
|
660 | 661 | |
|
661 | 662 | if self.xmin is None: |
|
662 | 663 | self.tmin = t |
@@ -680,11 +681,6 class Plot(Operation): | |||
|
680 | 681 | |
|
681 | 682 | tm = getattr(dataOut, self.attr_time) |
|
682 | 683 | |
|
683 | if not dataOut.useLocalTime and self.localtime: | |
|
684 | tm -= time.timezone | |
|
685 | if dataOut.useLocalTime and not self.localtime: | |
|
686 | tm += time.timezone | |
|
687 | ||
|
688 | 684 | if self.data and (tm - self.tmin) >= self.xrange*60*60: |
|
689 | 685 | self.save_counter = self.save_period |
|
690 | 686 | self.__plot() |
General Comments 0
You need to be logged in to leave comments.
Login now