##// END OF EJS Templates
Multiprocessing for digitalRF just for reading Unit(Task #1461 )
George Yong -
r1192:fa272605c13d
parent child
Show More
@@ -416,7 +416,7 class OperationConf():
416 416 self.name = opElement.get('name')
417 417 self.type = opElement.get('type')
418 418 self.priority = opElement.get('priority')
419 self.project_id = str(project_id) #yong
419 self.project_id = str(project_id)
420 420
421 421 # Compatible with old signal chain version
422 422 # Use of 'run' method instead 'init'
@@ -1130,8 +1130,11 class Project(Process):
1130 1130
1131 1131 def createObjects(self):
1132 1132
1133 for procUnitConfObj in self.procUnitConfObjDict.values():
1134 procUnitConfObj.createObjects()
1133
1134 keys = list(self.procUnitConfObjDict.keys())
1135 keys.sort()
1136 for key in keys:
1137 self.procUnitConfObjDict[key].createObjects()
1135 1138
1136 1139 def __handleError(self, procUnitConfObj, modes=None, stdout=True):
1137 1140
@@ -24,7 +24,7 except:
24 24
25 25 from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader
26 26 from schainpy.model.data.jrodata import Voltage
27 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation
27 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator
28 28 from time import time
29 29
30 30 import pickle
@@ -33,18 +33,18 try:
33 33 except:
34 34 print('You should install "digital_rf" module if you want to read Digital RF data')
35 35
36
36 @MPDecorator
37 37 class DigitalRFReader(ProcessingUnit):
38 38 '''
39 39 classdocs
40 40 '''
41 41
42 def __init__(self, **kwargs):
42 def __init__(self):
43 43 '''
44 44 Constructor
45 45 '''
46 46
47 ProcessingUnit.__init__(self, **kwargs)
47 ProcessingUnit.__init__(self)
48 48
49 49 self.dataOut = Voltage()
50 50 self.__printInfo = True
@@ -569,18 +569,22 class DigitalRFReader(ProcessingUnit):
569 569 if self.__readNextBlock():
570 570 break
571 571 if self.__thisUnixSample > self.__endUTCSecond * self.__sample_rate:
572 return False
572 self.dataOut.error = (1, '')
573 return
573 574
574 575 if self.__flagDiscontinuousBlock:
575 576 print('[Reading] discontinuous block found ... continue with the next block')
576 continue
577 self.dataOut.error = (1, '')
578 return
577 579
578 580 if not self.__online:
579 return False
581 self.dataOut.error = (1, '')
582 return
580 583
581 584 err_counter += 1
582 585 if err_counter > nTries:
583 return False
586 self.dataOut.error = (1, '')
587 return
584 588
585 589 print('[Reading] waiting %d seconds to read a new block' % seconds)
586 590 sleep(seconds)
@@ -599,7 +603,7 class DigitalRFReader(ProcessingUnit):
599 603 if self.profileIndex == self.dataOut.nProfiles:
600 604 self.profileIndex = 0
601 605
602 return True
606 return
603 607
604 608 def printInfo(self):
605 609 '''
@@ -780,6 +784,8 class DigitalRFWriter(Operation):
780 784 # self.writeMetadata()
781 785 ## if self.currentSample == self.__nProfiles: self.currentSample = 0
782 786
787 return dataOut
788
783 789 def close(self):
784 790 print('[Writing] - Closing files ')
785 791 print('Average of writing to digital rf format is ', self.oldAverage * 1000)
@@ -789,12 +795,3 class DigitalRFWriter(Operation):
789 795 pass
790 796
791 797
792 # raise
793 if __name__ == '__main__':
794
795 readObj = DigitalRFReader()
796
797 while True:
798 readObj.run(path='/home/jchavez/jicamarca/mocked_data/')
799 # readObj.printInfo()
800 # readObj.printNumberOfBlock() No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now