@@ -258,7 +258,15 class ProcUnitConf(): | |||
|
258 | 258 | self.opConfObjList = [] |
|
259 | 259 | |
|
260 | 260 | self.addOperation(name='init', optype='self') |
|
261 | ||
|
262 | def addParameter(self, **kwargs): | |
|
263 | ||
|
264 | opObj = self.opConfObjList[0] | |
|
265 | ||
|
266 | opObj.addParameter(**kwargs) | |
|
261 | 267 | |
|
268 | return opObj | |
|
269 | ||
|
262 | 270 | def addOperation(self, name, optype='self'): |
|
263 | 271 | |
|
264 | 272 | id = self.__getNewId() |
@@ -585,36 +593,47 if __name__ == '__main__': | |||
|
585 | 593 | |
|
586 | 594 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
587 | 595 | |
|
588 |
readUnitConfObj = controllerObj.addReadUnit(datatype=' |
|
|
589 |
path=' |
|
|
590 |
startDate='2011/0 |
|
|
596 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', | |
|
597 | path='data/rawdata/', | |
|
598 | startDate='2011/01/01', | |
|
591 | 599 | endDate='2012/12/31', |
|
592 |
startTime='0 |
|
|
600 | startTime='00:00:00', | |
|
593 | 601 | endTime='23:59:59', |
|
594 | 602 | online=0) |
|
595 | 603 | |
|
596 | 604 | opObj00 = readUnitConfObj.addOperation(name='printTotalBlocks') |
|
597 | 605 | |
|
598 |
procUnitConfObj |
|
|
606 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |
|
607 | ||
|
608 | opObj10 = procUnitConfObj0.addOperation(name='selectChannels') | |
|
609 | opObj10.addParameter(name='channelList', value='3,4,5', format='intlist') | |
|
610 | ||
|
611 | opObj10 = procUnitConfObj0.addOperation(name='selectHeights') | |
|
612 | opObj10.addParameter(name='minHei', value='90', format='float') | |
|
613 | opObj10.addParameter(name='maxHei', value='180', format='float') | |
|
614 | ||
|
615 | opObj12 = procUnitConfObj0.addOperation(name='CohInt', optype='other') | |
|
616 | opObj12.addParameter(name='n', value='10', format='int') | |
|
599 | 617 | |
|
600 | opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
|
601 |
|
|
|
618 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) | |
|
619 | procUnitConfObj1.addParameter(name='nFFTPoints', value='16', format='int') | |
|
602 | 620 | |
|
603 | 621 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
604 | 622 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
605 | 623 | opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') |
|
606 |
|
|
|
607 |
|
|
|
608 |
opObj11.addParameter(name='showprofile', value=' |
|
|
609 | opObj11.addParameter(name='save', value='1', format='int') | |
|
610 | opObj11.addParameter(name='filename', value='/Users/dsuarez/Pictures/SpectraPlot.png', format='str') | |
|
624 | opObj11.addParameter(name='zmin', value='40', format='int') | |
|
625 | opObj11.addParameter(name='zmax', value='80', format='int') | |
|
626 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
611 | 627 | |
|
612 | 628 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') |
|
613 | 629 | opObj11.addParameter(name='idfigure', value='10', format='int') |
|
614 | 630 | opObj11.addParameter(name='wintitle', value='RTI', format='str') |
|
615 |
# opObj11.addParameter(name=' |
|
|
616 |
# opObj11.addParameter(name=' |
|
|
617 |
opObj11.addParameter(name=' |
|
|
631 | # opObj11.addParameter(name='xmin', value='21', format='float') | |
|
632 | # opObj11.addParameter(name='xmax', value='22', format='float') | |
|
633 | opObj11.addParameter(name='zmin', value='40', format='int') | |
|
634 | opObj11.addParameter(name='zmax', value='80', format='int') | |
|
635 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
|
636 | opObj11.addParameter(name='timerange', value=str(20), format='int') | |
|
618 | 637 | |
|
619 | 638 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
620 | 639 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') |
@@ -367,8 +367,8 class ProcessingHeader(Header): | |||
|
367 | 367 | self.totalSpectra = int(header['nTotalSpectra'][0]) |
|
368 | 368 | self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.nWindows) |
|
369 | 369 | self.nHeights = int(numpy.sum(self.samplingWindow['nsa'])) |
|
370 |
self.firstHeight = |
|
|
371 |
self.deltaHeight = |
|
|
370 | self.firstHeight = float(self.samplingWindow['h0'][0]) | |
|
371 | self.deltaHeight = float(self.samplingWindow['dh'][0]) | |
|
372 | 372 | self.samplesWin = self.samplingWindow['nsa'] |
|
373 | 373 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) |
|
374 | 374 |
@@ -266,6 +266,87 class VoltageProc(ProcessingUnit): | |||
|
266 | 266 | # self.dataOut.nChannels = nChannels |
|
267 | 267 | |
|
268 | 268 | return 1 |
|
269 | ||
|
270 | def selectHeights(self, minHei, maxHei): | |
|
271 | """ | |
|
272 | Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango | |
|
273 | minHei <= height <= maxHei | |
|
274 | ||
|
275 | Input: | |
|
276 | minHei : valor minimo de altura a considerar | |
|
277 | maxHei : valor maximo de altura a considerar | |
|
278 | ||
|
279 | Affected: | |
|
280 | Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex | |
|
281 | ||
|
282 | Return: | |
|
283 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
284 | """ | |
|
285 | if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei): | |
|
286 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
287 | ||
|
288 | if (maxHei > self.dataOut.heightList[-1]): | |
|
289 | maxHei = self.dataOut.heightList[-1] | |
|
290 | # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) | |
|
291 | ||
|
292 | minIndex = 0 | |
|
293 | maxIndex = 0 | |
|
294 | data = self.dataOut.heightList | |
|
295 | ||
|
296 | for i,val in enumerate(data): | |
|
297 | if val < minHei: | |
|
298 | continue | |
|
299 | else: | |
|
300 | minIndex = i; | |
|
301 | break | |
|
302 | ||
|
303 | for i,val in enumerate(data): | |
|
304 | if val <= maxHei: | |
|
305 | maxIndex = i; | |
|
306 | else: | |
|
307 | break | |
|
308 | ||
|
309 | self.selectHeightsByIndex(minIndex, maxIndex) | |
|
310 | ||
|
311 | return 1 | |
|
312 | ||
|
313 | ||
|
314 | def selectHeightsByIndex(self, minIndex, maxIndex): | |
|
315 | """ | |
|
316 | Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango | |
|
317 | minIndex <= index <= maxIndex | |
|
318 | ||
|
319 | Input: | |
|
320 | minIndex : valor de indice minimo de altura a considerar | |
|
321 | maxIndex : valor de indice maximo de altura a considerar | |
|
322 | ||
|
323 | Affected: | |
|
324 | self.dataOut.data | |
|
325 | self.dataOut.heightList | |
|
326 | ||
|
327 | Return: | |
|
328 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 | |
|
329 | """ | |
|
330 | ||
|
331 | if (minIndex < 0) or (minIndex > maxIndex): | |
|
332 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
333 | ||
|
334 | if (maxIndex >= self.dataOut.nHeights): | |
|
335 | maxIndex = self.dataOut.nHeights-1 | |
|
336 | # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) | |
|
337 | ||
|
338 | nHeights = maxIndex - minIndex + 1 | |
|
339 | ||
|
340 | #voltage | |
|
341 | data = self.dataOut.data[:,minIndex:maxIndex+1] | |
|
342 | ||
|
343 | firstHeight = self.dataOut.heightList[minIndex] | |
|
344 | ||
|
345 | self.dataOut.data = data | |
|
346 | self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1] | |
|
347 | ||
|
348 | return 1 | |
|
349 | ||
|
269 | 350 | |
|
270 | 351 | class CohInt(Operation): |
|
271 | 352 | |
@@ -494,8 +575,9 class SpectraProc(ProcessingUnit): | |||
|
494 | 575 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
495 | 576 | self.dataOut.nIncohInt = 1 |
|
496 | 577 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
497 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nConInt*self.dataOut.nIncohInt | |
|
498 | ||
|
578 | ||
|
579 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nCohInt*self.dataOut.nIncohInt | |
|
580 | ||
|
499 | 581 | def __getFft(self): |
|
500 | 582 | """ |
|
501 | 583 | Convierte valores de Voltaje a Spectra |
General Comments 0
You need to be logged in to leave comments.
Login now