##// END OF EJS Templates
Metodo destructor agregado a la clase Figure para desactivar el modo interactivo y mantener el gráfico.
Metodo destructor agregado a la clase Figure para desactivar el modo interactivo y mantener el gráfico.

File last commit:

r205:1ee343fe61a4
r206:8fad7d650bae
Show More
jroplot.py
226 lines | 6.8 KiB | text/x-python | PythonLexer
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 import numpy
import datetime
from graphics.figure import *
Daniel Valdez
En graphics:...
r192 class SpectraPlot(Figure):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 __isConfig = None
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 __nsubplots = None
WIDTHPROF = None
HEIGHTPROF = None
Daniel Valdez
En graphics:...
r192
def __init__(self):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 self.__isConfig = False
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 self.__nsubplots = 1
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.WIDTH = 300
self.HEIGHT = 400
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 self.WIDTHPROF = 120
self.HEIGHTPROF = 0
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
En graphics:...
r192 def getSubplots(self):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 ncol = int(numpy.sqrt(self.nplots)+0.9)
nrow = int(self.nplots*1./ncol + 0.9)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 return nrow, ncol
def setup(self, idfigure, nplots, wintitle, showprofile=True):
self.__showprofile = showprofile
self.nplots = nplots
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 ncolspan = 1
Daniel Valdez
En graphics:...
r192 colspan = 1
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 if showprofile:
ncolspan = 3
colspan = 2
self.__nsubplots = 2
self.WIDTH += self.WIDTHPROF
self.HEIGHT += self.HEIGHTPROF
self.createFigure(idfigure, wintitle)
Daniel Valdez
En graphics:...
r192
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 nrow, ncol = self.getSubplots()
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 counter = 0
for y in range(nrow):
for x in range(ncol):
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204
if counter >= self.nplots:
break
self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
if showprofile:
self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+2, 1, 1)
Daniel Valdez
En graphics:...
r192 counter += 1
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None):
"""
Input:
dataOut :
idfigure :
wintitle :
channelList :
showProfile :
xmin : None,
xmax : None,
ymin : None,
ymax : None,
zmin : None,
zmax : None
"""
Daniel Valdez
En graphics:...
r192
if channelList == None:
Miguel Valdez
Bug fixed: Al graficar los canales selecionados en SpectraPlot
r203 channelIndexList = dataOut.channelIndexList
else:
channelIndexList = []
for channel in channelList:
if channel not in dataOut.channelList:
raise ValueError, "Channel %d is not in dataOut.channelList"
channelIndexList.append(channel)
Daniel Valdez
En graphics:...
r192
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 x = dataOut.getVelRange(1)
Daniel Valdez
En graphics:...
r192 y = dataOut.heightList
Miguel Valdez
Bug fixed: Al graficar los canales selecionados en SpectraPlot
r203 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
Miguel Valdez
Se modifico el calculo automatico del rango de valores del grafico de Espectros.
r205 avg = numpy.average(z, axis=1)
Daniel Valdez
En graphics:...
r192
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199 noise = dataOut.getNoise()
Daniel Valdez
En graphics:...
r192 if not self.__isConfig:
Miguel Valdez
Bug fixed: Al graficar los canales selecionados en SpectraPlot
r203 nplots = len(channelIndexList)
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.setup(idfigure=idfigure,
nplots=nplots,
wintitle=wintitle,
showprofile=showprofile)
if xmin == None: xmin = numpy.nanmin(x)
if xmax == None: xmax = numpy.nanmax(x)
if ymin == None: ymin = numpy.nanmin(y)
if ymax == None: ymax = numpy.nanmax(y)
Miguel Valdez
Se modifico el calculo automatico del rango de valores del grafico de Espectros.
r205 if zmin == None: zmin = numpy.nanmin(avg)*0.9
if zmax == None: zmax = numpy.nanmax(avg)*0.9
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 self.__isConfig = True
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
En esta version se ha implementado la clase para ploteo de espectros, a este grafico aun le falta agregar el perfil de potencia para cada canal.
r196 thisDatetime = datetime.datetime.fromtimestamp(dataOut.utctime)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
xlabel = "Velocity (m/s)"
ylabel = "Range (Km)"
Daniel Valdez
En esta version se ha implementado la clase para ploteo de espectros, a este grafico aun le falta agregar el perfil de potencia para cada canal.
r196
self.setWinTitle(title)
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 for i in range(self.nplots):
Miguel Valdez
Bug fixed: Al graficar los canales selecionados en SpectraPlot
r203 title = "Channel %d: %4.2fdB" %(dataOut.channelList[i], noise[i])
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 axes = self.axesList[i*self.__nsubplots]
axes.pcolor(x, y, z[i,:,:],
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
xlabel=xlabel, ylabel=ylabel, title=title,
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 ticksize=9, cblabel='')
if self.__showprofile:
axes = self.axesList[i*self.__nsubplots +1]
axes.pline(avg[i], y,
xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
xlabel='dB', ylabel='', title='',
ytick_visible=False,
grid='x')
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 self.draw()
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 class Scope(Figure):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 __isConfig = None
def __init__(self):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 self.__isConfig = False
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.WIDTH = 600
self.HEIGHT = 200
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
def getSubplots(self):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 nrow = self.nplots
ncol = 3
return nrow, ncol
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 def setup(self, idfigure, nplots, wintitle):
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 self.createFigure(idfigure, wintitle)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
nrow,ncol = self.getSubplots()
colspan = 3
rowspan = 1
for i in range(nplots):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204
self.nplots = nplots
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 def run(self, dataOut, idfigure, wintitle="", channelList=None,
xmin=None, xmax=None, ymin=None, ymax=None):
"""
Input:
dataOut :
idfigure :
wintitle :
channelList :
xmin : None,
xmax : None,
ymin : None,
ymax : None,
"""
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
if channelList == None:
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 channelList = dataOut.channelList
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 x = dataOut.heightList
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 y = dataOut.data[channelList,:] * numpy.conjugate(dataOut.data[channelList,:])
y = y.real
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 noise = dataOut.getNoise()
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
if not self.__isConfig:
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 nplots = len(channelList)
self.setup(idfigure=idfigure,
nplots=nplots,
wintitle=wintitle)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 if xmin == None: xmin = numpy.nanmin(x)
if xmax == None: xmax = numpy.nanmax(x)
if ymin == None: ymin = numpy.nanmin(y)
if ymax == None: ymax = numpy.nanmax(y)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
self.__isConfig = True
thisDatetime = datetime.datetime.fromtimestamp(dataOut.utctime)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
xlabel = "Range (Km)"
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 ylabel = "Intensity"
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.setWinTitle(title)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
for i in range(len(self.axesList)):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199 title = "Channel %d: %4.2fdB" %(i, noise[i])
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 axes = self.axesList[i]
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 ychannel = y[i,:]
axes.pline(x, ychannel,
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
xlabel=xlabel, ylabel=ylabel, title=title)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
self.draw()