@@ -259,8 +259,10 class VoltACFPLot(Figure): | |||||
259 | widthplot = self.WIDTH, |
|
259 | widthplot = self.WIDTH, | |
260 | heightplot = self.HEIGHT, |
|
260 | heightplot = self.HEIGHT, | |
261 | show = show) |
|
261 | show = show) | |
|
262 | ||||
262 | nrow, ncol = self.getSubplots() |
|
263 | nrow, ncol = self.getSubplots() | |
263 | counter = 0 |
|
264 | counter = 0 | |
|
265 | ||||
264 | for y in range(nrow): |
|
266 | for y in range(nrow): | |
265 |
|
|
267 | for x in range(ncol): | |
266 |
|
|
268 | self.addAxes(nrow, ncol*ncolspan,y, x*ncolspan, colspan, 1) | |
@@ -298,7 +300,6 class VoltACFPLot(Figure): | |||||
298 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
300 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
299 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
301 | channelIndexList.append(dataOut.channelList.index(channel)) | |
300 |
|
302 | |||
301 |
|
||||
302 | #factor = dataOut.normFactor |
|
303 | #factor = dataOut.normFactor | |
303 | y = dataOut.getHeiRange() |
|
304 | y = dataOut.getHeiRange() | |
304 | #print y, dataOut.heightList[0] |
|
305 | #print y, dataOut.heightList[0] | |
@@ -306,9 +307,10 class VoltACFPLot(Figure): | |||||
306 | #import time |
|
307 | #import time | |
307 | #time.sleep(10) |
|
308 | #time.sleep(10) | |
308 | deltaHeight = dataOut.heightList[1]-dataOut.heightList[0] |
|
309 | deltaHeight = dataOut.heightList[1]-dataOut.heightList[0] | |
309 | z = dataOut.data |
|
310 | z = dataOut.data_acfLag | |
|
311 | ||||
|
312 | shape = dataOut.data_acfLag.shape | |||
310 |
|
313 | |||
311 | shape = dataOut.data.shape |
|
|||
312 |
hei_index = numpy.arange(shape[2]) |
|
314 | hei_index = numpy.arange(shape[2]) | |
313 | hei_plot = numpy.arange(nSamples)*resFactor |
|
315 | hei_plot = numpy.arange(nSamples)*resFactor | |
314 |
|
316 | |||
@@ -328,20 +330,19 class VoltACFPLot(Figure): | |||||
328 | #escalamiento -1 a 1 a resolucion (factor de resolucion en altura)* deltaHeight |
|
330 | #escalamiento -1 a 1 a resolucion (factor de resolucion en altura)* deltaHeight | |
329 | #min = numpy.min(z[0,:,0]) |
|
331 | #min = numpy.min(z[0,:,0]) | |
330 | #max =numpy.max(z[0,:,0]) |
|
332 | #max =numpy.max(z[0,:,0]) | |
|
333 | #print shape[0] | |||
331 | for i in range(shape[0]): |
|
334 | for i in range(shape[0]): | |
|
335 | #print "amigo i",i | |||
332 | for j in range(shape[2]): |
|
336 | for j in range(shape[2]): | |
333 |
|
|
337 | min = numpy.min(z[i,:,j]) | |
334 |
|
|
338 | max = numpy.max(z[i,:,j]) | |
335 | z[i,:,j]= (((z[i,:,j]-min)/(max-min))*deltaHeight*resFactor + j*deltaHeight+dataOut.heightList[0]) |
|
339 | z[i,:,j]= (((z[i,:,j]-min)/(max-min))*deltaHeight*resFactor + j*deltaHeight+dataOut.heightList[0]) | |
336 |
|
340 | |||
337 |
|
||||
338 | if xaxis == "time": |
|
341 | if xaxis == "time": | |
339 | x = dataOut.getAcfRange()*1000 |
|
342 | x = dataOut.getAcfRange()*1000 | |
340 | zdB = z[channel0,:,hei_plot] |
|
343 | zdB = z[channel0,:,hei_plot] | |
341 | xlabel = "Time (ms)" |
|
344 | xlabel = "Time (ms)" | |
342 | ylabel = "VOLT_ACF" |
|
345 | ylabel = "VOLT_ACF" | |
343 |
|
||||
344 |
|
||||
345 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
346 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |
346 | title = wintitle + "VOLT ACF Plot Ch %s %s" %(channel0,thisDatetime.strftime("%d-%b-%Y")) |
|
347 | title = wintitle + "VOLT ACF Plot Ch %s %s" %(channel0,thisDatetime.strftime("%d-%b-%Y")) | |
347 |
|
348 | |||
@@ -371,7 +372,6 class VoltACFPLot(Figure): | |||||
371 | self.isConfig = True |
|
372 | self.isConfig = True | |
372 |
|
373 | |||
373 | self.setWinTitle(title) |
|
374 | self.setWinTitle(title) | |
374 |
|
||||
375 |
|
|
375 | title = "VOLT ACF Plot: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
376 | axes = self.axesList[0] |
|
376 | axes = self.axesList[0] | |
377 |
|
377 | |||
@@ -398,29 +398,3 class VoltACFPLot(Figure): | |||||
398 | ftp=ftp, |
|
398 | ftp=ftp, | |
399 | wr_period=wr_period, |
|
399 | wr_period=wr_period, | |
400 | thisDatetime=thisDatetime) |
|
400 | thisDatetime=thisDatetime) | |
401 |
|
||||
402 |
|
||||
403 |
|
||||
404 |
|
||||
405 |
|
||||
406 |
|
||||
407 |
|
||||
408 |
|
||||
409 |
|
||||
410 |
|
||||
411 |
|
||||
412 |
|
||||
413 |
|
||||
414 |
|
||||
415 |
|
||||
416 |
|
||||
417 |
|
||||
418 |
|
||||
419 |
|
||||
420 |
|
||||
421 |
|
||||
422 |
|
||||
423 |
|
||||
424 |
|
||||
425 |
|
||||
426 |
|
@@ -933,7 +933,7 class ProfileSelector(Operation): | |||||
933 | rangeList : List of profile ranges. Example: rangeList = ((4, 30), (32, 64), (128, 256)) |
|
933 | rangeList : List of profile ranges. Example: rangeList = ((4, 30), (32, 64), (128, 256)) | |
934 |
|
934 | |||
935 | """ |
|
935 | """ | |
936 | print "HOLA MUNDO CRUEL" |
|
936 | #print "HOLA MUNDO CRUEL" | |
937 | if rangeList is not None: |
|
937 | if rangeList is not None: | |
938 | if type(rangeList[0]) not in (tuple, list): |
|
938 | if type(rangeList[0]) not in (tuple, list): | |
939 | rangeList = [rangeList] |
|
939 | rangeList = [rangeList] | |
@@ -1355,6 +1355,7 class voltACFLags(Operation): | |||||
1355 | self.isConfig = False |
|
1355 | self.isConfig = False | |
1356 | self.profIndex = 0 |
|
1356 | self.profIndex = 0 | |
1357 | self.buffer = None |
|
1357 | self.buffer = None | |
|
1358 | self.channelList = [] | |||
1358 |
|
1359 | |||
1359 |
|
1360 | |||
1360 | def setup(self,dataOut ,lags = None,mode =None, fullBuffer= None ,pairsList = None,nAvg = 1): |
|
1361 | def setup(self,dataOut ,lags = None,mode =None, fullBuffer= None ,pairsList = None,nAvg = 1): | |
@@ -1364,7 +1365,7 class voltACFLags(Operation): | |||||
1364 | self.mode = mode |
|
1365 | self.mode = mode | |
1365 | self.fullBuffer= fullBuffer |
|
1366 | self.fullBuffer= fullBuffer | |
1366 | self.nAvg = nAvg |
|
1367 | self.nAvg = nAvg | |
1367 | self.pairsList = pairsList |
|
1368 | self.pairsList = [pairsList] | |
1368 | nChannels = dataOut.nChannels |
|
1369 | nChannels = dataOut.nChannels | |
1369 | nProfiles = dataOut.nProfiles |
|
1370 | nProfiles = dataOut.nProfiles | |
1370 | nHeights = dataOut.nHeights |
|
1371 | nHeights = dataOut.nHeights | |
@@ -1381,7 +1382,10 class voltACFLags(Operation): | |||||
1381 | pairsList = [(0,1)] |
|
1382 | pairsList = [(0,1)] | |
1382 | self.pairsList= pairsList |
|
1383 | self.pairsList= pairsList | |
1383 |
|
1384 | |||
1384 | self.selectChannels(self.pairsList) |
|
1385 | ||
|
1386 | for i in range(len(self.pairsList)): | |||
|
1387 | self.channelList.append(self.pairsList[i][0]) | |||
|
1388 | self.channelList.append(self.pairsList[i][1]) | |||
1385 |
|
1389 | |||
1386 | if lags == None: |
|
1390 | if lags == None: | |
1387 | if mode=='time': |
|
1391 | if mode=='time': | |
@@ -1392,20 +1396,22 class voltACFLags(Operation): | |||||
1392 |
|
1396 | |||
1393 | # buffer de canalaes, perfiles, alturas |
|
1397 | # buffer de canalaes, perfiles, alturas | |
1394 | if self.buffer is None: |
|
1398 | if self.buffer is None: | |
1395 |
self.buffer = numpy.zeros(( |
|
1399 | self.buffer = numpy.zeros((nChannels,nProfiles,nHeights),dtype='complex') | |
1396 |
|
1400 | |||
1397 | if fullBuffer: |
|
1401 | if fullBuffer: | |
1398 | self.tmp = numpy.zeros((len(pairsList), len(self.lags), nProfiles, nHeights), dtype = 'complex')*numpy.nan |
|
1402 | self.tmp = numpy.zeros((len(self.pairsList), len(self.lags), nProfiles, nHeights), dtype = 'complex')*numpy.nan | |
1399 | elif mode =='time': |
|
1403 | elif mode =='time': | |
1400 | self.tmp = numpy.zeros((len(pairsList), len(self.lags), nHeights),dtype='complex') |
|
1404 | self.tmp = numpy.zeros((len(self.pairsList), len(self.lags), nHeights),dtype='complex') | |
1401 | elif mode =='height': |
|
1405 | elif mode =='height': | |
1402 |
self.tmp = numpy.zeros(len(pairsList), |
|
1406 | self.tmp = numpy.zeros((len(self.pairsList), len(self.lags), nProfiles),dtype='complex') | |
1403 |
|
1407 | |||
1404 | print "lags", len(self.lags),self.lags |
|
1408 | print "lags", len(self.lags),self.lags | |
1405 | print "mode",self.mode |
|
1409 | print "mode",self.mode | |
1406 | print "nChannels", nChannels |
|
1410 | print "nChannels", nChannels | |
1407 | print "nProfiles", nProfiles |
|
1411 | print "nProfiles", nProfiles | |
1408 | print "nHeights" , nHeights |
|
1412 | print "nHeights" , nHeights | |
|
1413 | print "acf_channels",len(self.pairsList) | |||
|
1414 | print "channelList",self.channelList | |||
1409 | print "pairsList", pairsList,len(self.pairsList) |
|
1415 | print "pairsList", pairsList,len(self.pairsList) | |
1410 | print "fullBuffer", fullBuffer |
|
1416 | print "fullBuffer", fullBuffer | |
1411 | #print "type(pairsList)",type(pairsList) |
|
1417 | #print "type(pairsList)",type(pairsList) | |
@@ -1419,21 +1425,18 class voltACFLags(Operation): | |||||
1419 | if not self.isConfig: |
|
1425 | if not self.isConfig: | |
1420 | self.setup(dataOut, lags = lags,mode = mode, fullBuffer= fullBuffer ,pairsList = pairsList,nAvg=nAvg) |
|
1426 | self.setup(dataOut, lags = lags,mode = mode, fullBuffer= fullBuffer ,pairsList = pairsList,nAvg=nAvg) | |
1421 | self.isConfig = True |
|
1427 | self.isConfig = True | |
1422 | print "pairsList Ale", self.pairsList |
|
1428 | ||
1423 | print dataOut.data[pairsList,:].shape |
|
|||
1424 | if dataOut.type == "Voltage": |
|
1429 | if dataOut.type == "Voltage": | |
1425 | if dataOut.flagDataAsBlock: |
|
1430 | if dataOut.flagDataAsBlock: | |
1426 | print "Not implemented yet" |
|
1431 | print "Not implemented yet" | |
1427 | return 0 |
|
1432 | return 0 | |
1428 | else: |
|
1433 | else: | |
1429 | print "shapebuffer",self.buffer[:,0,:].shape |
|
1434 | self.buffer[:, self.profIndex, :] = dataOut.data | |
1430 | self.buffer[:, self.profIndex, :] = dataOut.data#error |
|
|||
1431 | self.profIndex += 1 |
|
1435 | self.profIndex += 1 | |
1432 |
|
1436 | |||
1433 | if self.profIndex == self.__nProfiles : |
|
1437 | if self.profIndex == self.__nProfiles : | |
|
1438 | ||||
1434 | data_pre = self.buffer #data |
|
1439 | data_pre = self.buffer #data | |
1435 | print "size",data_pre.shape |
|
|||
1436 | # Here is the loop :D |
|
|||
1437 | for l in range(len(self.pairsList)): |
|
1440 | for l in range(len(self.pairsList)): | |
1438 | ch0 = self.pairsList[l][0] |
|
1441 | ch0 = self.pairsList[l][0] | |
1439 | ch1 = self.pairsList[l][1] |
|
1442 | ch1 = self.pairsList[l][1] | |
@@ -1451,15 +1454,14 class voltACFLags(Operation): | |||||
1451 | if self.fullBuffer: |
|
1454 | if self.fullBuffer: | |
1452 | 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) |
|
1455 | 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) | |
1453 | dataOut.nAvg = self.nAvg |
|
1456 | dataOut.nAvg = self.nAvg | |
1454 |
|
||||
1455 |
|
|
1457 | if self.mode == 'time': | |
|
1458 | #print "entre" | |||
1456 |
|
|
1459 | delta = dataOut.ippSeconds*dataOut.nCohInt | |
1457 |
|
|
1460 | else: | |
1458 | delta = dataOut.heightList[1] - dataOut.heightList[0] |
|
1461 | delta = dataOut.heightList[1] - dataOut.heightList[0] | |
1459 |
|
1462 | |||
1460 |
shape= self.tmp.shape |
|
1463 | shape= self.tmp.shape | |
1461 | # Normalizando |
|
1464 | for i in range(len(self.pairsList)): | |
1462 | for i in range(len(pairsList)): |
|
|||
1463 | for j in range(shape[2]): |
|
1465 | for j in range(shape[2]): | |
1464 |
self.tmp[i,:,j]= self.tmp[i,:,j].real |
|
1466 | self.tmp[i,:,j]= self.tmp[i,:,j].real/numpy.max(numpy.abs(self.tmp[i,:,j])) | |
1465 |
|
1467 | |||
@@ -1473,7 +1475,8 class voltACFLags(Operation): | |||||
1473 | #plt.show() |
|
1475 | #plt.show() | |
1474 | #import time |
|
1476 | #import time | |
1475 | #time.sleep(20) |
|
1477 | #time.sleep(20) | |
1476 |
dataOut.data |
|
1478 | dataOut.data = self.buffer | |
|
1479 | dataOut.data_acfLag = self.tmp | |||
1477 | dataOut.mode = self.mode |
|
1480 | dataOut.mode = self.mode | |
1478 | dataOut.nLags = len(self.lags) |
|
1481 | dataOut.nLags = len(self.lags) | |
1479 | dataOut.nProfiles = len(self.lags) |
|
1482 | dataOut.nProfiles = len(self.lags) | |
@@ -1482,6 +1485,7 class voltACFLags(Operation): | |||||
1482 | dataOut.lagRange = numpy.array(self.lags)*delta |
|
1485 | dataOut.lagRange = numpy.array(self.lags)*delta | |
1483 | dataOut.flagDataAsBlock = True |
|
1486 | dataOut.flagDataAsBlock = True | |
1484 | dataOut.flagNoData = False |
|
1487 | dataOut.flagNoData = False | |
|
1488 | self.profIndex = 0 | |||
1485 |
|
1489 | |||
1486 |
|
1490 | |||
1487 | import time |
|
1491 | import time |
General Comments 0
You need to be logged in to leave comments.
Login now