##// END OF EJS Templates
se termina la clase RTIfromNoise para ploteo RTI del Ruido.
se termina la clase RTIfromNoise para ploteo RTI del Ruido.

File last commit:

r246:b1aba47ee03f
r246:b1aba47ee03f
Show More
mpldriver.py
371 lines | 10.5 KiB | text/x-python | PythonLexer
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 import numpy
Daniel Valdez
Adicion del metodo saveFigure() para guardar archivos de imagen de la clase Figure(). Se modifica los xaxis se muestran en formato datetime, falta hacer ajustes en los ticks de acuerdo al intervalo [xmin, xmax]
r209 import datetime
Daniel Valdez
Adicion del factor de normalizacion en la clase Spectra....
r245 import sys
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 import matplotlib
Daniel Valdez
Adicion del factor de normalizacion en la clase Spectra....
r245 if sys.platform == 'linux':
matplotlib.use("GTKAgg")
if sys.platform == 'darwin':
matplotlib.use("TKAgg")
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 import matplotlib.pyplot
Daniel Valdez
Adicion del metodo saveFigure() para guardar archivos de imagen de la clase Figure(). Se modifica los xaxis se muestran en formato datetime, falta hacer ajustes en los ticks de acuerdo al intervalo [xmin, xmax]
r209 import matplotlib.dates
Miguel Valdez
Controlador de Signal Chain finalizado....
r197 #import scitools.numpyutils
Daniel Valdez
En graphics:...
r192 from mpl_toolkits.axes_grid1 import make_axes_locatable
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
Miguel Valdez
-Se agrego la funcionalidad de replotear el grafico de RTI, ademas de los parametros timerange, xmin, xmax...
r210 from matplotlib.dates import DayLocator, HourLocator, MinuteLocator, SecondLocator, DateFormatter
from matplotlib.ticker import FuncFormatter
from matplotlib.ticker import *
Daniel Valdez
Adicion del metodo saveFigure() para guardar archivos de imagen de la clase Figure(). Se modifica los xaxis se muestran en formato datetime, falta hacer ajustes en los ticks de acuerdo al intervalo [xmin, xmax]
r209
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 ###########################################
#Actualizacion de las funciones del driver
###########################################
def createFigure(idfigure, wintitle, width, height, facecolor="w"):
matplotlib.pyplot.ioff()
Miguel Valdez
Bugs fixed: Eliminacion de numpy.abs() en el calculo de las cross-correlaciones y mejoras en los graficos de CrossSpectra
r227 fig = matplotlib.pyplot.figure(num=idfigure, facecolor=facecolor)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 fig.canvas.manager.set_window_title(wintitle)
fig.canvas.manager.resize(width, height)
matplotlib.pyplot.ion()
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.show()
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
return fig
Miguel Valdez
Metodo destructor agregado a la clase Figure para desactivar el modo interactivo y mantener el gráfico.
r206 def closeFigure():
matplotlib.pyplot.ioff()
matplotlib.pyplot.show()
Daniel Valdez
Adicion de la clase RTIPlot
r207 return
Miguel Valdez
Metodo destructor agregado a la clase Figure para desactivar el modo interactivo y mantener el gráfico.
r206
Daniel Valdez
Adicion del metodo saveFigure() para guardar archivos de imagen de la clase Figure(). Se modifica los xaxis se muestran en formato datetime, falta hacer ajustes en los ticks de acuerdo al intervalo [xmin, xmax]
r209 def saveFigure(fig, filename):
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
matplotlib.pyplot.ioff()
Daniel Valdez
Adicion del metodo saveFigure() para guardar archivos de imagen de la clase Figure(). Se modifica los xaxis se muestran en formato datetime, falta hacer ajustes en los ticks de acuerdo al intervalo [xmin, xmax]
r209 fig.savefig(filename)
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.ion()
Daniel Valdez
Adicion del metodo saveFigure() para guardar archivos de imagen de la clase Figure(). Se modifica los xaxis se muestran en formato datetime, falta hacer ajustes en los ticks de acuerdo al intervalo [xmin, xmax]
r209
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 def setWinTitle(fig, title):
fig.canvas.manager.set_window_title(title)
def setTitle(fig, title):
fig.suptitle(title)
def createAxes(fig, nrow, ncol, xpos, ypos, colspan, rowspan):
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.ioff()
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 matplotlib.pyplot.figure(fig.number)
axes = matplotlib.pyplot.subplot2grid((nrow, ncol),
(xpos, ypos),
colspan=colspan,
rowspan=rowspan)
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
matplotlib.pyplot.ion()
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 return axes
def setAxesText(ax, text):
ax.annotate(text,
xy = (.1, .99),
xycoords = 'figure fraction',
horizontalalignment = 'left',
verticalalignment = 'top',
fontsize = 10)
def printLabels(ax, xlabel, ylabel, title):
ax.set_xlabel(xlabel, size=11)
ax.set_ylabel(ylabel, size=11)
ax.set_title(title, size=12)
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='',
ticksize=9, xtick_visible=True, ytick_visible=True,
nxticks=4, nyticks=10,
grid=None):
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 """
Input:
grid : None, 'both', 'x', 'y'
"""
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
matplotlib.pyplot.ioff()
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 ax.set_xlim([xmin,xmax])
ax.set_ylim([ymin,ymax])
printLabels(ax, xlabel, ylabel, title)
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 ######################################################
Daniel Valdez
Adicion de la clase ProfilePlot, CoherencePLot en el modulo jroplot.py...
r229 if (xmax-xmin)<=1:
xtickspos = numpy.linspace(xmin,xmax,nxticks)
xtickspos = numpy.array([float("%.1f"%i) for i in xtickspos])
ax.set_xticks(xtickspos)
else:
xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
ax.set_xticks(xtickspos)
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204
for tick in ax.get_xticklabels():
tick.set_visible(xtick_visible)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204
######################################################
for tick in ax.get_yticklabels():
tick.set_visible(ytick_visible)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
ax.plot(x, y)
Miguel Valdez
Se mejora el metodo para grabar graficos de RTI y Spectra....
r212 iplot = ax.lines[-1]
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204
######################################################
Miguel Valdez
Se mejora el metodo para grabar graficos de RTI y Spectra....
r212 if '0.' in matplotlib.__version__[0:2]:
print "The matplotlib version has to be updated to 1.1 or newer"
return iplot
if '1.0.' in matplotlib.__version__[0:4]:
print "The matplotlib version has to be updated to 1.1 or newer"
return iplot
Miguel Valdez
-Se agrego el perfil de potencia al grafico de espectros
r204 if grid != None:
ax.grid(b=True, which='major', axis=grid)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 matplotlib.pyplot.tight_layout()
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.ion()
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 return iplot
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 def set_linedata(ax, x, y, idline):
ax.lines[idline].set_data(x,y)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 def pline(iplot, x, y, xlabel='', ylabel='', title=''):
ax = iplot.get_axes()
printLabels(ax, xlabel, ylabel, title)
Daniel Valdez
Se agrega el metodo deflip a jroprocessing.py....
r239 set_linedata(ax, x, y, idline=0)
def addpline(ax, x, y, color, linestyle, lw):
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
Daniel Valdez
Se agrega el metodo deflip a jroprocessing.py....
r239 ax.plot(x,y,color=color,linestyle=linestyle,lw=lw)
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
def createPcolor(ax, x, y, z, xmin, xmax, ymin, ymax, zmin, zmax,
xlabel='', ylabel='', title='', ticksize = 9,
colormap='jet',cblabel='', cbsize="5%",
XAxisAsTime=False):
Daniel Valdez
Se agrega el metodo deflip a jroprocessing.py....
r239
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.ioff()
Daniel Valdez
Se agrega el metodo deflip a jroprocessing.py....
r239
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 divider = make_axes_locatable(ax)
ax_cb = divider.new_horizontal(size=cbsize, pad=0.05)
fig = ax.get_figure()
fig.add_axes(ax_cb)
ax.set_xlim([xmin,xmax])
ax.set_ylim([ymin,ymax])
printLabels(ax, xlabel, ylabel, title)
imesh = ax.pcolormesh(x,y,z.T, vmin=zmin, vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
cb = matplotlib.pyplot.colorbar(imesh, cax=ax_cb)
cb.set_label(cblabel)
# for tl in ax_cb.get_yticklabels():
# tl.set_visible(True)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
for tick in cb.ax.get_yticklabels():
tick.set_fontsize(ticksize)
ax_cb.yaxis.tick_right()
if '0.' in matplotlib.__version__[0:2]:
print "The matplotlib version has to be updated to 1.1 or newer"
return imesh
if '1.0.' in matplotlib.__version__[0:4]:
print "The matplotlib version has to be updated to 1.1 or newer"
return imesh
matplotlib.pyplot.tight_layout()
if XAxisAsTime:
func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
ax.xaxis.set_major_formatter(FuncFormatter(func))
ax.xaxis.set_major_locator(LinearLocator(7))
matplotlib.pyplot.ion()
return imesh
def pcolor(imesh, z, xlabel='', ylabel='', title=''):
z = z.T
ax = imesh.get_axes()
printLabels(ax, xlabel, ylabel, title)
imesh.set_array(z.ravel())
def addpcolor(ax, x, y, z, zmin, zmax, xlabel='', ylabel='', title='', colormap='jet'):
printLabels(ax, xlabel, ylabel, title)
imesh = ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax, cmap=matplotlib.pyplot.get_cmap(colormap))
Daniel Valdez
Adicion de la clase ProfilePlot, CoherencePLot en el modulo jroplot.py...
r229
def createPmultiline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
ticksize=9, xtick_visible=True, ytick_visible=True,
nxticks=4, nyticks=10,
grid=None):
"""
Input:
grid : None, 'both', 'x', 'y'
"""
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
matplotlib.pyplot.ioff()
Daniel Valdez
Adicion de la clase ProfilePlot, CoherencePLot en el modulo jroplot.py...
r229 lines = ax.plot(x.T, y)
Daniel Valdez
Adicion de la carpeta test donde se encuentra la aplicacion de prueba para los experimentos EWDrifts y Faraday...
r240 leg = ax.legend(lines, legendlabels, loc='upper right')
Daniel Valdez
Adicion de la clase ProfilePlot, CoherencePLot en el modulo jroplot.py...
r229 leg.get_frame().set_alpha(0.5)
ax.set_xlim([xmin,xmax])
ax.set_ylim([ymin,ymax])
printLabels(ax, xlabel, ylabel, title)
xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
ax.set_xticks(xtickspos)
for tick in ax.get_xticklabels():
tick.set_visible(xtick_visible)
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
for tick in ax.get_yticklabels():
tick.set_visible(ytick_visible)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
iplot = ax.lines[-1]
if '0.' in matplotlib.__version__[0:2]:
print "The matplotlib version has to be updated to 1.1 or newer"
return iplot
if '1.0.' in matplotlib.__version__[0:4]:
print "The matplotlib version has to be updated to 1.1 or newer"
return iplot
if grid != None:
ax.grid(b=True, which='major', axis=grid)
matplotlib.pyplot.tight_layout()
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244
matplotlib.pyplot.ion()
Daniel Valdez
Adicion de la clase ProfilePlot, CoherencePLot en el modulo jroplot.py...
r229 return iplot
def pmultiline(iplot, x, y, xlabel='', ylabel='', title=''):
ax = iplot.get_axes()
printLabels(ax, xlabel, ylabel, title)
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201
Daniel Valdez
Adicion de la clase ProfilePlot, CoherencePLot en el modulo jroplot.py...
r229 for i in range(len(ax.lines)):
line = ax.lines[i]
line.set_data(x[i,:],y)
Daniel Valdez
Adicion de la carpeta test donde se encuentra la aplicacion de prueba para los experimentos EWDrifts y Faraday...
r240
def createPmultilineYAxis(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', legendlabels=None,
ticksize=9, xtick_visible=True, ytick_visible=True,
nxticks=4, nyticks=10, marker='^', markersize=8, linestyle="solid",
grid=None, XAxisAsTime=False):
"""
Input:
grid : None, 'both', 'x', 'y'
"""
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.ioff()
Daniel Valdez
Adicion de la carpeta test donde se encuentra la aplicacion de prueba para los experimentos EWDrifts y Faraday...
r240 lines = ax.plot(x, y.T, marker=marker,markersize=markersize,linestyle=linestyle)
Daniel Valdez
se termina la clase RTIfromNoise para ploteo RTI del Ruido.
r246 leg = ax.legend(lines, legendlabels, loc='upper left', bbox_to_anchor=(1.01, 1.00), numpoints=1, handlelength=1.5, \
handletextpad=0.5, borderpad=0.5, labelspacing=0.5, borderaxespad=0.)
for label in leg.get_texts(): label.set_fontsize(9)
Daniel Valdez
Adicion de la carpeta test donde se encuentra la aplicacion de prueba para los experimentos EWDrifts y Faraday...
r240
ax.set_xlim([xmin,xmax])
ax.set_ylim([ymin,ymax])
printLabels(ax, xlabel, ylabel, title)
# xtickspos = numpy.arange(nxticks)*int((xmax-xmin)/(nxticks)) + int(xmin)
# ax.set_xticks(xtickspos)
for tick in ax.get_xticklabels():
tick.set_visible(xtick_visible)
for tick in ax.xaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
for tick in ax.get_yticklabels():
tick.set_visible(ytick_visible)
for tick in ax.yaxis.get_major_ticks():
tick.label.set_fontsize(ticksize)
iplot = ax.lines[-1]
if '0.' in matplotlib.__version__[0:2]:
print "The matplotlib version has to be updated to 1.1 or newer"
return iplot
if '1.0.' in matplotlib.__version__[0:4]:
print "The matplotlib version has to be updated to 1.1 or newer"
return iplot
if grid != None:
ax.grid(b=True, which='major', axis=grid)
matplotlib.pyplot.tight_layout()
if XAxisAsTime:
func = lambda x, pos: ('%s') %(datetime.datetime.utcfromtimestamp(x).strftime("%H:%M:%S"))
ax.xaxis.set_major_formatter(FuncFormatter(func))
ax.xaxis.set_major_locator(LinearLocator(7))
Miguel Valdez
Optimizacion del driver para matplotlib. Activacion y descativacion del modo interactivo al crear figures y axes
r244 matplotlib.pyplot.ion()
Daniel Valdez
Adicion de la carpeta test donde se encuentra la aplicacion de prueba para los experimentos EWDrifts y Faraday...
r240 return iplot
Daniel Valdez
se termina la clase RTIfromNoise para ploteo RTI del Ruido.
r246 def pmultilineyaxis(iplot, x, y, xlabel='', ylabel='', title=''):
Daniel Valdez
Adicion de la carpeta test donde se encuentra la aplicacion de prueba para los experimentos EWDrifts y Faraday...
r240
ax = iplot.get_axes()
printLabels(ax, xlabel, ylabel, title)
for i in range(len(ax.lines)):
line = ax.lines[i]
line.set_data(x,y[i,:])
Daniel Valdez
Adicion de la clase RTIPlot
r207
Miguel Valdez
Testeado con datos de Imagenes (Espectros)...
r201 def draw(fig):
if type(fig) == 'int':
raise ValueError, "This parameter should be of tpye matplotlib figure"
fig.canvas.draw()