@@ -34,22 +34,26 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) | |
51 |
|
55 | |||
52 | def addWriter(self,wrpath): |
|
56 | def addWriter(self, wrpath): | |
53 | objWriter = VoltageWriter(self.voltageOutObj) |
|
57 | objWriter = VoltageWriter(self.voltageOutObj) | |
54 | objWriter.setup(wrpath) |
|
58 | objWriter.setup(wrpath) | |
55 | self.writerList.append(objWriter) |
|
59 | self.writerList.append(objWriter) | |
@@ -59,19 +63,25 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, |
|
66 | def addIntegrator(self, nCohInt): | |
63 |
|
67 | |||
64 |
objCohInt = CoherentIntegrator( |
|
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): | |
68 |
|
72 | |||
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 |
|
|
84 | return 0 | |
75 |
|
85 | |||
76 | if len(self.writerList) <= self.writerIndex: |
|
86 | if len(self.writerList) <= self.writerIndex: | |
77 | self.addWriter(wrpath) |
|
87 | self.addWriter(wrpath) | |
@@ -85,7 +95,7 class VoltageProcessor: | |||||
85 |
|
95 | |||
86 | def plotData(self,idProfile, type, xmin=None, xmax=None, ymin=None, ymax=None, winTitle=''): |
|
96 | def plotData(self,idProfile, type, xmin=None, xmax=None, ymin=None, ymax=None, winTitle=''): | |
87 | if self.voltageOutObj.flagNoData: |
|
97 | if self.voltageOutObj.flagNoData: | |
88 |
|
|
98 | return 0 | |
89 |
|
99 | |||
90 | if len(self.plotterList) <= self.plotterIndex: |
|
100 | if len(self.plotterList) <= self.plotterIndex: | |
91 | self.addPlotter() |
|
101 | self.addPlotter() | |
@@ -95,8 +105,9 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 |
|
|
110 | return 0 | |
100 |
|
111 | |||
101 | if len(self.integratorList) <= self.integratorIndex: |
|
112 | if len(self.integratorList) <= self.integratorIndex: | |
102 | self.addIntegrator(N) |
|
113 | self.addIntegrator(N) | |
@@ -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 |
|
|
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 |
|
296 | ||
284 | heights = self.voltageOutObj.m_ProcessingHeader.numHeights |
|
297 | if self.voltageOutObj.flagNoData: | |
285 | newprofiles = maxIndex - minIndex + 1 |
|
298 | return 0 | |
286 |
|
299 | |||
287 | #voltage |
|
300 | if self.profSelectorIndex >= len(self.profileSelectorList): | |
288 | data = numpy.zeros( (channels,newprofiles,heights), dtype='complex' ) |
|
301 | self.addProfileSelector(nProfiles) | |
289 | for i in range(channels): |
|
302 | ||
290 | data[i,:,:] = self.voltageOutObj.data_spc[i,minIndex:maxIndex+1,:] |
|
303 | profileSelectorObj = self.profileSelectorList[self.profSelectorIndex] | |
291 |
|
304 | |||
292 | self.voltageOutObj.datablock = data |
|
305 | if profileSelectorObj.isProfileInRange(minIndex, maxIndex): | |
293 |
|
306 | self.voltageOutObj.flagNoData = False | ||
294 | self.voltageOutObj.m_ProcessingHeader.blockSize = data.size |
|
307 | self.profSelectorIndex += 1 | |
295 | self.voltageOutObj.nProfiles = newprofiles |
|
308 | return 1 | |
296 | self.voltageOutObj.m_SystemHeader.numProfiles = newprofiles |
|
309 | ||
297 |
|
310 | self.voltageOutObj.flagNoData = True | ||
|
311 | self.profSelectorIndex += 1 | |||
|
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: | |
@@ -321,7 +340,7 class Decoder: | |||||
321 | if type == 1: |
|
340 | if type == 1: | |
322 | self.convolutionInTime(data, ndata) |
|
341 | self.convolutionInTime(data, ndata) | |
323 |
|
342 | |||
324 | def convolutionInFreq(self,data,ndata): |
|
343 | def convolutionInFreq(self,data, ndata): | |
325 |
|
344 | |||
326 | newcode = numpy.zeros(ndata) |
|
345 | newcode = numpy.zeros(ndata) | |
327 | newcode[0:self.nBaud] = self.code[self.codeIndex] |
|
346 | newcode[0:self.nBaud] = self.code[self.codeIndex] | |
@@ -368,14 +387,16 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 | |
375 | self.flag = False |
|
396 | self.flag = False | |
376 | self.nCohInt = N |
|
397 | self.nCohInt = N | |
377 |
|
398 | |||
378 | def exe(self,data): |
|
399 | def exe(self, data): | |
379 |
|
400 | |||
380 | if self.buffer == None: |
|
401 | if self.buffer == None: | |
381 | self.buffer = data |
|
402 | self.buffer = data | |
@@ -392,5 +413,40 class CoherentIntegrator: | |||||
392 |
|
413 | |||
393 | self.profCounter += 1 |
|
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 | No newline at end of file |
|
452 |
General Comments 0
You need to be logged in to leave comments.
Login now