@@ -39,7 +39,7 class ConfBase(): | |||
|
39 | 39 | def getId(self): |
|
40 | 40 | |
|
41 | 41 | return self.id |
|
42 | ||
|
42 | ||
|
43 | 43 | def getNewId(self): |
|
44 | 44 | |
|
45 | 45 | return int(self.id) * 10 + len(self.operations) + 1 |
@@ -61,7 +61,7 class ConfBase(): | |||
|
61 | 61 | for key, value in self.parameters.items(): |
|
62 | 62 | if value not in (None, '', ' '): |
|
63 | 63 | params[key] = value |
|
64 | ||
|
64 | ||
|
65 | 65 | return params |
|
66 | 66 | |
|
67 | 67 | def update(self, **kwargs): |
@@ -72,8 +72,9 class ConfBase(): | |||
|
72 | 72 | def addParameter(self, name, value, format=None): |
|
73 | 73 | ''' |
|
74 | 74 | ''' |
|
75 | ||
|
76 | if isinstance(value, str) and re.search(r'(\d+/\d+/\d+)', value): | |
|
75 | if os.path.isdir(value): | |
|
76 | self.parameters[name] = value | |
|
77 | elif isinstance(value, str) and re.search(r'(\d+/\d+/\d+)', value): | |
|
77 | 78 | self.parameters[name] = datetime.date(*[int(x) for x in value.split('/')]) |
|
78 | 79 | elif isinstance(value, str) and re.search(r'(\d+:\d+:\d+)', value): |
|
79 | 80 | self.parameters[name] = datetime.time(*[int(x) for x in value.split(':')]) |
@@ -99,21 +100,21 class ConfBase(): | |||
|
99 | 100 | params[key] = str(value) |
|
100 | 101 | |
|
101 | 102 | return params |
|
102 | ||
|
103 | ||
|
103 | 104 | def makeXml(self, element): |
|
104 | 105 | |
|
105 | 106 | xml = SubElement(element, self.ELEMENTNAME) |
|
106 | 107 | for label in self.xml_labels: |
|
107 | 108 | xml.set(label, str(getattr(self, label))) |
|
108 | ||
|
109 | ||
|
109 | 110 | for key, value in self.getParameters().items(): |
|
110 | 111 | xml_param = SubElement(xml, 'Parameter') |
|
111 | 112 | xml_param.set('name', key) |
|
112 | 113 | xml_param.set('value', value) |
|
113 | ||
|
114 | ||
|
114 | 115 | for conf in self.operations: |
|
115 | 116 | conf.makeXml(xml) |
|
116 | ||
|
117 | ||
|
117 | 118 | def __str__(self): |
|
118 | 119 | |
|
119 | 120 | if self.ELEMENTNAME == 'Operation': |
@@ -126,7 +127,7 class ConfBase(): | |||
|
126 | 127 | s += ' {}: {}\n'.format(key, value) |
|
127 | 128 | else: |
|
128 | 129 | s += ' {}: {}\n'.format(key, value) |
|
129 | ||
|
130 | ||
|
130 | 131 | for conf in self.operations: |
|
131 | 132 | s += str(conf) |
|
132 | 133 | |
@@ -179,7 +180,7 class ProcUnitConf(ConfBase): | |||
|
179 | 180 | def setup(self, project_id, id, name, datatype, inputId, err_queue): |
|
180 | 181 | ''' |
|
181 | 182 | ''' |
|
182 | ||
|
183 | ||
|
183 | 184 | if datatype == None and name == None: |
|
184 | 185 | raise ValueError('datatype or name should be defined') |
|
185 | 186 | |
@@ -205,7 +206,7 class ProcUnitConf(ConfBase): | |||
|
205 | 206 | |
|
206 | 207 | i = [1 if x.id==id else 0 for x in self.operations] |
|
207 | 208 | self.operations.pop(i.index(1)) |
|
208 | ||
|
209 | ||
|
209 | 210 | def getOperation(self, id): |
|
210 | 211 | |
|
211 | 212 | for conf in self.operations: |
@@ -233,7 +234,7 class ProcUnitConf(ConfBase): | |||
|
233 | 234 | self.err_queue = err_queue |
|
234 | 235 | self.operations = [] |
|
235 | 236 | self.parameters = {} |
|
236 | ||
|
237 | ||
|
237 | 238 | for elm in element: |
|
238 | 239 | if elm.tag == 'Parameter': |
|
239 | 240 | self.addParameter(elm.get('name'), elm.get('value')) |
@@ -254,21 +255,21 class ProcUnitConf(ConfBase): | |||
|
254 | 255 | log.success('creating process...', self.name) |
|
255 | 256 | |
|
256 | 257 | for conf in self.operations: |
|
257 | ||
|
258 | ||
|
258 | 259 | opObj = conf.createObject() |
|
259 | ||
|
260 | ||
|
260 | 261 | log.success('adding operation: {}, type:{}'.format( |
|
261 | 262 | conf.name, |
|
262 | 263 | conf.type), self.name) |
|
263 | ||
|
264 | ||
|
264 | 265 | procUnitObj.addOperation(conf, opObj) |
|
265 | ||
|
266 | ||
|
266 | 267 | self.object = procUnitObj |
|
267 | 268 | |
|
268 | 269 | def run(self): |
|
269 | 270 | ''' |
|
270 | 271 | ''' |
|
271 | ||
|
272 | ||
|
272 | 273 | return self.object.call(**self.getKwargs()) |
|
273 | 274 | |
|
274 | 275 | |
@@ -284,10 +285,10 class ReadUnitConf(ProcUnitConf): | |||
|
284 | 285 | self.inputId = None |
|
285 | 286 | self.operations = [] |
|
286 | 287 | self.parameters = {} |
|
287 | ||
|
288 | ||
|
288 | 289 | def setup(self, project_id, id, name, datatype, err_queue, path='', startDate='', endDate='', |
|
289 | 290 | startTime='', endTime='', server=None, **kwargs): |
|
290 | ||
|
291 | ||
|
291 | 292 | if datatype == None and name == None: |
|
292 | 293 | raise ValueError('datatype or name should be defined') |
|
293 | 294 | if name == None: |
@@ -307,8 +308,8 class ReadUnitConf(ProcUnitConf): | |||
|
307 | 308 | self.project_id = project_id |
|
308 | 309 | self.name = name |
|
309 | 310 | self.datatype = datatype |
|
310 |
self.err_queue = err_queue |
|
|
311 | ||
|
311 | self.err_queue = err_queue | |
|
312 | ||
|
312 | 313 | self.addParameter(name='path', value=path) |
|
313 | 314 | self.addParameter(name='startDate', value=startDate) |
|
314 | 315 | self.addParameter(name='endDate', value=endDate) |
@@ -377,7 +378,7 class Project(Process): | |||
|
377 | 378 | def setup(self, id=1, name='', description='', email=None, alarm=[]): |
|
378 | 379 | |
|
379 | 380 | self.id = str(id) |
|
380 |
self.description = description |
|
|
381 | self.description = description | |
|
381 | 382 | self.email = email |
|
382 | 383 | self.alarm = alarm |
|
383 | 384 | if name: |
@@ -411,7 +412,7 class Project(Process): | |||
|
411 | 412 | conf = ReadUnitConf() |
|
412 | 413 | conf.setup(self.id, idReadUnit, name, datatype, self.err_queue, **kwargs) |
|
413 | 414 | self.configurations[conf.id] = conf |
|
414 | ||
|
415 | ||
|
415 | 416 | return conf |
|
416 | 417 | |
|
417 | 418 | def addProcUnit(self, id=None, inputId='0', datatype=None, name=None): |
@@ -423,7 +424,7 class Project(Process): | |||
|
423 | 424 | idProcUnit = self.getNewId() |
|
424 | 425 | else: |
|
425 | 426 | idProcUnit = id |
|
426 | ||
|
427 | ||
|
427 | 428 | conf = ProcUnitConf() |
|
428 | 429 | conf.setup(self.id, idProcUnit, name, datatype, inputId, self.err_queue) |
|
429 | 430 | self.configurations[conf.id] = conf |
@@ -458,7 +459,7 class Project(Process): | |||
|
458 | 459 | def updateUnit(self, id, **kwargs): |
|
459 | 460 | |
|
460 | 461 | conf = self.configurations[id].update(**kwargs) |
|
461 | ||
|
462 | ||
|
462 | 463 | def makeXml(self): |
|
463 | 464 | |
|
464 | 465 | xml = Element('Project') |
@@ -529,7 +530,7 class Project(Process): | |||
|
529 | 530 | self.configurations[conf.id] = conf |
|
530 | 531 | |
|
531 | 532 | self.filename = abs_file |
|
532 | ||
|
533 | ||
|
533 | 534 | return 1 |
|
534 | 535 | |
|
535 | 536 | def __str__(self): |
@@ -559,14 +560,14 class Project(Process): | |||
|
559 | 560 | |
|
560 | 561 | t = Thread(target=self._monitor, args=(self.err_queue, self.ctx)) |
|
561 | 562 | t.start() |
|
562 | ||
|
563 | ||
|
563 | 564 | def _monitor(self, queue, ctx): |
|
564 | 565 | |
|
565 | 566 | import socket |
|
566 | ||
|
567 | ||
|
567 | 568 | procs = 0 |
|
568 | 569 | err_msg = '' |
|
569 | ||
|
570 | ||
|
570 | 571 | while True: |
|
571 | 572 | msg = queue.get() |
|
572 | 573 | if '#_start_#' in msg: |
@@ -575,11 +576,11 class Project(Process): | |||
|
575 | 576 | procs -=1 |
|
576 | 577 | else: |
|
577 | 578 | err_msg = msg |
|
578 | ||
|
579 |
if procs == 0 or 'Traceback' in err_msg: |
|
|
579 | ||
|
580 | if procs == 0 or 'Traceback' in err_msg: | |
|
580 | 581 | break |
|
581 | 582 | time.sleep(0.1) |
|
582 | ||
|
583 | ||
|
583 | 584 | if '|' in err_msg: |
|
584 | 585 | name, err = err_msg.split('|') |
|
585 | 586 | if 'SchainWarning' in err: |
@@ -588,11 +589,11 class Project(Process): | |||
|
588 | 589 | log.error(err.split('SchainError:')[-1].split('\n')[0].strip(), name) |
|
589 | 590 | else: |
|
590 | 591 | log.error(err, name) |
|
591 |
else: |
|
|
592 | else: | |
|
592 | 593 | name, err = self.name, err_msg |
|
593 | ||
|
594 | ||
|
594 | 595 | time.sleep(1) |
|
595 | ||
|
596 | ||
|
596 | 597 | ctx.term() |
|
597 | 598 | |
|
598 | 599 | message = ''.join(err) |
@@ -617,7 +618,7 class Project(Process): | |||
|
617 | 618 | subtitle += '[End time = %s]\n' % readUnitConfObj.parameters['endTime'] |
|
618 | 619 | |
|
619 | 620 | a = Alarm( |
|
620 |
modes=self.alarm, |
|
|
621 | modes=self.alarm, | |
|
621 | 622 | email=self.email, |
|
622 | 623 | message=message, |
|
623 | 624 | subject=subject, |
@@ -635,10 +636,10 class Project(Process): | |||
|
635 | 636 | |
|
636 | 637 | err = False |
|
637 | 638 | n = len(self.configurations) |
|
638 | ||
|
639 | ||
|
639 | 640 | while not err: |
|
640 | 641 | for conf in self.getUnits(): |
|
641 |
ok = conf.run() |
|
|
642 | ok = conf.run() | |
|
642 | 643 | if ok == 'Error': |
|
643 | 644 | n -= 1 |
|
644 | 645 | continue |
@@ -646,12 +647,12 class Project(Process): | |||
|
646 | 647 | break |
|
647 | 648 | if n == 0: |
|
648 | 649 | err = True |
|
649 | ||
|
650 | ||
|
650 | 651 | def run(self): |
|
651 | 652 | |
|
652 | 653 | log.success('\nStarting Project {} [id={}]'.format(self.name, self.id), tag='') |
|
653 | 654 | self.started = True |
|
654 |
self.start_time = time.time() |
|
|
655 | self.start_time = time.time() | |
|
655 | 656 | self.createObjects() |
|
656 | 657 | self.runProcs() |
|
657 | 658 | log.success('{} Done (Time: {:4.2f}s)'.format( |
@@ -38,24 +38,33 mode_proc = 0 | |||
|
38 | 38 | #path = "/DATA_RM/DRONE01ABRIL1429" |
|
39 | 39 | #path_ped = "/DATA_RM/TEST_PEDESTAL/P20220322-171722" |
|
40 | 40 | #path = "/DATA_RM/DRONE01ABRIL1701" |
|
41 | path = "/DATA_RM/DATA/Torre_con_bola_1649092242/rawdata" | |
|
42 | path="/DATA_RM/DRONE01ABRIL1727" | |
|
41 | ##path = "/DATA_RM/DATA/Torre_con_bola_1649092242/rawdata" | |
|
42 | ##path="/DATA_RM/DRONE01ABRIL1727" | |
|
43 | path ="/DATA_RM/DATA/TEST@2022-04-11T17:29:56/rawdata" | |
|
44 | #path="/DATA_RM/TEST172956_0411" | |
|
45 | ||
|
46 | ||
|
47 | #path = "/DATA_RM/DATA/TEST@2022-04-11T17:29:56/rawdata" | |
|
48 | ||
|
43 | 49 | #path_ped = "/DATA_RM/DRONE01ABRIL1450" |
|
44 | path_ped="/DATA_RM/TEST_PEDESTAL/P20220401-172744" | |
|
50 | #path_ped="/DATA_RM/TEST_PEDESTAL/P20220401-172744" | |
|
51 | ||
|
52 | path_ped="/DATA_RM/TEST_PEDESTAL/P20220411-173017" | |
|
53 | ||
|
45 | 54 | #path_ped = "/DATA_RM/DATA/Torre_con_bola_1649092242/position/2022-04-04T17-00-00" |
|
46 | 55 | #------------------------------------------------------------------------------- |
|
47 |
figpath_pp = "/home/soporte/Pictures/T |
|
|
56 | figpath_pp = "/home/soporte/Pictures/TEST" | |
|
48 | 57 | #figpath_pp = "/home/soporte/Pictures/MARTES_22_PP_1M_1us" |
|
49 | 58 | figpath_spec = "/home/soporte/Pictures/MARTES_22_1M_1us" |
|
50 |
figpath_pp_ppi = "/home/soporte/Pictures/ |
|
|
59 | figpath_pp_ppi = "/home/soporte/Pictures/PPILUNES11042022" | |
|
51 | 60 | |
|
52 | 61 | |
|
53 | 62 | figpath_pp_rhi = "/DATA_RM/LUNES04ABRIL_1200_RHI" |
|
54 | 63 | #--------------------------OPCIONES--------------------------------------------- |
|
55 |
plot_ppi = |
|
|
56 | plot = 0 | |
|
57 | plot_rhi = 1 | |
|
58 | integration = 1 | |
|
64 | plot_ppi = 1 | |
|
65 | plot = 0#0 | |
|
66 | plot_rhi = 0#1 | |
|
67 | integration = 1#1 | |
|
59 | 68 | save = 0 |
|
60 | 69 | plot_spec = 0 |
|
61 | 70 | #---------------------------SAVE HDF5 PROCESADO/-------------------------------- |
@@ -110,10 +119,10 time.sleep(4) | |||
|
110 | 119 | ################# RANGO DE PLOTEO###################################### |
|
111 | 120 | dBmin = '20' |
|
112 | 121 | dBmax = '60' |
|
113 |
xmin = '1 |
|
|
114 |
xmax = '1 |
|
|
122 | xmin = '17.4' #17.1,17.5 | |
|
123 | xmax = '17.7' #17.2,17.8 | |
|
115 | 124 | ymin = '0' #### PONER A 0 |
|
116 |
ymax = '1. |
|
|
125 | ymax = '1.5' #### PONER A 8 | |
|
117 | 126 | ########################FECHA########################################## |
|
118 | 127 | str1 = datetime.date.today() |
|
119 | 128 | today = str1.strftime("%Y/%m/%d") |
@@ -128,9 +137,9 controllerObj.setup(id = '191', name='Test_USRP', description=desc) | |||
|
128 | 137 | #------------------------ UNIDAD DE LECTURA------------------------------------- |
|
129 | 138 | readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader', |
|
130 | 139 | path=path, |
|
131 |
startDate="2022/04/ |
|
|
132 |
endDate="2022/04/ |
|
|
133 |
startTime=' |
|
|
140 | startDate="2022/04/11",#today, | |
|
141 | endDate="2022/04/11",#today, | |
|
142 | startTime='17:36:00',#'17:39:25', | |
|
134 | 143 | endTime='23:59:59',#23:59:59', |
|
135 | 144 | delay=0, |
|
136 | 145 | #set=0, |
@@ -153,7 +162,7 opObj10.addParameter(name='ymax', value='1200', format='int') | |||
|
153 | 162 | opObj10.addParameter(name='save_period', value=10, format='int') |
|
154 | 163 | ''' |
|
155 | 164 | opObj11 = procUnitConfObjA.addOperation(name='setH0') |
|
156 |
opObj11.addParameter(name='h0', value='-1. |
|
|
165 | opObj11.addParameter(name='h0', value='-1.0', format='float') | |
|
157 | 166 | |
|
158 | 167 | opObj11 = procUnitConfObjA.addOperation(name='selectHeights') |
|
159 | 168 | opObj11.addParameter(name='minIndex', value='1', format='int') |
General Comments 0
You need to be logged in to leave comments.
Login now