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