@@ -1,247 +1,396 | |||||
1 | ''' |
|
1 | ''' | |
2 | Created on Feb 7, 2012 |
|
2 | Created on Feb 7, 2012 | |
3 |
|
3 | |||
4 | @author $Author$ |
|
4 | @author $Author$ | |
5 | @version $Id$ |
|
5 | @version $Id$ | |
6 | ''' |
|
6 | ''' | |
7 |
|
7 | |||
8 | import os, sys |
|
8 | import os, sys | |
9 | import numpy |
|
9 | import numpy | |
10 |
|
10 | |||
11 | path = os.path.split(os.getcwd())[0] |
|
11 | path = os.path.split(os.getcwd())[0] | |
12 | sys.path.append(path) |
|
12 | sys.path.append(path) | |
13 |
|
13 | |||
14 | from Model.Voltage import Voltage |
|
14 | from Model.Voltage import Voltage | |
15 | from IO.VoltageIO import VoltageWriter |
|
15 | from IO.VoltageIO import VoltageWriter | |
16 | from Graphics.VoltagePlot import Osciloscope |
|
16 | from Graphics.VoltagePlot import Osciloscope | |
17 |
|
17 | |||
18 | class VoltageProcessor: |
|
18 | class VoltageProcessor: | |
19 | ''' |
|
19 | ''' | |
20 | classdocs |
|
20 | classdocs | |
21 | ''' |
|
21 | ''' | |
22 |
|
22 | |||
23 | def __init__(self, voltageInObj, voltageOutObj=None): |
|
23 | def __init__(self, voltageInObj, voltageOutObj=None): | |
24 | ''' |
|
24 | ''' | |
25 | Constructor |
|
25 | Constructor | |
26 | ''' |
|
26 | ''' | |
27 |
|
27 | |||
28 | self.voltageInObj = voltageInObj |
|
28 | self.voltageInObj = voltageInObj | |
29 |
|
29 | |||
30 | if voltageOutObj == None: |
|
30 | if voltageOutObj == None: | |
31 | self.voltageOutObj = Voltage() |
|
31 | self.voltageOutObj = Voltage() | |
32 | else: |
|
32 | else: | |
33 | self.voltageOutObj = voltageOutObj |
|
33 | self.voltageOutObj = voltageOutObj | |
34 |
|
34 | |||
35 | self.integratorIndex = None |
|
35 | self.integratorIndex = None | |
36 | self.decoderIndex = None |
|
36 | self.decoderIndex = None | |
37 | self.writerIndex = None |
|
37 | self.writerIndex = None | |
38 | self.plotterIndex = None |
|
38 | self.plotterIndex = None | |
39 |
|
39 | |||
40 | self.integratorList = [] |
|
40 | self.integratorList = [] | |
41 | self.decoderList = [] |
|
41 | self.decoderList = [] | |
42 | self.writerList = [] |
|
42 | self.writerList = [] | |
43 | self.plotterList = [] |
|
43 | self.plotterList = [] | |
44 |
|
44 | |||
45 | def init(self): |
|
45 | def init(self): | |
46 | self.integratorIndex = 0 |
|
46 | self.integratorIndex = 0 | |
47 | self.decoderIndex = 0 |
|
47 | self.decoderIndex = 0 | |
48 | self.writerIndex = 0 |
|
48 | self.writerIndex = 0 | |
49 | self.plotterIndex = 0 |
|
49 | self.plotterIndex = 0 | |
50 | self.voltageOutObj.copy(self.voltageInObj) |
|
50 | self.voltageOutObj.copy(self.voltageInObj) | |
51 |
|
51 | |||
52 | def addWriter(self,wrpath): |
|
52 | def addWriter(self,wrpath): | |
53 | objWriter = VoltageWriter(self.voltageOutObj) |
|
53 | objWriter = VoltageWriter(self.voltageOutObj) | |
54 | objWriter.setup(wrpath) |
|
54 | objWriter.setup(wrpath) | |
55 | self.writerList.append(objWriter) |
|
55 | self.writerList.append(objWriter) | |
56 |
|
56 | |||
57 | def addPlotter(self): |
|
57 | def addPlotter(self): | |
58 |
|
58 | |||
59 | plotObj = Osciloscope(self.voltageOutObj,self.plotterIndex) |
|
59 | plotObj = Osciloscope(self.voltageOutObj,self.plotterIndex) | |
60 | self.plotterList.append(plotObj) |
|
60 | self.plotterList.append(plotObj) | |
61 |
|
61 | |||
62 | def addIntegrator(self,N): |
|
62 | def addIntegrator(self,N): | |
63 |
|
63 | |||
64 | objCohInt = CoherentIntegrator(N) |
|
64 | objCohInt = CoherentIntegrator(N) | |
65 | self.integratorList.append(objCohInt) |
|
65 | self.integratorList.append(objCohInt) | |
66 |
|
66 | |||
67 | def addDecoder(self,code,ncode,nbaud): |
|
67 | def addDecoder(self,code,ncode,nbaud): | |
68 |
|
68 | |||
69 | objDecoder = Decoder(code,ncode,nbaud) |
|
69 | objDecoder = Decoder(code,ncode,nbaud) | |
70 | self.decoderList.append(objDecoder) |
|
70 | self.decoderList.append(objDecoder) | |
71 |
|
71 | |||
72 | def writeData(self,wrpath): |
|
72 | def writeData(self,wrpath): | |
73 | if self.voltageOutObj.flagNoData: |
|
73 | if self.voltageOutObj.flagNoData: | |
74 | return 0 |
|
74 | return 0 | |
75 |
|
75 | |||
76 | if len(self.writerList) <= self.writerIndex: |
|
76 | if len(self.writerList) <= self.writerIndex: | |
77 | self.addWriter(wrpath) |
|
77 | self.addWriter(wrpath) | |
78 |
|
78 | |||
79 | self.writerList[self.writerIndex].putData() |
|
79 | self.writerList[self.writerIndex].putData() | |
80 |
|
80 | |||
81 | # myWrObj = self.writerList[self.writerIndex] |
|
81 | # myWrObj = self.writerList[self.writerIndex] | |
82 | # myWrObj.putData() |
|
82 | # myWrObj.putData() | |
83 |
|
83 | |||
84 | self.writerIndex += 1 |
|
84 | self.writerIndex += 1 | |
85 |
|
85 | |||
86 | def plotData(self,idProfile, type, xmin=None, xmax=None, ymin=None, ymax=None, winTitle=''): |
|
86 | def plotData(self,idProfile, type, xmin=None, xmax=None, ymin=None, ymax=None, winTitle=''): | |
87 | if self.voltageOutObj.flagNoData: |
|
87 | if self.voltageOutObj.flagNoData: | |
88 | return 0 |
|
88 | return 0 | |
89 |
|
89 | |||
90 | if len(self.plotterList) <= self.plotterIndex: |
|
90 | if len(self.plotterList) <= self.plotterIndex: | |
91 | self.addPlotter() |
|
91 | self.addPlotter() | |
92 |
|
92 | |||
93 | self.plotterList[self.plotterIndex].plotData(type=type, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,winTitle=winTitle) |
|
93 | self.plotterList[self.plotterIndex].plotData(type=type, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,winTitle=winTitle) | |
94 |
|
94 | |||
95 | self.plotterIndex += 1 |
|
95 | self.plotterIndex += 1 | |
96 |
|
96 | |||
97 | def integrator(self, N): |
|
97 | def integrator(self, N): | |
98 | if self.voltageOutObj.flagNoData: |
|
98 | if self.voltageOutObj.flagNoData: | |
99 | return 0 |
|
99 | return 0 | |
100 |
|
100 | |||
101 | if len(self.integratorList) <= self.integratorIndex: |
|
101 | if len(self.integratorList) <= self.integratorIndex: | |
102 | self.addIntegrator(N) |
|
102 | self.addIntegrator(N) | |
103 |
|
103 | |||
104 | myCohIntObj = self.integratorList[self.integratorIndex] |
|
104 | myCohIntObj = self.integratorList[self.integratorIndex] | |
105 | myCohIntObj.exe(self.voltageOutObj.data) |
|
105 | myCohIntObj.exe(self.voltageOutObj.data) | |
106 |
|
106 | |||
107 | if myCohIntObj.flag: |
|
107 | if myCohIntObj.flag: | |
108 | self.voltageOutObj.data = myCohIntObj.data |
|
108 | self.voltageOutObj.data = myCohIntObj.data | |
109 | self.voltageOutObj.m_ProcessingHeader.coherentInt *= N |
|
109 | self.voltageOutObj.m_ProcessingHeader.coherentInt *= N | |
110 | self.voltageOutObj.flagNoData = False |
|
110 | self.voltageOutObj.flagNoData = False | |
111 |
|
111 | |||
112 | else: |
|
112 | else: | |
113 | self.voltageOutObj.flagNoData = True |
|
113 | self.voltageOutObj.flagNoData = True | |
114 |
|
114 | |||
115 | self.integratorIndex += 1 |
|
115 | self.integratorIndex += 1 | |
116 |
|
116 | |||
117 | def decoder(self,code=None,type = 0): |
|
117 | def decoder(self,code=None,type = 0): | |
118 | if self.voltageOutObj.flagNoData: |
|
118 | if self.voltageOutObj.flagNoData: | |
119 | return 0 |
|
119 | return 0 | |
120 | if code == None: |
|
120 | if code == None: | |
121 | code = self.voltageOutObj.m_RadarControllerHeader.code |
|
121 | code = self.voltageOutObj.m_RadarControllerHeader.code | |
122 | ncode, nbaud = code.shape |
|
122 | ncode, nbaud = code.shape | |
123 |
|
123 | |||
124 | if len(self.decoderList) <= self.decoderIndex: |
|
124 | if len(self.decoderList) <= self.decoderIndex: | |
125 | self.addDecoder(code,ncode,nbaud) |
|
125 | self.addDecoder(code,ncode,nbaud) | |
126 |
|
126 | |||
127 | myDecodObj = self.decoderList[self.decoderIndex] |
|
127 | myDecodObj = self.decoderList[self.decoderIndex] | |
128 | myDecodObj.exe(data=self.voltageOutObj.data,type=type) |
|
128 | myDecodObj.exe(data=self.voltageOutObj.data,type=type) | |
129 |
|
129 | |||
130 | if myDecodObj.flag: |
|
130 | if myDecodObj.flag: | |
131 | self.voltageOutObj.data = myDecodObj.data |
|
131 | self.voltageOutObj.data = myDecodObj.data | |
132 | self.voltageOutObj.flagNoData = False |
|
132 | self.voltageOutObj.flagNoData = False | |
133 | else: |
|
133 | else: | |
134 | self.voltageOutObj.flagNoData = True |
|
134 | self.voltageOutObj.flagNoData = True | |
135 |
|
135 | |||
136 | self.decoderIndex += 1 |
|
136 | self.decoderIndex += 1 | |
|
137 | ||||
137 |
|
138 | |||
138 | def removeDC(self): |
|
139 | def filterByHei(self, window): | |
139 | pass |
|
140 | pass | |
|
141 | ||||
140 |
|
142 | |||
141 | def removeSignalInt(self): |
|
143 | def selectChannels(self, channelList): | |
142 |
|
|
144 | """ | |
|
145 | Selecciona un bloque de datos en base a canales y pares segun el channelList y el pairList | |||
|
146 | ||||
|
147 | Input: | |||
|
148 | channelList : lista sencilla de canales a seleccionar por ej. (2,3,7) | |||
|
149 | pairList : tupla de pares que se desea selecionar por ej. ( (0,1), (0,2) ) | |||
|
150 | ||||
|
151 | Affected: | |||
|
152 | self.dataOutObj.datablock | |||
|
153 | self.dataOutObj.nChannels | |||
|
154 | self.dataOutObj.m_SystemHeader.numChannels | |||
|
155 | self.voltageOutObj.m_ProcessingHeader.blockSize | |||
|
156 | ||||
|
157 | Return: | |||
|
158 | None | |||
|
159 | """ | |||
|
160 | if not(channelList): | |||
|
161 | return | |||
|
162 | ||||
|
163 | channels = 0 | |||
|
164 | profiles = self.voltageOutObj.nProfiles | |||
|
165 | heights = self.voltageOutObj.m_ProcessingHeader.numHeights | |||
|
166 | ||||
|
167 | #self spectra | |||
|
168 | channels = len(channelList) | |||
|
169 | data = numpy.zeros( (channels,profiles,heights), dtype='complex' ) | |||
|
170 | for index,channel in enumerate(channelList): | |||
|
171 | data[index,:,:] = self.voltageOutObj.data_spc[channel,:,:] | |||
143 |
|
172 | |||
144 | def selChannel(self): |
|
173 | self.voltageOutObj.datablock = data | |
145 |
|
|
174 | ||
|
175 | #fill the m_ProcessingHeader.spectraComb up | |||
|
176 | channels = len(channelList) | |||
|
177 | ||||
|
178 | self.voltageOutObj.channelList = channelList | |||
|
179 | self.voltageOutObj.nChannels = nchannels | |||
|
180 | self.voltageOutObj.m_ProcessingHeader.totalSpectra = nchannels | |||
|
181 | self.voltageOutObj.m_SystemHeader.numChannels = nchannels | |||
|
182 | self.voltageOutObj.m_ProcessingHeader.blockSize = data.size | |||
|
183 | ||||
146 |
|
184 | |||
147 | def selRange(self): |
|
185 | def selectHeightsByValue(self, minHei, maxHei): | |
148 |
|
|
186 | """ | |
|
187 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |||
|
188 | minHei <= height <= maxHei | |||
|
189 | ||||
|
190 | Input: | |||
|
191 | minHei : valor minimo de altura a considerar | |||
|
192 | maxHei : valor maximo de altura a considerar | |||
|
193 | ||||
|
194 | Affected: | |||
|
195 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex | |||
|
196 | ||||
|
197 | Return: | |||
|
198 | None | |||
|
199 | """ | |||
|
200 | minIndex = 0 | |||
|
201 | maxIndex = 0 | |||
|
202 | data = self.dataOutObj.heightList | |||
|
203 | ||||
|
204 | for i,val in enumerate(data): | |||
|
205 | if val < minHei: | |||
|
206 | continue | |||
|
207 | else: | |||
|
208 | minIndex = i; | |||
|
209 | break | |||
|
210 | ||||
|
211 | for i,val in enumerate(data): | |||
|
212 | if val <= maxHei: | |||
|
213 | maxIndex = i; | |||
|
214 | else: | |||
|
215 | break | |||
|
216 | ||||
|
217 | self.selectHeightsByIndex(minIndex, maxIndex) | |||
|
218 | ||||
|
219 | ||||
|
220 | def selectHeightsByIndex(self, minIndex, maxIndex): | |||
|
221 | """ | |||
|
222 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |||
|
223 | minIndex <= index <= maxIndex | |||
|
224 | ||||
|
225 | Input: | |||
|
226 | minIndex : valor minimo de altura a considerar | |||
|
227 | maxIndex : valor maximo de altura a considerar | |||
|
228 | ||||
|
229 | Affected: | |||
|
230 | self.voltageOutObj.datablock | |||
|
231 | self.voltageOutObj.m_ProcessingHeader.numHeights | |||
|
232 | self.voltageOutObj.m_ProcessingHeader.blockSize | |||
|
233 | self.voltageOutObj.heightList | |||
|
234 | self.voltageOutObj.nHeights | |||
|
235 | self.voltageOutObj.m_RadarControllerHeader.numHeights | |||
|
236 | ||||
|
237 | Return: | |||
|
238 | None | |||
|
239 | """ | |||
|
240 | channels = self.voltageOutObj.nChannels | |||
|
241 | profiles = self.voltageOutObj.nProfiles | |||
|
242 | newheis = maxIndex - minIndex + 1 | |||
|
243 | firstHeight = 0 | |||
|
244 | ||||
|
245 | #voltage | |||
|
246 | data = numpy.zeros( (channels,profiles,newheis), dtype='complex' ) | |||
|
247 | for i in range(channels): | |||
|
248 | data[i] = self.voltageOutObj.data_spc[i,:,minIndex:maxIndex+1] | |||
|
249 | ||||
|
250 | self.voltageOutObj.datablock = data | |||
|
251 | ||||
|
252 | firstHeight = self.dataOutObj.heightList[minIndex] | |||
|
253 | ||||
|
254 | self.voltageOutObj.nHeights = newheis | |||
|
255 | self.voltageOutObj.m_ProcessingHeader.blockSize = data.size | |||
|
256 | self.voltageOutObj.m_ProcessingHeader.numHeights = newheis | |||
|
257 | self.voltageOutObj.m_ProcessingHeader.firstHeight = firstHeight | |||
|
258 | self.voltageOutObj.m_RadarControllerHeader = newheis | |||
|
259 | ||||
|
260 | xi = firstHeight | |||
|
261 | step = self.voltageOutObj.m_ProcessingHeader.deltaHeight | |||
|
262 | xf = xi + newheis * step | |||
|
263 | self.voltageOutObj.heightList = numpy.arange(xi, xf, step) | |||
|
264 | ||||
|
265 | ||||
|
266 | def selectProfiles(self, minIndex, maxIndex): | |||
|
267 | """ | |||
|
268 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |||
|
269 | minIndex <= index <= maxIndex | |||
|
270 | ||||
|
271 | Input: | |||
|
272 | minIndex : valor minimo de altura a considerar | |||
|
273 | maxIndex : valor maximo de altura a considerar | |||
|
274 | ||||
|
275 | Affected: | |||
|
276 | self.voltageOutObj.datablock | |||
|
277 | self.voltageOutObj.m_ProcessingHeader.numHeights | |||
|
278 | self.voltageOutObj.heightList | |||
|
279 | ||||
|
280 | Return: | |||
|
281 | None | |||
|
282 | """ | |||
|
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 | ||||
149 |
|
298 | |||
150 |
def sel |
|
299 | def selectNtxs(self, ntx): | |
151 | pass |
|
300 | pass | |
152 |
|
301 | |||
153 |
|
302 | |||
154 | class Decoder: |
|
303 | class Decoder: | |
155 | def __init__(self,code, ncode, nbaud): |
|
304 | def __init__(self,code, ncode, nbaud): | |
156 | self.buffer = None |
|
305 | self.buffer = None | |
157 | self.profCounter = 1 |
|
306 | self.profCounter = 1 | |
158 | self.nCode = ncode |
|
307 | self.nCode = ncode | |
159 | self.nBaud = nbaud |
|
308 | self.nBaud = nbaud | |
160 | self.codeIndex = 0 |
|
309 | self.codeIndex = 0 | |
161 | self.code = code #this is a List |
|
310 | self.code = code #this is a List | |
162 | self.fft_code = None |
|
311 | self.fft_code = None | |
163 | self.flag = False |
|
312 | self.flag = False | |
164 | self.setCodeFft = False |
|
313 | self.setCodeFft = False | |
165 |
|
314 | |||
166 | def exe(self, data, ndata=None, type = 0): |
|
315 | def exe(self, data, ndata=None, type = 0): | |
167 | if ndata == None: ndata = data.shape[1] |
|
316 | if ndata == None: ndata = data.shape[1] | |
168 |
|
317 | |||
169 | if type == 0: |
|
318 | if type == 0: | |
170 | self.convolutionInFreq(data,ndata) |
|
319 | self.convolutionInFreq(data,ndata) | |
171 |
|
320 | |||
172 | if type == 1: |
|
321 | if type == 1: | |
173 | self.convolutionInTime(data, ndata) |
|
322 | self.convolutionInTime(data, ndata) | |
174 |
|
323 | |||
175 | def convolutionInFreq(self,data,ndata): |
|
324 | def convolutionInFreq(self,data,ndata): | |
176 |
|
325 | |||
177 | newcode = numpy.zeros(ndata) |
|
326 | newcode = numpy.zeros(ndata) | |
178 | newcode[0:self.nBaud] = self.code[self.codeIndex] |
|
327 | newcode[0:self.nBaud] = self.code[self.codeIndex] | |
179 |
|
328 | |||
180 | self.codeIndex += 1 |
|
329 | self.codeIndex += 1 | |
181 |
|
330 | |||
182 | fft_data = numpy.fft.fft(data, axis=1) |
|
331 | fft_data = numpy.fft.fft(data, axis=1) | |
183 | fft_code = numpy.conj(numpy.fft.fft(newcode)) |
|
332 | fft_code = numpy.conj(numpy.fft.fft(newcode)) | |
184 | fft_code = fft_code.reshape(1,len(fft_code)) |
|
333 | fft_code = fft_code.reshape(1,len(fft_code)) | |
185 |
|
334 | |||
186 | conv = fft_data.copy() |
|
335 | conv = fft_data.copy() | |
187 | conv.fill(0) |
|
336 | conv.fill(0) | |
188 |
|
337 | |||
189 | conv = fft_data*fft_code # This other way to calculate multiplication between bidimensional arrays |
|
338 | conv = fft_data*fft_code # This other way to calculate multiplication between bidimensional arrays | |
190 | # for i in range(ndata): |
|
339 | # for i in range(ndata): | |
191 | # conv[i,:] = fft_data[i,:]*fft_code[i] |
|
340 | # conv[i,:] = fft_data[i,:]*fft_code[i] | |
192 |
|
341 | |||
193 | self.data = numpy.fft.ifft(conv,axis=1) |
|
342 | self.data = numpy.fft.ifft(conv,axis=1) | |
194 | self.flag = True |
|
343 | self.flag = True | |
195 |
|
344 | |||
196 | if self.profCounter == self.nCode: |
|
345 | if self.profCounter == self.nCode: | |
197 | self.profCounter = 0 |
|
346 | self.profCounter = 0 | |
198 | self.codeIndex = 0 |
|
347 | self.codeIndex = 0 | |
199 |
|
348 | |||
200 | self.profCounter += 1 |
|
349 | self.profCounter += 1 | |
201 |
|
350 | |||
202 | def convolutionInTime(self, data, ndata): |
|
351 | def convolutionInTime(self, data, ndata): | |
203 |
|
352 | |||
204 | nchannel = data.shape[1] |
|
353 | nchannel = data.shape[1] | |
205 | newcode = self.code[self.codeIndex] |
|
354 | newcode = self.code[self.codeIndex] | |
206 | self.codeIndex += 1 |
|
355 | self.codeIndex += 1 | |
207 | conv = data.copy() |
|
356 | conv = data.copy() | |
208 | for i in range(nchannel): |
|
357 | for i in range(nchannel): | |
209 | conv[i,:] = numpy.correlate(data[i,:], newcode, 'same') |
|
358 | conv[i,:] = numpy.correlate(data[i,:], newcode, 'same') | |
210 |
|
359 | |||
211 | self.data = conv |
|
360 | self.data = conv | |
212 | self.flag = True |
|
361 | self.flag = True | |
213 |
|
362 | |||
214 | if self.profCounter == self.nCode: |
|
363 | if self.profCounter == self.nCode: | |
215 | self.profCounter = 0 |
|
364 | self.profCounter = 0 | |
216 | self.codeIndex = 0 |
|
365 | self.codeIndex = 0 | |
217 |
|
366 | |||
218 | self.profCounter += 1 |
|
367 | self.profCounter += 1 | |
219 |
|
368 | |||
220 |
|
369 | |||
221 | class CoherentIntegrator: |
|
370 | class CoherentIntegrator: | |
222 | def __init__(self, N): |
|
371 | def __init__(self, N): | |
223 | self.profCounter = 1 |
|
372 | self.profCounter = 1 | |
224 | self.data = None |
|
373 | self.data = None | |
225 | self.buffer = None |
|
374 | self.buffer = None | |
226 | self.flag = False |
|
375 | self.flag = False | |
227 | self.nCohInt = N |
|
376 | self.nCohInt = N | |
228 |
|
377 | |||
229 | def exe(self,data): |
|
378 | def exe(self,data): | |
230 |
|
379 | |||
231 | if self.buffer == None: |
|
380 | if self.buffer == None: | |
232 | self.buffer = data |
|
381 | self.buffer = data | |
233 | else: |
|
382 | else: | |
234 | self.buffer = self.buffer + data |
|
383 | self.buffer = self.buffer + data | |
235 |
|
384 | |||
236 | if self.profCounter == self.nCohInt: |
|
385 | if self.profCounter == self.nCohInt: | |
237 | self.data = self.buffer |
|
386 | self.data = self.buffer | |
238 | self.buffer = None |
|
387 | self.buffer = None | |
239 | self.profCounter = 0 |
|
388 | self.profCounter = 0 | |
240 | self.flag = True |
|
389 | self.flag = True | |
241 | else: |
|
390 | else: | |
242 | self.flag = False |
|
391 | self.flag = False | |
243 |
|
392 | |||
244 | self.profCounter += 1 |
|
393 | self.profCounter += 1 | |
245 |
|
394 | |||
246 |
|
395 | |||
247 | No newline at end of file |
|
396 |
General Comments 0
You need to be logged in to leave comments.
Login now