@@ -131,7 +131,8 class ExecUnit: | |||
|
131 | 131 | def integrator(*args): |
|
132 | 132 | inputs = args[0] |
|
133 | 133 | N = inputs[0] |
|
134 | self.execProcObj.integrator(N) | |
|
134 | timeInterval = inputs[1] | |
|
135 | self.execProcObj.integrator(N, timeInterval) | |
|
135 | 136 | |
|
136 | 137 | pfuncDict = { "setup": setup, |
|
137 | 138 | "getdata": getData, |
@@ -10,14 +10,14 type = Voltage | |||
|
10 | 10 | input = 0 |
|
11 | 11 | setup = None,None |
|
12 | 12 | init = None,None |
|
13 |
integrator = int, |
|
|
14 | ||
|
13 | integrator = int,4,None,None | |
|
14 | plotData = float,None,float,None,float,None,float,None,str,iq,str,Test Data Voltage 2,int,1 | |
|
15 | 15 | |
|
16 | 16 | [Processing1] |
|
17 | 17 | id = 2 |
|
18 | 18 | type = Spectra |
|
19 | 19 | input = 1 |
|
20 |
setup = int, |
|
|
20 | setup = int,8,None,None | |
|
21 | 21 | init = None,None |
|
22 |
integrator = int, |
|
|
23 |
plotData = float,None,float,None,float,None,float,None,str,Test Spectra Data,int, |
|
|
22 | integrator = int,4,int,3 | |
|
23 | plotData = float,None,float,None,float,None,float,None,str,Test Spectra Data,int,2 |
@@ -121,10 +121,7 class Osciloscope: | |||
|
121 | 121 | |
|
122 | 122 | self.__isPlotIni = True |
|
123 | 123 | |
|
124 |
def plotData(self, xmin=None, xmax=None, ymin=None, ymax |
|
|
125 | ||
|
126 | if idProfile != None and idProfile != self.voltageObj.idProfile: | |
|
127 | return | |
|
124 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False, type='iq', winTitle="Voltage"): | |
|
128 | 125 | |
|
129 | 126 | if not(self.__isPlotConfig): |
|
130 | 127 | self.setup(titleList, xlabelList, ylabelList, XAxisAsTime) |
@@ -136,7 +133,7 class Osciloscope: | |||
|
136 | 133 | |
|
137 | 134 | data = self.voltageObj.data |
|
138 | 135 | |
|
139 | x = self.voltageObj.heights | |
|
136 | x = self.voltageObj.heightList | |
|
140 | 137 | |
|
141 | 138 | if xmin == None: xmin = x[0] |
|
142 | 139 | if xmax == None: xmax = x[-1] |
@@ -67,6 +67,8 class Spectra(JROData): | |||
|
67 | 67 | |
|
68 | 68 | self.nFFTPoints = None |
|
69 | 69 | |
|
70 | self.nAvg = None | |
|
71 | ||
|
70 | 72 | self.nPairs = 0 |
|
71 | 73 | |
|
72 | 74 | self.pairsList = None |
@@ -53,7 +53,7 class Voltage(JROData): | |||
|
53 | 53 | |
|
54 | 54 | self.flagResetProcessing = False |
|
55 | 55 | |
|
56 | ||
|
56 | self.nAvg = None | |
|
57 | 57 | |
|
58 | 58 | self.profileIndex = None |
|
59 | 59 |
@@ -140,6 +140,9 class SpectraProcessor: | |||
|
140 | 140 | self.dataOutObj.m_ProcessingHeader.spectraComb |
|
141 | 141 | self.dataOutObj.m_ProcessingHeader.shif_fft |
|
142 | 142 | """ |
|
143 | if self.dataInObj.flagNoData: | |
|
144 | return 0 | |
|
145 | ||
|
143 | 146 | blocksize = 0 |
|
144 | 147 | nFFTPoints = self.nFFTPoints |
|
145 | 148 | nChannels, nheis = self.dataInObj.data.shape |
@@ -150,7 +153,7 class SpectraProcessor: | |||
|
150 | 153 | self.buffer[:,self.ptsId,:] = self.dataInObj.data |
|
151 | 154 | self.ptsId += 1 |
|
152 | 155 | |
|
153 |
if self.ptsId < self. |
|
|
156 | if self.ptsId < self.nFFTPoints: | |
|
154 | 157 | self.dataOutObj.flagNoData = True |
|
155 | 158 | return |
|
156 | 159 | |
@@ -241,12 +244,11 class SpectraProcessor: | |||
|
241 | 244 | self.plotterObjList.append(plotObj) |
|
242 | 245 | |
|
243 | 246 | |
|
244 | def addIntegrator(self,N): | |
|
247 | def addIntegrator(self,N,timeInterval): | |
|
245 | 248 | |
|
246 | objIncohInt = IncoherentIntegration(N) | |
|
249 | objIncohInt = IncoherentIntegration(N,timeInterval) | |
|
247 | 250 | self.integratorObjList.append(objIncohInt) |
|
248 | 251 | |
|
249 | ||
|
250 | 252 | def writeData(self, wrpath): |
|
251 | 253 | if self.dataOutObj.flagNoData: |
|
252 | 254 | return 0 |
@@ -269,21 +271,24 class SpectraProcessor: | |||
|
269 | 271 | |
|
270 | 272 | self.plotterObjIndex += 1 |
|
271 | 273 | |
|
272 | def integrator(self, N): | |
|
274 | def integrator(self, N=None, timeInterval=None): | |
|
275 | ||
|
273 | 276 | if self.dataOutObj.flagNoData: |
|
274 | 277 | return 0 |
|
275 | 278 | |
|
276 | 279 | if len(self.integratorObjList) <= self.integratorObjIndex: |
|
277 | self.addIntegrator(N) | |
|
280 | self.addIntegrator(N,timeInterval) | |
|
278 | 281 | |
|
279 |
my |
|
|
280 |
my |
|
|
282 | myIncohIntObj = self.integratorObjList[self.integratorObjIndex] | |
|
283 | myIncohIntObj.exe(data=self.dataOutObj.data_spc,timeOfData=self.dataOutObj.m_BasicHeader.utc) | |
|
281 | 284 | |
|
282 |
if my |
|
|
283 |
self.dataOutObj.data_spc = my |
|
|
284 |
self.dataOutObj. |
|
|
285 | if myIncohIntObj.isReady: | |
|
286 | self.dataOutObj.data_spc = myIncohIntObj.data | |
|
287 | self.dataOutObj.nAvg = myIncohIntObj.navg | |
|
288 | self.dataOutObj.m_ProcessingHeader.incoherentInt *= myIncohIntObj.navg | |
|
289 | #print "myIncohIntObj.navg: ",myIncohIntObj.navg | |
|
285 | 290 | self.dataOutObj.flagNoData = False |
|
286 | ||
|
291 | ||
|
287 | 292 | else: |
|
288 | 293 | self.dataOutObj.flagNoData = True |
|
289 | 294 | |
@@ -418,7 +423,6 class SpectraProcessor: | |||
|
418 | 423 | self.dataOutObj.nChannels = nChannels |
|
419 | 424 | self.dataOutObj.m_ProcessingHeader.blockSize = blocksize |
|
420 | 425 | |
|
421 | ||
|
422 | 426 | def selectHeightsByValue(self, minHei, maxHei): |
|
423 | 427 | """ |
|
424 | 428 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango |
@@ -462,8 +466,7 class SpectraProcessor: | |||
|
462 | 466 | break |
|
463 | 467 | |
|
464 | 468 | self.selectHeightsByIndex(minIndex, maxIndex) |
|
465 | ||
|
466 | ||
|
469 | ||
|
467 | 470 | def selectHeightsByIndex(self, minIndex, maxIndex): |
|
468 | 471 | """ |
|
469 | 472 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango |
@@ -536,34 +539,82 class SpectraProcessor: | |||
|
536 | 539 | |
|
537 | 540 | class IncoherentIntegration: |
|
538 | 541 | |
|
539 |
|
|
|
542 | integ_counter = None | |
|
540 | 543 | data = None |
|
544 | navg = None | |
|
541 | 545 | buffer = None |
|
542 | flag = False | |
|
543 | 546 | nIncohInt = None |
|
544 | 547 | |
|
545 | def __init__(self, N): | |
|
548 | def __init__(self, N = None, timeInterval = None): | |
|
549 | """ | |
|
550 | N | |
|
551 | timeInterval - interval time [min], integer value | |
|
552 | """ | |
|
546 | 553 | |
|
547 | self.profCounter = 1 | |
|
548 | 554 | self.data = None |
|
555 | self.navg = None | |
|
549 | 556 | self.buffer = None |
|
550 |
self. |
|
|
557 | self.timeOut = None | |
|
558 | self.exitCondition = False | |
|
559 | self.isReady = False | |
|
551 | 560 | self.nIncohInt = N |
|
561 | self.integ_counter = 0 | |
|
562 | if timeInterval!=None: | |
|
563 | self.timeIntervalInSeconds = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line | |
|
564 | ||
|
565 | if ((timeInterval==None) and (N==None)): | |
|
566 | print 'N = None ; timeInterval = None' | |
|
567 | sys.exit(0) | |
|
568 | elif timeInterval == None: | |
|
569 | self.timeFlag = False | |
|
570 | else: | |
|
571 | self.timeFlag = True | |
|
572 | ||
|
552 | 573 | |
|
553 | def exe(self,data): | |
|
574 | def exe(self,data,timeOfData): | |
|
575 | """ | |
|
576 | data | |
|
577 | ||
|
578 | timeOfData [seconds] | |
|
579 | """ | |
|
554 | 580 | |
|
555 |
if self. |
|
|
556 |
self. |
|
|
581 | if self.timeFlag: | |
|
582 | if self.timeOut == None: | |
|
583 | self.timeOut = timeOfData + self.timeIntervalInSeconds | |
|
584 | ||
|
585 | if timeOfData < self.timeOut: | |
|
586 | if self.buffer == None: | |
|
587 | self.buffer = data | |
|
588 | else: | |
|
589 | self.buffer = self.buffer + data | |
|
590 | self.integ_counter += 1 | |
|
591 | else: | |
|
592 | self.exitCondition = True | |
|
593 | ||
|
557 | 594 | else: |
|
558 | self.buffer = self.buffer + data | |
|
559 | ||
|
560 | if self.profCounter == self.nIncohInt: | |
|
595 | if self.integ_counter < self.nIncohInt: | |
|
596 | if self.buffer == None: | |
|
597 | self.buffer = data | |
|
598 | else: | |
|
599 | self.buffer = self.buffer + data | |
|
600 | ||
|
601 | self.integ_counter += 1 | |
|
602 | ||
|
603 | if self.integ_counter == self.nIncohInt: | |
|
604 | self.exitCondition = True | |
|
605 | ||
|
606 | if self.exitCondition: | |
|
561 | 607 | self.data = self.buffer |
|
608 | self.navg = self.integ_counter | |
|
609 | self.isReady = True | |
|
562 | 610 | self.buffer = None |
|
563 |
self. |
|
|
564 |
self. |
|
|
565 | else: | |
|
566 | self.flag = False | |
|
611 | self.timeOut = None | |
|
612 | self.integ_counter = 0 | |
|
613 | self.exitCondition = False | |
|
567 | 614 | |
|
568 | self.profCounter += 1 | |
|
569 | ||
|
615 | if self.timeFlag: | |
|
616 | self.buffer = data | |
|
617 | self.timeOut = timeOfData + self.timeIntervalInSeconds | |
|
618 | else: | |
|
619 | self.isReady = False | |
|
620 | No newline at end of file |
@@ -102,9 +102,9 class VoltageProcessor: | |||
|
102 | 102 | plotObj = Osciloscope(self.dataOutObj, index) |
|
103 | 103 | self.plotterObjList.append(plotObj) |
|
104 | 104 | |
|
105 |
def addIntegrator(self, |
|
|
105 | def addIntegrator(self, N,timeInterval): | |
|
106 | 106 | |
|
107 |
objCohInt = CoherentIntegrator( |
|
|
107 | objCohInt = CoherentIntegrator(N,timeInterval) | |
|
108 | 108 | self.integratorObjList.append(objCohInt) |
|
109 | 109 | |
|
110 | 110 | def addDecoder(self, code, ncode, nbaud): |
@@ -143,20 +143,22 class VoltageProcessor: | |||
|
143 | 143 | |
|
144 | 144 | self.plotterObjIndex += 1 |
|
145 | 145 | |
|
146 | def integrator(self, N): | |
|
146 | def integrator(self, N=None, timeInterval=None): | |
|
147 | 147 | |
|
148 | 148 | if self.dataOutObj.flagNoData: |
|
149 | 149 | return 0 |
|
150 | 150 | |
|
151 | 151 | if len(self.integratorObjList) <= self.integratorObjIndex: |
|
152 | self.addIntegrator(N) | |
|
152 | self.addIntegrator(N,timeInterval) | |
|
153 | 153 | |
|
154 | 154 | myCohIntObj = self.integratorObjList[self.integratorObjIndex] |
|
155 | myCohIntObj.exe(self.dataOutObj.data) | |
|
155 | myCohIntObj.exe(data=self.dataOutObj.data,timeOfData=self.dataOutObj.m_BasicHeader.utc) | |
|
156 | 156 | |
|
157 |
if myCohIntObj. |
|
|
157 | if myCohIntObj.isReady: | |
|
158 | 158 | self.dataOutObj.data = myCohIntObj.data |
|
159 | self.dataOutObj.m_ProcessingHeader.coherentInt *= N | |
|
159 | self.dataOutObj.nAvg = myCohIntObj.navg | |
|
160 | self.dataOutObj.m_ProcessingHeader.coherentInt *= myCohIntObj.navg | |
|
161 | #print "myCohIntObj.navg: ",myCohIntObj.navg | |
|
160 | 162 | self.dataOutObj.flagNoData = False |
|
161 | 163 | |
|
162 | 164 | else: |
@@ -480,36 +482,76 class Decoder: | |||
|
480 | 482 | |
|
481 | 483 | class CoherentIntegrator: |
|
482 | 484 | |
|
483 |
|
|
|
485 | integ_counter = None | |
|
484 | 486 | data = None |
|
487 | navg = None | |
|
485 | 488 | buffer = None |
|
486 | flag = False | |
|
487 | 489 | nCohInt = None |
|
488 | 490 | |
|
489 | def __init__(self, N): | |
|
491 | def __init__(self, N=None,timeInterval=None): | |
|
490 | 492 | |
|
491 | self.profCounter = 1 | |
|
492 | 493 | self.data = None |
|
494 | self.navg = None | |
|
493 | 495 | self.buffer = None |
|
494 |
self. |
|
|
496 | self.timeOut = None | |
|
497 | self.exitCondition = False | |
|
498 | self.isReady = False | |
|
495 | 499 | self.nCohInt = N |
|
500 | self.integ_counter = 0 | |
|
501 | if timeInterval!=None: | |
|
502 | self.timeIntervalInSeconds = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line | |
|
503 | ||
|
504 | if ((timeInterval==None) and (N==None)): | |
|
505 | print 'N = None ; timeInterval = None' | |
|
506 | sys.exit(0) | |
|
507 | elif timeInterval == None: | |
|
508 | self.timeFlag = False | |
|
509 | else: | |
|
510 | self.timeFlag = True | |
|
496 | 511 | |
|
497 | def exe(self, data): | |
|
512 | def exe(self, data, timeOfData): | |
|
498 | 513 | |
|
499 |
if self. |
|
|
500 |
self. |
|
|
514 | if self.timeFlag: | |
|
515 | if self.timeOut == None: | |
|
516 | self.timeOut = timeOfData + self.timeIntervalInSeconds | |
|
517 | ||
|
518 | if timeOfData < self.timeOut: | |
|
519 | if self.buffer == None: | |
|
520 | self.buffer = data | |
|
521 | else: | |
|
522 | self.buffer = self.buffer + data | |
|
523 | self.integ_counter += 1 | |
|
524 | else: | |
|
525 | self.exitCondition = True | |
|
526 | ||
|
501 | 527 | else: |
|
502 | self.buffer = self.buffer + data | |
|
503 | ||
|
504 | if self.profCounter == self.nCohInt: | |
|
528 | if self.integ_counter < self.nCohInt: | |
|
529 | if self.buffer == None: | |
|
530 | self.buffer = data | |
|
531 | else: | |
|
532 | self.buffer = self.buffer + data | |
|
533 | ||
|
534 | self.integ_counter += 1 | |
|
535 | ||
|
536 | if self.integ_counter == self.nCohInt: | |
|
537 | self.exitCondition = True | |
|
538 | ||
|
539 | if self.exitCondition: | |
|
505 | 540 | self.data = self.buffer |
|
541 | self.navg = self.integ_counter | |
|
542 | self.isReady = True | |
|
506 | 543 | self.buffer = None |
|
507 |
self. |
|
|
508 |
self. |
|
|
544 | self.timeOut = None | |
|
545 | self.integ_counter = 0 | |
|
546 | self.exitCondition = False | |
|
547 | ||
|
548 | if self.timeFlag: | |
|
549 | self.buffer = data | |
|
550 | self.timeOut = timeOfData + self.timeIntervalInSeconds | |
|
509 | 551 | else: |
|
510 |
self. |
|
|
552 | self.isReady = False | |
|
511 | 553 | |
|
512 | self.profCounter += 1 | |
|
554 | ||
|
513 | 555 | |
|
514 | 556 | class ProfileSelector: |
|
515 | 557 |
General Comments 0
You need to be logged in to leave comments.
Login now