@@ -34,17 +34,21 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) |
@@ -59,9 +63,9 class VoltageProcessor: | |||
|
59 | 63 | plotObj = Osciloscope(self.voltageOutObj,self.plotterIndex) |
|
60 | 64 | self.plotterList.append(plotObj) |
|
61 | 65 | |
|
62 |
def addIntegrator(self, |
|
|
66 | def addIntegrator(self, nCohInt): | |
|
63 | 67 | |
|
64 |
objCohInt = CoherentIntegrator( |
|
|
68 | objCohInt = CoherentIntegrator(nCohInt) | |
|
65 | 69 | self.integratorList.append(objCohInt) |
|
66 | 70 | |
|
67 | 71 | def addDecoder(self,code,ncode,nbaud): |
@@ -69,7 +73,13 class VoltageProcessor: | |||
|
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 | 84 |
|
|
75 | 85 | |
@@ -95,6 +105,7 class VoltageProcessor: | |||
|
95 | 105 | self.plotterIndex += 1 |
|
96 | 106 | |
|
97 | 107 | def integrator(self, N): |
|
108 | ||
|
98 | 109 | if self.voltageOutObj.flagNoData: |
|
99 | 110 |
|
|
100 | 111 | |
@@ -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 | 131 |
|
|
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 | 296 | |
|
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,:] | |
|
297 | if self.voltageOutObj.flagNoData: | |
|
298 | return 0 | |
|
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 | |
|
295 | self.voltageOutObj.nProfiles = newprofiles | |
|
296 | self.voltageOutObj.m_SystemHeader.numProfiles = newprofiles | |
|
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 | |
|
297 | 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: |
@@ -368,7 +387,9 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 |
@@ -392,5 +413,40 class CoherentIntegrator: | |||
|
392 | 413 | |
|
393 | 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 | 452 | No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now