##// 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,17 +34,21 class VoltageProcessor:
34
34
35 self.integratorIndex = None
35 self.integratorIndex = None
36 self.decoderIndex = None
36 self.decoderIndex = None
37 self.profSelectorIndex = None
37 self.writerIndex = None
38 self.writerIndex = None
38 self.plotterIndex = None
39 self.plotterIndex = None
39
40
40 self.integratorList = []
41 self.integratorList = []
41 self.decoderList = []
42 self.decoderList = []
43 self.profileSelectorList = []
42 self.writerList = []
44 self.writerList = []
43 self.plotterList = []
45 self.plotterList = []
44
46
45 def init(self):
47 def init(self):
48
46 self.integratorIndex = 0
49 self.integratorIndex = 0
47 self.decoderIndex = 0
50 self.decoderIndex = 0
51 self.profSelectorIndex = 0
48 self.writerIndex = 0
52 self.writerIndex = 0
49 self.plotterIndex = 0
53 self.plotterIndex = 0
50 self.voltageOutObj.copy(self.voltageInObj)
54 self.voltageOutObj.copy(self.voltageInObj)
@@ -59,9 +63,9 class VoltageProcessor:
59 plotObj = Osciloscope(self.voltageOutObj,self.plotterIndex)
63 plotObj = Osciloscope(self.voltageOutObj,self.plotterIndex)
60 self.plotterList.append(plotObj)
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 self.integratorList.append(objCohInt)
69 self.integratorList.append(objCohInt)
66
70
67 def addDecoder(self,code,ncode,nbaud):
71 def addDecoder(self, code, ncode, nbaud):
@@ -69,7 +73,13 class VoltageProcessor:
69 objDecoder = Decoder(code,ncode,nbaud)
73 objDecoder = Decoder(code,ncode,nbaud)
70 self.decoderList.append(objDecoder)
74 self.decoderList.append(objDecoder)
71
75
76 def addProfileSelector(self, nProfiles):
77
78 objProfSelector = ProfileSelector(nProfiles)
79 self.profileSelectorList.append(objProfSelector)
80
72 def writeData(self,wrpath):
81 def writeData(self,wrpath):
82
73 if self.voltageOutObj.flagNoData:
83 if self.voltageOutObj.flagNoData:
74 return 0
84 return 0
75
85
@@ -95,6 +105,7 class VoltageProcessor:
95 self.plotterIndex += 1
105 self.plotterIndex += 1
96
106
97 def integrator(self, N):
107 def integrator(self, N):
108
98 if self.voltageOutObj.flagNoData:
109 if self.voltageOutObj.flagNoData:
99 return 0
110 return 0
100
111
@@ -115,8 +126,10 class VoltageProcessor:
115 self.integratorIndex += 1
126 self.integratorIndex += 1
116
127
117 def decoder(self,code=None,type = 0):
128 def decoder(self,code=None,type = 0):
129
118 if self.voltageOutObj.flagNoData:
130 if self.voltageOutObj.flagNoData:
119 return 0
131 return 0
132
120 if code == None:
133 if code == None:
121 code = self.voltageOutObj.m_RadarControllerHeader.code
134 code = self.voltageOutObj.m_RadarControllerHeader.code
122 ncode, nbaud = code.shape
135 ncode, nbaud = code.shape
@@ -263,7 +276,7 class VoltageProcessor:
263 self.voltageOutObj.heightList = numpy.arange(xi, xf, step)
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 Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
281 Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
269 minIndex <= index <= maxIndex
282 minIndex <= index <= maxIndex
@@ -280,28 +293,33 class VoltageProcessor:
280 Return:
293 Return:
281 None
294 None
282 """
295 """
283 channels = self.voltageOutObj.nChannels
284 heights = self.voltageOutObj.m_ProcessingHeader.numHeights
285 newprofiles = maxIndex - minIndex + 1
286
296
287 #voltage
297 if self.voltageOutObj.flagNoData:
288 data = numpy.zeros( (channels,newprofiles,heights), dtype='complex' )
298 return 0
289 for i in range(channels):
290 data[i,:,:] = self.voltageOutObj.data_spc[i,minIndex:maxIndex+1,:]
291
299
292 self.voltageOutObj.datablock = data
300 if self.profSelectorIndex >= len(self.profileSelectorList):
301 self.addProfileSelector(nProfiles)
293
302
294 self.voltageOutObj.m_ProcessingHeader.blockSize = data.size
303 profileSelectorObj = self.profileSelectorList[self.profSelectorIndex]
295 self.voltageOutObj.nProfiles = newprofiles
304
296 self.voltageOutObj.m_SystemHeader.numProfiles = newprofiles
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
297
312
313 return 0
298
314
299 def selectNtxs(self, ntx):
315 def selectNtxs(self, ntx):
300 pass
316 pass
301
317
302
318
303 class Decoder:
319 class Decoder:
320
304 def __init__(self,code, ncode, nbaud):
321 def __init__(self,code, ncode, nbaud):
322
305 self.buffer = None
323 self.buffer = None
306 self.profCounter = 1
324 self.profCounter = 1
307 self.nCode = ncode
325 self.nCode = ncode
@@ -313,6 +331,7 class Decoder:
313 self.setCodeFft = False
331 self.setCodeFft = False
314
332
315 def exe(self, data, ndata=None, type = 0):
333 def exe(self, data, ndata=None, type = 0):
334
316 if ndata == None: ndata = data.shape[1]
335 if ndata == None: ndata = data.shape[1]
317
336
318 if type == 0:
337 if type == 0:
@@ -368,7 +387,9 class Decoder:
368
387
369
388
370 class CoherentIntegrator:
389 class CoherentIntegrator:
390
371 def __init__(self, N):
391 def __init__(self, N):
392
372 self.profCounter = 1
393 self.profCounter = 1
373 self.data = None
394 self.data = None
374 self.buffer = None
395 self.buffer = None
@@ -392,5 +413,40 class CoherentIntegrator:
392
413
393 self.profCounter += 1
414 self.profCounter += 1
394
415
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
395
451
396 No newline at end of file
452
General Comments 0
You need to be logged in to leave comments. Login now