##// END OF EJS Templates
-Se modificó el atributo nChannels de la clase JROData y derivadas por la propiedad nChannels (llamada a la funcion self.getNChannels)...
-Se modificó el atributo nChannels de la clase JROData y derivadas por la propiedad nChannels (llamada a la funcion self.getNChannels) -Se modificó el atributo channelIndexList de la clase JROData y derivadas por la propiedad channelIndexList (llamada a la funcion self.getChannelIndexList) -Se eliminó todas las asignaciones de valor de 'nChannels' y 'channelIndexList' de los obejtos del tipo JROData y derivados (ahora no son atributos sino que se modifican dinamicante a partir de 'channelList') -Se modificó el metodo selectChannels de la clase VoltageProc y SpectraProc para que acepte como atributo la lista de canales y no la lista de indices de canales. -Se modificó el test del controlador para probar estas modificaciones

File last commit:

r200:ac28b7810bcd
r200:ac28b7810bcd
Show More
jroplot.py
192 lines | 5.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
def __init__(self):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 self.__isConfig = False
self.width = 850
self.height = 800
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)
return nrow, ncol
def setAxesWithOutProfiles(self, nrow, ncol):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 colspan = 1
rowspan = 1
counter = 0
for y in range(nrow):
for x in range(ncol):
if counter < self.nplots:
self.makeAxes(nrow, ncol, y, x, colspan, rowspan)
counter += 1
def setAxesWithProfiles(self, nrow, ncol):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 colspan = 1
rowspan = 1
factor = 2
ncol = ncol*factor
counter = 0
for y in range(nrow):
for x in range(ncol):
if counter < self.nplots*factor:
# plt.subplot2grid((nrow, ncol), (y, x), colspan=colspan, rowspan=rowspan)
self.makeAxes(nrow, ncol, y, x, colspan, rowspan)
counter += 1
def setup(self, idfigure, wintitle, width, height, nplots, profile):
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199
Daniel Valdez
En graphics:...
r192 self.init(idfigure, wintitle, width, height, nplots)
nrow,ncol = self.getSubplots()
if profile:
self.setAxesWithProfiles(nrow, ncol)
else:
self.setAxesWithOutProfiles(nrow, ncol)
def run(self, dataOut, idfigure, wintitle="", channelList=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, profile=False):
if channelList == None:
channelList = dataOut.channelList
nplots = len(channelList)
z = 10.*numpy.log10(dataOut.data_spc[channelList,:,:])
y = dataOut.heightList
x = numpy.arange(dataOut.nFFTPoints)
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199 noise = dataOut.getNoise()
Daniel Valdez
En graphics:...
r192 if not self.__isConfig:
self.setup(idfigure=idfigure,
wintitle=wintitle,
width=self.width,
height=self.height,
nplots=nplots,
profile=profile)
Miguel Valdez
Primera version del controlador probada y testeada incluyendo graficos
r199 if xmin == None: xmin = numpy.min(x)
if xmax == None: xmax = numpy.max(x)
if ymin == None: ymin = numpy.min(y)
if ymax == None: ymax = numpy.max(y)
if zmin == None: zmin = numpy.min(z)
if zmax == None: zmax = numpy.max(z)
self.xmin = xmin
self.xmax = xmax
self.ymin = ymin
self.ymax = ymax
self.zmin = zmin
self.zmax = zmax
Daniel Valdez
En graphics:...
r192 self.__isConfig = True
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)
dateTime = "%s"%(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
date = "%s"%(thisDatetime.strftime("%d-%b-%Y"))
title = "Spectra: " + dateTime
self.setWinTitle(title)
Daniel Valdez
En graphics:...
r192 ylabel = "Range[Km]"
xlabel = "m/s"
for i in range(len(self.axesList)):
Miguel Valdez
-Se modificó el atributo nChannels de la clase JROData y derivadas por la propiedad nChannels (llamada a la funcion self.getNChannels)...
r200 title = "Channel %d: %4.2fdB" %(channelList[i], noise[i])
Daniel Valdez
En graphics:...
r192 axes = self.axesList[i]
z2 = z[i,:,:]
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 axes.pcolor(x, y, z2, self.xmin, self.xmax, self.ymin, self.ymax, self.zmin, self.zmax, xlabel, ylabel, title)
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):
__isConfig = None
def __init__(self):
self.__isConfig = False
self.width = 850
self.height = 800
def getSubplots(self):
nrow = self.nplots
ncol = 3
return nrow, ncol
def setup(self, idfigure, wintitle, width, height, nplots):
self.init(idfigure, wintitle, width, height, nplots)
nrow,ncol = self.getSubplots()
colspan = 3
rowspan = 1
for i in range(nplots):
self.makeAxes(nrow, ncol, i, 0, colspan, rowspan)
def run(self, dataOut, idfigure, wintitle="", channelList=None, xmin=None, xmax=None, ymin=None, ymax=None):
if dataOut.isEmpty():
return None
if channelList == None:
channelList = dataOut.channelList
nplots = len(channelList)
y = dataOut.data[channelList,:] * numpy.conjugate(dataOut.data[channelList,:])
y = y.real
x = dataOut.heightList
if not self.__isConfig:
self.setup(idfigure=idfigure,
Daniel Valdez
En graphics:...
r192 wintitle=wintitle,
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190 width=self.width,
height=self.height,
nplots=nplots)
if xmin == None: self.xmin = numpy.min(x)
if xmax == None: self.xmax = numpy.max(x)
if ymin == None: self.ymin = numpy.min(y)
if ymax == None: self.ymax = numpy.max(y)
self.__isConfig = True
thisDatetime = datetime.datetime.fromtimestamp(dataOut.utctime)
dateTime = "%s"%(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
date = "%s"%(thisDatetime.strftime("%d-%b-%Y"))
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 title = "Scope: " + dateTime
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
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)
Daniel Valdez
Se agrega el folder "graphics" que contiene figure.py y mpldriver.py...
r190
ylabel = "Intensity"
xlabel = "Range[Km]"
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]
y2 = y[i,:]
axes.pline(x, y2, self.xmin, self.xmax, self.ymin, self.ymax, xlabel, ylabel, title)
self.draw()