diff --git a/schainpy/model/utils/jroutils_publish.py b/schainpy/model/utils/jroutils_publish.py index e7945ad..869245e 100644 --- a/schainpy/model/utils/jroutils_publish.py +++ b/schainpy/model/utils/jroutils_publish.py @@ -29,6 +29,10 @@ def roundFloats(obj): elif isinstance(obj, float): return round(obj, 2) +def decimate(z): + # dx = int(len(self.x)/self.__MAXNUMX) + 1 + dy = int(len(z[0])/MAXNUMY) + 1 + return z[::, ::dy] class throttle(object): """Decorator that prevents a function from being called more than once every @@ -319,7 +323,7 @@ class ReceiverData(ProcessingUnit, Process): return sendDataThrottled def send(self, data): - print '[sending] data=%s size=%s' % (data.keys(), len(data['times'])) + # print '[sending] data=%s size=%s' % (data.keys(), len(data['times'])) self.sender.send_pyobj(data) def update(self): @@ -343,7 +347,7 @@ class ReceiverData(ProcessingUnit, Process): if plottype == 'phase': self.data[plottype][t] = self.dataOut.getCoherence(phase=True) if self.realtime: - self.data_web[plottype] = self.data[plottype][t] + self.data_web[plottype] = roundFloats(decimate(self.data[plottype][t]).tolist()) self.data_web['time'] = t def run(self): @@ -356,10 +360,11 @@ class ReceiverData(ProcessingUnit, Process): self.sender = self.context.socket(zmq.PUB) if self.realtime: self.sender_web = self.context.socket(zmq.PUB) - self.sender.bind("ipc:///tmp/zmq.web") + # self.sender_web.setsockopt(zmq.PUBLISH, 'realtime') + self.sender_web.bind("ipc:///tmp/zmq.web") self.sender.bind("ipc:///tmp/zmq.plots") - t = Thread(target=self.event_monitor) + t = Thread(target=self.event_monitor, args=(monitor,)) t.start() while True: @@ -380,7 +385,7 @@ class ReceiverData(ProcessingUnit, Process): else: if self.realtime: self.send(self.data) - self.sender_web.send_json(json.dumps(self.data_web)) + self.sender_web.send_string(json.dumps(self.data_web)) else: self.sendData(self.send, self.data) self.started = True diff --git a/schainpy/scripts/PPD.py b/schainpy/scripts/PPD.py index 76cde49..c4c00a7 100644 --- a/schainpy/scripts/PPD.py +++ b/schainpy/scripts/PPD.py @@ -65,7 +65,7 @@ def fiber(cursor, skip, q, dt): # opObj13.addParameter(name='zeromq', value=1, format='int') # opObj13.addParameter(name='server', value="juanca", format='str') - # opObj12.addParameter(name='delay', value=1, format='int') + opObj12.addParameter(name='delay', value=1, format='int') # print "Escribiendo el archivo XML" @@ -81,6 +81,6 @@ def fiber(cursor, skip, q, dt): if __name__ == '__main__': parser = argparse.ArgumentParser(description='Set number of parallel processes') - parser.add_argument('--nProcess', default=2, type=int) + parser.add_argument('--nProcess', default=1, type=int) args = parser.parse_args() multiSchain(fiber, nProcess=args.nProcess, startDate='2015/09/26', endDate='2015/09/26') diff --git a/schainpy/scripts/receiver.py b/schainpy/scripts/receiver.py index fa7b082..b83a5d1 100644 --- a/schainpy/scripts/receiver.py +++ b/schainpy/scripts/receiver.py @@ -16,7 +16,6 @@ if __name__ == '__main__': proc1 = controllerObj.addProcUnit(name='ReceiverData') proc1.addParameter(name='realtime', value='1', format='bool') - proc1.addParameter(name='plottypes', value='rti', format='str') proc1.addParameter(name='throttle', value='10', format='int') ## TODO Agregar direccion de server de publicacion a graficos como variable diff --git a/schainpy/scripts/schain.xml b/schainpy/scripts/schain.xml index a3a9eea..89b71e9 100644 --- a/schainpy/scripts/schain.xml +++ b/schainpy/scripts/schain.xml @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file