##// END OF EJS Templates
simulador y pruebas de librerias
simulador y pruebas de librerias

File last commit:

r1290:a2308e7c2e9e
r1290:a2308e7c2e9e
Show More
jroplot_voltage.py
295 lines | 9.9 KiB | text/x-python | PythonLexer
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 '''
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 Created on Jul 9, 2014
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 @author: roj-idl71
'''
import os
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 import datetime
import numpy
George Yong
Multiprocessing for voltage (all operations) working
r1173 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation, MPDecorator #YONG
from schainpy.utils import log
George Yong
Python 2to3, Spectra (all operations) working
r1167 from .figure import Figure
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487
George Yong
Multiprocessing for voltage (all operations) working
r1173
@MPDecorator
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class Scope_(Figure):
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 isConfig = None
Update de WR-Project
r1282
George Yong
Multiprocessing for voltage (all operations) working
r1173 def __init__(self):#, **kwargs): #YONG
Figure.__init__(self)#, **kwargs)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = False
self.WIDTH = 300
self.HEIGHT = 200
self.counter_imagwr = 0
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def getSubplots(self):
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nrow = self.nplots
ncol = 3
return nrow, ncol
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def setup(self, id, nplots, wintitle, show):
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.nplots = nplots
Update de WR-Project
r1282
self.createFigure(id=id,
wintitle=wintitle,
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 show=show)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 nrow,ncol = self.getSubplots()
colspan = 3
rowspan = 1
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for i in range(nplots):
self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def plot_iq(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax):
yreal = y[channelIndexList,:].real
yimag = y[channelIndexList,:].imag
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
xlabel = "Range (Km)"
ylabel = "Intensity - IQ"
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not self.isConfig:
nplots = len(channelIndexList)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.setup(id=id,
nplots=nplots,
wintitle='',
show=show)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if xmin == None: xmin = numpy.nanmin(x)
if xmax == None: xmax = numpy.nanmax(x)
if ymin == None: ymin = min(numpy.nanmin(yreal),numpy.nanmin(yimag))
if ymax == None: ymax = max(numpy.nanmax(yreal),numpy.nanmax(yimag))
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = True
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.setWinTitle(title)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for i in range(len(self.axesList)):
title = "Channel %d" %(i)
axes = self.axesList[i]
axes.pline(x, yreal[i,:],
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
xlabel=xlabel, ylabel=ylabel, title=title)
axes.addpline(x, yimag[i,:], idline=1, color="red", linestyle="solid", lw=2)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def plot_power(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax):
y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:])
yreal = y.real
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
xlabel = "Range (Km)"
ylabel = "Intensity"
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if not self.isConfig:
nplots = len(channelIndexList)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.setup(id=id,
nplots=nplots,
wintitle='',
show=show)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if xmin == None: xmin = numpy.nanmin(x)
if xmax == None: xmax = numpy.nanmax(x)
if ymin == None: ymin = numpy.nanmin(yreal)
if ymax == None: ymax = numpy.nanmax(yreal)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.isConfig = True
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.setWinTitle(title)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 for i in range(len(self.axesList)):
title = "Channel %d" %(i)
axes = self.axesList[i]
ychannel = yreal[i,:]
axes.pline(x, ychannel,
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
xlabel=xlabel, ylabel=ylabel, title=title)
Update de WR-Project
r1282 def plot_weatherpower(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax):
y = y[channelIndexList,:]
yreal = y
title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
xlabel = "Range (Km)"
ylabel = "Intensity"
if not self.isConfig:
nplots = len(channelIndexList)
self.setup(id=id,
nplots=nplots,
wintitle='',
show=show)
if xmin == None: xmin = numpy.nanmin(x)
if xmax == None: xmax = numpy.nanmax(x)
if ymin == None: ymin = numpy.nanmin(yreal)
if ymax == None: ymax = numpy.nanmax(yreal)
self.isConfig = True
self.setWinTitle(title)
for i in range(len(self.axesList)):
title = "Channel %d" %(i)
axes = self.axesList[i]
ychannel = yreal[i,:]
axes.pline(x, ychannel,
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
xlabel=xlabel, ylabel=ylabel, title=title)
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 def run(self, dataOut, id, wintitle="", channelList=None,
xmin=None, xmax=None, ymin=None, ymax=None, save=False,
figpath='./', figfile=None, show=True, wr_period=1,
Jose Chavez
voltage DigitalRFReader funcionando
r973 ftp=False, server=None, folder=None, username=None, password=None, type='power', **kwargs):
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 """
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 Input:
dataOut :
id :
wintitle :
channelList :
xmin : None,
xmax : None,
ymin : None,
ymax : None,
"""
Update de WR-Project
r1282 if dataOut.flagNoData:
George Yong
Multiprocessing for voltage (all operations) working
r1173 return dataOut
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 if channelList == None:
channelIndexList = dataOut.channelIndexList
else:
channelIndexList = []
for channel in channelList:
if channel not in dataOut.channelList:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Channel %d is not in dataOut.channelList")
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 channelIndexList.append(dataOut.channelList.index(channel))
Update de WR-Project
r1282
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
simulador y pruebas de librerias
r1290 #print("***************** PLOTEO **************************")
#print(dataOut.nProfiles)
#print(dataOut.heightList.shape)
#print(dataOut.data.shape)
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 if dataOut.flagDataAsBlock:
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 for i in range(dataOut.nProfiles):
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 wintitle1 = wintitle + " [Profile = %d] " %i
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 if type == "power":
Update de WR-Project
r1282 self.plot_power(dataOut.heightList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 dataOut.data[:,i,:],
Update de WR-Project
r1282 id,
channelIndexList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 thisDatetime,
wintitle1,
show,
xmin,
xmax,
ymin,
ymax)
Update de WR-Project
r1282
if type == "weatherpower":
self.plot_weatherpower(dataOut.heightList,
dataOut.data[:,i,:],
id,
channelIndexList,
thisDatetime,
wintitle1,
show,
xmin,
xmax,
ymin,
ymax)
if type == "weathervelocity":
self.plot_weatherpower(dataOut.heightList,
dataOut.data_velocity[:,i,:],
id,
channelIndexList,
thisDatetime,
wintitle1,
show,
xmin,
xmax,
ymin,
ymax)
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 if type == "iq":
Update de WR-Project
r1282 self.plot_iq(dataOut.heightList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 dataOut.data[:,i,:],
Update de WR-Project
r1282 id,
channelIndexList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 thisDatetime,
wintitle1,
show,
xmin,
xmax,
ymin,
ymax)
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 self.draw()
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage: saving every profile
r774 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
figfile = self.getFilename(name = str_datetime) + "_" + str(i)
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage: saving every profile
r774 self.save(figpath=figpath,
figfile=figfile,
save=save,
ftp=ftp,
wr_period=wr_period,
thisDatetime=thisDatetime)
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 else:
wintitle += " [Profile = %d] " %dataOut.profileIndex
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 if type == "power":
Update de WR-Project
r1282 self.plot_power(dataOut.heightList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 dataOut.data,
Update de WR-Project
r1282 id,
channelIndexList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 thisDatetime,
wintitle,
show,
xmin,
xmax,
ymin,
ymax)
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 if type == "iq":
Update de WR-Project
r1282 self.plot_iq(dataOut.heightList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 dataOut.data,
Update de WR-Project
r1282 id,
channelIndexList,
Miguel Valdez
jroplot_voltage.py: New feature added. Support for plotting voltages when getByBlock is set.
r742 thisDatetime,
wintitle,
show,
xmin,
xmax,
ymin,
ymax)
Update de WR-Project
r1282
Daniel Valdez
This is the new organization by packages and scripts for Signal Chain, this version contains new features and bugs fixed until August 2014
r487 self.draw()
Update de WR-Project
r1282
Miguel Valdez
jroplot_voltage: saving every profile
r774 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") + "_" + str(dataOut.profileIndex)
Update de WR-Project
r1282 figfile = self.getFilename(name = str_datetime)
Miguel Valdez
A new SendToServer Unit has been created to upload files to a remote server....
r573 self.save(figpath=figpath,
figfile=figfile,
save=save,
ftp=ftp,
wr_period=wr_period,
George Yong
Multiprocessing for voltage (all operations) working
r1173 thisDatetime=thisDatetime)
Update de WR-Project
r1282 return dataOut