@@ -1105,6 +1105,7 class PlotterData(object): | |||||
1105 |
|
1105 | |||
1106 | def __init__(self, code, throttle_value, exp_code, buffering=True, snr=False): |
|
1106 | def __init__(self, code, throttle_value, exp_code, buffering=True, snr=False): | |
1107 |
|
1107 | |||
|
1108 | self.key = code | |||
1108 | self.throttle = throttle_value |
|
1109 | self.throttle = throttle_value | |
1109 | self.exp_code = exp_code |
|
1110 | self.exp_code = exp_code | |
1110 | self.buffering = buffering |
|
1111 | self.buffering = buffering | |
@@ -1202,10 +1203,8 class PlotterData(object): | |||||
1202 | self.tm = tm |
|
1203 | self.tm = tm | |
1203 | self.type = dataOut.type |
|
1204 | self.type = dataOut.type | |
1204 | self.parameters = getattr(dataOut, 'parameters', []) |
|
1205 | self.parameters = getattr(dataOut, 'parameters', []) | |
1205 | if hasattr(dataOut, 'pairsList'): |
|
|||
1206 | self.pairs = dataOut.pairsList |
|
|||
1207 | if hasattr(dataOut, 'meta'): |
|
1206 | if hasattr(dataOut, 'meta'): | |
1208 |
self.meta |
|
1207 | self.meta.update(dataOut.meta) | |
1209 | self.channels = dataOut.channelList |
|
1208 | self.channels = dataOut.channelList | |
1210 | self.interval = dataOut.getTimeInterval() |
|
1209 | self.interval = dataOut.getTimeInterval() | |
1211 | self.localtime = dataOut.useLocalTime |
|
1210 | self.localtime = dataOut.useLocalTime | |
@@ -1288,40 +1287,40 class PlotterData(object): | |||||
1288 |
|
1287 | |||
1289 | self.__heights = [H for tm in self.__times] |
|
1288 | self.__heights = [H for tm in self.__times] | |
1290 |
|
1289 | |||
1291 | def jsonify(self, decimate=False): |
|
1290 | def jsonify(self, plot_name, plot_type, decimate=False): | |
1292 | ''' |
|
1291 | ''' | |
1293 | Convert data to json |
|
1292 | Convert data to json | |
1294 | ''' |
|
1293 | ''' | |
1295 |
|
1294 | |||
1296 | data = {} |
|
|||
1297 | tm = self.times[-1] |
|
1295 | tm = self.times[-1] | |
1298 | dy = int(self.heights.size/self.MAXNUMY) + 1 |
|
1296 | dy = int(self.heights.size/self.MAXNUMY) + 1 | |
1299 | for key in self.data: |
|
1297 | if self.key in ('spc', 'cspc') or not self.buffering: | |
1300 | if key in ('spc', 'cspc') or not self.buffering: |
|
1298 | dx = int(self.data[self.key].shape[1]/self.MAXNUMX) + 1 | |
1301 | dx = int(self.data[key].shape[1]/self.MAXNUMX) + 1 |
|
1299 | data = self.roundFloats( | |
1302 | data[key] = self.roundFloats( |
|
1300 | self.data[self.key][::, ::dx, ::dy].tolist()) | |
1303 | self.data[key][::, ::dx, ::dy].tolist()) |
|
|||
1304 | else: |
|
|||
1305 | data[key] = self.roundFloats(self.data[key][tm].tolist()) |
|
|||
1306 |
|
||||
1307 | ret = {'data': data} |
|
|||
1308 | ret['exp_code'] = self.exp_code |
|
|||
1309 | ret['time'] = float(tm) |
|
|||
1310 | ret['interval'] = float(self.interval) |
|
|||
1311 | ret['localtime'] = self.localtime |
|
|||
1312 | ret['yrange'] = self.roundFloats(self.heights[::dy].tolist()) |
|
|||
1313 | if 'spc' in self.data or 'cspc' in self.data: |
|
|||
1314 | ret['xrange'] = self.roundFloats(self.xrange[2][::dx].tolist()) |
|
|||
1315 | else: |
|
1301 | else: | |
1316 | ret['xrange'] = [] |
|
1302 | data = self.roundFloats(self.data[self.key][tm].tolist()) | |
1317 |
if |
|
1303 | if self.key is 'noise': | |
1318 | ret['pairs'] = [(int(p[0]), int(p[1])) for p in self.pairs] |
|
1304 | data = [[x] for x in data] | |
|
1305 | ||||
|
1306 | meta = {} | |||
|
1307 | ret = { | |||
|
1308 | 'plot': plot_name, | |||
|
1309 | 'code': self.exp_code, | |||
|
1310 | 'time': float(tm), | |||
|
1311 | 'data': data, | |||
|
1312 | } | |||
|
1313 | meta['type'] = plot_type | |||
|
1314 | meta['interval'] = float(self.interval) | |||
|
1315 | meta['localtime'] = self.localtime | |||
|
1316 | meta['yrange'] = self.roundFloats(self.heights[::dy].tolist()) | |||
|
1317 | if 'spc' in self.data or 'cspc' in self.data: | |||
|
1318 | meta['xrange'] = self.roundFloats(self.xrange[2][::dx].tolist()) | |||
1319 | else: |
|
1319 | else: | |
1320 |
|
|
1320 | meta['xrange'] = [] | |
1321 |
|
||||
1322 | for key, value in list(self.meta.items()): |
|
|||
1323 | ret[key] = value |
|
|||
1324 |
|
1321 | |||
|
1322 | meta.update(self.meta) | |||
|
1323 | ret['metadata'] = meta | |||
1325 | return json.dumps(ret) |
|
1324 | return json.dumps(ret) | |
1326 |
|
1325 | |||
1327 | @property |
|
1326 | @property |
@@ -236,6 +236,8 class Plot(Operation): | |||||
236 | 'Sending to server: {}'.format(self.plot_server), |
|
236 | 'Sending to server: {}'.format(self.plot_server), | |
237 | self.name |
|
237 | self.name | |
238 | ) |
|
238 | ) | |
|
239 | if 'plot_name' in kwargs: | |||
|
240 | self.plot_name = kwargs['plot_name'] | |||
239 |
|
241 | |||
240 | def __setup_plot(self): |
|
242 | def __setup_plot(self): | |
241 | ''' |
|
243 | ''' | |
@@ -672,10 +674,10 class Plot(Operation): | |||||
672 | self.sender_counter += 1 |
|
674 | self.sender_counter += 1 | |
673 |
|
675 | |||
674 | self.sender_counter = 1 |
|
676 | self.sender_counter = 1 | |
675 |
|
677 | self.data.meta['titles'] = self.titles | ||
676 | retries = 2 |
|
678 | retries = 2 | |
677 | while True: |
|
679 | while True: | |
678 | self.socket.send_string(self.data.jsonify()) |
|
680 | self.socket.send_string(self.data.jsonify(self.plot_name, self.plot_type)) | |
679 | socks = dict(self.poll.poll(5000)) |
|
681 | socks = dict(self.poll.poll(5000)) | |
680 | if socks.get(self.socket) == zmq.POLLIN: |
|
682 | if socks.get(self.socket) == zmq.POLLIN: | |
681 | reply = self.socket.recv_string() |
|
683 | reply = self.socket.recv_string() |
@@ -42,6 +42,8 class SpectraPlot(Plot): | |||||
42 |
|
42 | |||
43 | CODE = 'spc' |
|
43 | CODE = 'spc' | |
44 | colormap = 'jro' |
|
44 | colormap = 'jro' | |
|
45 | plot_name = 'Spectra' | |||
|
46 | plot_type = 'pcolor' | |||
45 |
|
47 | |||
46 | def setup(self): |
|
48 | def setup(self): | |
47 | self.nplots = len(self.data.channels) |
|
49 | self.nplots = len(self.data.channels) | |
@@ -112,6 +114,8 class CrossSpectraPlot(Plot): | |||||
112 |
|
114 | |||
113 | CODE = 'cspc' |
|
115 | CODE = 'cspc' | |
114 | colormap = 'jet' |
|
116 | colormap = 'jet' | |
|
117 | plot_name = 'CrossSpectra' | |||
|
118 | plot_type = 'pcolor' | |||
115 | zmin_coh = None |
|
119 | zmin_coh = None | |
116 | zmax_coh = None |
|
120 | zmax_coh = None | |
117 | zmin_phase = None |
|
121 | zmin_phase = None | |
@@ -211,6 +215,8 class SpectralMomentsPlot(SpectraPlot): | |||||
211 | ''' |
|
215 | ''' | |
212 | CODE = 'spc_moments' |
|
216 | CODE = 'spc_moments' | |
213 | colormap = 'jro' |
|
217 | colormap = 'jro' | |
|
218 | plot_name = 'SpectralMoments' | |||
|
219 | plot_type = 'pcolor' | |||
214 |
|
220 | |||
215 |
|
221 | |||
216 | class RTIPlot(Plot): |
|
222 | class RTIPlot(Plot): | |
@@ -220,6 +226,8 class RTIPlot(Plot): | |||||
220 |
|
226 | |||
221 | CODE = 'rti' |
|
227 | CODE = 'rti' | |
222 | colormap = 'jro' |
|
228 | colormap = 'jro' | |
|
229 | plot_name = 'RTI' | |||
|
230 | plot_type = 'pcolorbuffer' | |||
223 |
|
231 | |||
224 | def setup(self): |
|
232 | def setup(self): | |
225 | self.xaxis = 'time' |
|
233 | self.xaxis = 'time' | |
@@ -275,6 +283,7 class CoherencePlot(RTIPlot): | |||||
275 | ''' |
|
283 | ''' | |
276 |
|
284 | |||
277 | CODE = 'coh' |
|
285 | CODE = 'coh' | |
|
286 | plot_name = 'Coherence' | |||
278 |
|
287 | |||
279 | def setup(self): |
|
288 | def setup(self): | |
280 | self.xaxis = 'time' |
|
289 | self.xaxis = 'time' | |
@@ -299,6 +308,7 class PhasePlot(CoherencePlot): | |||||
299 |
|
308 | |||
300 | CODE = 'phase' |
|
309 | CODE = 'phase' | |
301 | colormap = 'seismic' |
|
310 | colormap = 'seismic' | |
|
311 | plot_name = 'Phase' | |||
302 |
|
312 | |||
303 |
|
313 | |||
304 | class NoisePlot(Plot): |
|
314 | class NoisePlot(Plot): | |
@@ -307,6 +317,9 class NoisePlot(Plot): | |||||
307 | ''' |
|
317 | ''' | |
308 |
|
318 | |||
309 | CODE = 'noise' |
|
319 | CODE = 'noise' | |
|
320 | plot_name = 'Noise' | |||
|
321 | plot_type = 'scatterbuffer' | |||
|
322 | ||||
310 |
|
323 | |||
311 | def setup(self): |
|
324 | def setup(self): | |
312 | self.xaxis = 'time' |
|
325 | self.xaxis = 'time' | |
@@ -345,6 +358,7 class SnrPlot(RTIPlot): | |||||
345 |
|
358 | |||
346 | CODE = 'snr' |
|
359 | CODE = 'snr' | |
347 | colormap = 'jet' |
|
360 | colormap = 'jet' | |
|
361 | plot_name = 'SNR' | |||
348 |
|
362 | |||
349 |
|
363 | |||
350 | class DopplerPlot(RTIPlot): |
|
364 | class DopplerPlot(RTIPlot): | |
@@ -354,6 +368,7 class DopplerPlot(RTIPlot): | |||||
354 |
|
368 | |||
355 | CODE = 'dop' |
|
369 | CODE = 'dop' | |
356 | colormap = 'jet' |
|
370 | colormap = 'jet' | |
|
371 | plot_name = 'Doppler' | |||
357 |
|
372 | |||
358 |
|
373 | |||
359 | class SkyMapPlot(Plot): |
|
374 | class SkyMapPlot(Plot): | |
@@ -411,6 +426,7 class ParametersPlot(RTIPlot): | |||||
411 |
|
426 | |||
412 | CODE = 'param' |
|
427 | CODE = 'param' | |
413 | colormap = 'seismic' |
|
428 | colormap = 'seismic' | |
|
429 | plot_name = 'Parameters' | |||
414 |
|
430 | |||
415 | def setup(self): |
|
431 | def setup(self): | |
416 | self.xaxis = 'time' |
|
432 | self.xaxis = 'time' | |
@@ -480,6 +496,7 class OutputPlot(ParametersPlot): | |||||
480 |
|
496 | |||
481 | CODE = 'output' |
|
497 | CODE = 'output' | |
482 | colormap = 'seismic' |
|
498 | colormap = 'seismic' | |
|
499 | plot_name = 'Output' | |||
483 |
|
500 | |||
484 |
|
501 | |||
485 | class PolarMapPlot(Plot): |
|
502 | class PolarMapPlot(Plot): | |
@@ -621,6 +638,8 class ScopePlot(Plot): | |||||
621 | ''' |
|
638 | ''' | |
622 |
|
639 | |||
623 | CODE = 'scope' |
|
640 | CODE = 'scope' | |
|
641 | plot_name = 'Scope' | |||
|
642 | plot_type = 'scatter' | |||
624 |
|
643 | |||
625 | def setup(self): |
|
644 | def setup(self): | |
626 |
|
645 | |||
@@ -720,11 +739,6 class ScopePlot(Plot): | |||||
720 | thisDatetime, |
|
739 | thisDatetime, | |
721 | wintitle1 |
|
740 | wintitle1 | |
722 | ) |
|
741 | ) | |
723 |
|
||||
724 |
|
||||
725 |
|
||||
726 |
|
||||
727 |
|
||||
728 | else: |
|
742 | else: | |
729 | wintitle = " [Profile = %d] " %self.data.profileIndex |
|
743 | wintitle = " [Profile = %d] " %self.data.profileIndex | |
730 |
|
744 | |||
@@ -743,6 +757,3 class ScopePlot(Plot): | |||||
743 | thisDatetime, |
|
757 | thisDatetime, | |
744 | wintitle |
|
758 | wintitle | |
745 | ) |
|
759 | ) | |
746 |
|
||||
747 |
|
||||
748 | No newline at end of file |
|
General Comments 0
You need to be logged in to leave comments.
Login now