##// END OF EJS Templates
antes de la nueva 2.3
J Gomez -
r958:2f4ff9a3b28d merge
parent child
Show More
@@ -8,6 +8,7 import ast
8 import datetime
8 import datetime
9 import traceback
9 import traceback
10 import math
10 import math
11 import time
11 from multiprocessing import Process, Queue, cpu_count
12 from multiprocessing import Process, Queue, cpu_count
12
13
13 import schainpy
14 import schainpy
@@ -66,7 +67,8 def multiSchain(child, nProcess=cpu_count(), startDate=None, endDate=None, by_da
66 for process in processes:
67 for process in processes:
67 process.join()
68 process.join()
68 process.terminate()
69 process.terminate()
69 #sys.exit()
70
71 time.sleep(3)
70
72
71
73
72 class ParameterConf():
74 class ParameterConf():
1 NO CONTENT: modified file
NO CONTENT: modified file
@@ -24,9 +24,8 class PlotData(Operation, Process):
24
24
25 CODE = 'Figure'
25 CODE = 'Figure'
26 colormap = 'jro'
26 colormap = 'jro'
27 CONFLATE = True
27 CONFLATE = False
28 __MAXNUMX = 80
28 __MAXNUMX = 80
29 __MAXNUMY = 80
30 __missing = 1E30
29 __missing = 1E30
31
30
32 def __init__(self, **kwargs):
31 def __init__(self, **kwargs):
@@ -38,6 +37,7 class PlotData(Operation, Process):
38 self.dataOut = None
37 self.dataOut = None
39 self.isConfig = False
38 self.isConfig = False
40 self.figure = None
39 self.figure = None
40 self.figure2 = None #JM modificatiom
41 self.axes = []
41 self.axes = []
42 self.localtime = kwargs.pop('localtime', True)
42 self.localtime = kwargs.pop('localtime', True)
43 self.show = kwargs.get('show', True)
43 self.show = kwargs.get('show', True)
@@ -55,7 +55,9 class PlotData(Operation, Process):
55 self.xrange = kwargs.get('xrange', 24)
55 self.xrange = kwargs.get('xrange', 24)
56 self.ymin = kwargs.get('ymin', None)
56 self.ymin = kwargs.get('ymin', None)
57 self.ymax = kwargs.get('ymax', None)
57 self.ymax = kwargs.get('ymax', None)
58 self.__MAXNUMY = kwargs.get('decimation', 80)
58 self.throttle_value = 5
59 self.throttle_value = 5
60 self.times = []
59
61
60 def fill_gaps(self, x_buffer, y_buffer, z_buffer):
62 def fill_gaps(self, x_buffer, y_buffer, z_buffer):
61
63
@@ -94,19 +96,27 class PlotData(Operation, Process):
94 if self.show:
96 if self.show:
95 print 'showing'
97 print 'showing'
96 self.figure.show()
98 self.figure.show()
99 self.figure2.show()
97
100
98 self.plot()
101 self.plot()
99 plt.tight_layout()
102 plt.tight_layout()
100 self.figure.canvas.manager.set_window_title('{} {} - Date:{}'.format(self.title, self.CODE.upper(),
103 self.figure.canvas.manager.set_window_title('{} {} - Date:{}'.format(self.title, self.CODE.upper(),
101 datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')))
104 datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')))
105 self.figure2.canvas.manager.set_window_title('{} {} - Date:{}'.format(self.title, self.CODE.upper(),
106 datetime.datetime.fromtimestamp(self.max_time).strftime('%y/%m/%d %H:%M:%S')))
102
107
103 if self.save:
108 if self.save:
104 figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,
109 figname = os.path.join(self.save, '{}_{}.png'.format(self.CODE,
105 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
110 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
106 print 'Saving figure: {}'.format(figname)
111 print 'Saving figure: {}'.format(figname)
107 self.figure.savefig(figname)
112 self.figure.savefig(figname)
113 figname2 = os.path.join(self.save, '{}_{}2.png'.format(self.CODE,
114 datetime.datetime.fromtimestamp(self.saveTime).strftime('%y%m%d_%H%M%S')))
115 print 'Saving figure: {}'.format(figname2)
116 self.figure2.savefig(figname2)
108
117
109 self.figure.canvas.draw()
118 self.figure.canvas.draw()
119 self.figure2.canvas.draw()
110
120
111 def plot(self):
121 def plot(self):
112
122
@@ -121,11 +131,16 class PlotData(Operation, Process):
121 receiver.setsockopt(zmq.SUBSCRIBE, '')
131 receiver.setsockopt(zmq.SUBSCRIBE, '')
122 receiver.setsockopt(zmq.CONFLATE, self.CONFLATE)
132 receiver.setsockopt(zmq.CONFLATE, self.CONFLATE)
123 receiver.connect("ipc:///tmp/zmq.plots")
133 receiver.connect("ipc:///tmp/zmq.plots")
124
134 seconds_passed = 0
125 while True:
135 while True:
126 try:
136 try:
127 self.data = receiver.recv_pyobj(flags=zmq.NOBLOCK)
137 self.data = receiver.recv_pyobj(flags=zmq.NOBLOCK)#flags=zmq.NOBLOCK
138 self.started = self.data['STARTED']
128 self.dataOut = self.data['dataOut']
139 self.dataOut = self.data['dataOut']
140
141 if (len(self.times) < len(self.data['times']) and not self.started and self.data['ENDED']):
142 continue
143
129 self.times = self.data['times']
144 self.times = self.data['times']
130 self.times.sort()
145 self.times.sort()
131 self.throttle_value = self.data['throttle']
146 self.throttle_value = self.data['throttle']
@@ -133,16 +148,25 class PlotData(Operation, Process):
133 self.max_time = self.times[-1]
148 self.max_time = self.times[-1]
134
149
135 if self.isConfig is False:
150 if self.isConfig is False:
151 print 'setting up'
136 self.setup()
152 self.setup()
137 self.isConfig = True
153 self.isConfig = True
138 self.__plot()
154 self.__plot()
139
155
140 if self.data['ENDED'] is True:
156 if self.data['ENDED'] is True:
157 print '********GRAPHIC ENDED********'
158 self.ended = True
141 self.isConfig = False
159 self.isConfig = False
160 self.__plot()
161 elif seconds_passed >= self.data['throttle']:
162 print 'passed', seconds_passed
163 self.__plot()
164 seconds_passed = 0
142
165
143 except zmq.Again as e:
166 except zmq.Again as e:
144 print 'Waiting for data...'
167 print 'Waiting for data...'
145 plt.pause(self.throttle_value)
168 plt.pause(2)
169 seconds_passed += 2
146
170
147 def close(self):
171 def close(self):
148 if self.dataOut:
172 if self.dataOut:
@@ -453,10 +477,29 class PlotRTIData(PlotData):
453 self.figure.clf()
477 self.figure.clf()
454 self.axes = []
478 self.axes = []
455
479
456 for n in range(self.nrows):
480 if self.figure2 is None:
457 ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
481 self.figure2 = plt.figure(figsize=(self.width, self.height),
482 edgecolor='k',
483 facecolor='w')
484 else:
485 self.figure2.clf()
486 self.axes = []
487
488 ax = self.figure.add_subplot(1,1,1)
489 #ax = self.figure( n+1)
490 ax.firsttime = True
491 self.axes.append(ax)
492
493 ax = self.figure2.add_subplot(1,1,1)
494 #ax = self.figure( n+1)
458 ax.firsttime = True
495 ax.firsttime = True
459 self.axes.append(ax)
496 self.axes.append(ax)
497 # for n in range(self.nrows):
498 # ax = self.figure.add_subplot(self.nrows, self.ncols, n+1)
499 # #ax = self.figure( n+1)
500 # ax.firsttime = True
501 # self.axes.append(ax)
502
460
503
461 def plot(self):
504 def plot(self):
462
505
@@ -469,15 +512,14 class PlotRTIData(PlotData):
469
512
470 self.z = np.array(self.z)
513 self.z = np.array(self.z)
471 for n, ax in enumerate(self.axes):
514 for n, ax in enumerate(self.axes):
472
473 x, y, z = self.fill_gaps(*self.decimate())
515 x, y, z = self.fill_gaps(*self.decimate())
474 xmin = self.min_time
516 xmin = self.min_time
475 xmax = xmin+self.xrange*60*60
517 xmax = xmin+self.xrange*60*60
518 self.zmin = self.zmin if self.zmin else np.min(self.z)
519 self.zmax = self.zmax if self.zmax else np.max(self.z)
476 if ax.firsttime:
520 if ax.firsttime:
477 self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
521 self.ymin = self.ymin if self.ymin else np.nanmin(self.y)
478 self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
522 self.ymax = self.ymax if self.ymax else np.nanmax(self.y)
479 self.zmin = self.zmin if self.zmin else np.nanmin(self.z)
480 self.zmax = self.zmax if self.zmax else np.nanmax(self.z)
481 plot = ax.pcolormesh(x, y, z[n].T,
523 plot = ax.pcolormesh(x, y, z[n].T,
482 vmin=self.zmin,
524 vmin=self.zmin,
483 vmax=self.zmax,
525 vmax=self.zmax,
@@ -485,7 +527,8 class PlotRTIData(PlotData):
485 )
527 )
486 divider = make_axes_locatable(ax)
528 divider = make_axes_locatable(ax)
487 cax = divider.new_horizontal(size='2%', pad=0.05)
529 cax = divider.new_horizontal(size='2%', pad=0.05)
488 self.figure.add_axes(cax)
530 #self.figure.add_axes(cax)
531 #self.figure2.add_axes(cax)
489 plt.colorbar(plot, cax)
532 plt.colorbar(plot, cax)
490 ax.set_ylim(self.ymin, self.ymax)
533 ax.set_ylim(self.ymin, self.ymax)
491
534
@@ -888,6 +888,7 class JRODataReader(JRODataIO):
888 print '[Reading] No more files to read'
888 print '[Reading] No more files to read'
889 return 0
889 return 0
890
890
891 if self.verbose:
891 print '[Reading] Setting the file: %s' % self.filename
892 print '[Reading] Setting the file: %s' % self.filename
892
893
893 self.__readFirstHeader()
894 self.__readFirstHeader()
@@ -1053,6 +1054,7 class JRODataReader(JRODataIO):
1053
1054
1054 break
1055 break
1055
1056
1057 if self.verbose:
1056 print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks,
1058 print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks,
1057 self.processingHeaderObj.dataBlocksPerFile,
1059 self.processingHeaderObj.dataBlocksPerFile,
1058 self.dataOut.datatime.ctime())
1060 self.dataOut.datatime.ctime())
@@ -1266,7 +1268,9 class JRODataReader(JRODataIO):
1266 blocktime=None,
1268 blocktime=None,
1267 queue=None,
1269 queue=None,
1268 skip=None,
1270 skip=None,
1269 cursor=None):
1271 cursor=None,
1272 warnings=True,
1273 verbose=True):
1270
1274
1271 if path == None:
1275 if path == None:
1272 raise ValueError, "[Reading] The path is not valid"
1276 raise ValueError, "[Reading] The path is not valid"
@@ -1338,6 +1342,9 class JRODataReader(JRODataIO):
1338 self.selBlocksize = blocksize
1342 self.selBlocksize = blocksize
1339 self.selBlocktime = blocktime
1343 self.selBlocktime = blocktime
1340
1344
1345 # Verbose-----------
1346 self.verbose = verbose
1347 self.warnings = warnings
1341
1348
1342 if not(self.setNextFile()):
1349 if not(self.setNextFile()):
1343 if (startDate!=None) and (endDate!=None):
1350 if (startDate!=None) and (endDate!=None):
@@ -24,7 +24,7 def checkKwargs(method, kwargs):
24 if fuzz is None:
24 if fuzz is None:
25 continue
25 continue
26 if fuzz[1] < 100:
26 if fuzz[1] < 100:
27 raise Exception('\x1b[2;30;43mDid you mean {} instead of {} in {}? \x1b[0m'.
27 raise Exception('\x1b[0;32;40mDid you mean {} instead of {} in {}? \x1b[0m'.
28 format(fuzz[0], kwarg, method.__self__.__class__.__name__))
28 format(fuzz[0], kwarg, method.__self__.__class__.__name__))
29
29
30 class ProcessingUnit(object):
30 class ProcessingUnit(object):
@@ -7,7 +7,7 import json
7 import numpy
7 import numpy
8 import paho.mqtt.client as mqtt
8 import paho.mqtt.client as mqtt
9 import zmq
9 import zmq
10 import cPickle as pickle
10 from profilehooks import profile
11 import datetime
11 import datetime
12 from zmq.utils.monitor import recv_monitor_message
12 from zmq.utils.monitor import recv_monitor_message
13 from functools import wraps
13 from functools import wraps
@@ -29,7 +29,7 def roundFloats(obj):
29 elif isinstance(obj, float):
29 elif isinstance(obj, float):
30 return round(obj, 2)
30 return round(obj, 2)
31
31
32 def decimate(z):
32 def decimate(z, MAXNUMY):
33 # dx = int(len(self.x)/self.__MAXNUMX) + 1
33 # dx = int(len(self.x)/self.__MAXNUMX) + 1
34
34
35 dy = int(len(z[0])/MAXNUMY) + 1
35 dy = int(len(z[0])/MAXNUMY) + 1
@@ -107,7 +107,7 class PublishData(Operation):
107 print "MQTT Conection error."
107 print "MQTT Conection error."
108 self.client = False
108 self.client = False
109
109
110 def setup(self, port=1883, username=None, password=None, clientId="user", zeromq=1, **kwargs):
110 def setup(self, port=1883, username=None, password=None, clientId="user", zeromq=1, verbose=True, **kwargs):
111 self.counter = 0
111 self.counter = 0
112 self.topic = kwargs.get('topic', 'schain')
112 self.topic = kwargs.get('topic', 'schain')
113 self.delay = kwargs.get('delay', 0)
113 self.delay = kwargs.get('delay', 0)
@@ -119,6 +119,8 class PublishData(Operation):
119 self.zeromq = zeromq
119 self.zeromq = zeromq
120 self.mqtt = kwargs.get('plottype', 0)
120 self.mqtt = kwargs.get('plottype', 0)
121 self.client = None
121 self.client = None
122 self.verbose = verbose
123 self.dataOut.firstdata = True
122 setup = []
124 setup = []
123 if mqtt is 1:
125 if mqtt is 1:
124 self.client = mqtt.Client(
126 self.client = mqtt.Client(
@@ -150,6 +152,7 class PublishData(Operation):
150 self.zmq_socket.connect(address)
152 self.zmq_socket.connect(address)
151 time.sleep(1)
153 time.sleep(1)
152
154
155
153 def publish_data(self):
156 def publish_data(self):
154 self.dataOut.finished = False
157 self.dataOut.finished = False
155 if self.mqtt is 1:
158 if self.mqtt is 1:
@@ -230,8 +233,11 class PublishData(Operation):
230 self.client.publish(self.topic + self.plottype, json.dumps(payload), qos=0)
233 self.client.publish(self.topic + self.plottype, json.dumps(payload), qos=0)
231
234
232 if self.zeromq is 1:
235 if self.zeromq is 1:
236 if self.verbose:
233 print '[Sending] {} - {}'.format(self.dataOut.type, self.dataOut.datatime)
237 print '[Sending] {} - {}'.format(self.dataOut.type, self.dataOut.datatime)
234 self.zmq_socket.send_pyobj(self.dataOut)
238 self.zmq_socket.send_pyobj(self.dataOut)
239 self.dataOut.firstdata = False
240
235
241
236 def run(self, dataOut, **kwargs):
242 def run(self, dataOut, **kwargs):
237 self.dataOut = dataOut
243 self.dataOut = dataOut
@@ -246,12 +252,11 class PublishData(Operation):
246 if self.zeromq is 1:
252 if self.zeromq is 1:
247 self.dataOut.finished = True
253 self.dataOut.finished = True
248 self.zmq_socket.send_pyobj(self.dataOut)
254 self.zmq_socket.send_pyobj(self.dataOut)
249
255 self.zmq_socket.close()
250 if self.client:
256 if self.client:
251 self.client.loop_stop()
257 self.client.loop_stop()
252 self.client.disconnect()
258 self.client.disconnect()
253
259
254
255 class ReceiverData(ProcessingUnit, Process):
260 class ReceiverData(ProcessingUnit, Process):
256
261
257 throttle_value = 5
262 throttle_value = 5
@@ -330,12 +335,13 class ReceiverData(ProcessingUnit, Process):
330
335
331 return sendDataThrottled
336 return sendDataThrottled
332
337
338
333 def send(self, data):
339 def send(self, data):
334 # print '[sending] data=%s size=%s' % (data.keys(), len(data['times']))
340 # print '[sending] data=%s size=%s' % (data.keys(), len(data['times']))
335 self.sender.send_pyobj(data)
341 self.sender.send_pyobj(data)
336
342
337 def update(self):
338
343
344 def update(self):
339 t = self.dataOut.utctime
345 t = self.dataOut.utctime
340
346
341 if t in self.data['times']:
347 if t in self.data['times']:
@@ -397,7 +403,7 class ReceiverData(ProcessingUnit, Process):
397 self.sender_web.connect(self.plot_address)
403 self.sender_web.connect(self.plot_address)
398 time.sleep(1)
404 time.sleep(1)
399 self.sender.bind("ipc:///tmp/zmq.plots")
405 self.sender.bind("ipc:///tmp/zmq.plots")
400
406 time.sleep(3)
401 t = Thread(target=self.event_monitor, args=(monitor,))
407 t = Thread(target=self.event_monitor, args=(monitor,))
402 t.start()
408 t.start()
403
409
@@ -408,6 +414,10 class ReceiverData(ProcessingUnit, Process):
408
414
409 self.update()
415 self.update()
410
416
417 if self.dataOut.firstdata is True:
418 self.data['STARTED'] = True
419
420
411 if self.dataOut.finished is True:
421 if self.dataOut.finished is True:
412 self.send(self.data)
422 self.send(self.data)
413 self.connections -= 1
423 self.connections -= 1
@@ -416,6 +426,7 class ReceiverData(ProcessingUnit, Process):
416 self.data['ENDED'] = True
426 self.data['ENDED'] = True
417 self.send(self.data)
427 self.send(self.data)
418 self.setup()
428 self.setup()
429 self.started = False
419 else:
430 else:
420 if self.realtime:
431 if self.realtime:
421 self.send(self.data)
432 self.send(self.data)
@@ -424,6 +435,7 class ReceiverData(ProcessingUnit, Process):
424 self.sendData(self.send, self.data)
435 self.sendData(self.send, self.data)
425 self.started = True
436 self.started = True
426
437
438 self.data['STARTED'] = False
427 return
439 return
428
440
429 def sendToWeb(self):
441 def sendToWeb(self):
@@ -4,6 +4,7 from schainpy.controller import Project, multiSchain
4
4
5 desc = "HF_EXAMPLE"
5 desc = "HF_EXAMPLE"
6 path='/home/ci-81/Documents/DATA/HFADATA/hfdata_2017/pdata/sp1_f0'
6 path='/home/ci-81/Documents/DATA/HFADATA/hfdata_2017/pdata/sp1_f0'
7 path = '/media/ci-81/Huancayo/DATA/hfradar_2016/pdata/sp1_f1'
7 def fiber(cursor, skip, q, dt):
8 def fiber(cursor, skip, q, dt):
8
9
9 controllerObj = Project()
10 controllerObj = Project()
@@ -96,4 +97,4 if __name__ == '__main__':
96 parser = argparse.ArgumentParser(description='Set number of parallel processes')
97 parser = argparse.ArgumentParser(description='Set number of parallel processes')
97 parser.add_argument('--nProcess', default=1, type=int)
98 parser.add_argument('--nProcess', default=1, type=int)
98 args = parser.parse_args()
99 args = parser.parse_args()
99 multiSchain(fiber, nProcess=8, startDate='2017/02/10', endDate='2017/02/12')
100 multiSchain(fiber, nProcess=8, startDate='2016/04/23', endDate='2016/04/27')
@@ -1,75 +1,97
1 #!/usr/bin/env python
1 import argparse
2 '''
3 Created on Jul 7, 2014
4
2
5 @author: roj-idl71
3 from schainpy.controller import Project, multiSchain
6 '''
7 import os, sys
8 from datetime import datetime, timedelta
9 import multiprocessing
10 from schainpy.controller import Project
11
4
12 def main(date):
5 desc = "HF_EXAMPLE"
6
7 def fiber(cursor, skip, q, dt):
13
8
14 controllerObj = Project()
9 controllerObj = Project()
15
10
16 controllerObj.setup(id='191', name='test01', description='')
11 controllerObj.setup(id='191', name='test01', description=desc)
17
12
18 readUnitConfObj = controllerObj.addReadUnit(datatype='Spectra',
13 readUnitConfObj = controllerObj.addReadUnit(datatype='SpectraReader',
19 path='/home/nanosat/data/zeus',
14 path='/home/nanosat/data/julia',
20 startDate=date,
15 startDate=dt,
21 endDate=date,
16 endDate=dt,
22 startTime='00:00:00',
17 startTime="00:00:00",
23 endTime='23:59:59',
18 endTime="23:59:59",
24 online=0,
19 online=0,
20 #set=1426485881,
21 delay=10,
25 walk=1,
22 walk=1,
26 expLabel='')
23 queue=q,
27
24 cursor=cursor,
28 procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId())
25 skip=skip,
29 #opObj11 = procUnitConfObj1.addOperation(name='removeDC')
26 #timezone=-5*3600
30 #opObj11.addParameter(name='mode', value='1', format='int')
27 )
31
28
32 #opObj11 = procUnitConfObj1.addOperation(name='removeInterference')
29 # #opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock')
33
30 #
34
31 procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId())
35 opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other')
32 # procUnitConfObj2.addParameter(name='nipp', value='5', format='int')
36 opObj11.addParameter(name='id', value='10', format='int')
33
37 opObj11.addParameter(name='wintitle', value='150Km', format='str')
34 # procUnitConfObj3 = controllerObj.addProcUnit(datatype='ParametersProc', inputId=readUnitConfObj.getId())
38 opObj11.addParameter(name='colormap', value='jro', format='str')
35 # opObj11 = procUnitConfObj3.addOperation(name='SpectralMoments', optype='other')
39 opObj11.addParameter(name='xaxis', value='time', format='str')
36
40 opObj11.addParameter(name='xmin', value='0', format='int')
37 #
41 opObj11.addParameter(name='xmax', value='23', format='int')
38 # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other')
42 #opObj11.addParameter(name='ymin', value='100', format='int')
39 # opObj11.addParameter(name='id', value='1000', format='int')
43 #opObj11.addParameter(name='ymax', value='150', format='int')
40 # opObj11.addParameter(name='wintitle', value='HF_Jicamarca_Spc', format='str')
44 opObj11.addParameter(name='zmin', value='10', format='int')
41 # opObj11.addParameter(name='channelList', value='0', format='intlist')
45 opObj11.addParameter(name='zmax', value='35', format='int')
42 # opObj11.addParameter(name='zmin', value='-120', format='float')
46
43 # opObj11.addParameter(name='zmax', value='-70', format='float')
47
44 # opObj11.addParameter(name='save', value='1', format='int')
48
45 # opObj11.addParameter(name='figpath', value=figpath, format='str')
49
46
50 opObject12 = procUnitConfObj1.addOperation(name='PlotRTIData', optype='other')
47 # opObj11 = procUnitConfObj3.addOperation(name='Parameters1Plot', optype='other')
51 opObject12.addParameter(name='id', value='12', format='int')
48 # opObj11.addParameter(name='channelList', value='0', format='intList')
52 opObject12.addParameter(name='wintitle', value='150Km', format='str')
49 #
53 opObject12.addParameter(name='colormap', value='jro', format='str')
50 # opObj11.addParameter(name='id', value='2000', format='int')
54 opObject12.addParameter(name='xaxis', value='time', format='str')
51 # # opObj11.addParameter(name='colormap', value='0', format='bool')
55 opObject12.addParameter(name='xmin', value='0', format='int')
52 # opObj11.addParameter(name='onlySNR', value='1', format='bool')
56 opObject12.addParameter(name='xmax', value='23', format='int')
53 # opObj11.addParameter(name='DOP', value='0', format='bool')
57 #opObject12.addParameter(name='ymin', value='100', format='int')
54 # opObj11.addParameter(name='showSNR', value='1', format='bool')
58 #opObject12.addParameter(name='ymax', value='150', format='int')
55 # opObj11.addParameter(name='SNRthresh', value='0', format='int')
59 opObject12.addParameter(name='zmin', value='10', format='int')
56 # opObj11.addParameter(name='SNRmin', value='-10', format='int')
60 opObject12.addParameter(name='zmax', value='35', format='int')
57 # opObj11.addParameter(name='SNRmax', value='30', format='int')
61 #opObject12.addParameter(name='pause', value='1', format='bool')
58
62 opObject12.addParameter(name='show', value='0', format='bool')
59 # opObj11.addParameter(name='showSNR', value='1', format='int')
63 opObject12.addParameter(name='save', value='/tmp', format='str')
60 # # opObj11.addParameter(name='channelList', value='0', format='intlist')
64
61 # # opObj11.addParameter(name='xmin', value='0', format='float')
62 # opObj11.addParameter(name='xmin', value='0', format='float')
63 # opObj11.addParameter(name='xmax', value='24', format='float')
64
65 # opObj11.addParameter(name='zmin', value='-110', format='float')
66 # opObj11.addParameter(name='zmax', value='-70', format='float')
67 # opObj11.addParameter(name='save', value='0', format='int')
68 # # opObj11.addParameter(name='figpath', value='/tmp/', format='str')
69 #
70 opObj12 = procUnitConfObj2.addOperation(name='PublishData', optype='other')
71 opObj12.addParameter(name='zeromq', value=1, format='int')
72 # opObj12.addParameter(name='server', value='tcp://10.10.10.82:7000', format='str')
73
74
75 # opObj13 = procUnitConfObj3.addOperation(name='PublishData', optype='other')
76 # opObj13.addParameter(name='zeromq', value=1, format='int')
77 # opObj13.addParameter(name='server', value="juanca", format='str')
78
79 # opObj12.addParameter(name='delay', value=1, format='int')
80
81
82 # print "Escribiendo el archivo XML"
83 # controllerObj.writeXml(filename)
84 # print "Leyendo el archivo XML"
85 # controllerObj.readXml(filename)
86
87
88 # timeit.timeit('controllerObj.run()', number=2)
65
89
66 controllerObj.start()
90 controllerObj.start()
67
91
68 if __name__=='__main__':
69
92
70 dt = datetime(2017, 1, 12)
93 if __name__ == '__main__':
71
94 parser = argparse.ArgumentParser(description='Set number of parallel processes')
72 dates = [(dt+timedelta(x)).strftime('%Y/%m/%d') for x in range(20)]
95 parser.add_argument('--nProcess', default=1, type=int)
73
96 args = parser.parse_args()
74 p = multiprocessing.Pool(4)
97 multiSchain(fiber, nProcess=args.nProcess, startDate='2016/08/19', endDate='2016/08/19')
75 p.map(main, dates)
@@ -17,11 +17,14 if __name__ == '__main__':
17 proc1 = controllerObj.addProcUnit(name='ReceiverData')
17 proc1 = controllerObj.addProcUnit(name='ReceiverData')
18 # proc1.addParameter(name='realtime', value='0', format='bool')
18 # proc1.addParameter(name='realtime', value='0', format='bool')
19 #proc1.addParameter(name='plottypes', value='rti,coh,phase,snr,dop', format='str')
19 #proc1.addParameter(name='plottypes', value='rti,coh,phase,snr,dop', format='str')
20 proc1.addParameter(name='plottypes', value='rti,coh,phase,snr', format='str')
20 #proc1.addParameter(name='plottypes', value='rti,coh,phase,snr', format='str')
21 proc1.addParameter(name='plottypes', value='dop', format='str')
22
21 proc1.addParameter(name='throttle', value='10', format='int')
23 proc1.addParameter(name='throttle', value='10', format='int')
22 #proc1.addParameter(name='server', value='tcp://10.10.10.82:7000', format='str')
24 #proc1.addParameter(name='server', value='tcp://10.10.10.82:7000', format='str')
23 ## TODO Agregar direccion de server de publicacion a graficos como variable
25 ## TODO Agregar direccion de server de publicacion a graficos como variable
24
26
27 """
25 op1 = proc1.addOperation(name='PlotRTIData', optype='other')
28 op1 = proc1.addOperation(name='PlotRTIData', optype='other')
26 op1.addParameter(name='wintitle', value='HF System', format='str')
29 op1.addParameter(name='wintitle', value='HF System', format='str')
27 op1.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
30 op1.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
@@ -49,6 +52,7 if __name__ == '__main__':
49 # proc2.addParameter(name='server', value='juanca', format='str')
52 # proc2.addParameter(name='server', value='juanca', format='str')
50 # proc2.addParameter(name='plottypes', value='snr,dop', format='str')
53 # proc2.addParameter(name='plottypes', value='snr,dop', format='str')
51 #
54 #
55
52 op3 = proc1.addOperation(name='PlotSNRData', optype='other')
56 op3 = proc1.addOperation(name='PlotSNRData', optype='other')
53 op3.addParameter(name='wintitle', value='HF System SNR0', format='str')
57 op3.addParameter(name='wintitle', value='HF System SNR0', format='str')
54 op3.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
58 op3.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
@@ -56,23 +60,19 if __name__ == '__main__':
56 op3.addParameter(name='zmin', value='-10', format='int')
60 op3.addParameter(name='zmin', value='-10', format='int')
57 op3.addParameter(name='zmax', value='30', format='int')
61 op3.addParameter(name='zmax', value='30', format='int')
58 op3.addParameter(name='SNRthresh', value='0', format='float')
62 op3.addParameter(name='SNRthresh', value='0', format='float')
63 """
59 #
64 #
65 op5 = proc1.addOperation(name='PlotDOPData', optype='other')
66 op5.addParameter(name='wintitle', value='HF System DOP', format='str')
67 op5.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
68 op5.addParameter(name='show', value='1', format='bool')
69 op5.addParameter(name='zmin', value='-120', format='float')
70 op5.addParameter(name='zmax', value='120', format='float')
71 op5.addParameter(name='colormap', value='RdBu_r', format='str')
60 """
72 """
61 op4 = proc1.addOperation(name='PlotSNRData1', optype='other')
73 op4 = proc1.addOperation(name='PlotSNRData1', optype='other')
62 op4.addParameter(name='wintitle', value='HF System SNR1', format='str')
74 op4.addParameter(name='wintitle', value='HF System SNR1', format='str')
63 op4.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
75 op4.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
64 op4.addParameter(name='show', value='0', format='bool')
76 op4.addParameter(name='show', value='0', format='bool')
65
66
67 op5 = proc1.addOperation(name='PlotDOPData', optype='other')
68 op5.addParameter(name='wintitle', value='HF System DOP', format='str')
69 op5.addParameter(name='save', value='/home/ci-81/Pictures', format='str')
70 op5.addParameter(name='show', value='0', format='bool')
71 op5.addParameter(name='colormap', value='jet', format='str')
72 """
77 """
73
74
75
76
77
78 controllerObj.start()
78 controllerObj.start()
@@ -1,1 +1,1
1 <Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/home/ci-81/Documents/DATA/HFADATA/hfdata_2017/pdata/sp1_f0" /><Parameter format="date" id="191113" name="startDate" value="2017/02/12" /><Parameter format="date" id="191114" name="endDate" value="2017/02/12" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="9" /><Parameter format="int" id="191119" name="skip" value="90" /><Parameter format="int" id="191120" name="delay" value="10" /><Parameter format="int" id="191121" name="walk" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="ParametersProc" id="1913" inputId="1911" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="PublishData" priority="3" type="other"><Parameter format="int" id="191331" name="zeromq" value="1" /></Operation></ProcUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="removeInterference" priority="2" type="self" /></ProcUnit></Project> No newline at end of file
1 <Project description="HF_EXAMPLE" id="191" name="test01"><ReadUnit datatype="SpectraReader" id="1911" inputId="0" name="SpectraReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="SpectraReader" /><Parameter format="str" id="191112" name="path" value="/media/ci-81/Huancayo/DATA/hfradar_2016/pdata/sp1_f1" /><Parameter format="date" id="191113" name="startDate" value="2016/04/23" /><Parameter format="date" id="191114" name="endDate" value="2016/04/23" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="int" id="191118" name="cursor" value="6" /><Parameter format="int" id="191119" name="skip" value="16" /><Parameter format="int" id="191120" name="delay" value="10" /><Parameter format="int" id="191121" name="walk" value="1" /><Parameter format="int" id="191122" name="online" value="0" /></Operation></ReadUnit><ProcUnit datatype="ParametersProc" id="1913" inputId="1911" name="ParametersProc"><Operation id="19131" name="run" priority="1" type="self" /><Operation id="19132" name="SpectralMoments" priority="2" type="other" /><Operation id="19133" name="PublishData" priority="3" type="other"><Parameter format="int" id="191331" name="zeromq" value="1" /></Operation></ProcUnit><ProcUnit datatype="Spectra" id="1912" inputId="1911" name="SpectraProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="removeInterference" priority="2" type="self" /></ProcUnit></Project> No newline at end of file
@@ -44,5 +44,6 setup(name="schainpy",
44 "paramiko >= 2.1.2",
44 "paramiko >= 2.1.2",
45 "paho-mqtt >= 1.2",
45 "paho-mqtt >= 1.2",
46 "zmq",
46 "zmq",
47 "fuzzywuzzy"
47 ],
48 ],
48 )
49 )
General Comments 0
You need to be logged in to leave comments. Login now