##// END OF EJS Templates
Merge branch 'schain_alarm' into v2.3
Merge branch 'schain_alarm' into v2.3

File last commit:

r1130:d903be96a0b2
r1159:d0480f11c356 merge
Show More
jroplot_data.py
978 lines | 32.3 KiB | text/x-python | PythonLexer
Juan C. Valdez
New plotter operation
r865
import os
import time
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 import glob
Juan C. Valdez
New plotter operation
r865 import datetime
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 from multiprocessing import Process
import zmq
import numpy
José Chávez
ningun cambio
r927 import matplotlib
Juan C. Valdez
New plotter operation
r865 import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 from matplotlib.ticker import FuncFormatter, LinearLocator, MultipleLocator
Juan C. Valdez
New plotter operation
r865
from schainpy.model.proc.jroproc_base import Operation
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 from schainpy.utils import log
ReceiverData Operation, test PlotData
r889
Juan C. Espinoza
Fix SkyMapPlot
r1095 jet_values = matplotlib.pyplot.get_cmap('jet', 100)(numpy.arange(100))[10:90]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 blu_values = matplotlib.pyplot.get_cmap(
Juan C. Espinoza
Fix SkyMapPlot
r1095 'seismic_r', 20)(numpy.arange(20))[10:15]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list(
Juan C. Espinoza
Fix SkyMapPlot
r1095 'jro', numpy.vstack((blu_values, jet_values)))
Add interactive change of CMAP and localtime support
r1071 matplotlib.pyplot.register_cmap(cmap=ncmap)
José Chávez
cambios xmax xmin
r1004
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 CMAPS = [plt.get_cmap(s) for s in ('jro', 'jet', 'viridis', 'plasma', 'inferno', 'Greys', 'seismic', 'bwr', 'coolwarm')]
Juan C. Valdez
New plotter operation
r865
José Chávez
decimation a 300
r1093
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 def figpause(interval):
backend = plt.rcParams['backend']
if backend in matplotlib.rcsetup.interactive_bk:
figManager = matplotlib._pylab_helpers.Gcf.get_active()
if figManager is not None:
canvas = figManager.canvas
if canvas.figure.stale:
canvas.draw()
Alarm working ok
r1130 try:
canvas.start_event_loop(interval)
except:
pass
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 return
sound, email & popup alarm
r1128 def popup(message):
Alarm working ok
r1130 '''
'''
fig = plt.figure(figsize=(12, 8), facecolor='r')
text = '\n'.join([s.strip() for s in message.split(':')])
fig.text(0.01, 0.5, text, ha='left', va='center', size='20', weight='heavy', color='w')
sound, email & popup alarm
r1128 fig.show()
figpause(1000)
ReceiverData Operation, test PlotData
r889 class PlotData(Operation, Process):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Base class for Schain plotting operations
'''
Juan C. Valdez
New plotter operation
r865
ReceiverData Operation, test PlotData
r889 CODE = 'Figure'
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 colormap = 'jro'
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 bgcolor = 'white'
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 CONFLATE = False
Juan C. Valdez
New plotter operation
r865 __missing = 1E30
Juan C. Espinoza
Add __attrs__ attribute to Process clasess to improve CLI finder
r1097 __attrs__ = ['show', 'save', 'xmin', 'xmax', 'ymin', 'ymax', 'zmin', 'zmax',
Juan C. Espinoza
Bugs in PlotData
r1099 'zlimits', 'xlabel', 'ylabel', 'xaxis','cb_label', 'title',
'colorbar', 'bgcolor', 'width', 'height', 'localtime', 'oneFigure',
'showprofile', 'decimation']
Juan C. Espinoza
Add __attrs__ attribute to Process clasess to improve CLI finder
r1097
ReceiverData Operation, test PlotData
r889 def __init__(self, **kwargs):
Juan C. Valdez
New plotter operation
r865
Juan C. Espinoza
Update version, fix kwargs for self operations (methods), Add SendToWeb...
r906 Operation.__init__(self, plot=True, **kwargs)
ReceiverData Operation, test PlotData
r889 Process.__init__(self)
Julia Reader Done!! Task #1085
r1105
Juan C. Espinoza
Update version, fix kwargs for self operations (methods), Add SendToWeb...
r906 self.kwargs['code'] = self.CODE
ReceiverData Operation, test PlotData
r889 self.mp = False
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.data = None
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.isConfig = False
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.figures = []
ReceiverData Operation, test PlotData
r889 self.axes = []
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.cb_axes = []
Juan C. Valdez
New plotter operation
r865 self.localtime = kwargs.pop('localtime', True)
ReceiverData Operation, test PlotData
r889 self.show = kwargs.get('show', True)
self.save = kwargs.get('save', False)
self.colormap = kwargs.get('colormap', self.colormap)
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.colormap_coh = kwargs.get('colormap_coh', 'jet')
self.colormap_phase = kwargs.get('colormap_phase', 'RdBu_r')
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.colormaps = kwargs.get('colormaps', None)
self.bgcolor = kwargs.get('bgcolor', self.bgcolor)
self.showprofile = kwargs.get('showprofile', False)
self.title = kwargs.get('wintitle', self.CODE.upper())
self.cb_label = kwargs.get('cb_label', None)
self.cb_labels = kwargs.get('cb_labels', None)
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.xaxis = kwargs.get('xaxis', 'frequency')
Juan C. Valdez
New plotter operation
r865 self.zmin = kwargs.get('zmin', None)
self.zmax = kwargs.get('zmax', None)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.zlimits = kwargs.get('zlimits', None)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.xmin = kwargs.get('xmin', None)
ReceiverData Operation, test PlotData
r889 self.xmax = kwargs.get('xmax', None)
self.xrange = kwargs.get('xrange', 24)
Juan C. Valdez
RTI & SNR in new plotter operation
r866 self.ymin = kwargs.get('ymin', None)
self.ymax = kwargs.get('ymax', None)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.xlabel = kwargs.get('xlabel', None)
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 self.decimation = kwargs.get('decimation', None)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.showSNR = kwargs.get('showSNR', False)
self.oneFigure = kwargs.get('oneFigure', True)
self.width = kwargs.get('width', None)
self.height = kwargs.get('height', None)
self.colorbar = kwargs.get('colorbar', True)
self.factors = kwargs.get('factors', [1, 1, 1, 1, 1, 1, 1, 1])
Julia Reader Done!! Task #1085
r1105 self.titles = kwargs.get('titles', [])
Juan C. Espinoza
Fix SkyMapPlot
r1095 self.polar = False
Fix events for non colormaps plots
r1091
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 def __fmtTime(self, x, pos):
'''
'''
return '{}'.format(self.getDateTime(x).strftime('%H:%M'))
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
def __setup(self):
'''
Common setup for all figures, here figures and axes are created
'''
Juan C. Espinoza
Fix SkyMapPlot
r1095 if self.CODE not in self.data:
raise ValueError(log.error('Missing data for {}'.format(self.CODE),
José Chávez
merge v2.3
r1098 self.name))
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
self.setup()
Add interactive change of CMAP and localtime support
r1071 self.time_label = 'LT' if self.localtime else 'UTC'
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 if self.data.localtime:
José Chávez
decimation a 300
r1093 self.getDateTime = datetime.datetime.fromtimestamp
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 else:
José Chávez
decimation a 300
r1093 self.getDateTime = datetime.datetime.utcfromtimestamp
Add interactive change of CMAP and localtime support
r1071
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.width is None:
self.width = 8
José Chávez
funcionando multidia
r933
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.figures = []
self.axes = []
self.cb_axes = []
self.pf_axes = []
self.cmaps = []
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 size = '15%' if self.ncols == 1 else '30%'
pad = '4%' if self.ncols == 1 else '8%'
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
if self.oneFigure:
if self.height is None:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.height = 1.4 * self.nrows + 1
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 fig = plt.figure(figsize=(self.width, self.height),
edgecolor='k',
facecolor='w')
self.figures.append(fig)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 for n in range(self.nplots):
José Chávez
merge v2.3
r1098 ax = fig.add_subplot(self.nrows, self.ncols,
n + 1, polar=self.polar)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.tick_params(labelsize=8)
ax.firsttime = True
Add interactive change of CMAP and localtime support
r1071 ax.index = 0
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax.press = None
José Chávez
decimation a 300
r1093 self.axes.append(ax)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.showprofile:
cax = self.__add_axes(ax, size=size, pad=pad)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 cax.tick_params(labelsize=8)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.pf_axes.append(cax)
else:
if self.height is None:
self.height = 3
for n in range(self.nplots):
fig = plt.figure(figsize=(self.width, self.height),
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 edgecolor='k',
facecolor='w')
Juan C. Espinoza
Fix SkyMapPlot
r1095 ax = fig.add_subplot(1, 1, 1, polar=self.polar)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.tick_params(labelsize=8)
ax.firsttime = True
Add interactive change of CMAP and localtime support
r1071 ax.index = 0
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax.press = None
José Chávez
decimation a 300
r1093 self.figures.append(fig)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.axes.append(ax)
if self.showprofile:
cax = self.__add_axes(ax, size=size, pad=pad)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 cax.tick_params(labelsize=8)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.pf_axes.append(cax)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 for n in range(self.nrows):
if self.colormaps is not None:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 cmap = plt.get_cmap(self.colormaps[n])
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 else:
cmap = plt.get_cmap(self.colormap)
cmap.set_bad(self.bgcolor, 1.)
self.cmaps.append(cmap)
Add interactive change of CMAP and localtime support
r1071 for fig in self.figures:
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 fig.canvas.mpl_connect('key_press_event', self.OnKeyPress)
fig.canvas.mpl_connect('scroll_event', self.OnBtnScroll)
fig.canvas.mpl_connect('button_press_event', self.onBtnPress)
fig.canvas.mpl_connect('motion_notify_event', self.onMotion)
fig.canvas.mpl_connect('button_release_event', self.onBtnRelease)
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 if self.show:
fig.show()
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087
def OnKeyPress(self, event):
'''
Event for pressing keys (up, down) change colormap
'''
ax = event.inaxes
José Chávez
decimation a 300
r1093 if ax in self.axes:
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 if event.key == 'down':
ax.index += 1
elif event.key == 'up':
ax.index -= 1
if ax.index < 0:
José Chávez
decimation a 300
r1093 ax.index = len(CMAPS) - 1
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 elif ax.index == len(CMAPS):
ax.index = 0
José Chávez
decimation a 300
r1093 cmap = CMAPS[ax.index]
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax.cbar.set_cmap(cmap)
ax.cbar.draw_all()
José Chávez
decimation a 300
r1093 ax.plt.set_cmap(cmap)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax.cbar.patch.figure.canvas.draw()
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 self.colormap = cmap.name
Add interactive change of CMAP and localtime support
r1071
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 def OnBtnScroll(self, event):
Add interactive change of CMAP and localtime support
r1071 '''
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 Event for scrolling, scale figure
Add interactive change of CMAP and localtime support
r1071 '''
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 cb_ax = event.inaxes
Fix events for non colormaps plots
r1091 if cb_ax in [ax.cbar.ax for ax in self.axes if ax.cbar]:
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax = [ax for ax in self.axes if cb_ax == ax.cbar.ax][0]
José Chávez
decimation a 300
r1093 pt = ax.cbar.ax.bbox.get_points()[:, 1]
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 nrm = ax.cbar.norm
José Chávez
decimation a 300
r1093 vmin, vmax, p0, p1, pS = (
nrm.vmin, nrm.vmax, pt[0], pt[1], event.y)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 scale = 2 if event.step == 1 else 0.5
José Chávez
decimation a 300
r1093 point = vmin + (vmax - vmin) / (p1 - p0) * (pS - p0)
ax.cbar.norm.vmin = point - scale * (point - vmin)
ax.cbar.norm.vmax = point - scale * (point - vmax)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax.plt.set_norm(ax.cbar.norm)
ax.cbar.draw_all()
ax.cbar.patch.figure.canvas.draw()
def onBtnPress(self, event):
'''
Event for mouse button press
'''
cb_ax = event.inaxes
if cb_ax is None:
return
Add interactive change of CMAP and localtime support
r1071
Fix events for non colormaps plots
r1091 if cb_ax in [ax.cbar.ax for ax in self.axes if ax.cbar]:
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 cb_ax.press = event.x, event.y
else:
cb_ax.press = None
def onMotion(self, event):
'''
Event for move inside colorbar
'''
cb_ax = event.inaxes
if cb_ax is None:
return
Fix events for non colormaps plots
r1091 if cb_ax not in [ax.cbar.ax for ax in self.axes if ax.cbar]:
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 return
José Chávez
decimation a 300
r1093 if cb_ax.press is None:
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 return
ax = [ax for ax in self.axes if cb_ax == ax.cbar.ax][0]
xprev, yprev = cb_ax.press
dx = event.x - xprev
dy = event.y - yprev
José Chávez
decimation a 300
r1093 cb_ax.press = event.x, event.y
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 scale = ax.cbar.norm.vmax - ax.cbar.norm.vmin
perc = 0.03
if event.button == 1:
José Chávez
decimation a 300
r1093 ax.cbar.norm.vmin -= (perc * scale) * numpy.sign(dy)
ax.cbar.norm.vmax -= (perc * scale) * numpy.sign(dy)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 elif event.button == 3:
José Chávez
decimation a 300
r1093 ax.cbar.norm.vmin -= (perc * scale) * numpy.sign(dy)
ax.cbar.norm.vmax += (perc * scale) * numpy.sign(dy)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087
ax.cbar.draw_all()
ax.plt.set_norm(ax.cbar.norm)
ax.cbar.patch.figure.canvas.draw()
def onBtnRelease(self, event):
'''
Event for mouse button release
'''
cb_ax = event.inaxes
if cb_ax is not None:
cb_ax.press = None
Add interactive change of CMAP and localtime support
r1071
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 def __add_axes(self, ax, size='30%', pad='8%'):
J Gomez
Issue Listo graficas separadas 90%
r964 '''
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 Add new axes to the given figure
J Gomez
Issue Listo graficas separadas 90%
r964 '''
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 divider = make_axes_locatable(ax)
nax = divider.new_horizontal(size=size, pad=pad)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax.figure.add_axes(nax)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 return nax
J Gomez
Issue Listo graficas separadas 90%
r964
MADReader support for HDF5 (mad2 & mad3)
r1065 self.setup()
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 def setup(self):
'''
This method should be implemented in the child class, the following
attributes should be set:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.nrows: number of rows
self.ncols: number of cols
self.nplots: number of plots (channels or pairs)
self.ylabel: label for Y axes
self.titles: list of axes title
'''
raise(NotImplementedError, 'Implement this method in child class')
Juan C. Valdez
New plotter operation
r865
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 def fill_gaps(self, x_buffer, y_buffer, z_buffer):
'''
Create a masked array for missing data
'''
Juan C. Valdez
New plotter operation
r865 if x_buffer.shape[0] < 2:
return x_buffer, y_buffer, z_buffer
deltas = x_buffer[1:] - x_buffer[0:-1]
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x_median = numpy.median(deltas)
Juan C. Valdez
New plotter operation
r865
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 index = numpy.where(deltas > 5 * x_median)
Juan C. Valdez
New plotter operation
r865
if len(index[0]) != 0:
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 z_buffer[::, index[0], ::] = self.__missing
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 z_buffer = numpy.ma.masked_inside(z_buffer,
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 0.99 * self.__missing,
1.01 * self.__missing)
Juan C. Valdez
New plotter operation
r865
return x_buffer, y_buffer, z_buffer
Juan C. Valdez
RTI & SNR in new plotter operation
r866 def decimate(self):
ReceiverData Operation, test PlotData
r889
José Chávez
funcionando todo
r898 # dx = int(len(self.x)/self.__MAXNUMX) + 1
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 dy = int(len(self.y) / self.decimation) + 1
ReceiverData Operation, test PlotData
r889
José Chávez
funcionando todo
r898 # x = self.x[::dx]
x = self.x
ReceiverData Operation, test PlotData
r889 y = self.y[::dy]
José Chávez
funcionando todo
r898 z = self.z[::, ::, ::dy]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Valdez
RTI & SNR in new plotter operation
r866 return x, y, z
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 def format(self):
'''
Set min and max values, labels, ticks and titles
'''
J Gomez
PlotsListos Fase,Coh, Snr, Dop
r983
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.xmin is None:
xmin = self.min_time
else:
if self.xaxis is 'time':
José Chávez
decimation a 300
r1093 dt = self.getDateTime(self.min_time)
xmin = (dt.replace(hour=int(self.xmin), minute=0, second=0) -
datetime.datetime(1970, 1, 1)).total_seconds()
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 if self.data.localtime:
xmin += time.timezone
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 else:
xmin = self.xmin
J Gomez
PlotsListos Fase,Coh, Snr, Dop
r983
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.xmax is None:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 xmax = xmin + self.xrange * 60 * 60
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 else:
if self.xaxis is 'time':
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 dt = self.getDateTime(self.max_time)
José Chávez
merge v2.3
r1098 xmax = (dt.replace(hour=int(self.xmax), minute=59, second=59) -
Juan C. Espinoza
Bugs in PlotData
r1099 datetime.datetime(1970, 1, 1) + datetime.timedelta(seconds=1)).total_seconds()
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 if self.data.localtime:
xmax += time.timezone
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 else:
xmax = self.xmax
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ymin = self.ymin if self.ymin else numpy.nanmin(self.y)
José Chávez
decimation a 300
r1093 ymax = self.ymax if self.ymax else numpy.nanmax(self.y)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 Y = numpy.array([5, 10, 20, 50, 100, 200, 500, 1000, 2000])
Juan C. Espinoza
Bugs in PlotData
r1099 i = 1 if numpy.where(ymax-ymin < Y)[0][0] < 0 else numpy.where(ymax-ymin < Y)[0][0]
ystep = Y[i] / 5
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 for n, ax in enumerate(self.axes):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if ax.firsttime:
ax.set_facecolor(self.bgcolor)
ax.yaxis.set_major_locator(MultipleLocator(ystep))
José Chávez
decimation a 300
r1093 if self.xaxis is 'time':
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 ax.xaxis.set_major_formatter(FuncFormatter(self.__fmtTime))
José Chávez
decimation a 300
r1093 ax.xaxis.set_major_locator(LinearLocator(9))
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.xlabel is not None:
ax.set_xlabel(self.xlabel)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax.set_ylabel(self.ylabel)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.firsttime = False
if self.showprofile:
self.pf_axes[n].set_ylim(ymin, ymax)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.pf_axes[n].set_xlim(self.zmin, self.zmax)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.pf_axes[n].set_xlabel('dB')
self.pf_axes[n].grid(b=True, axis='x')
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 [tick.set_visible(False)
for tick in self.pf_axes[n].get_yticklabels()]
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.colorbar:
José Chávez
merge v2.3
r1098 ax.cbar = plt.colorbar(
ax.plt, ax=ax, fraction=0.05, pad=0.02, aspect=10)
Add interactive change of CMAP and localtime support
r1071 ax.cbar.ax.tick_params(labelsize=8)
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 ax.cbar.ax.press = None
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.cb_label:
Add interactive change of CMAP and localtime support
r1071 ax.cbar.set_label(self.cb_label, size=8)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 elif self.cb_labels:
Add interactive change of CMAP and localtime support
r1071 ax.cbar.set_label(self.cb_labels[n], size=8)
Fix events for non colormaps plots
r1091 else:
ax.cbar = None
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix SkyMapPlot
r1095 if not self.polar:
ax.set_xlim(xmin, xmax)
ax.set_ylim(ymin, ymax)
ax.set_title('{} - {} {}'.format(
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.titles[n],
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 self.getDateTime(self.max_time).strftime('%H:%M:%S'),
Add interactive change of CMAP and localtime support
r1071 self.time_label),
José Chávez
merge v2.3
r1098 size=8)
else:
Juan C. Espinoza
Fix SkyMapPlot
r1095 ax.set_title('{}'.format(self.titles[n]), size=8)
ax.set_ylim(0, 90)
ax.set_yticks(numpy.arange(0, 90, 20))
ax.yaxis.labelpad = 40
J Gomez
Issues Arreglados
r971
ReceiverData Operation, test PlotData
r889 def __plot(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
'''
log.success('Plotting', self.name)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Skip plotting if an error raise
r1121 try:
self.plot()
self.format()
except:
log.warning('{} Plot could not be updated... check data'.format(self.CODE), self.name)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 for n, fig in enumerate(self.figures):
if self.nrows == 0 or self.nplots == 0:
log.warning('No data', self.name)
Juan C. Espinoza
Fix SkyMapPlot
r1095 fig.text(0.5, 0.5, 'No Data', fontsize='large', ha='center')
Juan C. Espinoza
Bugs in PlotData
r1099 fig.canvas.manager.set_window_title(self.CODE)
José Chávez
decimation a 300
r1093 continue
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 fig.tight_layout()
José Chávez
decimation a 300
r1093 fig.canvas.manager.set_window_title('{} - {}'.format(self.title,
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 self.getDateTime(self.max_time).strftime('%Y/%m/%d')))
Julia Reader Done!! Task #1085
r1105 fig.canvas.draw()
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Bugs in PlotData
r1099 if self.save and self.data.ended:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 channels = range(self.nrows)
if self.oneFigure:
label = ''
else:
label = '_{}'.format(channels[n])
figname = os.path.join(
self.save,
Juan C. Espinoza
Bugs in PlotData
r1099 '{}{}_{}.png'.format(
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.CODE,
label,
José Chávez
decimation a 300
r1093 self.getDateTime(self.saveTime).strftime(
Add decimation to jsonify data to web & fix typo KM
r1122 '%Y%m%d_%H%M%S'),
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 )
)
Juan C. Espinoza
Fix SkyMapPlot
r1095 log.log('Saving figure: {}'.format(figname), self.name)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 fig.savefig(figname)
Juan C. Valdez
RTI & SNR in new plotter operation
r866
ReceiverData Operation, test PlotData
r889 def plot(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
'''
raise(NotImplementedError, 'Implement this method in child class')
Juan C. Valdez
RTI & SNR in new plotter operation
r866
ReceiverData Operation, test PlotData
r889 def run(self):
Juan C. Valdez
RTI & SNR in new plotter operation
r866
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 log.success('Starting', self.name)
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937
ReceiverData Operation, test PlotData
r889 context = zmq.Context()
receiver = context.socket(zmq.SUB)
receiver.setsockopt(zmq.SUBSCRIBE, '')
José Chávez
cambiados los kwargs para cada operacion/unidad de procesamiento
r897 receiver.setsockopt(zmq.CONFLATE, self.CONFLATE)
J Gomez
Antes del Branch a ind_plt_chs
r962
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 if 'server' in self.kwargs['parent']:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 receiver.connect(
'ipc:///tmp/{}.plots'.format(self.kwargs['parent']['server']))
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 else:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 receiver.connect("ipc:///tmp/zmq.plots")
Juan C. Espinoza
fixing merge
r938
ReceiverData Operation, test PlotData
r889 while True:
try:
Add interactive change of CMAP and localtime support
r1071 self.data = receiver.recv_pyobj(flags=zmq.NOBLOCK)
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 if self.data.localtime and self.localtime:
self.times = self.data.times
elif self.data.localtime and not self.localtime:
self.times = self.data.times + time.timezone
elif not self.data.localtime and self.localtime:
Add interactive change of CMAP and localtime support
r1071 self.times = self.data.times - time.timezone
else:
self.times = self.data.times
Juan C. Espinoza
Add localtime anf fix pause figs
r1089
Add interactive change of CMAP and localtime support
r1071 self.min_time = self.times[0]
self.max_time = self.times[-1]
Juan C. Valdez
RTI & SNR in new plotter operation
r866
ReceiverData Operation, test PlotData
r889 if self.isConfig is False:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.__setup()
ReceiverData Operation, test PlotData
r889 self.isConfig = True
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.__plot()
ReceiverData Operation, test PlotData
r889
except zmq.Again as e:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 log.log('Waiting for data...')
if self.data:
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 figpause(self.data.throttle)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 else:
time.sleep(2)
Juan C. Valdez
RTI & SNR in new plotter operation
r866
def close(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.data:
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.__plot()
ReceiverData Operation, test PlotData
r889
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Valdez
RTI & SNR in new plotter operation
r866 class PlotSpectraData(PlotData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for Spectra data
'''
Juan C. Valdez
RTI & SNR in new plotter operation
r866
ReceiverData Operation, test PlotData
r889 CODE = 'spc'
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 colormap = 'jro'
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
ReceiverData Operation, test PlotData
r889 def setup(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.nplots = len(self.data.channels)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
self.width = 3.4 * self.ncols
self.height = 3 * self.nrows
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.cb_label = 'dB'
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 if self.showprofile:
self.width += 0.8 * self.ncols
ReceiverData Operation, test PlotData
r889
Add decimation to jsonify data to web & fix typo KM
r1122 self.ylabel = 'Range [km]'
ReceiverData Operation, test PlotData
r889
Juan C. Valdez
New plotter operation
r865 def plot(self):
ReceiverData Operation, test PlotData
r889 if self.xaxis == "frequency":
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x = self.data.xrange[0]
self.xlabel = "Frequency (kHz)"
ReceiverData Operation, test PlotData
r889 elif self.xaxis == "time":
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x = self.data.xrange[1]
self.xlabel = "Time (ms)"
ReceiverData Operation, test PlotData
r889 else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
if self.CODE == 'spc_mean':
x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
ReceiverData Operation, test PlotData
r889
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.titles = []
ReceiverData Operation, test PlotData
r889
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 y = self.data.heights
self.y = y
z = self.data['spc']
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
ReceiverData Operation, test PlotData
r889 for n, ax in enumerate(self.axes):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 noise = self.data['noise'][n][-1]
if self.CODE == 'spc_mean':
mean = self.data['mean'][n][-1]
ReceiverData Operation, test PlotData
r889 if ax.firsttime:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
ReceiverData Operation, test PlotData
r889 self.xmin = self.xmin if self.xmin else -self.xmax
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 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,
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
ReceiverData Operation, test PlotData
r889
if self.showprofile:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax.plt_profile = self.pf_axes[n].plot(
self.data['rti'][n][-1], y)[0]
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 color="k", linestyle="dashed", lw=1)[0]
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.CODE == 'spc_mean':
ax.plt_mean = ax.plot(mean, y, color='k')[0]
ReceiverData Operation, test PlotData
r889 else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt.set_array(z[n].T.ravel())
ReceiverData Operation, test PlotData
r889 if self.showprofile:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt_profile.set_data(self.data['rti'][n][-1], y)
ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
if self.CODE == 'spc_mean':
ax.plt_mean.set_data(mean, y)
Juan C. Valdez
RTI & SNR in new plotter operation
r866
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.saveTime = self.max_time
class PlotCrossSpectraData(PlotData):
CODE = 'cspc'
zmin_coh = None
zmax_coh = None
zmin_phase = None
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 zmax_phase = None
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
def setup(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.ncols = 4
self.nrows = len(self.data.pairs)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.nplots = self.nrows * 4
self.width = 3.4 * self.ncols
self.height = 3 * self.nrows
Add decimation to jsonify data to web & fix typo KM
r1122 self.ylabel = 'Range [km]'
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.showprofile = False
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
def plot(self):
if self.xaxis == "frequency":
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x = self.data.xrange[0]
self.xlabel = "Frequency (kHz)"
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 elif self.xaxis == "time":
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x = self.data.xrange[1]
self.xlabel = "Time (ms)"
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x = self.data.xrange[2]
self.xlabel = "Velocity (m/s)"
self.titles = []
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 y = self.data.heights
self.y = y
spc = self.data['spc']
cspc = self.data['cspc']
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
for n in range(self.nrows):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 noise = self.data['noise'][n][-1]
pair = self.data.pairs[n]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax = self.axes[4 * n]
ax3 = self.axes[4 * n + 3]
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 if ax.firsttime:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.xmin = self.xmin if self.xmin else -self.xmax
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.zmin = self.zmin if self.zmin else numpy.nanmin(spc)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.zmax = self.zmax if self.zmax else numpy.nanmax(spc)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt = ax.pcolormesh(x, y, spc[pair[0]].T,
vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 )
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt.set_array(spc[pair[0]].T.ravel())
self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax = self.axes[4 * n + 1]
if ax.firsttime:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt = ax.pcolormesh(x, y, spc[pair[1]].T,
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt.set_array(spc[pair[1]].T.ravel())
self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 coh = numpy.abs(out)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
ax = self.axes[4 * n + 2]
if ax.firsttime:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt = ax.pcolormesh(x, y, coh.T,
vmin=0,
vmax=1,
cmap=plt.get_cmap(self.colormap_coh)
)
else:
ax.plt.set_array(coh.T.ravel())
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.titles.append(
'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax = self.axes[4 * n + 3]
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if ax.firsttime:
ax.plt = ax.pcolormesh(x, y, phase.T,
vmin=-180,
vmax=180,
cmap=plt.get_cmap(self.colormap_phase)
)
else:
ax.plt.set_array(phase.T.ravel())
self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.saveTime = self.max_time
Juan C. Valdez
RTI & SNR in new plotter operation
r866
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 class PlotSpectraMeanData(PlotSpectraData):
'''
Plot for Spectra and Mean
'''
CODE = 'spc_mean'
colormap = 'jro'
Juan C. Valdez
RTI & SNR in new plotter operation
r866 class PlotRTIData(PlotData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for RTI data
'''
ReceiverData Operation, test PlotData
r889
CODE = 'rti'
colormap = 'jro'
def setup(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.xaxis = 'time'
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.ncols = 1
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.nrows = len(self.data.channels)
self.nplots = len(self.data.channels)
Add decimation to jsonify data to web & fix typo KM
r1122 self.ylabel = 'Range [km]'
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.cb_label = 'dB'
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.titles = ['{} Channel {}'.format(
self.CODE.upper(), x) for x in range(self.nrows)]
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
Juan C. Valdez
RTI & SNR in new plotter operation
r866 def plot(self):
Add interactive change of CMAP and localtime support
r1071 self.x = self.times
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.y = self.data.heights
self.z = self.data[self.CODE]
self.z = numpy.ma.masked_invalid(self.z)
Juan C. Valdez
New plotter operation
r865
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 if self.decimation is None:
x, y, z = self.fill_gaps(self.x, self.y, self.z)
else:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 x, y, z = self.fill_gaps(*self.decimate())
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119
for n, ax in enumerate(self.axes):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.zmin = self.zmin if self.zmin else numpy.min(self.z)
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 if ax.firsttime:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plt = ax.pcolormesh(x, y, z[n].T,
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.showprofile:
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax.plot_profile = self.pf_axes[n].plot(
self.data['rti'][n][-1], self.y)[0]
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y,
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)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 )
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.showprofile:
ax.plot_profile.set_data(self.data['rti'][n][-1], self.y)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 ax.plot_noise.set_data(numpy.repeat(
self.data['noise'][n][-1], len(self.y)), self.y)
J Gomez
Issue Listo graficas separadas 90%
r964
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.saveTime = self.min_time
ReceiverData Operation, test PlotData
r889
class PlotCOHData(PlotRTIData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for Coherence data
'''
ReceiverData Operation, test PlotData
r889
CODE = 'coh'
def setup(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.xaxis = 'time'
ReceiverData Operation, test PlotData
r889 self.ncols = 1
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.nrows = len(self.data.pairs)
self.nplots = len(self.data.pairs)
Add decimation to jsonify data to web & fix typo KM
r1122 self.ylabel = 'Range [km]'
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.CODE == 'coh':
self.cb_label = ''
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.titles = [
'Coherence Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
ReceiverData Operation, test PlotData
r889 else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.cb_label = 'Degrees'
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.titles = [
'Phase Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
ReceiverData Operation, test PlotData
r889
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
class PlotPHASEData(PlotCOHData):
'''
Plot for Phase map data
'''
CODE = 'phase'
colormap = 'seismic'
ReceiverData Operation, test PlotData
r889
Juan C. Valdez
New plotter operation
r865
add NoisePlot
r907 class PlotNoiseData(PlotData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for noise
'''
add NoisePlot
r907 CODE = 'noise'
def setup(self):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.xaxis = 'time'
add NoisePlot
r907 self.ncols = 1
self.nrows = 1
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.nplots = 1
add NoisePlot
r907 self.ylabel = 'Intensity [dB]'
self.titles = ['Noise']
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.colorbar = False
add NoisePlot
r907
def plot(self):
Add interactive change of CMAP and localtime support
r1071 x = self.times
add NoisePlot
r907 xmin = self.min_time
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 xmax = xmin + self.xrange * 60 * 60
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 Y = self.data[self.CODE]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if self.axes[0].firsttime:
for ch in self.data.channels:
y = Y[ch]
self.axes[0].plot(x, y, lw=1, label='Ch{}'.format(ch))
add NoisePlot
r907 plt.legend()
else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 for ch in self.data.channels:
y = Y[ch]
self.axes[0].lines[ch].set_data(x, y)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.ymin = numpy.nanmin(Y) - 5
self.ymax = numpy.nanmax(Y) + 5
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 self.saveTime = self.min_time
add NoisePlot
r907
class PlotSNRData(PlotRTIData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for SNR Data
'''
José Chávez
funcionando todo
r898 CODE = 'snr'
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 colormap = 'jet'
ReceiverData Operation, test PlotData
r889
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
José Chávez
funcionando todo
r898 class PlotDOPData(PlotRTIData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for DOPPLER Data
'''
José Chávez
funcionando todo
r898 CODE = 'dop'
colormap = 'jet'
ReceiverData Operation, test PlotData
r889
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 class PlotSkyMapData(PlotData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for meteors detection data
'''
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937
Juan C. Espinoza
Fix SkyMapPlot
r1095 CODE = 'param'
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937
def setup(self):
self.ncols = 1
self.nrows = 1
self.width = 7.2
self.height = 7.2
Juan C. Espinoza
Fix SkyMapPlot
r1095 self.nplots = 1
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 self.xlabel = 'Zonal Zenith Angle (deg)'
self.ylabel = 'Meridional Zenith Angle (deg)'
Juan C. Espinoza
Fix SkyMapPlot
r1095 self.polar = True
self.ymin = -180
self.ymax = 180
self.colorbar = False
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937
def plot(self):
José Chávez
merge v2.3
r1098 arrayParameters = numpy.concatenate(self.data['param'])
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 error = arrayParameters[:, -1]
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 indValid = numpy.where(error == 0)[0]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 finalMeteor = arrayParameters[indValid, :]
finalAzimuth = finalMeteor[:, 3]
finalZenith = finalMeteor[:, 4]
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 x = finalAzimuth * numpy.pi / 180
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 y = finalZenith
Juan C. Espinoza
Fix SkyMapPlot
r1095 ax = self.axes[0]
if ax.firsttime:
José Chávez
merge v2.3
r1098 ax.plot = ax.plot(x, y, 'bo', markersize=5)[0]
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 else:
Juan C. Espinoza
Fix SkyMapPlot
r1095 ax.plot.set_data(x, y)
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937
Juan C. Espinoza
Add localtime anf fix pause figs
r1089 dt1 = self.getDateTime(self.min_time).strftime('%y/%m/%d %H:%M:%S')
dt2 = self.getDateTime(self.max_time).strftime('%y/%m/%d %H:%M:%S')
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 title = 'Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n' % (dt1,
dt2,
len(x))
Juan C. Espinoza
Fix SkyMapPlot
r1095 self.titles[0] = title
Juan C. Espinoza
Add SkyMapPlotData, operation can access parent kwargs, fix server plot for multiple ReceiverData
r937 self.saveTime = self.max_time
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 class PlotParamData(PlotRTIData):
'''
Plot for data_param object
'''
CODE = 'param'
colormap = 'seismic'
def setup(self):
self.xaxis = 'time'
self.ncols = 1
self.nrows = self.data.shape(self.CODE)[0]
self.nplots = self.nrows
if self.showSNR:
self.nrows += 1
MADReader support for HDF5 (mad2 & mad3)
r1065 self.nplots += 1
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Add decimation to jsonify data to web & fix typo KM
r1122 self.ylabel = 'Height [km]'
Julia Reader Done!! Task #1085
r1105 if not self.titles:
self.titles = self.data.parameters \
if self.data.parameters else ['Param {}'.format(x) for x in xrange(self.nrows)]
if self.showSNR:
self.titles.append('SNR')
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
def plot(self):
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 self.data.normalize_heights()
Add interactive change of CMAP and localtime support
r1071 self.x = self.times
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.y = self.data.heights
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 if self.showSNR:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 self.z = numpy.concatenate(
(self.data[self.CODE], self.data['snr'])
)
else:
self.z = self.data[self.CODE]
self.z = numpy.ma.masked_invalid(self.z)
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119 if self.decimation is None:
x, y, z = self.fill_gaps(self.x, self.y, self.z)
else:
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 x, y, z = self.fill_gaps(*self.decimate())
Juan C. Espinoza
Fix decimation in jroplot_data.py
r1119
for n, ax in enumerate(self.axes):
José Chávez
decimation a 300
r1093 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])
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 if ax.firsttime:
if self.zlimits is not None:
self.zmin, self.zmax = self.zlimits[n]
José Chávez
decimation a 300
r1093
ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n],
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 vmin=self.zmin,
vmax=self.zmax,
cmap=self.cmaps[n]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 )
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 else:
if self.zlimits is not None:
self.zmin, self.zmax = self.zlimits[n]
ax.collections.remove(ax.collections[0])
José Chávez
decimation a 300
r1093 ax.plt = ax.pcolormesh(x, y, z[n].T * self.factors[n],
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 vmin=self.zmin,
vmax=self.zmax,
cmap=self.cmaps[n]
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 )
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062
self.saveTime = self.min_time
José Chávez
decimation a 300
r1093
Juan C. Espinoza
Add new events to PlotData, fix utc times
r1087 class PlotOutputData(PlotParamData):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot data_output object
'''
CODE = 'output'
MADReader support for HDF5 (mad2 & mad3)
r1065 colormap = 'seismic'