##// END OF EJS Templates
El metodo y la clase selector de perfiles han sido añadidos
Miguel Valdez -
r92:bd7a5985b381
parent child
Show More
@@ -34,22 +34,26 class VoltageProcessor:
34 34
35 35 self.integratorIndex = None
36 36 self.decoderIndex = None
37 self.profSelectorIndex = None
37 38 self.writerIndex = None
38 39 self.plotterIndex = None
39 40
40 41 self.integratorList = []
41 42 self.decoderList = []
43 self.profileSelectorList = []
42 44 self.writerList = []
43 45 self.plotterList = []
44 46
45 47 def init(self):
48
46 49 self.integratorIndex = 0
47 50 self.decoderIndex = 0
51 self.profSelectorIndex = 0
48 52 self.writerIndex = 0
49 53 self.plotterIndex = 0
50 54 self.voltageOutObj.copy(self.voltageInObj)
51 55
52 def addWriter(self,wrpath):
56 def addWriter(self, wrpath):
53 57 objWriter = VoltageWriter(self.voltageOutObj)
54 58 objWriter.setup(wrpath)
55 59 self.writerList.append(objWriter)
@@ -59,19 +63,25 class VoltageProcessor:
59 63 plotObj = Osciloscope(self.voltageOutObj,self.plotterIndex)
60 64 self.plotterList.append(plotObj)
61 65
62 def addIntegrator(self,N):
66 def addIntegrator(self, nCohInt):
63 67
64 objCohInt = CoherentIntegrator(N)
68 objCohInt = CoherentIntegrator(nCohInt)
65 69 self.integratorList.append(objCohInt)
66 70
67 def addDecoder(self,code,ncode,nbaud):
71 def addDecoder(self, code, ncode, nbaud):
68 72
69 73 objDecoder = Decoder(code,ncode,nbaud)
70 74 self.decoderList.append(objDecoder)
71 75
76 def addProfileSelector(self, nProfiles):
77
78 objProfSelector = ProfileSelector(nProfiles)
79 self.profileSelectorList.append(objProfSelector)
80
72 81 def writeData(self,wrpath):
82
73 83 if self.voltageOutObj.flagNoData:
74 return 0
84 return 0
75 85
76 86 if len(self.writerList) <= self.writerIndex:
77 87 self.addWriter(wrpath)
@@ -85,7 +95,7 class VoltageProcessor:
85 95
86 96 def plotData(self,idProfile, type, xmin=None, xmax=None, ymin=None, ymax=None, winTitle=''):
87 97 if self.voltageOutObj.flagNoData:
88 return 0
98 return 0
89 99
90 100 if len(self.plotterList) <= self.plotterIndex:
91 101 self.addPlotter()
@@ -95,8 +105,9 class VoltageProcessor:
95 105 self.plotterIndex += 1
96 106
97 107 def integrator(self, N):
108
98 109 if self.voltageOutObj.flagNoData:
99 return 0
110 return 0
100 111
101 112 if len(self.integratorList) <= self.integratorIndex:
102 113 self.addIntegrator(N)
@@ -115,8 +126,10 class VoltageProcessor:
115 126 self.integratorIndex += 1
116 127
117 128 def decoder(self,code=None,type = 0):
129
118 130 if self.voltageOutObj.flagNoData:
119 return 0
131 return 0
132
120 133 if code == None:
121 134 code = self.voltageOutObj.m_RadarControllerHeader.code
122 135 ncode, nbaud = code.shape
@@ -263,7 +276,7 class VoltageProcessor:
263 276 self.voltageOutObj.heightList = numpy.arange(xi, xf, step)
264 277
265 278
266 def selectProfiles(self, minIndex, maxIndex):
279 def selectProfiles(self, minIndex, maxIndex, nProfiles):
267 280 """
268 281 Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
269 282 minIndex <= index <= maxIndex
@@ -280,28 +293,33 class VoltageProcessor:
280 293 Return:
281 294 None
282 295 """
283 channels = self.voltageOutObj.nChannels
284 heights = self.voltageOutObj.m_ProcessingHeader.numHeights
285 newprofiles = maxIndex - minIndex + 1
286
287 #voltage
288 data = numpy.zeros( (channels,newprofiles,heights), dtype='complex' )
289 for i in range(channels):
290 data[i,:,:] = self.voltageOutObj.data_spc[i,minIndex:maxIndex+1,:]
291
292 self.voltageOutObj.datablock = data
293
294 self.voltageOutObj.m_ProcessingHeader.blockSize = data.size
295 self.voltageOutObj.nProfiles = newprofiles
296 self.voltageOutObj.m_SystemHeader.numProfiles = newprofiles
297
296
297 if self.voltageOutObj.flagNoData:
298 return 0
299
300 if self.profSelectorIndex >= len(self.profileSelectorList):
301 self.addProfileSelector(nProfiles)
302
303 profileSelectorObj = self.profileSelectorList[self.profSelectorIndex]
304
305 if profileSelectorObj.isProfileInRange(minIndex, maxIndex):
306 self.voltageOutObj.flagNoData = False
307 self.profSelectorIndex += 1
308 return 1
309
310 self.voltageOutObj.flagNoData = True
311 self.profSelectorIndex += 1
312
313 return 0
298 314
299 315 def selectNtxs(self, ntx):
300 316 pass
301 317
302 318
303 319 class Decoder:
320
304 321 def __init__(self,code, ncode, nbaud):
322
305 323 self.buffer = None
306 324 self.profCounter = 1
307 325 self.nCode = ncode
@@ -313,6 +331,7 class Decoder:
313 331 self.setCodeFft = False
314 332
315 333 def exe(self, data, ndata=None, type = 0):
334
316 335 if ndata == None: ndata = data.shape[1]
317 336
318 337 if type == 0:
@@ -321,7 +340,7 class Decoder:
321 340 if type == 1:
322 341 self.convolutionInTime(data, ndata)
323 342
324 def convolutionInFreq(self,data,ndata):
343 def convolutionInFreq(self,data, ndata):
325 344
326 345 newcode = numpy.zeros(ndata)
327 346 newcode[0:self.nBaud] = self.code[self.codeIndex]
@@ -368,14 +387,16 class Decoder:
368 387
369 388
370 389 class CoherentIntegrator:
390
371 391 def __init__(self, N):
392
372 393 self.profCounter = 1
373 394 self.data = None
374 395 self.buffer = None
375 396 self.flag = False
376 397 self.nCohInt = N
377 398
378 def exe(self,data):
399 def exe(self, data):
379 400
380 401 if self.buffer == None:
381 402 self.buffer = data
@@ -392,5 +413,40 class CoherentIntegrator:
392 413
393 414 self.profCounter += 1
394 415
395
416 class ProfileSelector():
417
418 indexProfile = None
419 # Tamaño total de los perfiles
420 nProfiles = None
421
422 def __init__(self, nProfiles):
423
424 self.indexProfile = 0
425 self.nProfiles = nProfiles
426
427 def isProfileInRange(self, minIndex, maxIndex):
428
429 if minIndex < self.indexProfile:
430 self.indexProfile += 1
431 return False
432
433 if maxIndex > self.indexProfile:
434 self.indexProfile += 1
435 return False
436
437 self.indexProfile += 1
438
439 return True
440
441 def isProfileInList(self, profileList):
442
443 if self.indexProfile not in profileList:
444 self.indexProfile += 1
445 return False
446
447 self.indexProfile += 1
448
449 return True
450
451
396 452 No newline at end of file
General Comments 0
You need to be logged in to leave comments. Login now