##// END OF EJS Templates
Merge EW-Drifts
Merge EW-Drifts

File last commit:

r1396:f39ad5b721a3
r1396:f39ad5b721a3
Show More
jroplot_voltage.py
302 lines | 9.6 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
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 from schainpy.model.graphics.jroplot_base import Plot, plt
George Yong
Multiprocessing for voltage (all operations) working
r1173
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
class ScopePlot(Plot):
'''
Plot for Scope
update for weather radar options
r1296 '''
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
CODE = 'scope'
plot_type = 'scatter'
update for weather radar options
r1296
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def setup(self):
self.xaxis = 'Range (Km)'
self.ncols = 1
self.nrows = 1
self.nplots = 1
self.ylabel = 'Intensity [dB]'
self.titles = ['Scope']
self.colorbar = False
self.width = 6
self.height = 4
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
data = {}
meta = {
'nProfiles': dataOut.nProfiles,
'flagDataAsBlock': dataOut.flagDataAsBlock,
'profileIndex': dataOut.profileIndex,
}
if self.CODE == 'scope':
data[self.CODE] = dataOut.data
elif self.CODE == 'pp_power':
data[self.CODE] = dataOut.dataPP_POWER
elif self.CODE == 'pp_signal':
data[self.CODE] = dataOut.dataPP_POW
elif self.CODE == 'pp_velocity':
data[self.CODE] = dataOut.dataPP_DOP
elif self.CODE == 'pp_specwidth':
data[self.CODE] = dataOut.dataPP_WIDTH
return data, meta
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot_iq(self, x, y, channelIndexList, thisDatetime, wintitle):
update for weather radar options
r1296
Merge EW-Drifts
r1396 yreal = y[channelIndexList, :].real
yimag = y[channelIndexList, :].imag
title = wintitle + " Scope: %s" % (thisDatetime.strftime("%d-%b-%Y"))
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.xlabel = "Range (Km)"
self.ylabel = "Intensity - IQ"
update for weather radar options
r1296
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.y = yreal
self.x = x
update for weather radar options
r1296
self.titles[0] = 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
Merge EW-Drifts
r1396 for i, ax in enumerate(self.axes):
title = "Channel %d" % (i)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if ax.firsttime:
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.xmin = min(x)
self.xmax = max(x)
Merge EW-Drifts
r1396 ax.plt_r = ax.plot(x, yreal[i, :], color='b')[0]
ax.plt_i = ax.plot(x, yimag[i, :], color='r')[0]
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 else:
Merge EW-Drifts
r1396 ax.plt_r.set_data(x, yreal[i, :])
ax.plt_i.set_data(x, yimag[i, :])
update for weather radar options
r1296
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot_power(self, x, y, channelIndexList, thisDatetime, wintitle):
Merge EW-Drifts
r1396 y = y[channelIndexList, :] * numpy.conjugate(y[channelIndexList, :])
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 yreal = y.real
Merge EW-Drifts
r1396 yreal = 10 * numpy.log10(yreal)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.y = yreal
Merge EW-Drifts
r1396 title = wintitle + " Power: %s" % (thisDatetime.strftime("%d-%b-%Y"))
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.xlabel = "Range (Km)"
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.ylabel = "Intensity [dB]"
update for weather radar options
r1296
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.titles[0] = title
Merge EW-Drifts
r1396 for i, ax in enumerate(self.axes):
title = "Channel %d" % (i)
ychannel = yreal[i, :]
update for weather radar options
r1296
if ax.firsttime:
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.xmin = min(x)
self.xmax = max(x)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 ax.plt_r = ax.plot(x, ychannel)[0]
else:
ax.plt_r.set_data(x, ychannel)
update for weather radar options
r1296
def plot_weatherpower(self, x, y, channelIndexList, thisDatetime, wintitle):
Merge EW-Drifts
r1396 y = y[channelIndexList, :]
yreal = y.real
yreal = 10 * numpy.log10(yreal)
update for weather radar options
r1296 self.y = yreal
Merge EW-Drifts
r1396 title = wintitle + " Scope: %s" % (thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
update for weather radar options
r1296 self.xlabel = "Range (Km)"
self.ylabel = "Intensity"
Merge EW-Drifts
r1396 self.xmin = min(x)
self.xmax = max(x)
update for weather radar options
r1296
Merge EW-Drifts
r1396 self.titles[0] = title
for i, ax in enumerate(self.axes):
title = "Channel %d" % (i)
update for weather radar options
r1296
Merge EW-Drifts
r1396 ychannel = yreal[i, :]
update for weather radar options
r1296
if ax.firsttime:
ax.plt_r = ax.plot(x, ychannel)[0]
else:
Merge EW-Drifts
r1396 # pass
update for weather radar options
r1296 ax.plt_r.set_data(x, ychannel)
def plot_weathervelocity(self, x, y, channelIndexList, thisDatetime, wintitle):
Merge EW-Drifts
r1396 x = x[channelIndexList, :]
yreal = y
update for weather radar options
r1296 self.y = yreal
Merge EW-Drifts
r1396 title = wintitle + " Scope: %s" % (thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
update for weather radar options
r1296 self.xlabel = "Velocity (m/s)"
self.ylabel = "Range (Km)"
Merge EW-Drifts
r1396 self.xmin = numpy.min(x)
self.xmax = numpy.max(x)
self.titles[0] = title
for i, ax in enumerate(self.axes):
title = "Channel %d" % (i)
xchannel = x[i, :]
update for weather radar options
r1296 if ax.firsttime:
ax.plt_r = ax.plot(xchannel, yreal)[0]
else:
Merge EW-Drifts
r1396 # pass
update for weather radar options
r1296 ax.plt_r.set_data(xchannel, yreal)
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
graficos de ploteo pulsepair
r1305 def plot_weatherspecwidth(self, x, y, channelIndexList, thisDatetime, wintitle):
Merge EW-Drifts
r1396 x = x[channelIndexList, :]
yreal = y
graficos de ploteo pulsepair
r1305 self.y = yreal
Merge EW-Drifts
r1396 title = wintitle + " Scope: %s" % (thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
graficos de ploteo pulsepair
r1305 self.xlabel = "width "
self.ylabel = "Range (Km)"
Merge EW-Drifts
r1396 self.xmin = numpy.min(x)
self.xmax = numpy.max(x)
self.titles[0] = title
for i, ax in enumerate(self.axes):
title = "Channel %d" % (i)
xchannel = x[i, :]
graficos de ploteo pulsepair
r1305 if ax.firsttime:
ax.plt_r = ax.plot(xchannel, yreal)[0]
else:
Merge EW-Drifts
r1396 # pass
graficos de ploteo pulsepair
r1305 ax.plt_r.set_data(xchannel, yreal)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
if self.channels:
channels = self.channels
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 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 channels = self.data.channels
thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1])
Add update method to plots to pass data (no more changes in jrodata)
r1343
scope = self.data[-1][self.CODE]
update for weather radar options
r1296
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.data.flagDataAsBlock:
update for weather radar options
r1296
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for i in range(self.data.nProfiles):
Merge EW-Drifts
r1396 wintitle1 = " [Profile = %d] " % i
if self.CODE == "scope":
update for weather radar options
r1296 if self.type == "power":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_power(self.data.yrange,
Merge EW-Drifts
r1396 scope[:, i, :],
update for weather radar options
r1296 channels,
thisDatetime,
wintitle1
)
if self.type == "iq":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_iq(self.data.yrange,
Merge EW-Drifts
r1396 scope[:, i, :],
update for weather radar options
r1296 channels,
thisDatetime,
wintitle1
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 )
Merge EW-Drifts
r1396 if self.CODE == "pp_power":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_weatherpower(self.data.yrange,
Merge EW-Drifts
r1396 scope[:, i, :],
update for weather radar options
r1296 channels,
thisDatetime,
wintitle
)
Merge EW-Drifts
r1396 if self.CODE == "pp_signal":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_weatherpower(self.data.yrange,
Merge EW-Drifts
r1396 scope[:, i, :],
UPDATE del jroplot_voltage.py
r1312 channels,
thisDatetime,
wintitle
)
Merge EW-Drifts
r1396 if self.CODE == "pp_velocity":
self.plot_weathervelocity(scope[:, i, :],
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.data.yrange,
update for weather radar options
r1296 channels,
thisDatetime,
wintitle
)
Merge EW-Drifts
r1396 if self.CODE == "pp_spcwidth":
self.plot_weatherspecwidth(scope[:, i, :],
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.data.yrange,
graficos de ploteo pulsepair
r1305 channels,
thisDatetime,
wintitle
)
update for weather radar options
r1296 else:
Merge EW-Drifts
r1396 wintitle = " [Profile = %d] " % self.data.profileIndex
if self.CODE == "scope":
update for weather radar options
r1296 if self.type == "power":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_power(self.data.yrange,
update for weather radar options
r1296 scope,
channels,
thisDatetime,
wintitle
)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
if self.type == "iq":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_iq(self.data.yrange,
update for weather radar options
r1296 scope,
channels,
thisDatetime,
wintitle
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 )
Merge EW-Drifts
r1396 if self.CODE == "pp_power":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_weatherpower(self.data.yrange,
update for weather radar options
r1296 scope,
channels,
thisDatetime,
wintitle
)
Merge EW-Drifts
r1396 if self.CODE == "pp_signal":
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plot_weatherpower(self.data.yrange,
UPDATE del jroplot_voltage.py
r1312 scope,
channels,
thisDatetime,
wintitle
)
Merge EW-Drifts
r1396 if self.CODE == "pp_velocity":
update for weather radar options
r1296 self.plot_weathervelocity(scope,
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.data.yrange,
update for weather radar options
r1296 channels,
thisDatetime,
wintitle
)
Merge EW-Drifts
r1396 if self.CODE == "pp_specwidth":
graficos de ploteo pulsepair
r1305 self.plot_weatherspecwidth(scope,
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.data.yrange,
graficos de ploteo pulsepair
r1305 channels,
thisDatetime,
wintitle
)
update for weather radar options
r1296
class PulsepairPowerPlot(ScopePlot):
'''
UPDATE del jroplot_voltage.py
r1312 Plot for P= S+N
update for weather radar options
r1296 '''
CODE = 'pp_power'
plot_type = 'scatter'
class PulsepairVelocityPlot(ScopePlot):
'''
UPDATE del jroplot_voltage.py
r1312 Plot for VELOCITY
update for weather radar options
r1296 '''
CODE = 'pp_velocity'
plot_type = 'scatter'
graficos de ploteo pulsepair
r1305
class PulsepairSpecwidthPlot(ScopePlot):
'''
UPDATE del jroplot_voltage.py
r1312 Plot for WIDTH
graficos de ploteo pulsepair
r1305 '''
CODE = 'pp_specwidth'
plot_type = 'scatter'
UPDATE del jroplot_voltage.py
r1312
class PulsepairSignalPlot(ScopePlot):
'''
Plot for S
'''
CODE = 'pp_signal'
plot_type = 'scatter'