##// END OF EJS Templates
update de operacion voltACFLags en jroproc_voltage.py y VoltACFPLot en jroplot_voltage.py
avaldez -
r1274:b6957aa66e1c
parent child
Show More
@@ -259,8 +259,10 class VoltACFPLot(Figure):
259 259 widthplot = self.WIDTH,
260 260 heightplot = self.HEIGHT,
261 261 show = show)
262
262 263 nrow, ncol = self.getSubplots()
263 264 counter = 0
265
264 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 300 raise ValueError, "Channel %d is not in dataOut.channelList"
299 301 channelIndexList.append(dataOut.channelList.index(channel))
300 302
301
302 303 #factor = dataOut.normFactor
303 304 y = dataOut.getHeiRange()
304 305 #print y, dataOut.heightList[0]
@@ -306,9 +307,10 class VoltACFPLot(Figure):
306 307 #import time
307 308 #time.sleep(10)
308 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 314 hei_index = numpy.arange(shape[2])
313 315 hei_plot = numpy.arange(nSamples)*resFactor
314 316
@@ -328,20 +330,19 class VoltACFPLot(Figure):
328 330 #escalamiento -1 a 1 a resolucion (factor de resolucion en altura)* deltaHeight
329 331 #min = numpy.min(z[0,:,0])
330 332 #max =numpy.max(z[0,:,0])
333 #print shape[0]
331 334 for i in range(shape[0]):
335 #print "amigo i",i
332 336 for j in range(shape[2]):
333 337 min = numpy.min(z[i,:,j])
334 338 max = numpy.max(z[i,:,j])
335 339 z[i,:,j]= (((z[i,:,j]-min)/(max-min))*deltaHeight*resFactor + j*deltaHeight+dataOut.heightList[0])
336 340
337
338 341 if xaxis == "time":
339 342 x = dataOut.getAcfRange()*1000
340 343 zdB = z[channel0,:,hei_plot]
341 344 xlabel = "Time (ms)"
342 345 ylabel = "VOLT_ACF"
343
344
345 346 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
346 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 372 self.isConfig = True
372 373
373 374 self.setWinTitle(title)
374
375 375 title = "VOLT ACF Plot: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
376 376 axes = self.axesList[0]
377 377
@@ -398,29 +398,3 class VoltACFPLot(Figure):
398 398 ftp=ftp,
399 399 wr_period=wr_period,
400 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 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 937 if rangeList is not None:
938 938 if type(rangeList[0]) not in (tuple, list):
939 939 rangeList = [rangeList]
@@ -1355,6 +1355,7 class voltACFLags(Operation):
1355 1355 self.isConfig = False
1356 1356 self.profIndex = 0
1357 1357 self.buffer = None
1358 self.channelList = []
1358 1359
1359 1360
1360 1361 def setup(self,dataOut ,lags = None,mode =None, fullBuffer= None ,pairsList = None,nAvg = 1):
@@ -1364,7 +1365,7 class voltACFLags(Operation):
1364 1365 self.mode = mode
1365 1366 self.fullBuffer= fullBuffer
1366 1367 self.nAvg = nAvg
1367 self.pairsList = pairsList
1368 self.pairsList = [pairsList]
1368 1369 nChannels = dataOut.nChannels
1369 1370 nProfiles = dataOut.nProfiles
1370 1371 nHeights = dataOut.nHeights
@@ -1381,7 +1382,10 class voltACFLags(Operation):
1381 1382 pairsList = [(0,1)]
1382 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 1390 if lags == None:
1387 1391 if mode=='time':
@@ -1392,20 +1396,22 class voltACFLags(Operation):
1392 1396
1393 1397 # buffer de canalaes, perfiles, alturas
1394 1398 if self.buffer is None:
1395 self.buffer = numpy.zeros((len(pairsList),nProfiles,nHeights),dtype='complex')
1399 self.buffer = numpy.zeros((nChannels,nProfiles,nHeights),dtype='complex')
1396 1400
1397 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 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 1405 elif mode =='height':
1402 self.tmp = numpy.zeros(len(pairsList), (len(self.lags), nProfiles),dtype='complex')
1406 self.tmp = numpy.zeros((len(self.pairsList), len(self.lags), nProfiles),dtype='complex')
1403 1407
1404 1408 print "lags", len(self.lags),self.lags
1405 1409 print "mode",self.mode
1406 1410 print "nChannels", nChannels
1407 1411 print "nProfiles", nProfiles
1408 1412 print "nHeights" , nHeights
1413 print "acf_channels",len(self.pairsList)
1414 print "channelList",self.channelList
1409 1415 print "pairsList", pairsList,len(self.pairsList)
1410 1416 print "fullBuffer", fullBuffer
1411 1417 #print "type(pairsList)",type(pairsList)
@@ -1419,21 +1425,18 class voltACFLags(Operation):
1419 1425 if not self.isConfig:
1420 1426 self.setup(dataOut, lags = lags,mode = mode, fullBuffer= fullBuffer ,pairsList = pairsList,nAvg=nAvg)
1421 1427 self.isConfig = True
1422 print "pairsList Ale", self.pairsList
1423 print dataOut.data[pairsList,:].shape
1428
1424 1429 if dataOut.type == "Voltage":
1425 1430 if dataOut.flagDataAsBlock:
1426 1431 print "Not implemented yet"
1427 1432 return 0
1428 1433 else:
1429 print "shapebuffer",self.buffer[:,0,:].shape
1430 self.buffer[:, self.profIndex, :] = dataOut.data#error
1434 self.buffer[:, self.profIndex, :] = dataOut.data
1431 1435 self.profIndex += 1
1432 1436
1433 1437 if self.profIndex == self.__nProfiles :
1438
1434 1439 data_pre = self.buffer #data
1435 print "size",data_pre.shape
1436 # Here is the loop :D
1437 1440 for l in range(len(self.pairsList)):
1438 1441 ch0 = self.pairsList[l][0]
1439 1442 ch1 = self.pairsList[l][1]
@@ -1451,15 +1454,14 class voltACFLags(Operation):
1451 1454 if self.fullBuffer:
1452 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 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 1461 delta = dataOut.heightList[1] - dataOut.heightList[0]
1459 1462
1460 shape= self.tmp.shape # mode time
1461 # Normalizando
1462 for i in range(len(pairsList)):
1463 shape= self.tmp.shape
1464 for i in range(len(self.pairsList)):
1463 1465 for j in range(shape[2]):
1464 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 1475 #plt.show()
1474 1476 #import time
1475 1477 #time.sleep(20)
1476 dataOut.data = self.tmp
1478 dataOut.data = self.buffer
1479 dataOut.data_acfLag = self.tmp
1477 1480 dataOut.mode = self.mode
1478 1481 dataOut.nLags = len(self.lags)
1479 1482 dataOut.nProfiles = len(self.lags)
@@ -1482,6 +1485,7 class voltACFLags(Operation):
1482 1485 dataOut.lagRange = numpy.array(self.lags)*delta
1483 1486 dataOut.flagDataAsBlock = True
1484 1487 dataOut.flagNoData = False
1488 self.profIndex = 0
1485 1489
1486 1490
1487 1491 import time
General Comments 0
You need to be logged in to leave comments. Login now