##// END OF EJS Templates
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers

File last commit:

r1528:9eee9f011a2c
r1528:9eee9f011a2c
Show More
jroplot_spectra.py
1180 lines | 38.1 KiB | text/x-python | PythonLexer
Add update method to plots to pass data (no more changes in jrodata)
r1343 # Copyright (c) 2012-2020 Jicamarca Radio Observatory
# All rights reserved.
#
# Distributed under the terms of the BSD 3-clause license.
"""Classes to plot Spectra data
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568
Add update method to plots to pass data (no more changes in jrodata)
r1343 """
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
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 os
import numpy
Add update method to plots to pass data (no more changes in jrodata)
r1343 from schainpy.model.graphics.jroplot_base import Plot, plt, log
completado op clean Rayleigh, modificada la escritura y lectura de hdf5 para potencia, cambio en gráficos para uso del ChannelList, añadir en otros pendiente
r1397 from itertools import combinations
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 from matplotlib.ticker import LinearLocator
Lectura y procesamiento de spectra desde HDF5
r1404
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 class SpectraPlot(Plot):
'''
Plot for Spectra data
'''
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 CODE = 'spc'
colormap = 'jet'
plot_type = 'pcolor'
Add update method to plots to pass data (no more changes in jrodata)
r1343 buffering = False
clean Rayleigh funcionando, tiempo de ejecución elevado usando todos los pares
r1391 channelList = []
Hildebrand_S en C, clear sats
r1475 elevationList = []
azimuthList = []
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def setup(self):
cambios para amisr ISR
r1465
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.nplots = len(self.data.channels)
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
nuevo 2 pc
r1473 self.height = 3.4 * self.nrows
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.cb_label = 'dB'
if self.showprofile:
nuevo 2 pc
r1473 self.width = 5.2 * self.ncols
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:
nuevo 2 pc
r1473 self.width = 4.2* self.ncols
self.plots_adjust.update({'wspace': 0.4, 'hspace':0.4, 'left': 0.1, 'right': 0.9, 'bottom': 0.12})
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.ylabel = 'Range [km]'
cambios para amisr ISR
r1465
Lectura y procesamiento de spectra desde HDF5
r1404 def update_list(self,dataOut):
if len(self.channelList) == 0:
self.channelList = dataOut.channelList
Hildebrand_S en C, clear sats
r1475 if len(self.elevationList) == 0:
self.elevationList = dataOut.elevationList
if len(self.azimuthList) == 0:
self.azimuthList = dataOut.azimuthList
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
cambios para amisr ISR
r1465
Lectura y procesamiento de spectra desde HDF5
r1404 self.update_list(dataOut)
Add update method to plots to pass data (no more changes in jrodata)
r1343 data = {}
meta = {}
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
data['spc'] = spc
data['rti'] = dataOut.getPower()
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
Add update method to plots to pass data (no more changes in jrodata)
r1343 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
if self.CODE == 'spc_moments':
data['moments'] = dataOut.moments
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
return data, meta
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
if self.xaxis == "frequency":
x = self.data.xrange[0]
self.xlabel = "Frequency (kHz)"
elif self.xaxis == "time":
x = self.data.xrange[1]
self.xlabel = "Time (ms)"
ebocanegra
first commit
r965 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
if self.CODE == 'spc_moments':
x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
self.titles = []
Add update method to plots to pass data (no more changes in jrodata)
r1343 y = self.data.yrange
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.y = y
Add update method to plots to pass data (no more changes in jrodata)
r1343
data = self.data[-1]
z = data['spc']
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print(z.shape, x.shape, y.shape)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for n, ax in enumerate(self.axes):
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #noise = data['noise'][n]
noise=62
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.CODE == 'spc_moments':
Fix bugs in SpectraCutPlot, GenericRTIPlot and saving when using throttle
r1359 mean = data['moments'][n, 1]
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if ax.firsttime:
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
self.xmin = self.xmin if self.xmin else -self.xmax
self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
if self.showprofile:
ax.plt_profile = self.pf_axes[n].plot(
Add update method to plots to pass data (no more changes in jrodata)
r1343 data['rti'][n], y)[0]
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 # ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
# color="k", linestyle="dashed", lw=1)[0]
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.CODE == 'spc_moments':
ax.plt_mean = ax.plot(mean, y, color='k')[0]
else:
ax.plt.set_array(z[n].T.ravel())
if self.showprofile:
Add update method to plots to pass data (no more changes in jrodata)
r1343 ax.plt_profile.set_data(data['rti'][n], y)
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.CODE == 'spc_moments':
ax.plt_mean.set_data(mean, y)
Hildebrand_S en C, clear sats
r1475 if len(self.azimuthList) > 0 and len(self.elevationList) > 0:
self.titles.append('CH {}: {:2.1f}elv {:2.1f}az {:3.2f}dB'.format(self.channelList[n], noise, self.elevationList[n], self.azimuthList[n]))
else:
self.titles.append('CH {}: {:3.2f}dB'.format(self.channelList[n], noise))
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
class CrossSpectraPlot(Plot):
CODE = 'cspc'
colormap = 'jet'
plot_type = 'pcolor'
zmin_coh = None
zmax_coh = None
zmin_phase = None
zmax_phase = None
Operando clean Rayleigh con crossSpectra
r1392 realChannels = None
crossPairs = None
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
def setup(self):
self.ncols = 4
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.nplots = len(self.data.pairs) * 2
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
Fix xmin & xmax in plots, fix SendToFTP
r1334 self.width = 3.1 * self.ncols
self.height = 2.6 * self.nrows
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.ylabel = 'Range [km]'
self.showprofile = False
Fix xmin & xmax in plots, fix SendToFTP
r1334 self.plots_adjust.update({'left': 0.08, 'right': 0.92, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
data = {}
meta = {}
spc = dataOut.data_spc
cspc = dataOut.data_cspc
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
Operando clean Rayleigh con crossSpectra
r1392 rawPairs = list(combinations(list(range(dataOut.nChannels)), 2))
meta['pairs'] = rawPairs
if self.crossPairs == None:
self.crossPairs = dataOut.pairsList
Add update method to plots to pass data (no more changes in jrodata)
r1343
tmp = []
for n, pair in enumerate(meta['pairs']):
Operando clean Rayleigh con crossSpectra
r1392
Add update method to plots to pass data (no more changes in jrodata)
r1343 out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
coh = numpy.abs(out)
phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
tmp.append(coh)
tmp.append(phase)
data['cspc'] = numpy.array(tmp)
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 return data, meta
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
if self.xaxis == "frequency":
x = self.data.xrange[0]
self.xlabel = "Frequency (kHz)"
elif self.xaxis == "time":
x = self.data.xrange[1]
self.xlabel = "Time (ms)"
Miguel Valdez
jroplot_spectra: xaxis can be frequency, velocity or time.
r777 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.titles = []
Add update method to plots to pass data (no more changes in jrodata)
r1343 y = self.data.yrange
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.y = y
Add update method to plots to pass data (no more changes in jrodata)
r1343 data = self.data[-1]
cspc = data['cspc']
Lectura y procesamiento de spectra desde HDF5
r1404
Add update method to plots to pass data (no more changes in jrodata)
r1343 for n in range(len(self.data.pairs)):
cambios sendtoServer, lectura spectra desde Hdf5
r1406
Operando clean Rayleigh con crossSpectra
r1392 pair = self.crossPairs[n]
Add update method to plots to pass data (no more changes in jrodata)
r1343 coh = cspc[n*2]
phase = cspc[n*2+1]
ax = self.axes[2 * n]
Operando clean Rayleigh con crossSpectra
r1392
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if ax.firsttime:
ax.plt = ax.pcolormesh(x, y, coh.T,
cambios para amisr ISR
r1465 vmin=self.zmin_coh,
vmax=self.zmax_coh,
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 cmap=plt.get_cmap(self.colormap_coh)
)
else:
ax.plt.set_array(coh.T.ravel())
self.titles.append(
'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
Add update method to plots to pass data (no more changes in jrodata)
r1343 ax = self.axes[2 * n + 1]
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if ax.firsttime:
ax.plt = ax.pcolormesh(x, y, phase.T,
vmin=-180,
vmax=180,
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 cmap=plt.get_cmap(self.colormap_phase)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 )
else:
ax.plt.set_array(phase.T.ravel())
cambios para amisr ISR
r1465
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
class RTIPlot(Plot):
'''
Plot for RTI data
'''
CODE = 'rti'
colormap = 'jet'
plot_type = 'pcolorbuffer'
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 titles = None
clean Rayleigh funcionando, tiempo de ejecución elevado usando todos los pares
r1391 channelList = []
Hildebrand_S en C, clear sats
r1475 elevationList = []
azimuthList = []
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
def setup(self):
self.xaxis = 'time'
self.ncols = 1
completado op clean Rayleigh, modificada la escritura y lectura de hdf5 para potencia, cambio en gráficos para uso del ChannelList, añadir en otros pendiente
r1397 #print("dataChannels ",self.data.channels)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.nrows = len(self.data.channels)
self.nplots = len(self.data.channels)
self.ylabel = 'Range [km]'
self.xlabel = 'Time'
self.cb_label = 'dB'
nuevo 2 pc
r1473 self.plots_adjust.update({'hspace':0.8, 'left': 0.08, 'bottom': 0.2, 'right':0.94})
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.titles = ['{} Channel {}'.format(
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 self.CODE.upper(), x) for x in range(self.nplots)]
completado op clean Rayleigh, modificada la escritura y lectura de hdf5 para potencia, cambio en gráficos para uso del ChannelList, añadir en otros pendiente
r1397
agregado update_list en PlotRTI, nuevo parámetro t_units para uso de enteros en las horas del RTI en plot_base
r1398 def update_list(self,dataOut):
cambios sendtoServer, lectura spectra desde Hdf5
r1406
Hildebrand_S en C, clear sats
r1475 if len(self.channelList) == 0:
self.channelList = dataOut.channelList
if len(self.elevationList) == 0:
self.elevationList = dataOut.elevationList
if len(self.azimuthList) == 0:
self.azimuthList = dataOut.azimuthList
agregado update_list en PlotRTI, nuevo parámetro t_units para uso de enteros en las horas del RTI en plot_base
r1398
Lectura y procesamiento de spectra desde HDF5
r1404
agregado update_list en PlotRTI, nuevo parámetro t_units para uso de enteros en las horas del RTI en plot_base
r1398 def update(self, dataOut):
cambios sendtoServer, lectura spectra desde Hdf5
r1406 if len(self.channelList) == 0:
self.update_list(dataOut)
Add update method to plots to pass data (no more changes in jrodata)
r1343 data = {}
meta = {}
data['rti'] = dataOut.getPower()
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
return data, meta
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
completado op clean Rayleigh, modificada la escritura y lectura de hdf5 para potencia, cambio en gráficos para uso del ChannelList, añadir en otros pendiente
r1397
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.x = self.data.times
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.y = self.data.yrange
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print(" x, y: ",self.x, self.y)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.z = self.data[self.CODE]
cambios sendtoServer, lectura spectra desde Hdf5
r1406 self.z = numpy.array(self.z, dtype=float)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.z = numpy.ma.masked_invalid(self.z)
cambios para amisr ISR
r1465
Operando clean Rayleigh con crossSpectra
r1392 try:
if self.channelList != None:
Hildebrand_S en C, clear sats
r1475 if len(self.elevationList) > 0 and len(self.azimuthList) > 0:
self.titles = ['{} Channel {} ({:2.1f} Elev, {:2.1f} Azth)'.format(
self.CODE.upper(), x, self.elevationList[x], self.azimuthList[x]) for x in self.channelList]
else:
self.titles = ['{} Channel {}'.format(
self.CODE.upper(), x) for x in self.channelList]
Operando clean Rayleigh con crossSpectra
r1392 except:
if self.channelList.any() != None:
Hildebrand_S en C, clear sats
r1475
Operando clean Rayleigh con crossSpectra
r1392 self.titles = ['{} Channel {}'.format(
self.CODE.upper(), x) for x in self.channelList]
Hildebrand_S en C, clear sats
r1475
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.decimation is None:
x, y, z = self.fill_gaps(self.x, self.y, self.z)
ebocanegra
first commit
r965 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 x, y, z = self.fill_gaps(*self.decimate())
nuevo
r1472
#dummy_var = self.axes #Extrañamente esto actualiza el valor axes
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for n, ax in enumerate(self.axes):
self.zmin = self.zmin if self.zmin else numpy.min(self.z)
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
Add update method to plots to pass data (no more changes in jrodata)
r1343 data = self.data[-1]
nuevo
r1472
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if ax.firsttime:
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
if self.showprofile:
cambios para amisr ISR
r1465 ax.plot_profile = self.pf_axes[n].plot(data[self.CODE][n], self.y)[0]
if "noise" in self.data:
nuevo
r1472
cambios para amisr ISR
r1465 ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(data['noise'][n], len(self.y)), self.y,
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 color="k", linestyle="dashed", lw=1)[0]
else:
ax.collections.remove(ax.collections[0])
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
if self.showprofile:
cambios para amisr ISR
r1465 ax.plot_profile.set_data(data[self.CODE][n], self.y)
if "noise" in self.data:
nuevo
r1472
cambios para amisr ISR
r1465 ax.plot_noise.set_data(numpy.repeat(
Add update method to plots to pass data (no more changes in jrodata)
r1343 data['noise'][n], len(self.y)), self.y)
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
class CoherencePlot(RTIPlot):
'''
Plot for Coherence data
'''
CODE = 'coh'
def setup(self):
self.xaxis = 'time'
self.ncols = 1
self.nrows = len(self.data.pairs)
self.nplots = len(self.data.pairs)
self.ylabel = 'Range [km]'
self.xlabel = 'Time'
self.plots_adjust.update({'hspace':0.6, 'left': 0.1, 'bottom': 0.1,'right':0.95})
if self.CODE == 'coh':
self.cb_label = ''
self.titles = [
'Coherence Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
Miguel Valdez
r825 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.cb_label = 'Degrees'
self.titles = [
'Phase Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
agregado update_list en PlotRTI, nuevo parámetro t_units para uso de enteros en las horas del RTI en plot_base
r1398 self.update_list(dataOut)
Add update method to plots to pass data (no more changes in jrodata)
r1343 data = {}
meta = {}
data['coh'] = dataOut.getCoherence()
meta['pairs'] = dataOut.pairsList
agregado update_list en PlotRTI, nuevo parámetro t_units para uso de enteros en las horas del RTI en plot_base
r1398
Add update method to plots to pass data (no more changes in jrodata)
r1343 return data, meta
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 class PhasePlot(CoherencePlot):
'''
Plot for Phase map data
'''
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 CODE = 'phase'
colormap = 'seismic'
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
data = {}
meta = {}
data['phase'] = dataOut.getCoherence(phase=True)
meta['pairs'] = dataOut.pairsList
return data, meta
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 class NoisePlot(Plot):
'''
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 Plot for noise
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 '''
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 CODE = 'noise'
plot_type = 'scatterbuffer'
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def setup(self):
self.xaxis = 'time'
self.ncols = 1
self.nrows = 1
self.nplots = 1
self.ylabel = 'Intensity [dB]'
Juan C. Espinoza
Update plots modules
r1308 self.xlabel = 'Time'
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.titles = ['Noise']
self.colorbar = False
Add update method to plots to pass data (no more changes in jrodata)
r1343 self.plots_adjust.update({'right': 0.85 })
def update(self, dataOut):
data = {}
meta = {}
cambios para amisr ISR getNoise
r1468 noise = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor).reshape(dataOut.nChannels, 1)
data['noise'] = noise
Add update method to plots to pass data (no more changes in jrodata)
r1343 meta['yrange'] = numpy.array([])
return data, meta
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 x = self.data.times
xmin = self.data.min_time
xmax = xmin + self.xrange * 60 * 60
Add update method to plots to pass data (no more changes in jrodata)
r1343 Y = self.data['noise']
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.axes[0].firsttime:
cambios para amisr ISR getNoise
r1468 if self.ymin is None: self.ymin = numpy.nanmin(Y) - 5
if self.ymax is None: self.ymax = numpy.nanmax(Y) + 5
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for ch in self.data.channels:
y = Y[ch]
self.axes[0].plot(x, y, lw=1, label='Ch{}'.format(ch))
Add update method to plots to pass data (no more changes in jrodata)
r1343 plt.legend(bbox_to_anchor=(1.18, 1.0))
Julio Valdez
-Parameters Plot corrected...
r832 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for ch in self.data.channels:
y = Y[ch]
self.axes[0].lines[ch].set_data(x, y)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 class PowerProfilePlot(Plot):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 CODE = 'pow_profile'
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 plot_type = 'scatter'
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def setup(self):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.ncols = 1
self.nrows = 1
self.nplots = 1
self.height = 4
self.width = 3
self.ylabel = 'Range [km]'
self.xlabel = 'Intensity [dB]'
self.titles = ['Power Profile']
self.colorbar = False
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
data = {}
meta = {}
data[self.CODE] = dataOut.getPower()
return data, meta
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 y = self.data.yrange
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.y = y
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 x = self.data[-1][self.CODE]
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.xmin is None: self.xmin = numpy.nanmin(x)*0.9
if self.xmax is None: self.xmax = numpy.nanmax(x)*1.1
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if self.axes[0].firsttime:
for ch in self.data.channels:
self.axes[0].plot(x[ch], y, lw=1, label='Ch{}'.format(ch))
plt.legend()
Miguel Valdez
jroplot_spectra: xaxis can be frequency, velocity or time.
r777 else:
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for ch in self.data.channels:
self.axes[0].lines[ch].set_data(x[ch], y)
class SpectraCutPlot(Plot):
CODE = 'spc_cut'
plot_type = 'scatter'
buffering = False
cambios para amisr ISR
r1465 heights = []
channelList = []
maintitle = "Spectra Cuts"
nuevo 2 pc
r1473 flag_setIndex = False
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
def setup(self):
self.nplots = len(self.data.channels)
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
nuevo 2 pc
r1473 self.width = 4.2 * self.ncols + 2.5
self.height = 4.8 * self.nrows
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.ylabel = 'Power [dB]'
self.colorbar = False
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 self.plots_adjust.update({'left':0.05, 'hspace':0.3, 'right': 0.9, 'bottom':0.08})
nuevo 2 pc
r1473
if len(self.selectedHeightsList) > 0:
self.maintitle = "Spectra Cut"# for %d km " %(int(self.selectedHeight))
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Add update method to plots to pass data (no more changes in jrodata)
r1343 def update(self, dataOut):
cambios para amisr ISR
r1465 if len(self.channelList) == 0:
self.channelList = dataOut.channelList
Add update method to plots to pass data (no more changes in jrodata)
r1343
cambios para amisr ISR
r1465 self.heights = dataOut.heightList
nuevo 2 pc
r1473 #print("sels: ",self.selectedHeightsList)
if len(self.selectedHeightsList)>0 and not self.flag_setIndex:
for sel_height in self.selectedHeightsList:
index_list = numpy.where(self.heights >= sel_height)
index_list = index_list[0]
self.height_index.append(index_list[0])
#print("sels i:"", self.height_index)
self.flag_setIndex = True
cambios para amisr ISR
r1465 #print(self.height_index)
Add update method to plots to pass data (no more changes in jrodata)
r1343 data = {}
meta = {}
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
nuevo 2 pc
r1473
data['spc'] = spc
Add update method to plots to pass data (no more changes in jrodata)
r1343 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
return data, meta
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
if self.xaxis == "frequency":
x = self.data.xrange[0][1:]
self.xlabel = "Frequency (kHz)"
elif self.xaxis == "time":
x = self.data.xrange[1]
self.xlabel = "Time (ms)"
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 x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.titles = []
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Add update method to plots to pass data (no more changes in jrodata)
r1343 y = self.data.yrange
z = self.data[-1]['spc']
cambios para amisr ISR
r1465 #print(z.shape)
nuevo 2 pc
r1473 if len(self.height_index) > 0:
index = self.height_index
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 index = numpy.arange(0, len(y), int((len(y))/9))
nuevo 2 pc
r1473 #print("inde x ", index, self.axes)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 for n, ax in enumerate(self.axes):
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 if ax.firsttime:
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
self.xmin = self.xmin if self.xmin else -self.xmax
self.ymin = self.ymin if self.ymin else numpy.nanmin(z)
self.ymax = self.ymax if self.ymax else numpy.nanmax(z)
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
nuevo 2 pc
r1473 ax.plt = ax.plot(x, z[n, :, index].T)
labels = ['Range = {:2.1f}km'.format(y[i]) for i in index]
self.figures[0].legend(ax.plt, labels, loc='center right', prop={'size': 8})
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506 ax.minorticks_on()
ax.grid(which='major', axis='both')
ax.grid(which='minor', axis='x')
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 else:
Hildebrand_S en C, clear sats
r1475 for i, line in enumerate(ax.plt):
nuevo 2 pc
r1473 line.set_data(x, z[n, :, index[i]])
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
cambios para amisr ISR
r1465 self.titles.append('CH {}'.format(self.channelList[n]))
nuevo 2 pc
r1473 plt.suptitle(self.maintitle, fontsize=10)
George Yong
Multiprocessing for Spectra (all operation) working
r1171
omisión perfies para ISR, Bloques a perfiles, heildebrand en C, y más...
r1506
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 class BeaconPhase(Plot):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 __isConfig = None
__nsubplots = None
PREFIX = 'beacon_phase'
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
George Yong
Multiprocessing for writing Units(Spectral, Voltage and Parameters)
r1179 def __init__(self):
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 Plot.__init__(self)
Daniel Valdez
Fixing PNG File Storage...
r494 self.timerange = 24*60*60
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 self.isConfig = False
Daniel Valdez
Fixing PNG File Storage...
r494 self.__nsubplots = 1
self.counter_imagwr = 0
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 self.WIDTH = 800
self.HEIGHT = 400
Daniel Valdez
Fixing PNG File Storage...
r494 self.WIDTHPROF = 120
self.HEIGHTPROF = 0
self.xdata = None
self.ydata = None
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
A new SendToServer Unit has been created to upload files to a remote server....
r573 self.PLOT_CODE = BEACON_CODE
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.FTP_WEI = None
self.EXP_CODE = None
self.SUB_EXP_CODE = None
self.PLOT_POS = None
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.filename_phase = None
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.figfile = None
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.xmin = None
self.xmax = None
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 def getSubplots(self):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 ncol = 1
nrow = 1
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 return nrow, ncol
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 def setup(self, id, nplots, wintitle, showprofile=True, show=True):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.__showprofile = showprofile
self.nplots = nplots
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 ncolspan = 7
colspan = 6
self.__nsubplots = 2
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.createFigure(id = id,
wintitle = wintitle,
widthplot = self.WIDTH+self.WIDTHPROF,
heightplot = self.HEIGHT+self.HEIGHTPROF,
show=show)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 nrow, ncol = self.getSubplots()
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
def save_phase(self, filename_phase):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858 f = open(filename_phase,'w+')
Daniel Valdez
Fixing PNG File Storage...
r494 f.write('\n\n')
f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n')
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858 f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' )
Daniel Valdez
Fixing PNG File Storage...
r494 f.close()
def save_data(self, filename_phase, data, data_datetime):
f=open(filename_phase,'a')
timetuple_data = data_datetime.timetuple()
day = str(timetuple_data.tm_mday)
month = str(timetuple_data.tm_mon)
year = str(timetuple_data.tm_year)
hour = str(timetuple_data.tm_hour)
minute = str(timetuple_data.tm_min)
second = str(timetuple_data.tm_sec)
f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n')
f.close()
Juan C. Espinoza
Update and fix plot modules #TODO: correlation & spectraheis
r1285 def plot(self):
log.warning('TODO: Not yet implemented...')
Daniel Valdez
Fixing PNG File Storage...
r494
def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None,
Daniel Valdez
Fixing PNG File Storage...
r494 timerange=None,
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
Daniel Valdez
Fixing PNG File Storage...
r494 server=None, folder=None, username=None, password=None,
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 if dataOut.flagNoData:
George Yong
Multiprocessing for Spectra (all operation) working
r1171 return dataOut
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
return
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 if pairsList == None:
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 pairsIndexList = dataOut.pairsIndexList[:10]
Daniel Valdez
Fixing PNG File Storage...
r494 else:
pairsIndexList = []
for pair in pairsList:
if pair not in dataOut.pairsList:
George Yong
Python 2to3, Spectra (all operations) working
r1167 raise ValueError("Pair %s is not in dataOut.pairsList" %(pair))
Daniel Valdez
Fixing PNG File Storage...
r494 pairsIndexList.append(dataOut.pairsList.index(pair))
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 if pairsIndexList == []:
return
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Juan C. Espinoza
Fix SpectralMoments Plot
r1207 # if len(pairsIndexList) > 4:
# pairsIndexList = pairsIndexList[0:4]
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760
hmin_index = None
hmax_index = None
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if hmin != None and hmax != None:
indexes = numpy.arange(dataOut.nHeights)
hmin_list = indexes[dataOut.heightList >= hmin]
hmax_list = indexes[dataOut.heightList <= hmax]
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if hmin_list.any():
hmin_index = hmin_list[0]
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if hmax_list.any():
hmax_index = hmax_list[-1]+1
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 x = dataOut.getTimeRange()
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 thisDatetime = dataOut.datatime
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
Daniel Valdez
Fixing PNG File Storage...
r494 xlabel = "Local Time"
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 ylabel = "Phase (degrees)"
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 update_figfile = False
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 nplots = len(pairsIndexList)
#phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
phase_beacon = numpy.zeros(len(pairsIndexList))
for i in range(nplots):
pair = dataOut.pairsList[pairsIndexList[i]]
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0)
powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0)
powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0)
Daniel Valdez
Fixing PNG File Storage...
r494 avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if dataOut.beacon_heiIndexList:
phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
else:
phase_beacon[i] = numpy.average(phase)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if not self.isConfig:
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 nplots = len(pairsIndexList)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.setup(id=id,
nplots=nplots,
wintitle=wintitle,
showprofile=showprofile,
show=show)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 if timerange != None:
self.timerange = timerange
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if ymin == None: ymin = 0
if ymax == None: ymax = 360
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.FTP_WEI = ftp_wei
self.EXP_CODE = exp_code
self.SUB_EXP_CODE = sub_exp_code
self.PLOT_POS = plot_pos
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 self.isConfig = True
Daniel Valdez
Fixing PNG File Storage...
r494 self.figfile = figfile
self.xdata = numpy.array([])
self.ydata = numpy.array([])
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 update_figfile = True
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 #open file beacon phase
path = '%s%03d' %(self.PREFIX, self.id)
beacon_file = os.path.join(path,'%s.txt'%self.name)
self.filename_phase = os.path.join(figpath,beacon_file)
#self.save_phase(self.filename_phase)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 #store data beacon phase
#self.save_data(self.filename_phase, phase_beacon, thisDatetime)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.setWinTitle(title)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList]
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 axes = self.axesList[0]
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.xdata = numpy.hstack((self.xdata, x[0:1]))
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 if len(self.ydata)==0:
self.ydata = phase_beacon.reshape(-1,1)
else:
self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1)))
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
Miguel Valdez
Merge with branch schain_julia_drifts from rev. 803 to 995....
r568 xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax,
Daniel Valdez
Fixing PNG File Storage...
r494 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
XAxisAsTime=True, grid='both'
)
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Daniel Valdez
Fixing PNG File Storage...
r494 self.draw()
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 if dataOut.ltctime >= self.xmax:
Daniel Valdez
Fixing PNG File Storage...
r494 self.counter_imagwr = wr_period
Miguel Valdez
Bug fixed plotting RTI, CoherenceMap, Noise and BeaconPhase: It were not working properly when xmin and xmax were defined and more than one day selected.
r760 self.isConfig = False
update_figfile = True
Juan C. Valdez
Add colormap parameter for spectra and RTI, create jro colormap, plot masked arrays
r858
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,
thisDatetime=thisDatetime,
George Yong
Multiprocessing for Spectra (all operation) working
r1171 update_figfile=update_figfile)
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
r1386 return dataOut
cambios para amisr ISR
r1465
class NoiselessSpectraPlot(Plot):
'''
Plot for Spectra data, subtracting
the noise in all channels, using for
amisr-14 data
'''
CODE = 'noiseless_spc'
colormap = 'nipy_spectral'
plot_type = 'pcolor'
buffering = False
channelList = []
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 last_noise = None
cambios para amisr ISR
r1465
def setup(self):
self.nplots = len(self.data.channels)
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
self.height = 2.6 * self.nrows
self.cb_label = 'dB'
if self.showprofile:
self.width = 4 * self.ncols
else:
self.width = 3.5 * self.ncols
self.plots_adjust.update({'wspace': 0.4, 'hspace':0.4, 'left': 0.1, 'right': 0.9, 'bottom': 0.08})
self.ylabel = 'Range [km]'
def update_list(self,dataOut):
if len(self.channelList) == 0:
self.channelList = dataOut.channelList
def update(self, dataOut):
self.update_list(dataOut)
data = {}
meta = {}
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter
n0 = 10*numpy.log10(dataOut.getNoise()/float(norm))
cambios para amisr ISR
r1465
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 if self.last_noise == None:
self.last_noise = n0
else:
n0 = (n0*0.2 + self.last_noise*0.8)
self.last_noise = n0
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
cambios para amisr ISR
r1465
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 data['spc'] = spc - n0
data['rti'] = dataOut.getPower() - n0
#data['noise'] = noise
cambios para amisr ISR
r1465 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
return data, meta
def plot(self):
if self.xaxis == "frequency":
x = self.data.xrange[0]
self.xlabel = "Frequency (kHz)"
elif self.xaxis == "time":
x = self.data.xrange[1]
self.xlabel = "Time (ms)"
else:
x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
self.titles = []
y = self.data.yrange
self.y = y
data = self.data[-1]
z = data['spc']
for n, ax in enumerate(self.axes):
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #noise = data['noise'][n]
cambios para amisr ISR
r1465
if ax.firsttime:
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
self.xmin = self.xmin if self.xmin else -self.xmax
self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
if self.showprofile:
ax.plt_profile = self.pf_axes[n].plot(
data['rti'][n], y)[0]
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528
cambios para amisr ISR
r1465
else:
ax.plt.set_array(z[n].T.ravel())
if self.showprofile:
ax.plt_profile.set_data(data['rti'][n], y)
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528
self.titles.append('CH {}'.format(self.channelList[n]))
cambios para amisr ISR
r1465
class NoiselessRTIPlot(Plot):
'''
Plot for RTI data
'''
CODE = 'noiseless_rti'
colormap = 'jet'
plot_type = 'pcolorbuffer'
titles = None
channelList = []
Hildebrand_S en C, clear sats
r1475 elevationList = []
azimuthList = []
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 last_noise = None
cambios para amisr ISR
r1465
def setup(self):
self.xaxis = 'time'
self.ncols = 1
#print("dataChannels ",self.data.channels)
self.nrows = len(self.data.channels)
self.nplots = len(self.data.channels)
self.ylabel = 'Range [km]'
self.xlabel = 'Time'
self.cb_label = 'dB'
nuevo 2 pc
r1473 self.plots_adjust.update({'hspace':0.8, 'left': 0.08, 'bottom': 0.2, 'right':0.94})
cambios para amisr ISR
r1465 self.titles = ['{} Channel {}'.format(
self.CODE.upper(), x) for x in range(self.nplots)]
def update_list(self,dataOut):
Hildebrand_S en C, clear sats
r1475 if len(self.channelList) == 0:
self.channelList = dataOut.channelList
if len(self.elevationList) == 0:
self.elevationList = dataOut.elevationList
if len(self.azimuthList) == 0:
self.azimuthList = dataOut.azimuthList
cambios para amisr ISR
r1465
def update(self, dataOut):
if len(self.channelList) == 0:
self.update_list(dataOut)
data = {}
meta = {}
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528
norm = dataOut.nProfiles * dataOut.max_nIncohInt * dataOut.nCohInt * dataOut.windowOfFilter
n0 = 10*numpy.log10(dataOut.getNoise()/float(norm))
#print("noise: ",n0, dataOut.normFactor, norm, dataOut.nIncohInt, dataOut.max_nIncohInt)
if self.last_noise == None:
self.last_noise = n0
else:
n0 = (n0*0.2 + self.last_noise*0.8)
self.last_noise = n0
data['noiseless_rti'] = dataOut.getPower() - n0
#data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
#print(noise)
cambios para amisr ISR
r1465 return data, meta
def plot(self):
self.x = self.data.times
self.y = self.data.yrange
self.z = self.data['noiseless_rti']
self.z = numpy.array(self.z, dtype=float)
self.z = numpy.ma.masked_invalid(self.z)
try:
if self.channelList != None:
Hildebrand_S en C, clear sats
r1475 if len(self.elevationList) > 0 and len(self.azimuthList) > 0:
self.titles = ['{} Channel {} ({:2.1f} Elev, {:2.1f} Azth)'.format(
self.CODE.upper(), x, self.elevationList[x], self.azimuthList[x]) for x in self.channelList]
else:
self.titles = ['{} Channel {}'.format(
self.CODE.upper(), x) for x in self.channelList]
cambios para amisr ISR
r1465 except:
if self.channelList.any() != None:
Hildebrand_S en C, clear sats
r1475
cambios para amisr ISR
r1465 self.titles = ['{} Channel {}'.format(
self.CODE.upper(), x) for x in self.channelList]
if self.decimation is None:
x, y, z = self.fill_gaps(self.x, self.y, self.z)
else:
x, y, z = self.fill_gaps(*self.decimate())
dummy_var = self.axes #Extrañamente esto actualiza el valor axes
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 #print("plot shapes ", z.shape, x.shape, y.shape)
cambios para amisr ISR
r1465 for n, ax in enumerate(self.axes):
self.zmin = self.zmin if self.zmin else numpy.min(self.z)
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
data = self.data[-1]
if ax.firsttime:
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
if self.showprofile:
ax.plot_profile = self.pf_axes[n].plot(data['noiseless_rti'][n], self.y)[0]
else:
ax.collections.remove(ax.collections[0])
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
if self.showprofile:
ax.plot_profile.set_data(data['noiseless_rti'][n], self.y)
Eliminación de perfiles, retención de bloques, salida en pequeñps bloques o perfiles, rti de outliers
r1528 # if "noise" in self.data:
# #ax.plot_noise.set_data(numpy.repeat(data['noise'][n], len(self.y)), self.y)
# ax.plot_noise.set_data(data['noise'][n], self.y)
class OutliersRTIPlot(Plot):
'''
Plot for data_xxxx object
'''
CODE = 'outlier'
colormap = 'cool'
plot_type = 'pcolorbuffer'
def setup(self):
self.xaxis = 'time'
self.ncols = 1
self.nrows = self.data.shape('outlier')[0]
self.nplots = self.nrows
self.plots_adjust.update({'hspace':0.8, 'left': 0.08, 'bottom': 0.2, 'right':0.94})
if not self.xlabel:
self.xlabel = 'Time'
self.ylabel = 'Height [km]'
if not self.titles:
self.titles = ['Outliers Ch:{}'.format(x) for x in range(self.nrows)]
def update(self, dataOut):
data = {}
data['outlier'] = dataOut.data_outlier
meta = {}
return data, meta
def plot(self):
# self.data.normalize_heights()
self.x = self.data.times
self.y = self.data.yrange
self.z = self.data['outlier']
#self.z = numpy.ma.masked_invalid(self.z)
if self.decimation is None:
x, y, z = self.fill_gaps(self.x, self.y, self.z)
else:
x, y, z = self.fill_gaps(*self.decimate())
for n, ax in enumerate(self.axes):
self.zmax = self.zmax if self.zmax is not None else numpy.max(
self.z[n])
self.zmin = self.zmin if self.zmin is not None else numpy.min(
self.z[n])
data = self.data[-1]
if ax.firsttime:
if self.zlimits is not None:
self.zmin, self.zmax = self.zlimits[n]
ax.plt = ax.pcolormesh(x, y, z[n].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=self.cmaps[n]
)
if self.showprofile:
ax.plot_profile = self.pf_axes[n].plot(data['outlier'][n], self.y)[0]
self.pf_axes[n].set_xlabel('')
else:
if self.zlimits is not None:
self.zmin, self.zmax = self.zlimits[n]
ax.collections.remove(ax.collections[0])
ax.plt = ax.pcolormesh(x, y, z[n].T ,
vmin=self.zmin,
vmax=self.zmax,
cmap=self.cmaps[n]
)
if self.showprofile:
ax.plot_profile.set_data(data['outlier'][n], self.y)
self.pf_axes[n].set_xlabel('')
# class NoiseRTIPlot(Plot):
# '''
# Plot for data_xxxx object
# '''
#
# CODE = 'noise'
# colormap = 'jet'
# plot_type = 'pcolorbuffer'
#
# def setup(self):
# self.xaxis = 'time'
# self.ncols = 1
# self.nrows = self.data.shape('noise')[0]
# self.nplots = self.nrows
# self.plots_adjust.update({'hspace':0.8, 'left': 0.08, 'bottom': 0.2, 'right':0.94})
#
#
# if not self.xlabel:
# self.xlabel = 'Time'
#
# self.ylabel = 'Height [km]'
# if not self.titles:
# self.titles = ['noise Ch:{}'.format(x) for x in range(self.nrows)]
#
# def update(self, dataOut):
#
# data = {}
# norm = dataOut.max_nIncohInt*dataOut.nProfiles* dataOut.nCohInt*dataOut.windowOfFilter
# print("max incoh: ",dataOut.max_nIncohInt )
# n0 = 10*numpy.log10(dataOut.getNoise()/norm)
# data['noise'] = n0
#
# meta = {}
#
# return data, meta
#
# def plot(self):
# # self.data.normalize_heights()
# self.x = self.data.times
# self.y = self.data.yrange
# self.z = self.data['noise']
#
# #self.z = numpy.ma.masked_invalid(self.z)
#
# if self.decimation is None:
# x, y, z = self.fill_gaps(self.x, self.y, self.z)
# else:
# x, y, z = self.fill_gaps(*self.decimate())
#
# for n, ax in enumerate(self.axes):
#
# self.zmax = self.zmax if self.zmax is not None else numpy.max(
# self.z[n])
# self.zmin = self.zmin if self.zmin is not None else numpy.min(
# self.z[n])
# data = self.data[-1]
# if ax.firsttime:
# if self.zlimits is not None:
# self.zmin, self.zmax = self.zlimits[n]
#
# ax.plt = ax.pcolormesh(x, y, z[n].T,
# vmin=self.zmin,
# vmax=self.zmax,
# cmap=self.cmaps[n]
# )
# if self.showprofile:
# ax.plot_profile = self.pf_axes[n].plot(data['noise'][n], self.y)[0]
# else:
# if self.zlimits is not None:
# self.zmin, self.zmax = self.zlimits[n]
# ax.collections.remove(ax.collections[0])
# ax.plt = ax.pcolormesh(x, y, z[n].T ,
# vmin=self.zmin,
# vmax=self.zmax,
# cmap=self.cmaps[n]
# )
# if self.showprofile:
# ax.plot_profile.set_data(data['noise'][n], self.y)