@@ -143,6 +143,8 class Spectra(JROData): | |||
|
143 | 143 | |
|
144 | 144 | nIncohInt = None |
|
145 | 145 | |
|
146 | nCohInt = None #se requiere para determinar el valor de timeInterval | |
|
147 | ||
|
146 | 148 | def __init__(self): |
|
147 | 149 | ''' |
|
148 | 150 | Constructor |
@@ -735,7 +735,7 class SpectraWriter(JRODataWriter): | |||
|
735 | 735 | self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile |
|
736 | 736 | self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOutObj.processingHeaderObj.nWindows |
|
737 | 737 | self.processingHeaderObj.processFlags = self.__getProcessFlags() |
|
738 |
self.processingHeaderObj.nCohInt = |
|
|
738 | self.processingHeaderObj.nCohInt = self.dataOutObj.nCohInt# Se requiere para determinar el valor de timeInterval | |
|
739 | 739 | self.processingHeaderObj.nIncohInt = self.dataOutObj.nIncohInt |
|
740 | 740 | self.processingHeaderObj.totalSpectra = self.dataOutObj.nPairs + self.dataOutObj.nChannels |
|
741 | 741 |
@@ -13,7 +13,7 sys.path.append(path) | |||
|
13 | 13 | |
|
14 | 14 | from Data.JROData import Spectra, SpectraHeis |
|
15 | 15 | from IO.SpectraIO import SpectraWriter |
|
16 | from Graphics.schainPlotTypes import ScopeFigure, SpcFigure | |
|
16 | from Graphics.schainPlotTypes import ScopeFigure, SpcFigure, RTIFigure | |
|
17 | 17 | #from JRONoise import Noise |
|
18 | 18 | |
|
19 | 19 | class SpectraProcessor: |
@@ -37,6 +37,7 class SpectraProcessor: | |||
|
37 | 37 | |
|
38 | 38 | profIndex = 0 # Se emplea cuando el objeto de entrada es un Voltage |
|
39 | 39 | |
|
40 | firstdatatime = None | |
|
40 | 41 | |
|
41 | 42 | def __init__(self): |
|
42 | 43 | ''' |
@@ -51,6 +52,7 class SpectraProcessor: | |||
|
51 | 52 | self.noiseObj = [] |
|
52 | 53 | self.writerObjList = [] |
|
53 | 54 | self.buffer = None |
|
55 | self.firstdatatime = None | |
|
54 | 56 | self.profIndex = 0 |
|
55 | 57 | |
|
56 | 58 | def setup(self, dataInObj=None, dataOutObj=None, nFFTPoints=None, pairsList=None): |
@@ -119,6 +121,9 class SpectraProcessor: | |||
|
119 | 121 | self.buffer[:,self.profIndex,:] = self.dataInObj.data |
|
120 | 122 | self.profIndex += 1 |
|
121 | 123 | |
|
124 | if self.firstdatatime == None: | |
|
125 | self.firstdatatime = self.dataInObj.utctime | |
|
126 | ||
|
122 | 127 | if self.profIndex == self.dataOutObj.nFFTPoints: |
|
123 | 128 | |
|
124 | 129 | self.__updateObjFromInput() |
@@ -127,6 +132,7 class SpectraProcessor: | |||
|
127 | 132 | self.dataOutObj.flagNoData = False |
|
128 | 133 | |
|
129 | 134 | self.buffer = None |
|
135 | self.firstdatatime = None | |
|
130 | 136 | self.profIndex = 0 |
|
131 | 137 | |
|
132 | 138 | return |
@@ -206,13 +212,14 class SpectraProcessor: | |||
|
206 | 212 | self.dataOutObj.nProfiles = self.dataOutObj.nFFTPoints |
|
207 | 213 | self.dataOutObj.channelIndexList = self.dataInObj.channelIndexList |
|
208 | 214 | self.dataOutObj.flagTimeBlock = self.dataInObj.flagTimeBlock |
|
209 |
self.dataOutObj.utctime = self.data |
|
|
215 | self.dataOutObj.utctime = self.firstdatatime | |
|
210 | 216 | self.dataOutObj.flagDecodeData = self.dataInObj.flagDecodeData #asumo q la data esta decodificada |
|
211 | 217 | self.dataOutObj.flagDeflipData = self.dataInObj.flagDeflipData #asumo q la data esta sin flip |
|
212 | 218 | self.dataOutObj.flagShiftFFT = self.dataInObj.flagShiftFFT |
|
219 | self.dataOutObj.nCohInt = self.dataInObj.nCohInt | |
|
213 | 220 | self.dataOutObj.nIncohInt = 1 |
|
214 | 221 | self.dataOutObj.ippSeconds = self.dataInObj.ippSeconds |
|
215 | self.dataOutObj.timeInterval = self.dataInObj.timeInterval | |
|
222 | self.dataOutObj.timeInterval = self.dataInObj.timeInterval*self.dataOutObj.nFFTPoints | |
|
216 | 223 | |
|
217 | 224 | def addWriter(self, wrpath, blocksPerFile): |
|
218 | 225 | |
@@ -257,11 +264,18 class SpectraProcessor: | |||
|
257 | 264 | |
|
258 | 265 | y = self.dataOutObj.heightList |
|
259 | 266 | |
|
267 | data_spc = self.dataOutObj.data_spc | |
|
268 | data_cspc = self.dataOutObj.data_cspc | |
|
260 | 269 | |
|
270 | data = [] | |
|
261 | 271 | |
|
262 | 272 | |
|
263 | 273 | if len(self.plotObjList) <= self.plotObjIndex: |
|
264 | 274 | self.addSpc(idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile) |
|
275 | ||
|
276 | ||
|
277 | ||
|
278 | ||
|
265 | 279 | |
|
266 | 280 | def addRti(self, idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile): |
|
267 | 281 | rtiObj = RTIFigure(idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile) |
@@ -298,6 +312,8 class SpectraProcessor: | |||
|
298 | 312 | |
|
299 | 313 | data = 10.*numpy.log10(self.dataOutObj.data_spc[channelList,:,:]) |
|
300 | 314 | |
|
315 | data = numpy.average(data, axis=1) | |
|
316 | ||
|
301 | 317 | currenttime = self.dataOutObj.utctime - time.timezone |
|
302 | 318 | |
|
303 | 319 | range = self.dataOutObj.heightList |
@@ -311,7 +327,24 class SpectraProcessor: | |||
|
311 | 327 | |
|
312 | 328 | plotObj = self.plotObjList[self.plotObjIndex] |
|
313 | 329 | |
|
314 | ||
|
330 | plotObj.plotPcolor(data=data, | |
|
331 | x=currenttime, | |
|
332 | y=range, | |
|
333 | channelList=channelList, | |
|
334 | xmin=starttime, | |
|
335 | xmax=endtime, | |
|
336 | ymin=rangemin, | |
|
337 | ymax=rangemax, | |
|
338 | minvalue=minvalue, | |
|
339 | maxvalue=maxvalue, | |
|
340 | figuretitle=figuretitle, | |
|
341 | xrangestep=xrangestep, | |
|
342 | deltax=deltax, | |
|
343 | save=save, | |
|
344 | gpath=gpath, | |
|
345 | ratio=ratio, | |
|
346 | cleardata=cleardata | |
|
347 | ) | |
|
315 | 348 | |
|
316 | 349 | |
|
317 | 350 | |
@@ -419,12 +452,13 class SpectraProcessor: | |||
|
419 | 452 | self.addIntegrator(N,timeInterval) |
|
420 | 453 | |
|
421 | 454 | myIncohIntObj = self.integratorObjList[self.integratorObjIndex] |
|
422 |
myIncohIntObj.exe(data=self.dataOutObj.data_spc,time |
|
|
455 | myIncohIntObj.exe(data=self.dataOutObj.data_spc,datatime=self.dataOutObj.utctime) | |
|
423 | 456 | |
|
424 | 457 | if myIncohIntObj.isReady: |
|
425 | 458 | self.dataOutObj.data_spc = myIncohIntObj.data |
|
426 |
self.dataOutObj. |
|
|
427 | self.dataOutObj.m_ProcessingHeader.incoherentInt = self.dataInObj.m_ProcessingHeader.incoherentInt*myIncohIntObj.navg | |
|
459 | self.dataOutObj.timeInterval *= myCohIntObj.nIncohInt | |
|
460 | self.dataOutObj.nIncohInt = myIncohIntObj.navg * self.dataInObj.nIncohInt | |
|
461 | self.dataOutObj.utctime = myIncohIntObj.firstdatatime | |
|
428 | 462 | self.dataOutObj.flagNoData = False |
|
429 | 463 | |
|
430 | 464 | """Calcular el ruido""" |
@@ -622,6 +656,7 class IncoherentIntegration: | |||
|
622 | 656 | navg = None |
|
623 | 657 | buffer = None |
|
624 | 658 | nIncohInt = None |
|
659 | firstdatatime = None | |
|
625 | 660 | |
|
626 | 661 | def __init__(self, N = None, timeInterval = None): |
|
627 | 662 | """ |
@@ -637,6 +672,8 class IncoherentIntegration: | |||
|
637 | 672 | self.isReady = False |
|
638 | 673 | self.nIncohInt = N |
|
639 | 674 | self.integ_counter = 0 |
|
675 | self.firstdatatime = None | |
|
676 | ||
|
640 | 677 | if timeInterval!=None: |
|
641 | 678 | self.timeIntervalInSeconds = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line |
|
642 | 679 | |
@@ -649,18 +686,20 class IncoherentIntegration: | |||
|
649 | 686 | self.timeFlag = True |
|
650 | 687 | |
|
651 | 688 | |
|
652 |
def exe(self,data,time |
|
|
689 | def exe(self,data,datatime): | |
|
653 | 690 | """ |
|
654 | 691 | data |
|
655 | 692 | |
|
656 |
time |
|
|
693 | datatime [seconds] | |
|
657 | 694 | """ |
|
695 | if self.firstdatatime == None or self.isReady: | |
|
696 | self.firstdatatime = datatime | |
|
658 | 697 | |
|
659 | 698 | if self.timeFlag: |
|
660 | 699 | if self.timeOut == None: |
|
661 |
self.timeOut = time |
|
|
700 | self.timeOut = datatime + self.timeIntervalInSeconds | |
|
662 | 701 | |
|
663 |
if time |
|
|
702 | if datatime < self.timeOut: | |
|
664 | 703 | if self.buffer == None: |
|
665 | 704 | self.buffer = data |
|
666 | 705 | else: |
@@ -692,7 +731,7 class IncoherentIntegration: | |||
|
692 | 731 | |
|
693 | 732 | if self.timeFlag: |
|
694 | 733 | self.buffer = data |
|
695 |
self.timeOut = time |
|
|
734 | self.timeOut = datatime + self.timeIntervalInSeconds | |
|
696 | 735 | else: |
|
697 | 736 | self.isReady = False |
|
698 | 737 | No newline at end of file |
@@ -219,13 +219,16 class VoltageProcessor: | |||
|
219 | 219 | self.addIntegrator(nCohInt, timeInterval, overlapping) |
|
220 | 220 | |
|
221 | 221 | myCohIntObj = self.integratorObjList[self.integratorObjIndex] |
|
222 |
myCohIntObj.exe(data = self.dataOutObj.data, datatime= |
|
|
222 | myCohIntObj.exe(data = self.dataOutObj.data, datatime=self.dataOutObj.utctime) | |
|
223 | 223 | |
|
224 | 224 | # self.dataOutObj.timeInterval *= nCohInt |
|
225 | 225 | self.dataOutObj.flagNoData = True |
|
226 | 226 | |
|
227 | 227 | if myCohIntObj.isReady: |
|
228 |
self.dataOutObj. |
|
|
228 | self.dataOutObj.data = myCohIntObj.data | |
|
229 | self.dataOutObj.timeInterval *= myCohIntObj.nCohInt | |
|
230 | self.dataOutObj.nCohInt = myCohIntObj.nCohInt * self.dataInObj.nCohInt | |
|
231 | self.dataOutObj.utctime = myCohIntObj.firstdatatime | |
|
229 | 232 | self.dataOutObj.flagNoData = False |
|
230 | 233 | |
|
231 | 234 | def selectChannels(self, channelList): |
@@ -282,7 +285,7 class CoherentIntegrator: | |||
|
282 | 285 | |
|
283 | 286 | isReady = False |
|
284 | 287 | nCohInt = None |
|
285 | ||
|
288 | firstdatatime = None | |
|
286 | 289 | |
|
287 | 290 | def __init__(self, nCohInt=None, timeInterval=None, overlapping=False): |
|
288 | 291 | |
@@ -318,6 +321,7 class CoherentIntegrator: | |||
|
318 | 321 | self.__buffer = 0 |
|
319 | 322 | |
|
320 | 323 | self.__profIndex = 0 |
|
324 | firstdatatime = None | |
|
321 | 325 | |
|
322 | 326 | def putData(self, data): |
|
323 | 327 | |
@@ -407,6 +411,10 class CoherentIntegrator: | |||
|
407 | 411 | |
|
408 | 412 | def exe(self, data, datatime=None): |
|
409 | 413 | |
|
414 | ||
|
415 | if self.firstdatatime == None or self.isReady: | |
|
416 | self.firstdatatime = datatime | |
|
417 | ||
|
410 | 418 | if not self.__isByTime: |
|
411 | 419 | avg_data = self.byProfiles(data) |
|
412 | 420 | else: |
@@ -414,6 +422,8 class CoherentIntegrator: | |||
|
414 | 422 | |
|
415 | 423 | self.data = avg_data |
|
416 | 424 | |
|
425 | ||
|
426 | ||
|
417 | 427 | return avg_data |
|
418 | 428 | |
|
419 | 429 |
General Comments 0
You need to be logged in to leave comments.
Login now