##// END OF EJS Templates
Modificacion y actualizacion de la clase SpectraHeisProcessor
Alexander Valdez -
r151:8a63cb072d87
parent child
Show More
@@ -13,7 +13,7 sys.path.append(path)
13
13
14 from Data.JROData import SpectraHeis
14 from Data.JROData import SpectraHeis
15 from IO.SpectraIO import SpectraWriter
15 from IO.SpectraIO import SpectraWriter
16 #from Graphics.schainPlotTypes import SpcFigure
16 from Graphics.schainPlotTypes import ScopeFigure, SpcFigure
17 #from JRONoise import Noise
17 #from JRONoise import Noise
18
18
19 class SpectraProcessor:
19 class SpectraProcessor:
@@ -292,10 +292,10 class SpectraHeisProcessor:
292
292
293 self.integratorObjIndex = None
293 self.integratorObjIndex = None
294 self.writerObjIndex = None
294 self.writerObjIndex = None
295 self.plotterObjIndex = None
295 self.plotObjIndex = None
296 self.integratorObjList = []
296 self.integratorObjList = []
297 self.writerObjList = []
297 self.writerObjList = []
298 self.plotterObjList = []
298 self.plotObjList = []
299 #self.noiseObj = Noise()
299 #self.noiseObj = Noise()
300
300
301 def setup(self, dataInObj, dataOutObj=None, nFFTPoints=None, pairList=None):
301 def setup(self, dataInObj, dataOutObj=None, nFFTPoints=None, pairList=None):
@@ -309,80 +309,17 class SpectraHeisProcessor:
309 dataOutObj = SpectraHeis()
309 dataOutObj = SpectraHeis()
310
310
311 self.dataOutObj = dataOutObj
311 self.dataOutObj = dataOutObj
312 # self.noiseObj = Noise()
313
314 ##########################################
315 self.nFFTPoints = nFFTPoints
316 self.nChannels = self.dataInObj.nChannels
317 self.nHeights = self.dataInObj.nHeights
318 self.pairList = pairList
319
320 if pairList != None:
321 self.nPairs = len(pairList)
322 else:
323 self.nPairs = 0
324
325 self.dataOutObj.radarControllerHeaderObj = self.dataInObj.radarControllerHeaderObj.copy()
326 self.dataOutObj.systemHeaderObj = self.dataInObj.systemHeaderObj.copy()
327
328 self.dataOutObj.type = "SpectraHeis"
329
330 self.dataOutObj.dtype = self.dataInObj.dtype
331
332 self.dataOutObj.nChannels = self.nChannels
333
334 self.dataOutObj.nHeights = self.nHeights
335
336 self.dataOutObj.nProfiles = self.nFFTPoints
337
338 self.dataOutObj.heightList = None
339
340 self.dataOutObj.channelList = None
341
342 self.dataOutObj.channelIndexList = None
343
344 self.dataOutObj.flagNoData = False
345
346 self.dataOutObj.flagTimeBlock = False
347
348 self.dataOutObj.dataUtcTime = None
349
350 self.dataOutObj.nCode = None
351
352 self.dataOutObj.nBaud = None
353
354 self.dataOutObj.code = None
355
356 self.dataOutObj.flagDecodeData = True #asumo q la data esta decodificada
357
358 self.dataOutObj.flagDeflipData = True #asumo q la data esta sin flip
359
360 self.dataOutObj.flagShiftFFT = False
361
362 self.dataOutObj.ippSeconds = None
363
364 self.dataOutObjdata_spc = None
365
366 self.dataOutObjdata_cspc = None
367
368 self.dataOutObjdata_dc = None
369
370 self.dataOutObjnFFTPoints = None
371
372 self.dataOutObjnPairs = None
373
374 self.dataOutObjpairsList = None
375
376
312
377 return self.dataOutObj
313 return self.dataOutObj
378
314
379 def init(self):
315 def init(self):
380 self.integratorObjIndex = 0
316 self.integratorObjIndex = 0
381 self.writerObjIndex = 0
317 self.writerObjIndex = 0
382 self.plotterObjIndex = 0
318 self.plotObjIndex = 0
383
319
384 if self.dataInObj.type == "Voltage":
320 if self.dataInObj.type == "Voltage":
385 self.__getFft()
321 self.__getFft()
322 self.__updateFromObj()
386 self.dataOutObj.flagNoData = False
323 self.dataOutObj.flagNoData = False
387 return
324 return
388
325
@@ -394,6 +331,28 class SpectraHeisProcessor:
394
331
395 raise ValueError, "The type is not valid"
332 raise ValueError, "The type is not valid"
396
333
334 def __updateFromObj(self):
335 self.dataOutObj.radarControllerHeaderObj = self.dataInObj.radarControllerHeaderObj.copy()
336 self.dataOutObj.systemHeaderObj = self.dataInObj.systemHeaderObj.copy()
337 self.dataOutObj.channelList = self.dataInObj.channelList
338 self.dataOutObj.heightList = self.dataInObj.heightList
339 self.dataOutObj.dtype = self.dataInObj.dtype
340 self.dataOutObj.nHeights = self.dataInObj.nHeights
341 self.dataOutObj.nChannels = self.dataInObj.nChannels
342 self.dataOutObj.nBaud = self.dataInObj.nBaud
343 self.dataOutObj.nCode = self.dataInObj.nCode
344 self.dataOutObj.code = self.dataInObj.code
345 self.dataOutObj.nProfiles = 1
346 self.dataOutObj.nFFTPoints = self.dataInObj.nHeights
347 self.dataOutObj.channelIndexList = self.dataInObj.channelIndexList
348 self.dataOutObj.flagNoData = self.dataInObj.flagNoData
349 self.dataOutObj.flagTimeBlock = self.dataInObj.flagTimeBlock
350 self.dataOutObj.dataUtcTime = self.dataInObj.dataUtcTime
351 self.dataOutObj.flagDecodeData = self.dataInObj.flagDecodeData #asumo q la data esta decodificada
352 self.dataOutObj.flagDeflipData = self.dataInObj.flagDeflipData #asumo q la data esta sin flip
353 self.dataOutObj.flagShiftFFT = self.dataInObj.flagShiftFFT
354 self.dataOutObj.nIncohInt = 1
355
397 def __getFft(self):
356 def __getFft(self):
398 if self.dataInObj.flagNoData:
357 if self.dataInObj.flagNoData:
399 return 0
358 return 0
@@ -405,7 +364,6 class SpectraHeisProcessor:
405
364
406 spc = numpy.abs(fft_volt * numpy.conjugate(fft_volt))
365 spc = numpy.abs(fft_volt * numpy.conjugate(fft_volt))
407 self.dataOutObj.data_spc = spc
366 self.dataOutObj.data_spc = spc
408 #print spc
409
367
410 def getSpectra(self):
368 def getSpectra(self):
411
369
@@ -428,13 +386,11 class SpectraHeisProcessor:
428 self.addIntegrator(N,timeInterval)
386 self.addIntegrator(N,timeInterval)
429
387
430 myIncohIntObj = self.integratorObjList[self.integratorObjIndex]
388 myIncohIntObj = self.integratorObjList[self.integratorObjIndex]
431 myIncohIntObj.exe(data=self.dataOutObj.data_spc,timeOfData=self.dataOutObj.m_BasicHeader.utc)
389 myIncohIntObj.exe(data=self.dataOutObj.data_spc,timeOfData=self.dataOutObj.dataUtcTime)
432
390
433 if myIncohIntObj.isReady:
391 if myIncohIntObj.isReady:
434 self.dataOutObj.data_spc = myIncohIntObj.data
392 self.dataOutObj.data_spc = myIncohIntObj.data
435 self.dataOutObj.nAvg = myIncohIntObj.navg
393 self.dataOutObj.nIncohInt = self.dataOutObj.nIncohInt*myIncohIntObj.navg
436 self.dataOutObj.m_ProcessingHeader.incoherentInt *= myIncohIntObj.navg
437 #print "myIncohIntObj.navg: ",myIncohIntObj.navg
438 self.dataOutObj.flagNoData = False
394 self.dataOutObj.flagNoData = False
439
395
440 #self.getNoise(type="hildebrand",parm=myIncohIntObj.navg)
396 #self.getNoise(type="hildebrand",parm=myIncohIntObj.navg)
@@ -446,6 +402,61 class SpectraHeisProcessor:
446 self.integratorObjIndex += 1
402 self.integratorObjIndex += 1
447
403
448
404
405 def addScope(self, idfigure, nframes, wintitle, driver):
406 if idfigure==None:
407 idfigure = self.plotObjIndex
408
409 scopeObj = ScopeFigure(idfigure, nframes, wintitle, driver)
410 self.plotObjList.append(scopeObj)
411
412 def plotScope(self,
413 idfigure=None,
414 minvalue=None,
415 maxvalue=None,
416 xmin=None,
417 xmax=None,
418 wintitle='',
419 driver='plplot',
420 save=False,
421 gpath=None,
422 titleList=None,
423 xlabelList=None,
424 ylabelList=None):
425
426 if self.dataOutObj.flagNoData:
427 return 0
428
429 nframes = len(self.dataOutObj.channelList)
430
431 if len(self.plotObjList) <= self.plotObjIndex:
432 self.addScope(idfigure, nframes, wintitle, driver)
433
434
435 data1D = self.dataOutObj.data_spc
436
437 x = numpy.arange(self.dataOutObj.nHeights)
438
439 thisDatetime = datetime.datetime.fromtimestamp(self.dataOutObj.dataUtcTime)
440
441 dateTime = "%s"%(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
442 date = "%s"%(thisDatetime.strftime("%d-%b-%Y"))
443
444 figureTitle = "Scope Plot Radar Data: " + date
445
446 plotObj = self.plotObjList[self.plotObjIndex]
447
448 plotObj.plot1DArray(data1D,
449 x,
450 self.dataOutObj.channelList,
451 xmin,
452 xmax,
453 minvalue,
454 maxvalue,
455 figureTitle,
456 save,
457 gpath)
458
459 self.plotObjIndex += 1
449
460
450 class IncoherentIntegration:
461 class IncoherentIntegration:
451
462
General Comments 0
You need to be logged in to leave comments. Login now