##// END OF EJS Templates
Testeado con datos de Imagenes (Espectros)...
Testeado con datos de Imagenes (Espectros) Se visualiza el ruido en los graficos y en la escala correcta de velocidad 1. Upgrade de la libreria grafica 2. Adicion de la clase IncohInt para los datos de tipo Spectra 3. Adicion de calculo de ruido, calculo de numero de canales, rangeo de velocidad a la clase JROData

File last commit:

r201:86bbb8030d3e
r201:86bbb8030d3e
Show More
figure.py
231 lines | 6.5 KiB | text/x-python | PythonLexer
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 import numpy
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 import mpldriver
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 class Figure:
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
__driver = mpldriver
idfigure = None
wintitle = None
Daniel Valdez
En graphics:...
r192 width = None
height = None
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 nplots = None
axesObjList = []
WIDTH = None
HEIGHT = None
def __init__(self):
raise ValueError, "This method is not implemented"
def getAxesObjList(self):
return self.axesObjList
def getSubplots(self):
raise ValueError, "Abstract method: This method should be defined"
def getScreenDim(self):
nrow, ncol = self.getSubplots()
width = self.WIDTH*ncol
height = self.HEIGHT*nrow
return width, height
def init(self, idfigure, nplots, wintitle):
"""
Inicializa la figura de acuerdo al driver seleccionado
Input:
*args : Los parametros necesarios son
idfigure, wintitle, width, height
"""
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
self.idfigure = idfigure
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.nplots = nplots
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.wintitle = wintitle
self.width, self.height = self.getScreenDim()
self.fig = self.__driver.createFigure(self.idfigure,
self.wintitle,
self.width,
self.height)
self.axesObjList = []
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 setDriver(self, driver=mpldriver):
self.__driver = driver
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 def setTitle(self, title):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
self.__driver.setTitle(self.fig, title)
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 setWinTitle(self, title):
self.__driver.setWinTitle(self.fig, title=title)
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
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 def setTextFromAxes(self, text):
raise ValueError, "Este metodo ha sido reemplazaado con el metodo setText de la clase Axes"
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
def makeAxes(self, nrow, ncol, xpos, ypos, colspan, rowspan):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
raise ValueError, "Este metodo ha sido reemplazaado con el metodo addAxes"
def addAxes(self, *args):
"""
Input:
*args : Los parametros necesarios son
nrow, ncol, xpos, ypos, colspan, rowspan
"""
axesObj = Axes(self.fig, *args)
self.axesObjList.append(axesObj)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
def draw(self):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
self.__driver.draw(self.fig)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
def run(self):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
raise ValueError, "This method is not implemented"
axesList = property(getAxesObjList)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
class Axes:
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
__driver = mpldriver
fig = None
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 ax = None
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 plot = None
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 firsttime = None
def __init__(self, *args):
"""
Input:
*args : Los parametros necesarios son
fig, nrow, ncol, xpos, ypos, colspan, rowspan
"""
ax = self.__driver.createAxes(*args)
self.fig = args[0]
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 self.ax = ax
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 self.plot = None
self.firsttime = True
def setText(self, text):
self.__driver.setAxesText(self.ax, text)
def pline(self, x, y,
xmin=None, xmax=None,
ymin=None, ymax=None,
xlabel='', ylabel='',
title='',
**kwargs):
"""
Input:
x :
y :
xmin :
xmax :
ymin :
ymax :
xlabel :
ylabel :
title :
**kwargs : Los parametros aceptados son
ticksize
"""
if self.firsttime:
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)
self.plot = self.__driver.createPline(self.ax, x, y,
xmin, xmax,
ymin, ymax,
xlabel=xlabel,
ylabel=ylabel,
title=title,
**kwargs)
self.firsttime = False
return
self.__driver.pline(self.plot, x, y, xlabel=xlabel,
ylabel=ylabel,
title=title)
def pcolor(self, x, y, z,
xmin=None, xmax=None,
ymin=None, ymax=None,
zmin=None, zmax=None,
xlabel='', ylabel='',
title='',
**kwargs):
"""
Input:
x :
y :
x :
xmin :
xmax :
ymin :
ymax :
zmin :
zmax :
xlabel :
ylabel :
title :
**kwargs : Los parametros aceptados son
ticksize=9,
cblabel=''
"""
if self.firsttime:
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)
if zmin == None: zmin = numpy.nanmin(z)
if zmax == None: zmax = numpy.nanmax(z)
self.plot = self.__driver.createPcolor(self.ax, x, y, z,
xmin, xmax,
ymin, ymax,
zmin, zmax,
xlabel=xlabel,
ylabel=ylabel,
title=title,
**kwargs)
self.firsttime = False
return
mesh = self.__driver.pcolor(self.plot, z, xlabel=xlabel,
ylabel=ylabel,
title=title)