diff --git a/schainpy/model/graphics/jroplot_data.py b/schainpy/model/graphics/jroplot_data.py index 6d3d898..9d592e4 100644 --- a/schainpy/model/graphics/jroplot_data.py +++ b/schainpy/model/graphics/jroplot_data.py @@ -86,6 +86,9 @@ class PlotData(Operation, Process): print 'plotting...{}'.format(self.CODE) + if self.show: + self.figure.show() + self.plot() self.figure.suptitle('{} {} - Date:{}'.format(self.title, self.CODE.upper(), datetime.datetime.utcfromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S'))) @@ -184,7 +187,6 @@ class PlotSpectraData(PlotData): n += 1 self.figure.subplots_adjust(left=0.1, right=0.95, bottom=0.15, top=0.85, wspace=0.9, hspace=0.5) - self.figure.show() def plot(self): @@ -277,7 +279,6 @@ class PlotRTIData(PlotData): ax.firsttime = True self.axes.append(ax) self.figure.subplots_adjust(hspace=0.5) - self.figure.show() def plot(self): @@ -367,7 +368,6 @@ class PlotCOHData(PlotRTIData): self.axes.append(ax) self.figure.subplots_adjust(hspace=0.5) - self.figure.show() class PlotNoiseData(PlotData): CODE = 'noise' @@ -392,8 +392,6 @@ class PlotNoiseData(PlotData): self.ax = self.figure.add_subplot(self.nrows, self.ncols, 1) self.ax.firsttime = True - self.figure.show() - def plot(self): x = self.times diff --git a/schainpy/model/utils/jroutils_publish.py b/schainpy/model/utils/jroutils_publish.py index 5984794..b15b227 100644 --- a/schainpy/model/utils/jroutils_publish.py +++ b/schainpy/model/utils/jroutils_publish.py @@ -31,7 +31,9 @@ def roundFloats(obj): def decimate(z): # dx = int(len(self.x)/self.__MAXNUMX) + 1 + dy = int(len(z[0])/MAXNUMY) + 1 + return z[::, ::dy] class throttle(object): @@ -148,8 +150,6 @@ class PublishData(Operation): self.zmq_socket.connect(address) time.sleep(1) - - def publish_data(self): self.dataOut.finished = False if self.mqtt is 1: @@ -355,8 +355,12 @@ class ReceiverData(ProcessingUnit, Process): if plottype == 'phase': self.data[plottype][t] = self.dataOut.getCoherence(phase=True) if self.realtime: - self.data_web[plottype] = roundFloats(decimate(self.data[plottype][t]).tolist()) + if plottype == 'spc': + self.data_web[plottype] = roundFloats(decimate(self.data[plottype]).tolist()) + else: + self.data_web[plottype] = roundFloats(decimate(self.data[plottype][t]).tolist()) self.data_web['time'] = t + def run(self): print '[Starting] {} from {}'.format(self.name, self.address) @@ -366,8 +370,8 @@ class ReceiverData(ProcessingUnit, Process): self.receiver.bind(self.address) monitor = self.receiver.get_monitor_socket() self.sender = self.context.socket(zmq.PUB) - if self.realtime: - self.sender_web = self.context.socket(zmq.PUB) + if self.realtime: + self.sender_web = self.context.socket(zmq.PUB) self.sender_web.bind(self.plot_address) self.sender.bind("ipc:///tmp/zmq.plots") @@ -398,23 +402,21 @@ class ReceiverData(ProcessingUnit, Process): self.started = True return - + def sendToWeb(self): - + if not self.isWebConfig: context = zmq.Context() sender_web_config = context.socket(zmq.PUB) if 'tcp://' in self.plot_address: - print self.plot_address dum, address, port = self.plot_address.split(':') conf_address = '{}:{}:{}'.format(dum, address, int(port)+1) else: conf_address = self.plot_address + '.config' - sender_web_config.bind(conf_address) - + sender_web_config.bind(conf_address) + time.sleep(1) for kwargs in self.operationKwargs.values(): if 'plot' in kwargs: + print '[Sending] Config data to web for {}'.format(kwargs['code'].upper()) sender_web_config.send_string(json.dumps(kwargs)) - print kwargs self.isWebConfig = True -