##// END OF EJS Templates
jroproc_voltage
avaldez -
r1272:60a078275b06
parent child
Show More
@@ -933,7 +933,7 class ProfileSelector(Operation):
933 933 rangeList : List of profile ranges. Example: rangeList = ((4, 30), (32, 64), (128, 256))
934 934
935 935 """
936
936 print "HOLA MUNDO CRUEL"
937 937 if rangeList is not None:
938 938 if type(rangeList[0]) not in (tuple, list):
939 939 rangeList = [rangeList]
@@ -1357,9 +1357,11 class voltACFLags(Operation):
1357 1357 def setup(self,dataOut ,lags = None,mode =None, fullBuffer= None ,pairsList = None,nAvg = 1):
1358 1358
1359 1359 self.lags = lags
1360 print self.lags
1360 1361 self.mode = mode
1361 1362 self.fullBuffer= fullBuffer
1362 1363 self.nAvg = nAvg
1364 self.pairsList = pairsList
1363 1365 nChannels = dataOut.nChannels
1364 1366 nProfiles = dataOut.nProfiles
1365 1367 nHeights = dataOut.nHeights
@@ -1372,16 +1374,16 class voltACFLags(Operation):
1372 1374 print "Mode lags equal height."
1373 1375
1374 1376 if pairsList == None:
1375 print "Pairs list selected by default (1,0)"
1376 pairsList = [(0,1)]
1377 pairList= pairsList
1377 print "Pairs list selected by default (1,0)"
1378 pairsList = [(0,1)]
1379 self.pairsList= pairsList
1378 1380
1379 1381 if lags == None:
1380 if mode=='time':
1381 self.lags = numpy.arange(0,nProfiles)# -nProfiles+1, nProfiles
1382 print "self.lags", len(self.lags)
1383 if mode=='height':
1384 self.lags = numpy.arange(0,nHeights)# -nHeights+1, nHeights
1382 if mode=='time':
1383 self.lags = numpy.arange(0,nProfiles)# -nProfiles+1, nProfiles
1384 print "self.lags", len(self.lags)
1385 if mode=='height':
1386 self.lags = numpy.arange(0,nHeights)# -nHeights+1, nHeights
1385 1387
1386 1388 if fullBuffer:
1387 1389 self.tmp = numpy.zeros((len(pairsList), len(self.lags), nProfiles, nHeights), dtype = 'complex')*numpy.nan
@@ -1390,12 +1392,12 class voltACFLags(Operation):
1390 1392 elif mode =='height':
1391 1393 self.tmp = numpy.zeros(len(pairsList), (len(self.lags), nProfiles),dtype='complex')
1392 1394
1393 print "lags", len(self.lags)
1395 print "lags", len(self.lags),self.lags
1394 1396 print "mode",self.mode
1395 1397 print "nChannels", nChannels
1396 1398 print "nProfiles", nProfiles
1397 1399 print "nHeights" , nHeights
1398 print "pairsList", pairsList
1400 print "pairsList", pairsList,len(self.pairsList)
1399 1401 print "fullBuffer", fullBuffer
1400 1402 #print "type(pairsList)",type(pairsList)
1401 1403 print "tmp.shape",self.tmp.shape
@@ -1403,36 +1405,31 class voltACFLags(Operation):
1403 1405
1404 1406 def run(self, dataOut, lags =None,mode ='time',fullBuffer= False ,pairsList = None,nAvg = 1):
1405 1407
1406 dataOut.flagNoData = True
1408 dataOut.flagNoData = True
1407 1409
1408 1410 if not self.isConfig:
1409 1411 self.setup(dataOut, lags = lags,mode = mode, fullBuffer= fullBuffer ,pairsList = pairsList,nAvg=nAvg)
1410 1412 self.isConfig = True
1411
1412 if dataOut.type == "Voltage":
1413
1413 if dataOut.type == "Voltage":
1414 1414 data_pre = dataOut.data #data
1415
1416
1417 # Here is the loop :D
1418 for l in range(len(pairsList)):
1419 ch0 = pairsList[l][0]
1420 ch1 = pairsList[l][1]
1421
1422 for i in range(len(self.lags)):
1423 idx = self.lags[i]
1424 if self.mode == 'time':
1425 acf0 = data_pre[ch0,:self.__nProfiles-idx,:]*numpy.conj(data_pre[ch1,idx:,:]) # pair,lag,height
1426 else:
1427 acf0 = data_pre[ch0,:,:self.__nHeights-idx]*numpy.conj(data_pre[ch1,:,idx:]) # pair,lag,profile
1428
1429 if self.fullBuffer:
1430 self.tmp[l,i,:acf0.shape[0],:]= acf0
1431 else:
1432 self.tmp[l,i,:]= numpy.sum(acf0,axis=0)
1433
1415 print "size",data_pre.shape
1416 # Here is the loop :D
1417 for l in range(len(self.pairsList)):
1418 ch0 = self.pairsList[l][0]
1419 ch1 = self.pairsList[l][1]
1420 for i in range(len(self.lags)):
1421 print i,"hola dios"
1422 idx = self.lags[i]
1423 if self.mode == 'time':
1424 acf0 = data_pre[ch0,:self.__nProfiles-idx,:]*numpy.conj(data_pre[ch1,idx:,:]) # pair,lag,height
1425 else:
1426 acf0 = data_pre[ch0,:,:self.__nHeights-idx]*numpy.conj(data_pre[ch1,:,idx:]) # pair,lag,profile
1427
1428 if self.fullBuffer:
1429 self.tmp[l,i,:acf0.shape[0],:]= acf0
1430 else:
1431 self.tmp[l,i,:]= numpy.sum(acf0,axis=0)
1434 1432 if self.fullBuffer:
1435
1436 1433 self.tmp = numpy.sum(numpy.reshape(self.tmp,(self.tmp.shape[0],self.tmp.shape[1],self.tmp.shape[2]/self.nAvg,self.nAvg,self.tmp.shape[3])),axis=3)
1437 1434 dataOut.nAvg = self.nAvg
1438 1435
@@ -1447,7 +1444,6 class voltACFLags(Operation):
1447 1444 for j in range(shape[2]):
1448 1445 self.tmp[i,:,j]= self.tmp[i,:,j].real / numpy.max(numpy.abs(self.tmp[i,:,j]))
1449 1446
1450
1451 1447 #import matplotlib.pyplot as plt
1452 1448 #print "test",self.tmp.shape
1453 1449 #print self.tmp[0,0,0]
@@ -1467,7 +1463,7 class voltACFLags(Operation):
1467 1463 dataOut.nPairs = len(pairsList)
1468 1464 dataOut.lagRange = numpy.array(self.lags)*delta
1469 1465 dataOut.flagDataAsBlock = True
1470 dataOut.flagNoData = False
1466 dataOut.flagNoData = False
1471 1467
1472 1468 import time
1473 1469 #################################################
General Comments 0
You need to be logged in to leave comments. Login now