@@ -258,7 +258,15 class ProcUnitConf(): | |||||
258 | self.opConfObjList = [] |
|
258 | self.opConfObjList = [] | |
259 |
|
259 | |||
260 | self.addOperation(name='init', optype='self') |
|
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 | def addOperation(self, name, optype='self'): |
|
270 | def addOperation(self, name, optype='self'): | |
263 |
|
271 | |||
264 | id = self.__getNewId() |
|
272 | id = self.__getNewId() | |
@@ -585,36 +593,47 if __name__ == '__main__': | |||||
585 |
|
593 | |||
586 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
594 | controllerObj.setup(id = '191', name='test01', description=desc) | |
587 |
|
595 | |||
588 |
readUnitConfObj = controllerObj.addReadUnit(datatype=' |
|
596 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', | |
589 |
path=' |
|
597 | path='data/rawdata/', | |
590 |
startDate='2011/0 |
|
598 | startDate='2011/01/01', | |
591 | endDate='2012/12/31', |
|
599 | endDate='2012/12/31', | |
592 |
startTime='0 |
|
600 | startTime='00:00:00', | |
593 | endTime='23:59:59', |
|
601 | endTime='23:59:59', | |
594 | online=0) |
|
602 | online=0) | |
595 |
|
603 | |||
596 | opObj00 = readUnitConfObj.addOperation(name='printTotalBlocks') |
|
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') |
|
618 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) | |
601 |
|
|
619 | procUnitConfObj1.addParameter(name='nFFTPoints', value='16', format='int') | |
602 |
|
620 | |||
603 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
621 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
604 | opObj11.addParameter(name='idfigure', value='1', format='int') |
|
622 | opObj11.addParameter(name='idfigure', value='1', format='int') | |
605 | opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') |
|
623 | opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') | |
606 |
|
|
624 | opObj11.addParameter(name='zmin', value='40', format='int') | |
607 |
|
|
625 | opObj11.addParameter(name='zmax', value='80', format='int') | |
608 |
opObj11.addParameter(name='showprofile', value=' |
|
626 | opObj11.addParameter(name='showprofile', value='1', format='int') | |
609 | opObj11.addParameter(name='save', value='1', format='int') |
|
|||
610 | opObj11.addParameter(name='filename', value='/Users/dsuarez/Pictures/SpectraPlot.png', format='str') |
|
|||
611 |
|
627 | |||
612 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') |
|
628 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
613 | opObj11.addParameter(name='idfigure', value='10', format='int') |
|
629 | opObj11.addParameter(name='idfigure', value='10', format='int') | |
614 | opObj11.addParameter(name='wintitle', value='RTI', format='str') |
|
630 | opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
615 |
# opObj11.addParameter(name=' |
|
631 | # opObj11.addParameter(name='xmin', value='21', format='float') | |
616 |
# opObj11.addParameter(name=' |
|
632 | # opObj11.addParameter(name='xmax', value='22', format='float') | |
617 |
opObj11.addParameter(name=' |
|
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 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
638 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
620 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') |
|
639 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') |
@@ -367,8 +367,8 class ProcessingHeader(Header): | |||||
367 | self.totalSpectra = int(header['nTotalSpectra'][0]) |
|
367 | self.totalSpectra = int(header['nTotalSpectra'][0]) | |
368 | self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.nWindows) |
|
368 | self.samplingWindow = numpy.fromfile(fp,self.structSamplingWindow,self.nWindows) | |
369 | self.nHeights = int(numpy.sum(self.samplingWindow['nsa'])) |
|
369 | self.nHeights = int(numpy.sum(self.samplingWindow['nsa'])) | |
370 |
self.firstHeight = |
|
370 | self.firstHeight = float(self.samplingWindow['h0'][0]) | |
371 |
self.deltaHeight = |
|
371 | self.deltaHeight = float(self.samplingWindow['dh'][0]) | |
372 | self.samplesWin = self.samplingWindow['nsa'] |
|
372 | self.samplesWin = self.samplingWindow['nsa'] | |
373 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) |
|
373 | self.spectraComb = numpy.fromfile(fp,'u1',2*self.totalSpectra) | |
374 |
|
374 |
@@ -266,6 +266,87 class VoltageProc(ProcessingUnit): | |||||
266 | # self.dataOut.nChannels = nChannels |
|
266 | # self.dataOut.nChannels = nChannels | |
267 |
|
267 | |||
268 | return 1 |
|
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 | class CohInt(Operation): |
|
351 | class CohInt(Operation): | |
271 |
|
352 | |||
@@ -494,8 +575,9 class SpectraProc(ProcessingUnit): | |||||
494 | self.dataOut.nCohInt = self.dataIn.nCohInt |
|
575 | self.dataOut.nCohInt = self.dataIn.nCohInt | |
495 | self.dataOut.nIncohInt = 1 |
|
576 | self.dataOut.nIncohInt = 1 | |
496 | self.dataOut.ippSeconds = self.dataIn.ippSeconds |
|
577 | self.dataOut.ippSeconds = self.dataIn.ippSeconds | |
497 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nConInt*self.dataOut.nIncohInt |
|
578 | ||
498 |
|
579 | self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nCohInt*self.dataOut.nIncohInt | ||
|
580 | ||||
499 | def __getFft(self): |
|
581 | def __getFft(self): | |
500 | """ |
|
582 | """ | |
501 | Convierte valores de Voltaje a Spectra |
|
583 | Convierte valores de Voltaje a Spectra |
General Comments 0
You need to be logged in to leave comments.
Login now