@@ -1,1285 +1,1290 | |||||
1 | ''' |
|
1 | ''' | |
2 |
|
2 | |||
3 | $Author: dsuarez $ |
|
3 | $Author: dsuarez $ | |
4 | $Id: Processor.py 1 2012-11-12 18:56:07Z dsuarez $ |
|
4 | $Id: Processor.py 1 2012-11-12 18:56:07Z dsuarez $ | |
5 | ''' |
|
5 | ''' | |
6 | import os |
|
6 | import os | |
7 | import numpy |
|
7 | import numpy | |
8 | import datetime |
|
8 | import datetime | |
9 | import time |
|
9 | import time | |
10 |
|
10 | |||
11 | from jrodata import * |
|
11 | from jrodata import * | |
12 | from jrodataIO import * |
|
12 | from jrodataIO import * | |
13 | from jroplot import * |
|
13 | from jroplot import * | |
14 |
|
14 | |||
15 | class ProcessingUnit: |
|
15 | class ProcessingUnit: | |
16 |
|
16 | |||
17 | """ |
|
17 | """ | |
18 | Esta es la clase base para el procesamiento de datos. |
|
18 | Esta es la clase base para el procesamiento de datos. | |
19 |
|
19 | |||
20 | Contiene el metodo "call" para llamar operaciones. Las operaciones pueden ser: |
|
20 | Contiene el metodo "call" para llamar operaciones. Las operaciones pueden ser: | |
21 | - Metodos internos (callMethod) |
|
21 | - Metodos internos (callMethod) | |
22 | - Objetos del tipo Operation (callObject). Antes de ser llamados, estos objetos |
|
22 | - Objetos del tipo Operation (callObject). Antes de ser llamados, estos objetos | |
23 | tienen que ser agreagados con el metodo "add". |
|
23 | tienen que ser agreagados con el metodo "add". | |
24 |
|
24 | |||
25 | """ |
|
25 | """ | |
26 | # objeto de datos de entrada (Voltage, Spectra o Correlation) |
|
26 | # objeto de datos de entrada (Voltage, Spectra o Correlation) | |
27 | dataIn = None |
|
27 | dataIn = None | |
28 |
|
28 | |||
29 | # objeto de datos de entrada (Voltage, Spectra o Correlation) |
|
29 | # objeto de datos de entrada (Voltage, Spectra o Correlation) | |
30 | dataOut = None |
|
30 | dataOut = None | |
31 |
|
31 | |||
32 |
|
32 | |||
33 | objectDict = None |
|
33 | objectDict = None | |
34 |
|
34 | |||
35 | def __init__(self): |
|
35 | def __init__(self): | |
36 |
|
36 | |||
37 | self.objectDict = {} |
|
37 | self.objectDict = {} | |
38 |
|
38 | |||
39 | def init(self): |
|
39 | def init(self): | |
40 |
|
40 | |||
41 | raise ValueError, "Not implemented" |
|
41 | raise ValueError, "Not implemented" | |
42 |
|
42 | |||
43 | def addOperation(self, object, objId): |
|
43 | def addOperation(self, object, objId): | |
44 |
|
44 | |||
45 | """ |
|
45 | """ | |
46 | Agrega el objeto "object" a la lista de objetos "self.objectList" y retorna el |
|
46 | Agrega el objeto "object" a la lista de objetos "self.objectList" y retorna el | |
47 | identificador asociado a este objeto. |
|
47 | identificador asociado a este objeto. | |
48 |
|
48 | |||
49 | Input: |
|
49 | Input: | |
50 |
|
50 | |||
51 | object : objeto de la clase "Operation" |
|
51 | object : objeto de la clase "Operation" | |
52 |
|
52 | |||
53 | Return: |
|
53 | Return: | |
54 |
|
54 | |||
55 | objId : identificador del objeto, necesario para ejecutar la operacion |
|
55 | objId : identificador del objeto, necesario para ejecutar la operacion | |
56 | """ |
|
56 | """ | |
57 |
|
57 | |||
58 | self.objectDict[objId] = object |
|
58 | self.objectDict[objId] = object | |
59 |
|
59 | |||
60 | return objId |
|
60 | return objId | |
61 |
|
61 | |||
62 | def operation(self, **kwargs): |
|
62 | def operation(self, **kwargs): | |
63 |
|
63 | |||
64 | """ |
|
64 | """ | |
65 | Operacion directa sobre la data (dataOut.data). Es necesario actualizar los valores de los |
|
65 | Operacion directa sobre la data (dataOut.data). Es necesario actualizar los valores de los | |
66 | atributos del objeto dataOut |
|
66 | atributos del objeto dataOut | |
67 |
|
67 | |||
68 | Input: |
|
68 | Input: | |
69 |
|
69 | |||
70 | **kwargs : Diccionario de argumentos de la funcion a ejecutar |
|
70 | **kwargs : Diccionario de argumentos de la funcion a ejecutar | |
71 | """ |
|
71 | """ | |
72 |
|
72 | |||
73 | raise ValueError, "ImplementedError" |
|
73 | raise ValueError, "ImplementedError" | |
74 |
|
74 | |||
75 | def callMethod(self, name, **kwargs): |
|
75 | def callMethod(self, name, **kwargs): | |
76 |
|
76 | |||
77 | """ |
|
77 | """ | |
78 | Ejecuta el metodo con el nombre "name" y con argumentos **kwargs de la propia clase. |
|
78 | Ejecuta el metodo con el nombre "name" y con argumentos **kwargs de la propia clase. | |
79 |
|
79 | |||
80 | Input: |
|
80 | Input: | |
81 | name : nombre del metodo a ejecutar |
|
81 | name : nombre del metodo a ejecutar | |
82 |
|
82 | |||
83 | **kwargs : diccionario con los nombres y valores de la funcion a ejecutar. |
|
83 | **kwargs : diccionario con los nombres y valores de la funcion a ejecutar. | |
84 |
|
84 | |||
85 | """ |
|
85 | """ | |
86 | if name != 'run': |
|
86 | if name != 'run': | |
87 |
|
87 | |||
88 | if name == 'init' and self.dataIn.isEmpty(): |
|
88 | if name == 'init' and self.dataIn.isEmpty(): | |
89 | self.dataOut.flagNoData = True |
|
89 | self.dataOut.flagNoData = True | |
90 | return False |
|
90 | return False | |
91 |
|
91 | |||
92 | if name != 'init' and self.dataOut.isEmpty(): |
|
92 | if name != 'init' and self.dataOut.isEmpty(): | |
93 | return False |
|
93 | return False | |
94 |
|
94 | |||
95 | methodToCall = getattr(self, name) |
|
95 | methodToCall = getattr(self, name) | |
96 |
|
96 | |||
97 | methodToCall(**kwargs) |
|
97 | methodToCall(**kwargs) | |
98 |
|
98 | |||
99 | if name != 'run': |
|
99 | if name != 'run': | |
100 | return True |
|
100 | return True | |
101 |
|
101 | |||
102 | if self.dataOut.isEmpty(): |
|
102 | if self.dataOut.isEmpty(): | |
103 | return False |
|
103 | return False | |
104 |
|
104 | |||
105 | return True |
|
105 | return True | |
106 |
|
106 | |||
107 | def callObject(self, objId, **kwargs): |
|
107 | def callObject(self, objId, **kwargs): | |
108 |
|
108 | |||
109 | """ |
|
109 | """ | |
110 | Ejecuta la operacion asociada al identificador del objeto "objId" |
|
110 | Ejecuta la operacion asociada al identificador del objeto "objId" | |
111 |
|
111 | |||
112 | Input: |
|
112 | Input: | |
113 |
|
113 | |||
114 | objId : identificador del objeto a ejecutar |
|
114 | objId : identificador del objeto a ejecutar | |
115 |
|
115 | |||
116 | **kwargs : diccionario con los nombres y valores de la funcion a ejecutar. |
|
116 | **kwargs : diccionario con los nombres y valores de la funcion a ejecutar. | |
117 |
|
117 | |||
118 | Return: |
|
118 | Return: | |
119 |
|
119 | |||
120 | None |
|
120 | None | |
121 | """ |
|
121 | """ | |
122 |
|
122 | |||
123 | if self.dataOut.isEmpty(): |
|
123 | if self.dataOut.isEmpty(): | |
124 | return False |
|
124 | return False | |
125 |
|
125 | |||
126 | object = self.objectDict[objId] |
|
126 | object = self.objectDict[objId] | |
127 |
|
127 | |||
128 | object.run(self.dataOut, **kwargs) |
|
128 | object.run(self.dataOut, **kwargs) | |
129 |
|
129 | |||
130 | return True |
|
130 | return True | |
131 |
|
131 | |||
132 | def call(self, operationConf, **kwargs): |
|
132 | def call(self, operationConf, **kwargs): | |
133 |
|
133 | |||
134 | """ |
|
134 | """ | |
135 | Return True si ejecuta la operacion "operationConf.name" con los |
|
135 | Return True si ejecuta la operacion "operationConf.name" con los | |
136 | argumentos "**kwargs". False si la operacion no se ha ejecutado. |
|
136 | argumentos "**kwargs". False si la operacion no se ha ejecutado. | |
137 | La operacion puede ser de dos tipos: |
|
137 | La operacion puede ser de dos tipos: | |
138 |
|
138 | |||
139 | 1. Un metodo propio de esta clase: |
|
139 | 1. Un metodo propio de esta clase: | |
140 |
|
140 | |||
141 | operation.type = "self" |
|
141 | operation.type = "self" | |
142 |
|
142 | |||
143 | 2. El metodo "run" de un objeto del tipo Operation o de un derivado de ella: |
|
143 | 2. El metodo "run" de un objeto del tipo Operation o de un derivado de ella: | |
144 | operation.type = "other". |
|
144 | operation.type = "other". | |
145 |
|
145 | |||
146 | Este objeto de tipo Operation debe de haber sido agregado antes con el metodo: |
|
146 | Este objeto de tipo Operation debe de haber sido agregado antes con el metodo: | |
147 | "addOperation" e identificado con el operation.id |
|
147 | "addOperation" e identificado con el operation.id | |
148 |
|
148 | |||
149 |
|
149 | |||
150 | con el id de la operacion. |
|
150 | con el id de la operacion. | |
151 |
|
151 | |||
152 | Input: |
|
152 | Input: | |
153 |
|
153 | |||
154 | Operation : Objeto del tipo operacion con los atributos: name, type y id. |
|
154 | Operation : Objeto del tipo operacion con los atributos: name, type y id. | |
155 |
|
155 | |||
156 | """ |
|
156 | """ | |
157 |
|
157 | |||
158 | if operationConf.type == 'self': |
|
158 | if operationConf.type == 'self': | |
159 | sts = self.callMethod(operationConf.name, **kwargs) |
|
159 | sts = self.callMethod(operationConf.name, **kwargs) | |
160 |
|
160 | |||
161 | if operationConf.type == 'other': |
|
161 | if operationConf.type == 'other': | |
162 | sts = self.callObject(operationConf.id, **kwargs) |
|
162 | sts = self.callObject(operationConf.id, **kwargs) | |
163 |
|
163 | |||
164 | return sts |
|
164 | return sts | |
165 |
|
165 | |||
166 | def setInput(self, dataIn): |
|
166 | def setInput(self, dataIn): | |
167 |
|
167 | |||
168 | self.dataIn = dataIn |
|
168 | self.dataIn = dataIn | |
169 |
|
169 | |||
170 | def getOutput(self): |
|
170 | def getOutput(self): | |
171 |
|
171 | |||
172 | return self.dataOut |
|
172 | return self.dataOut | |
173 |
|
173 | |||
174 | class Operation(): |
|
174 | class Operation(): | |
175 |
|
175 | |||
176 | """ |
|
176 | """ | |
177 | Clase base para definir las operaciones adicionales que se pueden agregar a la clase ProcessingUnit |
|
177 | Clase base para definir las operaciones adicionales que se pueden agregar a la clase ProcessingUnit | |
178 | y necesiten acumular informacion previa de los datos a procesar. De preferencia usar un buffer de |
|
178 | y necesiten acumular informacion previa de los datos a procesar. De preferencia usar un buffer de | |
179 | acumulacion dentro de esta clase |
|
179 | acumulacion dentro de esta clase | |
180 |
|
180 | |||
181 | Ejemplo: Integraciones coherentes, necesita la informacion previa de los n perfiles anteriores (bufffer) |
|
181 | Ejemplo: Integraciones coherentes, necesita la informacion previa de los n perfiles anteriores (bufffer) | |
182 |
|
182 | |||
183 | """ |
|
183 | """ | |
184 |
|
184 | |||
185 | __buffer = None |
|
185 | __buffer = None | |
186 | __isConfig = False |
|
186 | __isConfig = False | |
187 |
|
187 | |||
188 | def __init__(self): |
|
188 | def __init__(self): | |
189 |
|
189 | |||
190 | pass |
|
190 | pass | |
191 |
|
191 | |||
192 | def run(self, dataIn, **kwargs): |
|
192 | def run(self, dataIn, **kwargs): | |
193 |
|
193 | |||
194 | """ |
|
194 | """ | |
195 | Realiza las operaciones necesarias sobre la dataIn.data y actualiza los atributos del objeto dataIn. |
|
195 | Realiza las operaciones necesarias sobre la dataIn.data y actualiza los atributos del objeto dataIn. | |
196 |
|
196 | |||
197 | Input: |
|
197 | Input: | |
198 |
|
198 | |||
199 | dataIn : objeto del tipo JROData |
|
199 | dataIn : objeto del tipo JROData | |
200 |
|
200 | |||
201 | Return: |
|
201 | Return: | |
202 |
|
202 | |||
203 | None |
|
203 | None | |
204 |
|
204 | |||
205 | Affected: |
|
205 | Affected: | |
206 | __buffer : buffer de recepcion de datos. |
|
206 | __buffer : buffer de recepcion de datos. | |
207 |
|
207 | |||
208 | """ |
|
208 | """ | |
209 |
|
209 | |||
210 | raise ValueError, "ImplementedError" |
|
210 | raise ValueError, "ImplementedError" | |
211 |
|
211 | |||
212 | class VoltageProc(ProcessingUnit): |
|
212 | class VoltageProc(ProcessingUnit): | |
213 |
|
213 | |||
214 |
|
214 | |||
215 | def __init__(self): |
|
215 | def __init__(self): | |
216 |
|
216 | |||
217 | self.objectDict = {} |
|
217 | self.objectDict = {} | |
218 | self.dataOut = Voltage() |
|
218 | self.dataOut = Voltage() | |
219 | self.flip = 1 |
|
219 | self.flip = 1 | |
220 |
|
220 | |||
221 | def init(self): |
|
221 | def init(self): | |
222 |
|
222 | |||
223 | self.dataOut.copy(self.dataIn) |
|
223 | self.dataOut.copy(self.dataIn) | |
224 | # No necesita copiar en cada init() los atributos de dataIn |
|
224 | # No necesita copiar en cada init() los atributos de dataIn | |
225 | # la copia deberia hacerse por cada nuevo bloque de datos |
|
225 | # la copia deberia hacerse por cada nuevo bloque de datos | |
226 |
|
226 | |||
227 | def selectChannels(self, channelList): |
|
227 | def selectChannels(self, channelList): | |
228 |
|
228 | |||
229 | channelIndexList = [] |
|
229 | channelIndexList = [] | |
230 |
|
230 | |||
231 | for channel in channelList: |
|
231 | for channel in channelList: | |
232 | index = self.dataOut.channelList.index(channel) |
|
232 | index = self.dataOut.channelList.index(channel) | |
233 | channelIndexList.append(index) |
|
233 | channelIndexList.append(index) | |
234 |
|
234 | |||
235 | self.selectChannelsByIndex(channelIndexList) |
|
235 | self.selectChannelsByIndex(channelIndexList) | |
236 |
|
236 | |||
237 | def selectChannelsByIndex(self, channelIndexList): |
|
237 | def selectChannelsByIndex(self, channelIndexList): | |
238 | """ |
|
238 | """ | |
239 | Selecciona un bloque de datos en base a canales segun el channelIndexList |
|
239 | Selecciona un bloque de datos en base a canales segun el channelIndexList | |
240 |
|
240 | |||
241 | Input: |
|
241 | Input: | |
242 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] |
|
242 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] | |
243 |
|
243 | |||
244 | Affected: |
|
244 | Affected: | |
245 | self.dataOut.data |
|
245 | self.dataOut.data | |
246 | self.dataOut.channelIndexList |
|
246 | self.dataOut.channelIndexList | |
247 | self.dataOut.nChannels |
|
247 | self.dataOut.nChannels | |
248 | self.dataOut.m_ProcessingHeader.totalSpectra |
|
248 | self.dataOut.m_ProcessingHeader.totalSpectra | |
249 | self.dataOut.systemHeaderObj.numChannels |
|
249 | self.dataOut.systemHeaderObj.numChannels | |
250 | self.dataOut.m_ProcessingHeader.blockSize |
|
250 | self.dataOut.m_ProcessingHeader.blockSize | |
251 |
|
251 | |||
252 | Return: |
|
252 | Return: | |
253 | None |
|
253 | None | |
254 | """ |
|
254 | """ | |
255 |
|
255 | |||
256 | for channelIndex in channelIndexList: |
|
256 | for channelIndex in channelIndexList: | |
257 | if channelIndex not in self.dataOut.channelIndexList: |
|
257 | if channelIndex not in self.dataOut.channelIndexList: | |
258 | print channelIndexList |
|
258 | print channelIndexList | |
259 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
259 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex | |
260 |
|
260 | |||
261 | nChannels = len(channelIndexList) |
|
261 | nChannels = len(channelIndexList) | |
262 |
|
262 | |||
263 | data = self.dataOut.data[channelIndexList,:] |
|
263 | data = self.dataOut.data[channelIndexList,:] | |
264 |
|
264 | |||
265 | self.dataOut.data = data |
|
265 | self.dataOut.data = data | |
266 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
266 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
267 | # self.dataOut.nChannels = nChannels |
|
267 | # self.dataOut.nChannels = nChannels | |
268 |
|
268 | |||
269 | return 1 |
|
269 | return 1 | |
270 |
|
270 | |||
271 | def selectHeights(self, minHei, maxHei): |
|
271 | def selectHeights(self, minHei, maxHei): | |
272 | """ |
|
272 | """ | |
273 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango |
|
273 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |
274 | minHei <= height <= maxHei |
|
274 | minHei <= height <= maxHei | |
275 |
|
275 | |||
276 | Input: |
|
276 | Input: | |
277 | minHei : valor minimo de altura a considerar |
|
277 | minHei : valor minimo de altura a considerar | |
278 | maxHei : valor maximo de altura a considerar |
|
278 | maxHei : valor maximo de altura a considerar | |
279 |
|
279 | |||
280 | Affected: |
|
280 | Affected: | |
281 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex |
|
281 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex | |
282 |
|
282 | |||
283 | Return: |
|
283 | Return: | |
284 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
284 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
285 | """ |
|
285 | """ | |
286 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): |
|
286 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): | |
287 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
287 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
288 |
|
288 | |||
289 | if (maxHei > self.dataOut.heightList[-1]): |
|
289 | if (maxHei > self.dataOut.heightList[-1]): | |
290 | maxHei = self.dataOut.heightList[-1] |
|
290 | maxHei = self.dataOut.heightList[-1] | |
291 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
291 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
292 |
|
292 | |||
293 | minIndex = 0 |
|
293 | minIndex = 0 | |
294 | maxIndex = 0 |
|
294 | maxIndex = 0 | |
295 | heights = self.dataOut.heightList |
|
295 | heights = self.dataOut.heightList | |
296 |
|
296 | |||
297 | inda = numpy.where(heights >= minHei) |
|
297 | inda = numpy.where(heights >= minHei) | |
298 | indb = numpy.where(heights <= maxHei) |
|
298 | indb = numpy.where(heights <= maxHei) | |
299 |
|
299 | |||
300 | try: |
|
300 | try: | |
301 | minIndex = inda[0][0] |
|
301 | minIndex = inda[0][0] | |
302 | except: |
|
302 | except: | |
303 | minIndex = 0 |
|
303 | minIndex = 0 | |
304 |
|
304 | |||
305 | try: |
|
305 | try: | |
306 | maxIndex = indb[0][-1] |
|
306 | maxIndex = indb[0][-1] | |
307 | except: |
|
307 | except: | |
308 | maxIndex = len(heights) |
|
308 | maxIndex = len(heights) | |
309 |
|
309 | |||
310 | self.selectHeightsByIndex(minIndex, maxIndex) |
|
310 | self.selectHeightsByIndex(minIndex, maxIndex) | |
311 |
|
311 | |||
312 | return 1 |
|
312 | return 1 | |
313 |
|
313 | |||
314 |
|
314 | |||
315 | def selectHeightsByIndex(self, minIndex, maxIndex): |
|
315 | def selectHeightsByIndex(self, minIndex, maxIndex): | |
316 | """ |
|
316 | """ | |
317 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango |
|
317 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |
318 | minIndex <= index <= maxIndex |
|
318 | minIndex <= index <= maxIndex | |
319 |
|
319 | |||
320 | Input: |
|
320 | Input: | |
321 | minIndex : valor de indice minimo de altura a considerar |
|
321 | minIndex : valor de indice minimo de altura a considerar | |
322 | maxIndex : valor de indice maximo de altura a considerar |
|
322 | maxIndex : valor de indice maximo de altura a considerar | |
323 |
|
323 | |||
324 | Affected: |
|
324 | Affected: | |
325 | self.dataOut.data |
|
325 | self.dataOut.data | |
326 | self.dataOut.heightList |
|
326 | self.dataOut.heightList | |
327 |
|
327 | |||
328 | Return: |
|
328 | Return: | |
329 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
329 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
330 | """ |
|
330 | """ | |
331 |
|
331 | |||
332 | if (minIndex < 0) or (minIndex > maxIndex): |
|
332 | if (minIndex < 0) or (minIndex > maxIndex): | |
333 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
333 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
334 |
|
334 | |||
335 | if (maxIndex >= self.dataOut.nHeights): |
|
335 | if (maxIndex >= self.dataOut.nHeights): | |
336 | maxIndex = self.dataOut.nHeights-1 |
|
336 | maxIndex = self.dataOut.nHeights-1 | |
337 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
337 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
338 |
|
338 | |||
339 | nHeights = maxIndex - minIndex + 1 |
|
339 | nHeights = maxIndex - minIndex + 1 | |
340 |
|
340 | |||
341 | #voltage |
|
341 | #voltage | |
342 | data = self.dataOut.data[:,minIndex:maxIndex+1] |
|
342 | data = self.dataOut.data[:,minIndex:maxIndex+1] | |
343 |
|
343 | |||
344 | firstHeight = self.dataOut.heightList[minIndex] |
|
344 | firstHeight = self.dataOut.heightList[minIndex] | |
345 |
|
345 | |||
346 | self.dataOut.data = data |
|
346 | self.dataOut.data = data | |
347 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] |
|
347 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] | |
348 |
|
348 | |||
349 | return 1 |
|
349 | return 1 | |
350 |
|
350 | |||
351 |
|
351 | |||
352 | def filterByHeights(self, window): |
|
352 | def filterByHeights(self, window): | |
353 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] |
|
353 | deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0] | |
354 |
|
354 | |||
355 | if window == None: |
|
355 | if window == None: | |
356 | window = self.dataOut.radarControllerHeaderObj.txA / deltaHeight |
|
356 | window = self.dataOut.radarControllerHeaderObj.txA / deltaHeight | |
357 |
|
357 | |||
358 | newdelta = deltaHeight * window |
|
358 | newdelta = deltaHeight * window | |
359 | r = self.dataOut.data.shape[1] % window |
|
359 | r = self.dataOut.data.shape[1] % window | |
360 | buffer = self.dataOut.data[:,0:self.dataOut.data.shape[1]-r] |
|
360 | buffer = self.dataOut.data[:,0:self.dataOut.data.shape[1]-r] | |
361 | buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window) |
|
361 | buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window) | |
362 | buffer = numpy.sum(buffer,2) |
|
362 | buffer = numpy.sum(buffer,2) | |
363 | self.dataOut.data = buffer |
|
363 | self.dataOut.data = buffer | |
364 | self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*self.dataOut.nHeights/window-newdelta,newdelta) |
|
364 | self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*self.dataOut.nHeights/window-newdelta,newdelta) | |
365 | self.dataOut.windowOfFilter = window |
|
365 | self.dataOut.windowOfFilter = window | |
366 |
|
366 | |||
367 | def deFlip(self): |
|
367 | def deFlip(self): | |
368 | self.dataOut.data *= self.flip |
|
368 | self.dataOut.data *= self.flip | |
369 | self.flip *= -1. |
|
369 | self.flip *= -1. | |
370 |
|
370 | |||
371 |
|
371 | |||
372 | class CohInt(Operation): |
|
372 | class CohInt(Operation): | |
373 |
|
373 | |||
374 | __isConfig = False |
|
374 | __isConfig = False | |
375 |
|
375 | |||
376 | __profIndex = 0 |
|
376 | __profIndex = 0 | |
377 | __withOverapping = False |
|
377 | __withOverapping = False | |
378 |
|
378 | |||
379 | __byTime = False |
|
379 | __byTime = False | |
380 | __initime = None |
|
380 | __initime = None | |
381 | __lastdatatime = None |
|
381 | __lastdatatime = None | |
382 | __integrationtime = None |
|
382 | __integrationtime = None | |
383 |
|
383 | |||
384 | __buffer = None |
|
384 | __buffer = None | |
385 |
|
385 | |||
386 | __dataReady = False |
|
386 | __dataReady = False | |
387 |
|
387 | |||
388 | n = None |
|
388 | n = None | |
389 |
|
389 | |||
390 |
|
390 | |||
391 | def __init__(self): |
|
391 | def __init__(self): | |
392 |
|
392 | |||
393 | self.__isConfig = False |
|
393 | self.__isConfig = False | |
394 |
|
394 | |||
395 | def setup(self, n=None, timeInterval=None, overlapping=False): |
|
395 | def setup(self, n=None, timeInterval=None, overlapping=False): | |
396 | """ |
|
396 | """ | |
397 | Set the parameters of the integration class. |
|
397 | Set the parameters of the integration class. | |
398 |
|
398 | |||
399 | Inputs: |
|
399 | Inputs: | |
400 |
|
400 | |||
401 | n : Number of coherent integrations |
|
401 | n : Number of coherent integrations | |
402 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work |
|
402 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work | |
403 | overlapping : |
|
403 | overlapping : | |
404 |
|
404 | |||
405 | """ |
|
405 | """ | |
406 |
|
406 | |||
407 | self.__initime = None |
|
407 | self.__initime = None | |
408 | self.__lastdatatime = 0 |
|
408 | self.__lastdatatime = 0 | |
409 | self.__buffer = None |
|
409 | self.__buffer = None | |
410 | self.__dataReady = False |
|
410 | self.__dataReady = False | |
411 |
|
411 | |||
412 |
|
412 | |||
413 | if n == None and timeInterval == None: |
|
413 | if n == None and timeInterval == None: | |
414 | raise ValueError, "n or timeInterval should be specified ..." |
|
414 | raise ValueError, "n or timeInterval should be specified ..." | |
415 |
|
415 | |||
416 | if n != None: |
|
416 | if n != None: | |
417 | self.n = n |
|
417 | self.n = n | |
418 | self.__byTime = False |
|
418 | self.__byTime = False | |
419 | else: |
|
419 | else: | |
420 | self.__integrationtime = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line |
|
420 | self.__integrationtime = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line | |
421 | self.n = 9999 |
|
421 | self.n = 9999 | |
422 | self.__byTime = True |
|
422 | self.__byTime = True | |
423 |
|
423 | |||
424 | if overlapping: |
|
424 | if overlapping: | |
425 | self.__withOverapping = True |
|
425 | self.__withOverapping = True | |
426 | self.__buffer = None |
|
426 | self.__buffer = None | |
427 | else: |
|
427 | else: | |
428 | self.__withOverapping = False |
|
428 | self.__withOverapping = False | |
429 | self.__buffer = 0 |
|
429 | self.__buffer = 0 | |
430 |
|
430 | |||
431 | self.__profIndex = 0 |
|
431 | self.__profIndex = 0 | |
432 |
|
432 | |||
433 | def putData(self, data): |
|
433 | def putData(self, data): | |
434 |
|
434 | |||
435 | """ |
|
435 | """ | |
436 | Add a profile to the __buffer and increase in one the __profileIndex |
|
436 | Add a profile to the __buffer and increase in one the __profileIndex | |
437 |
|
437 | |||
438 | """ |
|
438 | """ | |
439 |
|
439 | |||
440 | if not self.__withOverapping: |
|
440 | if not self.__withOverapping: | |
441 | self.__buffer += data.copy() |
|
441 | self.__buffer += data.copy() | |
442 | self.__profIndex += 1 |
|
442 | self.__profIndex += 1 | |
443 | return |
|
443 | return | |
444 |
|
444 | |||
445 | #Overlapping data |
|
445 | #Overlapping data | |
446 | nChannels, nHeis = data.shape |
|
446 | nChannels, nHeis = data.shape | |
447 | data = numpy.reshape(data, (1, nChannels, nHeis)) |
|
447 | data = numpy.reshape(data, (1, nChannels, nHeis)) | |
448 |
|
448 | |||
449 | #If the buffer is empty then it takes the data value |
|
449 | #If the buffer is empty then it takes the data value | |
450 | if self.__buffer == None: |
|
450 | if self.__buffer == None: | |
451 | self.__buffer = data |
|
451 | self.__buffer = data | |
452 | self.__profIndex += 1 |
|
452 | self.__profIndex += 1 | |
453 | return |
|
453 | return | |
454 |
|
454 | |||
455 | #If the buffer length is lower than n then stakcing the data value |
|
455 | #If the buffer length is lower than n then stakcing the data value | |
456 | if self.__profIndex < self.n: |
|
456 | if self.__profIndex < self.n: | |
457 | self.__buffer = numpy.vstack((self.__buffer, data)) |
|
457 | self.__buffer = numpy.vstack((self.__buffer, data)) | |
458 | self.__profIndex += 1 |
|
458 | self.__profIndex += 1 | |
459 | return |
|
459 | return | |
460 |
|
460 | |||
461 | #If the buffer length is equal to n then replacing the last buffer value with the data value |
|
461 | #If the buffer length is equal to n then replacing the last buffer value with the data value | |
462 | self.__buffer = numpy.roll(self.__buffer, -1, axis=0) |
|
462 | self.__buffer = numpy.roll(self.__buffer, -1, axis=0) | |
463 | self.__buffer[self.n-1] = data |
|
463 | self.__buffer[self.n-1] = data | |
464 | self.__profIndex = self.n |
|
464 | self.__profIndex = self.n | |
465 | return |
|
465 | return | |
466 |
|
466 | |||
467 |
|
467 | |||
468 | def pushData(self): |
|
468 | def pushData(self): | |
469 | """ |
|
469 | """ | |
470 | Return the sum of the last profiles and the profiles used in the sum. |
|
470 | Return the sum of the last profiles and the profiles used in the sum. | |
471 |
|
471 | |||
472 | Affected: |
|
472 | Affected: | |
473 |
|
473 | |||
474 | self.__profileIndex |
|
474 | self.__profileIndex | |
475 |
|
475 | |||
476 | """ |
|
476 | """ | |
477 |
|
477 | |||
478 | if not self.__withOverapping: |
|
478 | if not self.__withOverapping: | |
479 | data = self.__buffer |
|
479 | data = self.__buffer | |
480 | n = self.__profIndex |
|
480 | n = self.__profIndex | |
481 |
|
481 | |||
482 | self.__buffer = 0 |
|
482 | self.__buffer = 0 | |
483 | self.__profIndex = 0 |
|
483 | self.__profIndex = 0 | |
484 |
|
484 | |||
485 | return data, n |
|
485 | return data, n | |
486 |
|
486 | |||
487 | #Integration with Overlapping |
|
487 | #Integration with Overlapping | |
488 | data = numpy.sum(self.__buffer, axis=0) |
|
488 | data = numpy.sum(self.__buffer, axis=0) | |
489 | n = self.__profIndex |
|
489 | n = self.__profIndex | |
490 |
|
490 | |||
491 | return data, n |
|
491 | return data, n | |
492 |
|
492 | |||
493 | def byProfiles(self, data): |
|
493 | def byProfiles(self, data): | |
494 |
|
494 | |||
495 | self.__dataReady = False |
|
495 | self.__dataReady = False | |
496 | avgdata = None |
|
496 | avgdata = None | |
497 | n = None |
|
497 | n = None | |
498 |
|
498 | |||
499 | self.putData(data) |
|
499 | self.putData(data) | |
500 |
|
500 | |||
501 | if self.__profIndex == self.n: |
|
501 | if self.__profIndex == self.n: | |
502 |
|
502 | |||
503 | avgdata, n = self.pushData() |
|
503 | avgdata, n = self.pushData() | |
504 | self.__dataReady = True |
|
504 | self.__dataReady = True | |
505 |
|
505 | |||
506 | return avgdata |
|
506 | return avgdata | |
507 |
|
507 | |||
508 | def byTime(self, data, datatime): |
|
508 | def byTime(self, data, datatime): | |
509 |
|
509 | |||
510 | self.__dataReady = False |
|
510 | self.__dataReady = False | |
511 | avgdata = None |
|
511 | avgdata = None | |
512 | n = None |
|
512 | n = None | |
513 |
|
513 | |||
514 | self.putData(data) |
|
514 | self.putData(data) | |
515 |
|
515 | |||
516 | if (datatime - self.__initime) >= self.__integrationtime: |
|
516 | if (datatime - self.__initime) >= self.__integrationtime: | |
517 | avgdata, n = self.pushData() |
|
517 | avgdata, n = self.pushData() | |
518 | self.n = n |
|
518 | self.n = n | |
519 | self.__dataReady = True |
|
519 | self.__dataReady = True | |
520 |
|
520 | |||
521 | return avgdata |
|
521 | return avgdata | |
522 |
|
522 | |||
523 | def integrate(self, data, datatime=None): |
|
523 | def integrate(self, data, datatime=None): | |
524 |
|
524 | |||
525 | if self.__initime == None: |
|
525 | if self.__initime == None: | |
526 | self.__initime = datatime |
|
526 | self.__initime = datatime | |
527 |
|
527 | |||
528 | if self.__byTime: |
|
528 | if self.__byTime: | |
529 | avgdata = self.byTime(data, datatime) |
|
529 | avgdata = self.byTime(data, datatime) | |
530 | else: |
|
530 | else: | |
531 | avgdata = self.byProfiles(data) |
|
531 | avgdata = self.byProfiles(data) | |
532 |
|
532 | |||
533 |
|
533 | |||
534 | self.__lastdatatime = datatime |
|
534 | self.__lastdatatime = datatime | |
535 |
|
535 | |||
536 | if avgdata == None: |
|
536 | if avgdata == None: | |
537 | return None, None |
|
537 | return None, None | |
538 |
|
538 | |||
539 | avgdatatime = self.__initime |
|
539 | avgdatatime = self.__initime | |
540 |
|
540 | |||
541 | deltatime = datatime -self.__lastdatatime |
|
541 | deltatime = datatime -self.__lastdatatime | |
542 |
|
542 | |||
543 | if not self.__withOverapping: |
|
543 | if not self.__withOverapping: | |
544 | self.__initime = datatime |
|
544 | self.__initime = datatime | |
545 | else: |
|
545 | else: | |
546 | self.__initime += deltatime |
|
546 | self.__initime += deltatime | |
547 |
|
547 | |||
548 | return avgdata, avgdatatime |
|
548 | return avgdata, avgdatatime | |
549 |
|
549 | |||
550 | def run(self, dataOut, **kwargs): |
|
550 | def run(self, dataOut, **kwargs): | |
551 |
|
551 | |||
552 | if not self.__isConfig: |
|
552 | if not self.__isConfig: | |
553 | self.setup(**kwargs) |
|
553 | self.setup(**kwargs) | |
554 | self.__isConfig = True |
|
554 | self.__isConfig = True | |
555 |
|
555 | |||
556 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) |
|
556 | avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime) | |
557 |
|
557 | |||
558 | # dataOut.timeInterval *= n |
|
558 | # dataOut.timeInterval *= n | |
559 | dataOut.flagNoData = True |
|
559 | dataOut.flagNoData = True | |
560 |
|
560 | |||
561 | if self.__dataReady: |
|
561 | if self.__dataReady: | |
562 | dataOut.data = avgdata |
|
562 | dataOut.data = avgdata | |
563 | dataOut.nCohInt *= self.n |
|
563 | dataOut.nCohInt *= self.n | |
564 | dataOut.utctime = avgdatatime |
|
564 | dataOut.utctime = avgdatatime | |
565 | dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt |
|
565 | dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt | |
566 | dataOut.flagNoData = False |
|
566 | dataOut.flagNoData = False | |
567 |
|
567 | |||
568 |
|
568 | |||
569 | class Decoder(Operation): |
|
569 | class Decoder(Operation): | |
570 |
|
570 | |||
571 | __isConfig = False |
|
571 | __isConfig = False | |
572 | __profIndex = 0 |
|
572 | __profIndex = 0 | |
573 |
|
573 | |||
574 | code = None |
|
574 | code = None | |
575 |
|
575 | |||
576 | nCode = None |
|
576 | nCode = None | |
577 | nBaud = None |
|
577 | nBaud = None | |
578 |
|
578 | |||
579 | def __init__(self): |
|
579 | def __init__(self): | |
580 |
|
580 | |||
581 | self.__isConfig = False |
|
581 | self.__isConfig = False | |
582 |
|
582 | |||
583 | def setup(self, code): |
|
583 | def setup(self, code): | |
584 |
|
584 | |||
585 | self.__profIndex = 0 |
|
585 | self.__profIndex = 0 | |
586 |
|
586 | |||
587 | self.code = code |
|
587 | self.code = code | |
588 |
|
588 | |||
589 | self.nCode = len(code) |
|
589 | self.nCode = len(code) | |
590 | self.nBaud = len(code[0]) |
|
590 | self.nBaud = len(code[0]) | |
591 |
|
591 | |||
592 | def convolutionInFreq(self, data): |
|
592 | def convolutionInFreq(self, data): | |
593 |
|
593 | |||
594 | nchannel, ndata = data.shape |
|
594 | nchannel, ndata = data.shape | |
595 | newcode = numpy.zeros(ndata) |
|
595 | newcode = numpy.zeros(ndata) | |
596 | newcode[0:self.nBaud] = self.code[self.__profIndex] |
|
596 | newcode[0:self.nBaud] = self.code[self.__profIndex] | |
597 |
|
597 | |||
598 | fft_data = numpy.fft.fft(data, axis=1) |
|
598 | fft_data = numpy.fft.fft(data, axis=1) | |
599 | fft_code = numpy.conj(numpy.fft.fft(newcode)) |
|
599 | fft_code = numpy.conj(numpy.fft.fft(newcode)) | |
600 | fft_code = fft_code.reshape(1,len(fft_code)) |
|
600 | fft_code = fft_code.reshape(1,len(fft_code)) | |
601 |
|
601 | |||
602 | # conv = fft_data.copy() |
|
602 | # conv = fft_data.copy() | |
603 | # conv.fill(0) |
|
603 | # conv.fill(0) | |
604 |
|
604 | |||
605 | conv = fft_data*fft_code |
|
605 | conv = fft_data*fft_code | |
606 |
|
606 | |||
607 | data = numpy.fft.ifft(conv,axis=1) |
|
607 | data = numpy.fft.ifft(conv,axis=1) | |
608 |
|
608 | |||
609 | datadec = data[:,:-self.nBaud+1] |
|
609 | datadec = data[:,:-self.nBaud+1] | |
610 | ndatadec = ndata - self.nBaud + 1 |
|
610 | ndatadec = ndata - self.nBaud + 1 | |
611 |
|
611 | |||
612 | if self.__profIndex == self.nCode-1: |
|
612 | if self.__profIndex == self.nCode-1: | |
613 | self.__profIndex = 0 |
|
613 | self.__profIndex = 0 | |
614 | return ndatadec, datadec |
|
614 | return ndatadec, datadec | |
615 |
|
615 | |||
616 | self.__profIndex += 1 |
|
616 | self.__profIndex += 1 | |
617 |
|
617 | |||
618 | return ndatadec, datadec |
|
618 | return ndatadec, datadec | |
619 |
|
619 | |||
620 |
|
620 | |||
621 | def convolutionInTime(self, data): |
|
621 | def convolutionInTime(self, data): | |
622 |
|
622 | |||
623 | nchannel, ndata = data.shape |
|
623 | nchannel, ndata = data.shape | |
624 | newcode = self.code[self.__profIndex] |
|
624 | newcode = self.code[self.__profIndex] | |
625 | ndatadec = ndata - self.nBaud + 1 |
|
625 | ndatadec = ndata - self.nBaud + 1 | |
626 |
|
626 | |||
627 | datadec = numpy.zeros((nchannel, ndatadec)) |
|
627 | datadec = numpy.zeros((nchannel, ndatadec)) | |
628 |
|
628 | |||
629 | for i in range(nchannel): |
|
629 | for i in range(nchannel): | |
630 | datadec[i,:] = numpy.correlate(data[i,:], newcode) |
|
630 | datadec[i,:] = numpy.correlate(data[i,:], newcode) | |
631 |
|
631 | |||
632 | if self.__profIndex == self.nCode-1: |
|
632 | if self.__profIndex == self.nCode-1: | |
633 | self.__profIndex = 0 |
|
633 | self.__profIndex = 0 | |
634 | return ndatadec, datadec |
|
634 | return ndatadec, datadec | |
635 |
|
635 | |||
636 | self.__profIndex += 1 |
|
636 | self.__profIndex += 1 | |
637 |
|
637 | |||
638 | return ndatadec, datadec |
|
638 | return ndatadec, datadec | |
639 |
|
639 | |||
640 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0): |
|
640 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0): | |
641 |
|
641 | |||
642 | if not self.__isConfig: |
|
642 | if not self.__isConfig: | |
643 | if code != None: |
|
643 | if code != None: | |
644 | code = numpy.array(code).reshape(nCode,nBaud) |
|
644 | code = numpy.array(code).reshape(nCode,nBaud) | |
645 | dataOut.code = code |
|
645 | dataOut.code = code | |
646 | dataOut.nCode = nCode |
|
646 | dataOut.nCode = nCode | |
647 | dataOut.nBaud = nBaud |
|
647 | dataOut.nBaud = nBaud | |
648 | if code == None: |
|
648 | if code == None: | |
649 | code = dataOut.code |
|
649 | code = dataOut.code | |
650 |
|
650 | |||
651 | self.setup(code) |
|
651 | self.setup(code) | |
652 | self.__isConfig = True |
|
652 | self.__isConfig = True | |
653 |
|
653 | |||
654 | if mode == 0: |
|
654 | if mode == 0: | |
655 | ndatadec, datadec = self.convolutionInFreq(dataOut.data) |
|
655 | ndatadec, datadec = self.convolutionInFreq(dataOut.data) | |
656 |
|
656 | |||
657 | if mode == 1: |
|
657 | if mode == 1: | |
658 | print "This function is not implemented" |
|
658 | print "This function is not implemented" | |
659 | # ndatadec, datadec = self.convolutionInTime(dataOut.data) |
|
659 | # ndatadec, datadec = self.convolutionInTime(dataOut.data) | |
660 |
|
660 | |||
661 | dataOut.data = datadec |
|
661 | dataOut.data = datadec | |
662 |
|
662 | |||
663 | dataOut.heightList = dataOut.heightList[0:ndatadec] |
|
663 | dataOut.heightList = dataOut.heightList[0:ndatadec] | |
664 |
|
664 | |||
665 | dataOut.flagDecodeData = True #asumo q la data no esta decodificada |
|
665 | dataOut.flagDecodeData = True #asumo q la data no esta decodificada | |
666 |
|
666 | |||
667 | # dataOut.flagDeflipData = True #asumo q la data no esta sin flip |
|
667 | # dataOut.flagDeflipData = True #asumo q la data no esta sin flip | |
668 |
|
668 | |||
669 |
|
669 | |||
670 | class SpectraProc(ProcessingUnit): |
|
670 | class SpectraProc(ProcessingUnit): | |
671 |
|
671 | |||
672 | def __init__(self): |
|
672 | def __init__(self): | |
673 |
|
673 | |||
674 | self.objectDict = {} |
|
674 | self.objectDict = {} | |
675 | self.buffer = None |
|
675 | self.buffer = None | |
676 | self.firstdatatime = None |
|
676 | self.firstdatatime = None | |
677 | self.profIndex = 0 |
|
677 | self.profIndex = 0 | |
678 | self.dataOut = Spectra() |
|
678 | self.dataOut = Spectra() | |
679 |
|
679 | |||
680 | def __updateObjFromInput(self): |
|
680 | def __updateObjFromInput(self): | |
681 |
|
681 | |||
682 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy() |
|
682 | self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy() | |
683 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy() |
|
683 | self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy() | |
684 | self.dataOut.channelList = self.dataIn.channelList |
|
684 | self.dataOut.channelList = self.dataIn.channelList | |
685 | self.dataOut.heightList = self.dataIn.heightList |
|
685 | self.dataOut.heightList = self.dataIn.heightList | |
686 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) |
|
686 | self.dataOut.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) | |
687 | # self.dataOut.nHeights = self.dataIn.nHeights |
|
687 | # self.dataOut.nHeights = self.dataIn.nHeights | |
688 | # self.dataOut.nChannels = self.dataIn.nChannels |
|
688 | # self.dataOut.nChannels = self.dataIn.nChannels | |
689 | self.dataOut.nBaud = self.dataIn.nBaud |
|
689 | self.dataOut.nBaud = self.dataIn.nBaud | |
690 | self.dataOut.nCode = self.dataIn.nCode |
|
690 | self.dataOut.nCode = self.dataIn.nCode | |
691 | self.dataOut.code = self.dataIn.code |
|
691 | self.dataOut.code = self.dataIn.code | |
692 | self.dataOut.nProfiles = self.dataOut.nFFTPoints |
|
692 | self.dataOut.nProfiles = self.dataOut.nFFTPoints | |
693 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList |
|
693 | # self.dataOut.channelIndexList = self.dataIn.channelIndexList | |
694 | self.dataOut.flagTimeBlock = self.dataIn.flagTimeBlock |
|
694 | self.dataOut.flagTimeBlock = self.dataIn.flagTimeBlock | |
695 | self.dataOut.utctime = self.firstdatatime |
|
695 | self.dataOut.utctime = self.firstdatatime | |
696 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada |
|
696 | self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada | |
697 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip |
|
697 | self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip | |
698 | self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT |
|
698 | self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT | |
699 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
699 | self.dataOut.nCohInt = self.dataIn.nCohInt | |
700 | self.dataOut.nIncohInt = 1 |
|
700 | self.dataOut.nIncohInt = 1 | |
701 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
701 | self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
702 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter |
|
702 | self.dataOut.windowOfFilter = self.dataIn.windowOfFilter | |
703 |
|
703 | |||
704 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nIncohInt |
|
704 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nIncohInt | |
705 |
|
705 | |||
706 | def __getFft(self): |
|
706 | def __getFft(self): | |
707 | """ |
|
707 | """ | |
708 | Convierte valores de Voltaje a Spectra |
|
708 | Convierte valores de Voltaje a Spectra | |
709 |
|
709 | |||
710 | Affected: |
|
710 | Affected: | |
711 | self.dataOut.data_spc |
|
711 | self.dataOut.data_spc | |
712 | self.dataOut.data_cspc |
|
712 | self.dataOut.data_cspc | |
713 | self.dataOut.data_dc |
|
713 | self.dataOut.data_dc | |
714 | self.dataOut.heightList |
|
714 | self.dataOut.heightList | |
715 | self.profIndex |
|
715 | self.profIndex | |
716 | self.buffer |
|
716 | self.buffer | |
717 | self.dataOut.flagNoData |
|
717 | self.dataOut.flagNoData | |
718 | """ |
|
718 | """ | |
719 | fft_volt = numpy.fft.fft(self.buffer,axis=1) |
|
719 | fft_volt = numpy.fft.fft(self.buffer,axis=1) | |
720 | fft_volt = fft_volt.astype(numpy.dtype('complex')) |
|
720 | fft_volt = fft_volt.astype(numpy.dtype('complex')) | |
721 | dc = fft_volt[:,0,:] |
|
721 | dc = fft_volt[:,0,:] | |
722 |
|
722 | |||
723 | #calculo de self-spectra |
|
723 | #calculo de self-spectra | |
724 | fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,)) |
|
724 | fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,)) | |
725 | spc = fft_volt * numpy.conjugate(fft_volt) |
|
725 | spc = fft_volt * numpy.conjugate(fft_volt) | |
726 | spc = spc.real |
|
726 | spc = spc.real | |
727 |
|
727 | |||
728 | blocksize = 0 |
|
728 | blocksize = 0 | |
729 | blocksize += dc.size |
|
729 | blocksize += dc.size | |
730 | blocksize += spc.size |
|
730 | blocksize += spc.size | |
731 |
|
731 | |||
732 | cspc = None |
|
732 | cspc = None | |
733 | pairIndex = 0 |
|
733 | pairIndex = 0 | |
734 | if self.dataOut.pairsList != None: |
|
734 | if self.dataOut.pairsList != None: | |
735 | #calculo de cross-spectra |
|
735 | #calculo de cross-spectra | |
736 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') |
|
736 | cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex') | |
737 | for pair in self.dataOut.pairsList: |
|
737 | for pair in self.dataOut.pairsList: | |
738 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) |
|
738 | cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:]) | |
739 | pairIndex += 1 |
|
739 | pairIndex += 1 | |
740 | blocksize += cspc.size |
|
740 | blocksize += cspc.size | |
741 |
|
741 | |||
742 | self.dataOut.data_spc = spc |
|
742 | self.dataOut.data_spc = spc | |
743 | self.dataOut.data_cspc = cspc |
|
743 | self.dataOut.data_cspc = cspc | |
744 | self.dataOut.data_dc = dc |
|
744 | self.dataOut.data_dc = dc | |
745 | self.dataOut.blockSize = blocksize |
|
745 | self.dataOut.blockSize = blocksize | |
746 |
|
746 | |||
747 | def init(self, nFFTPoints=None, pairsList=None): |
|
747 | def init(self, nFFTPoints=None, pairsList=None): | |
748 |
|
748 | |||
749 | self.dataOut.flagNoData = True |
|
749 | self.dataOut.flagNoData = True | |
750 |
|
750 | |||
751 | if self.dataIn.type == "Spectra": |
|
751 | if self.dataIn.type == "Spectra": | |
752 | self.dataOut.copy(self.dataIn) |
|
752 | self.dataOut.copy(self.dataIn) | |
753 | return |
|
753 | return | |
754 |
|
754 | |||
755 | if self.dataIn.type == "Voltage": |
|
755 | if self.dataIn.type == "Voltage": | |
756 |
|
756 | |||
757 | if nFFTPoints == None: |
|
757 | if nFFTPoints == None: | |
758 | raise ValueError, "This SpectraProc.init() need nFFTPoints input variable" |
|
758 | raise ValueError, "This SpectraProc.init() need nFFTPoints input variable" | |
759 |
|
759 | |||
760 | if pairsList == None: |
|
760 | if pairsList == None: | |
761 | nPairs = 0 |
|
761 | nPairs = 0 | |
762 | else: |
|
762 | else: | |
763 | nPairs = len(pairsList) |
|
763 | nPairs = len(pairsList) | |
764 |
|
764 | |||
765 | self.dataOut.nFFTPoints = nFFTPoints |
|
765 | self.dataOut.nFFTPoints = nFFTPoints | |
766 | self.dataOut.pairsList = pairsList |
|
766 | self.dataOut.pairsList = pairsList | |
767 | self.dataOut.nPairs = nPairs |
|
767 | self.dataOut.nPairs = nPairs | |
768 |
|
768 | |||
769 | if self.buffer == None: |
|
769 | if self.buffer == None: | |
770 | self.buffer = numpy.zeros((self.dataIn.nChannels, |
|
770 | self.buffer = numpy.zeros((self.dataIn.nChannels, | |
771 | self.dataOut.nFFTPoints, |
|
771 | self.dataOut.nFFTPoints, | |
772 | self.dataIn.nHeights), |
|
772 | self.dataIn.nHeights), | |
773 | dtype='complex') |
|
773 | dtype='complex') | |
774 |
|
774 | |||
775 |
|
775 | |||
776 | self.buffer[:,self.profIndex,:] = self.dataIn.data.copy() |
|
776 | self.buffer[:,self.profIndex,:] = self.dataIn.data.copy() | |
777 | self.profIndex += 1 |
|
777 | self.profIndex += 1 | |
778 |
|
778 | |||
779 | if self.firstdatatime == None: |
|
779 | if self.firstdatatime == None: | |
780 | self.firstdatatime = self.dataIn.utctime |
|
780 | self.firstdatatime = self.dataIn.utctime | |
781 |
|
781 | |||
782 | if self.profIndex == self.dataOut.nFFTPoints: |
|
782 | if self.profIndex == self.dataOut.nFFTPoints: | |
783 | self.__updateObjFromInput() |
|
783 | self.__updateObjFromInput() | |
784 | self.__getFft() |
|
784 | self.__getFft() | |
785 |
|
785 | |||
786 | self.dataOut.flagNoData = False |
|
786 | self.dataOut.flagNoData = False | |
787 |
|
787 | |||
788 | self.buffer = None |
|
788 | self.buffer = None | |
789 | self.firstdatatime = None |
|
789 | self.firstdatatime = None | |
790 | self.profIndex = 0 |
|
790 | self.profIndex = 0 | |
791 |
|
791 | |||
792 | return |
|
792 | return | |
793 |
|
793 | |||
794 | raise ValuError, "The type object %s is not valid"%(self.dataIn.type) |
|
794 | raise ValuError, "The type object %s is not valid"%(self.dataIn.type) | |
795 |
|
795 | |||
796 | def selectChannels(self, channelList): |
|
796 | def selectChannels(self, channelList): | |
797 |
|
797 | |||
798 | channelIndexList = [] |
|
798 | channelIndexList = [] | |
799 |
|
799 | |||
800 | for channel in channelList: |
|
800 | for channel in channelList: | |
801 | index = self.dataOut.channelList.index(channel) |
|
801 | index = self.dataOut.channelList.index(channel) | |
802 | channelIndexList.append(index) |
|
802 | channelIndexList.append(index) | |
803 |
|
803 | |||
804 | self.selectChannelsByIndex(channelIndexList) |
|
804 | self.selectChannelsByIndex(channelIndexList) | |
805 |
|
805 | |||
806 | def selectChannelsByIndex(self, channelIndexList): |
|
806 | def selectChannelsByIndex(self, channelIndexList): | |
807 | """ |
|
807 | """ | |
808 | Selecciona un bloque de datos en base a canales segun el channelIndexList |
|
808 | Selecciona un bloque de datos en base a canales segun el channelIndexList | |
809 |
|
809 | |||
810 | Input: |
|
810 | Input: | |
811 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] |
|
811 | channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7] | |
812 |
|
812 | |||
813 | Affected: |
|
813 | Affected: | |
814 | self.dataOut.data_spc |
|
814 | self.dataOut.data_spc | |
815 | self.dataOut.channelIndexList |
|
815 | self.dataOut.channelIndexList | |
816 | self.dataOut.nChannels |
|
816 | self.dataOut.nChannels | |
817 |
|
817 | |||
818 | Return: |
|
818 | Return: | |
819 | None |
|
819 | None | |
820 | """ |
|
820 | """ | |
821 |
|
821 | |||
822 | for channelIndex in channelIndexList: |
|
822 | for channelIndex in channelIndexList: | |
823 | if channelIndex not in self.dataOut.channelIndexList: |
|
823 | if channelIndex not in self.dataOut.channelIndexList: | |
824 | print channelIndexList |
|
824 | print channelIndexList | |
825 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex |
|
825 | raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex | |
826 |
|
826 | |||
827 | nChannels = len(channelIndexList) |
|
827 | nChannels = len(channelIndexList) | |
828 |
|
828 | |||
829 | data_spc = self.dataOut.data_spc[channelIndexList,:] |
|
829 | data_spc = self.dataOut.data_spc[channelIndexList,:] | |
830 |
|
830 | |||
831 | self.dataOut.data_spc = data_spc |
|
831 | self.dataOut.data_spc = data_spc | |
832 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] |
|
832 | self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList] | |
833 | # self.dataOut.nChannels = nChannels |
|
833 | # self.dataOut.nChannels = nChannels | |
834 |
|
834 | |||
835 | return 1 |
|
835 | return 1 | |
836 |
|
836 | |||
837 | def selectHeights(self, minHei, maxHei): |
|
837 | def selectHeights(self, minHei, maxHei): | |
838 | """ |
|
838 | """ | |
839 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango |
|
839 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |
840 | minHei <= height <= maxHei |
|
840 | minHei <= height <= maxHei | |
841 |
|
841 | |||
842 | Input: |
|
842 | Input: | |
843 | minHei : valor minimo de altura a considerar |
|
843 | minHei : valor minimo de altura a considerar | |
844 | maxHei : valor maximo de altura a considerar |
|
844 | maxHei : valor maximo de altura a considerar | |
845 |
|
845 | |||
846 | Affected: |
|
846 | Affected: | |
847 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex |
|
847 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex | |
848 |
|
848 | |||
849 | Return: |
|
849 | Return: | |
850 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
850 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
851 | """ |
|
851 | """ | |
852 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): |
|
852 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): | |
853 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
853 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
854 |
|
854 | |||
855 | if (maxHei > self.dataOut.heightList[-1]): |
|
855 | if (maxHei > self.dataOut.heightList[-1]): | |
856 | maxHei = self.dataOut.heightList[-1] |
|
856 | maxHei = self.dataOut.heightList[-1] | |
857 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
857 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
858 |
|
858 | |||
859 | minIndex = 0 |
|
859 | minIndex = 0 | |
860 | maxIndex = 0 |
|
860 | maxIndex = 0 | |
861 | heights = self.dataOut.heightList |
|
861 | heights = self.dataOut.heightList | |
862 |
|
862 | |||
863 | inda = numpy.where(heights >= minHei) |
|
863 | inda = numpy.where(heights >= minHei) | |
864 | indb = numpy.where(heights <= maxHei) |
|
864 | indb = numpy.where(heights <= maxHei) | |
865 |
|
865 | |||
866 | try: |
|
866 | try: | |
867 | minIndex = inda[0][0] |
|
867 | minIndex = inda[0][0] | |
868 | except: |
|
868 | except: | |
869 | minIndex = 0 |
|
869 | minIndex = 0 | |
870 |
|
870 | |||
871 | try: |
|
871 | try: | |
872 | maxIndex = indb[0][-1] |
|
872 | maxIndex = indb[0][-1] | |
873 | except: |
|
873 | except: | |
874 | maxIndex = len(heights) |
|
874 | maxIndex = len(heights) | |
875 |
|
875 | |||
876 | self.selectHeightsByIndex(minIndex, maxIndex) |
|
876 | self.selectHeightsByIndex(minIndex, maxIndex) | |
877 |
|
877 | |||
878 | return 1 |
|
878 | return 1 | |
879 |
|
879 | |||
880 |
|
880 | |||
881 | def selectHeightsByIndex(self, minIndex, maxIndex): |
|
881 | def selectHeightsByIndex(self, minIndex, maxIndex): | |
882 | """ |
|
882 | """ | |
883 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango |
|
883 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |
884 | minIndex <= index <= maxIndex |
|
884 | minIndex <= index <= maxIndex | |
885 |
|
885 | |||
886 | Input: |
|
886 | Input: | |
887 | minIndex : valor de indice minimo de altura a considerar |
|
887 | minIndex : valor de indice minimo de altura a considerar | |
888 | maxIndex : valor de indice maximo de altura a considerar |
|
888 | maxIndex : valor de indice maximo de altura a considerar | |
889 |
|
889 | |||
890 | Affected: |
|
890 | Affected: | |
891 | self.dataOut.data_spc |
|
891 | self.dataOut.data_spc | |
892 | self.dataOut.data_cspc |
|
892 | self.dataOut.data_cspc | |
893 | self.dataOut.data_dc |
|
893 | self.dataOut.data_dc | |
894 | self.dataOut.heightList |
|
894 | self.dataOut.heightList | |
895 |
|
895 | |||
896 | Return: |
|
896 | Return: | |
897 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
897 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
898 | """ |
|
898 | """ | |
899 |
|
899 | |||
900 | if (minIndex < 0) or (minIndex > maxIndex): |
|
900 | if (minIndex < 0) or (minIndex > maxIndex): | |
901 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
901 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
902 |
|
902 | |||
903 | if (maxIndex >= self.dataOut.nHeights): |
|
903 | if (maxIndex >= self.dataOut.nHeights): | |
904 | maxIndex = self.dataOut.nHeights-1 |
|
904 | maxIndex = self.dataOut.nHeights-1 | |
905 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
905 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
906 |
|
906 | |||
907 | nHeights = maxIndex - minIndex + 1 |
|
907 | nHeights = maxIndex - minIndex + 1 | |
908 |
|
908 | |||
909 | #Spectra |
|
909 | #Spectra | |
910 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] |
|
910 | data_spc = self.dataOut.data_spc[:,:,minIndex:maxIndex+1] | |
911 |
|
911 | |||
912 | data_cspc = None |
|
912 | data_cspc = None | |
913 | if self.dataOut.data_cspc != None: |
|
913 | if self.dataOut.data_cspc != None: | |
914 | data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1] |
|
914 | data_cspc = self.dataOut.data_cspc[:,:,minIndex:maxIndex+1] | |
915 |
|
915 | |||
916 | data_dc = None |
|
916 | data_dc = None | |
917 | if self.dataOut.data_dc != None: |
|
917 | if self.dataOut.data_dc != None: | |
918 | data_dc = self.dataOut.data_dc[:,:,minIndex:maxIndex+1] |
|
918 | data_dc = self.dataOut.data_dc[:,:,minIndex:maxIndex+1] | |
919 |
|
919 | |||
920 | self.dataOut.data_spc = data_spc |
|
920 | self.dataOut.data_spc = data_spc | |
921 | self.dataOut.data_cspc = data_cspc |
|
921 | self.dataOut.data_cspc = data_cspc | |
922 | self.dataOut.data_dc = data_dc |
|
922 | self.dataOut.data_dc = data_dc | |
923 |
|
923 | |||
924 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] |
|
924 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] | |
925 |
|
925 | |||
926 | return 1 |
|
926 | return 1 | |
927 |
|
927 | |||
928 | def removeDC(self, mode = 1): |
|
928 | def removeDC(self, mode = 1): | |
929 |
|
929 | |||
930 | dc_index = 0 |
|
930 | dc_index = 0 | |
931 | freq_index = numpy.array([-2,-1,1,2]) |
|
931 | freq_index = numpy.array([-2,-1,1,2]) | |
932 | data_spc = self.dataOut.data_spc |
|
932 | data_spc = self.dataOut.data_spc | |
933 | data_cspc = self.dataOut.data_cspc |
|
933 | data_cspc = self.dataOut.data_cspc | |
934 | data_dc = self.dataOut.data_dc |
|
934 | data_dc = self.dataOut.data_dc | |
935 |
|
935 | |||
936 | if self.dataOut.flagShiftFFT: |
|
936 | if self.dataOut.flagShiftFFT: | |
937 | dc_index += self.dataOut.nFFTPoints/2 |
|
937 | dc_index += self.dataOut.nFFTPoints/2 | |
938 | freq_index += self.dataOut.nFFTPoints/2 |
|
938 | freq_index += self.dataOut.nFFTPoints/2 | |
939 |
|
939 | |||
940 | if mode == 1: |
|
940 | if mode == 1: | |
941 | data_spc[dc_index] = (data_spc[:,freq_index[1],:] + data_spc[:,freq_index[2],:])/2 |
|
941 | data_spc[dc_index] = (data_spc[:,freq_index[1],:] + data_spc[:,freq_index[2],:])/2 | |
942 | if data_cspc != None: |
|
942 | if data_cspc != None: | |
943 | data_cspc[dc_index] = (data_cspc[:,freq_index[1],:] + data_cspc[:,freq_index[2],:])/2 |
|
943 | data_cspc[dc_index] = (data_cspc[:,freq_index[1],:] + data_cspc[:,freq_index[2],:])/2 | |
944 | return 1 |
|
944 | return 1 | |
945 |
|
945 | |||
946 | if mode == 2: |
|
946 | if mode == 2: | |
947 | pass |
|
947 | pass | |
948 |
|
948 | |||
949 | if mode == 3: |
|
949 | if mode == 3: | |
950 | pass |
|
950 | pass | |
951 |
|
951 | |||
952 | raise ValueError, "mode parameter has to be 1, 2 or 3" |
|
952 | raise ValueError, "mode parameter has to be 1, 2 or 3" | |
953 |
|
953 | |||
954 | def removeInterference(self): |
|
954 | def removeInterference(self): | |
955 |
|
955 | |||
956 | pass |
|
956 | pass | |
957 |
|
957 | |||
958 |
|
958 | |||
959 | class IncohInt(Operation): |
|
959 | class IncohInt(Operation): | |
960 |
|
960 | |||
961 |
|
961 | |||
962 | __profIndex = 0 |
|
962 | __profIndex = 0 | |
963 | __withOverapping = False |
|
963 | __withOverapping = False | |
964 |
|
964 | |||
965 | __byTime = False |
|
965 | __byTime = False | |
966 | __initime = None |
|
966 | __initime = None | |
967 | __lastdatatime = None |
|
967 | __lastdatatime = None | |
968 | __integrationtime = None |
|
968 | __integrationtime = None | |
969 |
|
969 | |||
970 | __buffer_spc = None |
|
970 | __buffer_spc = None | |
971 | __buffer_cspc = None |
|
971 | __buffer_cspc = None | |
972 | __buffer_dc = None |
|
972 | __buffer_dc = None | |
973 |
|
973 | |||
974 | __dataReady = False |
|
974 | __dataReady = False | |
975 |
|
975 | |||
|
976 | __timeInterval = None | |||
|
977 | ||||
976 | n = None |
|
978 | n = None | |
977 |
|
979 | |||
978 |
|
980 | |||
|
981 | ||||
979 | def __init__(self): |
|
982 | def __init__(self): | |
980 |
|
983 | |||
981 | self.__isConfig = False |
|
984 | self.__isConfig = False | |
982 |
|
985 | |||
983 | def setup(self, n=None, timeInterval=None, overlapping=False): |
|
986 | def setup(self, n=None, timeInterval=None, overlapping=False): | |
984 | """ |
|
987 | """ | |
985 | Set the parameters of the integration class. |
|
988 | Set the parameters of the integration class. | |
986 |
|
989 | |||
987 | Inputs: |
|
990 | Inputs: | |
988 |
|
991 | |||
989 | n : Number of coherent integrations |
|
992 | n : Number of coherent integrations | |
990 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work |
|
993 | timeInterval : Time of integration. If the parameter "n" is selected this one does not work | |
991 | overlapping : |
|
994 | overlapping : | |
992 |
|
995 | |||
993 | """ |
|
996 | """ | |
994 |
|
997 | |||
995 | self.__initime = None |
|
998 | self.__initime = None | |
996 | self.__lastdatatime = 0 |
|
999 | self.__lastdatatime = 0 | |
997 | self.__buffer_spc = None |
|
1000 | self.__buffer_spc = None | |
998 | self.__buffer_cspc = None |
|
1001 | self.__buffer_cspc = None | |
999 | self.__buffer_dc = None |
|
1002 | self.__buffer_dc = None | |
1000 | self.__dataReady = False |
|
1003 | self.__dataReady = False | |
1001 |
|
1004 | |||
1002 |
|
1005 | |||
1003 | if n == None and timeInterval == None: |
|
1006 | if n == None and timeInterval == None: | |
1004 | raise ValueError, "n or timeInterval should be specified ..." |
|
1007 | raise ValueError, "n or timeInterval should be specified ..." | |
1005 |
|
1008 | |||
1006 | if n != None: |
|
1009 | if n != None: | |
1007 | self.n = n |
|
1010 | self.n = n | |
1008 | self.__byTime = False |
|
1011 | self.__byTime = False | |
1009 | else: |
|
1012 | else: | |
1010 | self.__integrationtime = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line |
|
1013 | self.__integrationtime = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line | |
1011 | self.n = 9999 |
|
1014 | self.n = 9999 | |
1012 | self.__byTime = True |
|
1015 | self.__byTime = True | |
1013 |
|
1016 | |||
1014 | if overlapping: |
|
1017 | if overlapping: | |
1015 | self.__withOverapping = True |
|
1018 | self.__withOverapping = True | |
1016 | else: |
|
1019 | else: | |
1017 | self.__withOverapping = False |
|
1020 | self.__withOverapping = False | |
1018 | self.__buffer_spc = 0 |
|
1021 | self.__buffer_spc = 0 | |
1019 | self.__buffer_cspc = 0 |
|
1022 | self.__buffer_cspc = 0 | |
1020 | self.__buffer_dc = 0 |
|
1023 | self.__buffer_dc = 0 | |
1021 |
|
1024 | |||
1022 | self.__profIndex = 0 |
|
1025 | self.__profIndex = 0 | |
1023 |
|
1026 | |||
1024 | def putData(self, data_spc, data_cspc, data_dc): |
|
1027 | def putData(self, data_spc, data_cspc, data_dc): | |
1025 |
|
1028 | |||
1026 | """ |
|
1029 | """ | |
1027 | Add a profile to the __buffer_spc and increase in one the __profileIndex |
|
1030 | Add a profile to the __buffer_spc and increase in one the __profileIndex | |
1028 |
|
1031 | |||
1029 | """ |
|
1032 | """ | |
1030 |
|
1033 | |||
1031 | if not self.__withOverapping: |
|
1034 | if not self.__withOverapping: | |
1032 | self.__buffer_spc += data_spc |
|
1035 | self.__buffer_spc += data_spc | |
1033 |
|
1036 | |||
1034 | if data_cspc == None: |
|
1037 | if data_cspc == None: | |
1035 | self.__buffer_cspc = None |
|
1038 | self.__buffer_cspc = None | |
1036 | else: |
|
1039 | else: | |
1037 | self.__buffer_cspc += data_cspc |
|
1040 | self.__buffer_cspc += data_cspc | |
1038 |
|
1041 | |||
1039 | if data_dc == None: |
|
1042 | if data_dc == None: | |
1040 | self.__buffer_dc = None |
|
1043 | self.__buffer_dc = None | |
1041 | else: |
|
1044 | else: | |
1042 | self.__buffer_dc += data_dc |
|
1045 | self.__buffer_dc += data_dc | |
1043 |
|
1046 | |||
1044 | self.__profIndex += 1 |
|
1047 | self.__profIndex += 1 | |
1045 | return |
|
1048 | return | |
1046 |
|
1049 | |||
1047 | #Overlapping data |
|
1050 | #Overlapping data | |
1048 | nChannels, nFFTPoints, nHeis = data_spc.shape |
|
1051 | nChannels, nFFTPoints, nHeis = data_spc.shape | |
1049 | data_spc = numpy.reshape(data_spc, (1, nChannels, nFFTPoints, nHeis)) |
|
1052 | data_spc = numpy.reshape(data_spc, (1, nChannels, nFFTPoints, nHeis)) | |
1050 | if data_cspc != None: |
|
1053 | if data_cspc != None: | |
1051 | data_cspc = numpy.reshape(data_cspc, (1, -1, nFFTPoints, nHeis)) |
|
1054 | data_cspc = numpy.reshape(data_cspc, (1, -1, nFFTPoints, nHeis)) | |
1052 | if data_dc != None: |
|
1055 | if data_dc != None: | |
1053 | data_dc = numpy.reshape(data_dc, (1, -1, nHeis)) |
|
1056 | data_dc = numpy.reshape(data_dc, (1, -1, nHeis)) | |
1054 |
|
1057 | |||
1055 | #If the buffer is empty then it takes the data value |
|
1058 | #If the buffer is empty then it takes the data value | |
1056 | if self.__buffer_spc == None: |
|
1059 | if self.__buffer_spc == None: | |
1057 | self.__buffer_spc = data_spc |
|
1060 | self.__buffer_spc = data_spc | |
1058 |
|
1061 | |||
1059 | if data_cspc == None: |
|
1062 | if data_cspc == None: | |
1060 | self.__buffer_cspc = None |
|
1063 | self.__buffer_cspc = None | |
1061 | else: |
|
1064 | else: | |
1062 | self.__buffer_cspc += data_cspc |
|
1065 | self.__buffer_cspc += data_cspc | |
1063 |
|
1066 | |||
1064 | if data_dc == None: |
|
1067 | if data_dc == None: | |
1065 | self.__buffer_dc = None |
|
1068 | self.__buffer_dc = None | |
1066 | else: |
|
1069 | else: | |
1067 | self.__buffer_dc += data_dc |
|
1070 | self.__buffer_dc += data_dc | |
1068 |
|
1071 | |||
1069 | self.__profIndex += 1 |
|
1072 | self.__profIndex += 1 | |
1070 | return |
|
1073 | return | |
1071 |
|
1074 | |||
1072 | #If the buffer length is lower than n then stakcing the data value |
|
1075 | #If the buffer length is lower than n then stakcing the data value | |
1073 | if self.__profIndex < self.n: |
|
1076 | if self.__profIndex < self.n: | |
1074 | self.__buffer_spc = numpy.vstack((self.__buffer_spc, data_spc)) |
|
1077 | self.__buffer_spc = numpy.vstack((self.__buffer_spc, data_spc)) | |
1075 |
|
1078 | |||
1076 | if data_cspc != None: |
|
1079 | if data_cspc != None: | |
1077 | self.__buffer_cspc = numpy.vstack((self.__buffer_cspc, data_cspc)) |
|
1080 | self.__buffer_cspc = numpy.vstack((self.__buffer_cspc, data_cspc)) | |
1078 |
|
1081 | |||
1079 | if data_dc != None: |
|
1082 | if data_dc != None: | |
1080 | self.__buffer_dc = numpy.vstack((self.__buffer_dc, data_dc)) |
|
1083 | self.__buffer_dc = numpy.vstack((self.__buffer_dc, data_dc)) | |
1081 |
|
1084 | |||
1082 | self.__profIndex += 1 |
|
1085 | self.__profIndex += 1 | |
1083 | return |
|
1086 | return | |
1084 |
|
1087 | |||
1085 | #If the buffer length is equal to n then replacing the last buffer value with the data value |
|
1088 | #If the buffer length is equal to n then replacing the last buffer value with the data value | |
1086 | self.__buffer_spc = numpy.roll(self.__buffer_spc, -1, axis=0) |
|
1089 | self.__buffer_spc = numpy.roll(self.__buffer_spc, -1, axis=0) | |
1087 | self.__buffer_spc[self.n-1] = data_spc |
|
1090 | self.__buffer_spc[self.n-1] = data_spc | |
1088 |
|
1091 | |||
1089 | if data_cspc != None: |
|
1092 | if data_cspc != None: | |
1090 | self.__buffer_cspc = numpy.roll(self.__buffer_cspc, -1, axis=0) |
|
1093 | self.__buffer_cspc = numpy.roll(self.__buffer_cspc, -1, axis=0) | |
1091 | self.__buffer_cspc[self.n-1] = data_cspc |
|
1094 | self.__buffer_cspc[self.n-1] = data_cspc | |
1092 |
|
1095 | |||
1093 | if data_dc != None: |
|
1096 | if data_dc != None: | |
1094 | self.__buffer_dc = numpy.roll(self.__buffer_dc, -1, axis=0) |
|
1097 | self.__buffer_dc = numpy.roll(self.__buffer_dc, -1, axis=0) | |
1095 | self.__buffer_dc[self.n-1] = data_dc |
|
1098 | self.__buffer_dc[self.n-1] = data_dc | |
1096 |
|
1099 | |||
1097 | self.__profIndex = self.n |
|
1100 | self.__profIndex = self.n | |
1098 | return |
|
1101 | return | |
1099 |
|
1102 | |||
1100 |
|
1103 | |||
1101 | def pushData(self): |
|
1104 | def pushData(self): | |
1102 | """ |
|
1105 | """ | |
1103 | Return the sum of the last profiles and the profiles used in the sum. |
|
1106 | Return the sum of the last profiles and the profiles used in the sum. | |
1104 |
|
1107 | |||
1105 | Affected: |
|
1108 | Affected: | |
1106 |
|
1109 | |||
1107 | self.__profileIndex |
|
1110 | self.__profileIndex | |
1108 |
|
1111 | |||
1109 | """ |
|
1112 | """ | |
1110 | data_spc = None |
|
1113 | data_spc = None | |
1111 | data_cspc = None |
|
1114 | data_cspc = None | |
1112 | data_dc = None |
|
1115 | data_dc = None | |
1113 |
|
1116 | |||
1114 | if not self.__withOverapping: |
|
1117 | if not self.__withOverapping: | |
1115 | data_spc = self.__buffer_spc |
|
1118 | data_spc = self.__buffer_spc | |
1116 | data_cspc = self.__buffer_cspc |
|
1119 | data_cspc = self.__buffer_cspc | |
1117 | data_dc = self.__buffer_dc |
|
1120 | data_dc = self.__buffer_dc | |
1118 |
|
1121 | |||
1119 | n = self.__profIndex |
|
1122 | n = self.__profIndex | |
1120 |
|
1123 | |||
1121 | self.__buffer_spc = 0 |
|
1124 | self.__buffer_spc = 0 | |
1122 | self.__buffer_cspc = 0 |
|
1125 | self.__buffer_cspc = 0 | |
1123 | self.__buffer_dc = 0 |
|
1126 | self.__buffer_dc = 0 | |
1124 | self.__profIndex = 0 |
|
1127 | self.__profIndex = 0 | |
1125 |
|
1128 | |||
1126 | return data_spc, data_cspc, data_dc, n |
|
1129 | return data_spc, data_cspc, data_dc, n | |
1127 |
|
1130 | |||
1128 | #Integration with Overlapping |
|
1131 | #Integration with Overlapping | |
1129 | data_spc = numpy.sum(self.__buffer_spc, axis=0) |
|
1132 | data_spc = numpy.sum(self.__buffer_spc, axis=0) | |
1130 |
|
1133 | |||
1131 | if self.__buffer_cspc != None: |
|
1134 | if self.__buffer_cspc != None: | |
1132 | data_cspc = numpy.sum(self.__buffer_cspc, axis=0) |
|
1135 | data_cspc = numpy.sum(self.__buffer_cspc, axis=0) | |
1133 |
|
1136 | |||
1134 | if self.__buffer_dc != None: |
|
1137 | if self.__buffer_dc != None: | |
1135 | data_dc = numpy.sum(self.__buffer_dc, axis=0) |
|
1138 | data_dc = numpy.sum(self.__buffer_dc, axis=0) | |
1136 |
|
1139 | |||
1137 | n = self.__profIndex |
|
1140 | n = self.__profIndex | |
1138 |
|
1141 | |||
1139 | return data_spc, data_cspc, data_dc, n |
|
1142 | return data_spc, data_cspc, data_dc, n | |
1140 |
|
1143 | |||
1141 | def byProfiles(self, *args): |
|
1144 | def byProfiles(self, *args): | |
1142 |
|
1145 | |||
1143 | self.__dataReady = False |
|
1146 | self.__dataReady = False | |
1144 | avgdata_spc = None |
|
1147 | avgdata_spc = None | |
1145 | avgdata_cspc = None |
|
1148 | avgdata_cspc = None | |
1146 | avgdata_dc = None |
|
1149 | avgdata_dc = None | |
1147 | n = None |
|
1150 | n = None | |
1148 |
|
1151 | |||
1149 | self.putData(*args) |
|
1152 | self.putData(*args) | |
1150 |
|
1153 | |||
1151 | if self.__profIndex == self.n: |
|
1154 | if self.__profIndex == self.n: | |
1152 |
|
1155 | |||
1153 | avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData() |
|
1156 | avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData() | |
1154 | self.__dataReady = True |
|
1157 | self.__dataReady = True | |
1155 |
|
1158 | |||
1156 | return avgdata_spc, avgdata_cspc, avgdata_dc |
|
1159 | return avgdata_spc, avgdata_cspc, avgdata_dc | |
1157 |
|
1160 | |||
1158 | def byTime(self, datatime, *args): |
|
1161 | def byTime(self, datatime, *args): | |
1159 |
|
1162 | |||
1160 | self.__dataReady = False |
|
1163 | self.__dataReady = False | |
1161 | avgdata_spc = None |
|
1164 | avgdata_spc = None | |
1162 | avgdata_cspc = None |
|
1165 | avgdata_cspc = None | |
1163 | avgdata_dc = None |
|
1166 | avgdata_dc = None | |
1164 | n = None |
|
1167 | n = None | |
1165 |
|
1168 | |||
1166 | self.putData(*args) |
|
1169 | self.putData(*args) | |
1167 |
|
1170 | |||
1168 | if (datatime - self.__initime) >= self.__integrationtime: |
|
1171 | if (datatime - self.__initime) >= self.__integrationtime: | |
1169 | avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData() |
|
1172 | avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData() | |
1170 | self.n = n |
|
1173 | self.n = n | |
1171 | self.__dataReady = True |
|
1174 | self.__dataReady = True | |
1172 |
|
1175 | |||
1173 | return avgdata_spc, avgdata_cspc, avgdata_dc |
|
1176 | return avgdata_spc, avgdata_cspc, avgdata_dc | |
1174 |
|
1177 | |||
1175 | def integrate(self, datatime, *args): |
|
1178 | def integrate(self, datatime, *args): | |
1176 |
|
1179 | |||
1177 | if self.__initime == None: |
|
1180 | if self.__initime == None: | |
1178 | self.__initime = datatime |
|
1181 | self.__initime = datatime | |
1179 |
|
1182 | |||
1180 | if self.__byTime: |
|
1183 | if self.__byTime: | |
1181 | avgdata_spc, avgdata_cspc, avgdata_dc = self.byTime(datatime, *args) |
|
1184 | avgdata_spc, avgdata_cspc, avgdata_dc = self.byTime(datatime, *args) | |
1182 | else: |
|
1185 | else: | |
1183 | avgdata_spc, avgdata_cspc, avgdata_dc = self.byProfiles(*args) |
|
1186 | avgdata_spc, avgdata_cspc, avgdata_dc = self.byProfiles(*args) | |
1184 |
|
1187 | |||
1185 | self.__lastdatatime = datatime |
|
1188 | self.__lastdatatime = datatime | |
1186 |
|
1189 | |||
1187 | if avgdata_spc == None: |
|
1190 | if avgdata_spc == None: | |
1188 | return None, None, None, None |
|
1191 | return None, None, None, None | |
1189 |
|
1192 | |||
1190 | avgdatatime = self.__initime |
|
1193 | avgdatatime = self.__initime | |
|
1194 | self.__timeInterval = (self.__lastdatatime - self.__initime)/(self.n - 1) | |||
1191 |
|
1195 | |||
1192 | deltatime = datatime -self.__lastdatatime |
|
1196 | deltatime = datatime -self.__lastdatatime | |
1193 |
|
1197 | |||
1194 | if not self.__withOverapping: |
|
1198 | if not self.__withOverapping: | |
1195 | self.__initime = datatime |
|
1199 | self.__initime = datatime | |
1196 | else: |
|
1200 | else: | |
1197 | self.__initime += deltatime |
|
1201 | self.__initime += deltatime | |
1198 |
|
1202 | |||
1199 | return avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc |
|
1203 | return avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc | |
1200 |
|
1204 | |||
1201 | def run(self, dataOut, n=None, timeInterval=None, overlapping=False): |
|
1205 | def run(self, dataOut, n=None, timeInterval=None, overlapping=False): | |
1202 |
|
1206 | |||
1203 | if not self.__isConfig: |
|
1207 | if not self.__isConfig: | |
1204 | self.setup(n, timeInterval, overlapping) |
|
1208 | self.setup(n, timeInterval, overlapping) | |
1205 | self.__isConfig = True |
|
1209 | self.__isConfig = True | |
1206 |
|
1210 | |||
1207 | avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime, |
|
1211 | avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime, | |
1208 | dataOut.data_spc, |
|
1212 | dataOut.data_spc, | |
1209 | dataOut.data_cspc, |
|
1213 | dataOut.data_cspc, | |
1210 | dataOut.data_dc) |
|
1214 | dataOut.data_dc) | |
1211 |
|
1215 | |||
1212 | # dataOut.timeInterval *= n |
|
1216 | # dataOut.timeInterval *= n | |
1213 | dataOut.flagNoData = True |
|
1217 | dataOut.flagNoData = True | |
1214 |
|
1218 | |||
1215 | if self.__dataReady: |
|
1219 | if self.__dataReady: | |
1216 |
|
1220 | |||
1217 | dataOut.data_spc = avgdata_spc |
|
1221 | dataOut.data_spc = avgdata_spc | |
1218 | dataOut.data_cspc = avgdata_cspc |
|
1222 | dataOut.data_cspc = avgdata_cspc | |
1219 | dataOut.data_dc = avgdata_dc |
|
1223 | dataOut.data_dc = avgdata_dc | |
1220 |
|
1224 | |||
1221 | dataOut.nIncohInt *= self.n |
|
1225 | dataOut.nIncohInt *= self.n | |
1222 | dataOut.utctime = avgdatatime |
|
1226 | dataOut.utctime = avgdatatime | |
1223 | dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt * dataOut.nIncohInt * dataOut.nFFTPoints |
|
1227 | #dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt * dataOut.nIncohInt * dataOut.nFFTPoints | |
|
1228 | dataOut.timeInterval = self.__timeInterval*self.n | |||
1224 | dataOut.flagNoData = False |
|
1229 | dataOut.flagNoData = False | |
1225 |
|
1230 | |||
1226 | class ProfileSelector(Operation): |
|
1231 | class ProfileSelector(Operation): | |
1227 |
|
1232 | |||
1228 | profileIndex = None |
|
1233 | profileIndex = None | |
1229 | # Tamanho total de los perfiles |
|
1234 | # Tamanho total de los perfiles | |
1230 | nProfiles = None |
|
1235 | nProfiles = None | |
1231 |
|
1236 | |||
1232 | def __init__(self): |
|
1237 | def __init__(self): | |
1233 |
|
1238 | |||
1234 | self.profileIndex = 0 |
|
1239 | self.profileIndex = 0 | |
1235 |
|
1240 | |||
1236 | def incIndex(self): |
|
1241 | def incIndex(self): | |
1237 | self.profileIndex += 1 |
|
1242 | self.profileIndex += 1 | |
1238 |
|
1243 | |||
1239 | if self.profileIndex >= self.nProfiles: |
|
1244 | if self.profileIndex >= self.nProfiles: | |
1240 | self.profileIndex = 0 |
|
1245 | self.profileIndex = 0 | |
1241 |
|
1246 | |||
1242 | def isProfileInRange(self, minIndex, maxIndex): |
|
1247 | def isProfileInRange(self, minIndex, maxIndex): | |
1243 |
|
1248 | |||
1244 | if self.profileIndex < minIndex: |
|
1249 | if self.profileIndex < minIndex: | |
1245 | return False |
|
1250 | return False | |
1246 |
|
1251 | |||
1247 | if self.profileIndex > maxIndex: |
|
1252 | if self.profileIndex > maxIndex: | |
1248 | return False |
|
1253 | return False | |
1249 |
|
1254 | |||
1250 | return True |
|
1255 | return True | |
1251 |
|
1256 | |||
1252 | def isProfileInList(self, profileList): |
|
1257 | def isProfileInList(self, profileList): | |
1253 |
|
1258 | |||
1254 | if self.profileIndex not in profileList: |
|
1259 | if self.profileIndex not in profileList: | |
1255 | return False |
|
1260 | return False | |
1256 |
|
1261 | |||
1257 | return True |
|
1262 | return True | |
1258 |
|
1263 | |||
1259 | def run(self, dataOut, profileList=None, profileRangeList=None): |
|
1264 | def run(self, dataOut, profileList=None, profileRangeList=None): | |
1260 |
|
1265 | |||
1261 | dataOut.flagNoData = True |
|
1266 | dataOut.flagNoData = True | |
1262 | self.nProfiles = dataOut.nProfiles |
|
1267 | self.nProfiles = dataOut.nProfiles | |
1263 |
|
1268 | |||
1264 | if profileList != None: |
|
1269 | if profileList != None: | |
1265 | if self.isProfileInList(profileList): |
|
1270 | if self.isProfileInList(profileList): | |
1266 | dataOut.flagNoData = False |
|
1271 | dataOut.flagNoData = False | |
1267 |
|
1272 | |||
1268 | self.incIndex() |
|
1273 | self.incIndex() | |
1269 | return 1 |
|
1274 | return 1 | |
1270 |
|
1275 | |||
1271 |
|
1276 | |||
1272 | elif profileRangeList != None: |
|
1277 | elif profileRangeList != None: | |
1273 | minIndex = profileRangeList[0] |
|
1278 | minIndex = profileRangeList[0] | |
1274 | maxIndex = profileRangeList[1] |
|
1279 | maxIndex = profileRangeList[1] | |
1275 | if self.isProfileInRange(minIndex, maxIndex): |
|
1280 | if self.isProfileInRange(minIndex, maxIndex): | |
1276 | dataOut.flagNoData = False |
|
1281 | dataOut.flagNoData = False | |
1277 |
|
1282 | |||
1278 | self.incIndex() |
|
1283 | self.incIndex() | |
1279 | return 1 |
|
1284 | return 1 | |
1280 |
|
1285 | |||
1281 | else: |
|
1286 | else: | |
1282 | raise ValueError, "ProfileSelector needs profileList or profileRangeList" |
|
1287 | raise ValueError, "ProfileSelector needs profileList or profileRangeList" | |
1283 |
|
1288 | |||
1284 | return 0 |
|
1289 | return 0 | |
1285 |
|
1290 |
General Comments 0
You need to be logged in to leave comments.
Login now