##// END OF EJS Templates
Writing Unit for Madrigal decorated (just for python 2x)
Writing Unit for Madrigal decorated (just for python 2x)

File last commit:

r1202:179ac651dbc0
r1206:59caf7a2130e
Show More
jroplot_data.py
747 lines | 24.1 KiB | text/x-python | PythonLexer
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 '''
New Plots Operations
@author: juan.espinoza@jro.igp.gob.pe
'''
Juan C. Valdez
New plotter operation
r865
import time
import datetime
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 import numpy
Juan C. Valdez
New plotter operation
r865
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 from schainpy.model.graphics.jroplot_base import Plot, plt
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 from schainpy.utils import log
ReceiverData Operation, test PlotData
r889
Change AER to Geodetic coordinates in PX plots
r1145 EARTH_RADIUS = 6.3710e3
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187
plot cities in SkyMap plot
r1144 def ll2xy(lat1, lon1, lat2, lon2):
p = 0.017453292519943295
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 a = 0.5 - numpy.cos((lat2 - lat1) * p)/2 + numpy.cos(lat1 * p) * \
numpy.cos(lat2 * p) * (1 - numpy.cos((lon2 - lon1) * p)) / 2
plot cities in SkyMap plot
r1144 r = 12742 * numpy.arcsin(numpy.sqrt(a))
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 theta = numpy.arctan2(numpy.sin((lon2-lon1)*p)*numpy.cos(lat2*p), numpy.cos(lat1*p)
* numpy.sin(lat2*p)-numpy.sin(lat1*p)*numpy.cos(lat2*p)*numpy.cos((lon2-lon1)*p))
plot cities in SkyMap plot
r1144 theta = -theta + numpy.pi/2
return r*numpy.cos(theta), r*numpy.sin(theta)
José Chávez
decimation a 300
r1093
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187
Change AER to Geodetic coordinates in PX plots
r1145 def km2deg(km):
'''
Convert distance in km to degrees
'''
return numpy.rad2deg(km/EARTH_RADIUS)
José Chávez
decimation a 300
r1093
Juan C. Valdez
RTI & SNR in new plotter operation
r866
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class SpectraPlot(Plot):
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
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class CrossSpectraPlot(Plot):
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922
CODE = 'cspc'
George Yong
Fix bug in CrossSpectraPlot
r1201 colormap = 'jet'
Fix all PlotData, add SpectraMean, CrossSpectra plots, now Parameters extends Spectra fix bugs in ParametersProc
r922 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)"
George Yong
Fix bug in CrossSpectraPlot
r1201
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 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]
George Yong
Fix bug in CrossSpectraPlot
r1201 spc0 = 10.*numpy.log10(spc[pair[0]]/self.data.factor)
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(spc)
self.zmax = self.zmax if self.zmax else numpy.nanmax(spc)
ax.plt = ax.pcolormesh(x , y , spc0.T,
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 vmin=self.zmin,
vmax=self.zmax,
cmap=plt.get_cmap(self.colormap)
George Yong
Fix bug in CrossSpectraPlot
r1201 )
else:
ax.plt.set_array(spc0.T.ravel())
self.titles.append('CH {}: {:3.2f}dB'.format(pair[0], 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]
George Yong
Fix bug in CrossSpectraPlot
r1201 spc1 = 10.*numpy.log10(spc[pair[1]]/self.data.factor)
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080 if ax.firsttime:
George Yong
Fix bug in CrossSpectraPlot
r1201 ax.plt = ax.pcolormesh(x , y, spc1.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)
)
George Yong
Fix bug in CrossSpectraPlot
r1201 else:
ax.plt.set_array(spc1.T.ravel())
self.titles.append('CH {}: {:3.2f}dB'.format(pair[1], 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]))
George Yong
Fix bug in CrossSpectraPlot
r1201
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,
George Yong
Fix bug in CrossSpectraPlot
r1201 cmap=plt.get_cmap(self.colormap_phase)
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 )
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
Juan C. Valdez
RTI & SNR in new plotter operation
r866
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class SpectraMeanPlot(SpectraPlot):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for Spectra and Mean
'''
CODE = 'spc_mean'
colormap = 'jro'
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class RTIPlot(Plot):
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):
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 self.x = self.data.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
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 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
ReceiverData Operation, test PlotData
r889
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class CoherencePlot(RTIPlot):
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
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class PhasePlot(CoherencePlot):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
Plot for Phase map data
'''
CODE = 'phase'
colormap = 'seismic'
ReceiverData Operation, test PlotData
r889
Juan C. Valdez
New plotter operation
r865
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class NoisePlot(Plot):
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):
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 x = self.data.times
xmin = self.data.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
add NoisePlot
r907
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class SnrPlot(RTIPlot):
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
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class DopplerPlot(RTIPlot):
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
New plotting architecture with buffering/throttle capabilities
r1187 class SkyMapPlot(Plot):
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
New plotting architecture with buffering/throttle capabilities
r1187 dt1 = self.getDateTime(self.data.min_time).strftime('%y/%m/%d %H:%M:%S')
dt2 = self.getDateTime(self.data.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
Fix publish and plots operations issue #929
r1062
José Chávez
kwargs restantes. Templates y changelog actualizado
r1080
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class ParametersPlot(RTIPlot):
Juan C. Espinoza
Fix publish and plots operations issue #929
r1062 '''
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 \
George Yong
Python 2to3, Spectra (all operations) working
r1167 if self.data.parameters else ['Param {}'.format(x) for x in range(self.nrows)]
Julia Reader Done!! Task #1085
r1105 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()
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 self.x = self.data.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):
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187
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
José Chávez
decimation a 300
r1093
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class OutputPlot(ParametersPlot):
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'
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 class PolarMapPlot(Plot):
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 '''
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 Plot for weather radar
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 '''
CODE = 'param'
colormap = 'seismic'
def setup(self):
self.ncols = 1
self.nrows = 1
self.width = 9
self.height = 8
Change AER to Geodetic coordinates in PX plots
r1145 self.mode = self.data.meta['mode']
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 if self.channels is not None:
self.nplots = len(self.channels)
self.nrows = len(self.channels)
else:
self.nplots = self.data.shape(self.CODE)[0]
self.nrows = self.nplots
George Yong
Python 2to3, Spectra (all operations) working
r1167 self.channels = list(range(self.nplots))
Change AER to Geodetic coordinates in PX plots
r1145 if self.mode == 'E':
self.xlabel = 'Longitude'
self.ylabel = 'Latitude'
Add RHI plot mode to PlotPolarMapData
r1141 else:
self.xlabel = 'Range (km)'
self.ylabel = 'Height (km)'
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 self.bgcolor = 'white'
Add RHI plot mode to PlotPolarMapData
r1141 self.cb_labels = self.data.meta['units']
Change AER to Geodetic coordinates in PX plots
r1145 self.lat = self.data.meta['latitude']
self.lon = self.data.meta['longitude']
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 self.xmin, self.xmax = float(
km2deg(self.xmin) + self.lon), float(km2deg(self.xmax) + self.lon)
self.ymin, self.ymax = float(
km2deg(self.ymin) + self.lat), float(km2deg(self.ymax) + self.lat)
Change AER to Geodetic coordinates in PX plots
r1145 # self.polar = True
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 def plot(self):
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 for n, ax in enumerate(self.axes):
data = self.data['param'][self.channels[n]]
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187
zeniths = numpy.linspace(
0, self.data.meta['max_range'], data.shape[1])
if self.mode == 'E':
Add RHI plot mode to PlotPolarMapData
r1141 azimuths = -numpy.radians(self.data.heights)+numpy.pi/2
r, theta = numpy.meshgrid(zeniths, azimuths)
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 x, y = r*numpy.cos(theta)*numpy.cos(numpy.radians(self.data.meta['elevation'])), r*numpy.sin(
theta)*numpy.cos(numpy.radians(self.data.meta['elevation']))
Change AER to Geodetic coordinates in PX plots
r1145 x = km2deg(x) + self.lon
y = km2deg(y) + self.lat
Add RHI plot mode to PlotPolarMapData
r1141 else:
azimuths = numpy.radians(self.data.heights)
r, theta = numpy.meshgrid(zeniths, azimuths)
x, y = r*numpy.cos(theta), r*numpy.sin(theta)
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 self.y = zeniths
if ax.firsttime:
if self.zlimits is not None:
self.zmin, self.zmax = self.zlimits[n]
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 ax.plt = ax.pcolormesh( # r, theta, numpy.ma.array(data, mask=numpy.isnan(data)),
x, y, numpy.ma.array(data, mask=numpy.isnan(data)),
vmin=self.zmin,
vmax=self.zmax,
cmap=self.cmaps[n])
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137 else:
if self.zlimits is not None:
self.zmin, self.zmax = self.zlimits[n]
ax.collections.remove(ax.collections[0])
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 ax.plt = ax.pcolormesh( # r, theta, numpy.ma.array(data, mask=numpy.isnan(data)),
x, y, numpy.ma.array(data, mask=numpy.isnan(data)),
vmin=self.zmin,
vmax=self.zmax,
cmap=self.cmaps[n])
Add NCDFReader for PX1000 radar, new PlotPolarMap, bugs in jroplot_data
r1137
Change AER to Geodetic coordinates in PX plots
r1145 if self.mode == 'A':
Add RHI plot mode to PlotPolarMapData
r1141 continue
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187
Add limites & polar grid to px plots
r1147 # plot district names
f = open('/data/workspace/schain_scripts/distrito.csv')
Add RHI plot mode to PlotPolarMapData
r1141 for line in f:
plot cities in SkyMap plot
r1144 label, lon, lat = [s.strip() for s in line.split(',') if s]
lat = float(lat)
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 lon = float(lon)
Add limites & polar grid to px plots
r1147 # ax.plot(lon, lat, '.b', ms=2)
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 ax.text(lon, lat, label.decode('utf8'), ha='center',
va='bottom', size='8', color='black')
Add limites & polar grid to px plots
r1147 # plot limites
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 limites = []
Add limites & polar grid to px plots
r1147 tmp = []
for line in open('/data/workspace/schain_scripts/lima.csv'):
if '#' in line:
if tmp:
limites.append(tmp)
tmp = []
continue
values = line.strip().split(',')
tmp.append((float(values[0]), float(values[1])))
for points in limites:
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 ax.add_patch(
Polygon(points, ec='k', fc='none', ls='--', lw=0.5))
Add limites & polar grid to px plots
r1147
# plot Cuencas
for cuenca in ('rimac', 'lurin', 'mala', 'chillon', 'chilca', 'chancay-huaral'):
f = open('/data/workspace/schain_scripts/{}.csv'.format(cuenca))
values = [line.strip().split(',') for line in f]
points = [(float(s[0]), float(s[1])) for s in values]
ax.add_patch(Polygon(points, ec='b', fc='none'))
# plot grid
for r in (15, 30, 45, 60):
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 ax.add_artist(plt.Circle((self.lon, self.lat),
km2deg(r), color='0.6', fill=False, lw=0.2))
Add limites & polar grid to px plots
r1147 ax.text(
self.lon + (km2deg(r))*numpy.cos(60*numpy.pi/180),
self.lat + (km2deg(r))*numpy.sin(60*numpy.pi/180),
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 '{}km'.format(r),
Add limites & polar grid to px plots
r1147 ha='center', va='bottom', size='8', color='0.6', weight='heavy')
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187
Change AER to Geodetic coordinates in PX plots
r1145 if self.mode == 'E':
Add RHI plot mode to PlotPolarMapData
r1141 title = 'El={}$^\circ$'.format(self.data.meta['elevation'])
Change AER to Geodetic coordinates in PX plots
r1145 label = 'E{:02d}'.format(int(self.data.meta['elevation']))
Add RHI plot mode to PlotPolarMapData
r1141 else:
title = 'Az={}$^\circ$'.format(self.data.meta['azimuth'])
Change AER to Geodetic coordinates in PX plots
r1145 label = 'A{:02d}'.format(int(self.data.meta['azimuth']))
Add RHI plot mode to PlotPolarMapData
r1141
Juan C. Espinoza
New plotting architecture with buffering/throttle capabilities
r1187 self.save_labels = ['{}-{}'.format(lbl, label) for lbl in self.labels]
self.titles = ['{} {}'.format(
self.data.parameters[x], title) for x in self.channels]
George Yong
Add ScopePlot to the new way of plotting data (jroplot_data)
r1202
class ScopePlot(Plot):
'''
Plot for Scope
'''
CODE = 'scope'
def setup(self):
self.xaxis = 'Range (Km)'
self.ncols = 1
self.nrows = 1
self.nplots = 1
self.ylabel = 'Intensity [dB]'
self.titles = ['Scope']
self.colorbar = False
colspan = 3
rowspan = 1
def plot_iq(self, x, y, channelIndexList, thisDatetime, wintitle):
yreal = y[channelIndexList,:].real
yimag = y[channelIndexList,:].imag
title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y"))
self.xlabel = "Range (Km)"
self.ylabel = "Intensity - IQ"
self.y = yreal
self.x = x
self.xmin = min(x)
self.xmax = max(x)
self.titles[0] = title
for i,ax in enumerate(self.axes):
title = "Channel %d" %(i)
if ax.firsttime:
ax.plt_r = ax.plot(x, yreal[i,:], color='b')[0]
ax.plt_i = ax.plot(x, yimag[i,:], color='r')[0]
else:
#pass
ax.plt_r.set_data(x, yreal[i,:])
ax.plt_i.set_data(x, yimag[i,:])
def plot_power(self, x, y, channelIndexList, thisDatetime, wintitle):
y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:])
yreal = y.real
self.y = yreal
title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y"))
self.xlabel = "Range (Km)"
self.ylabel = "Intensity"
self.xmin = min(x)
self.xmax = max(x)
self.titles[0] = title
for i,ax in enumerate(self.axes):
title = "Channel %d" %(i)
ychannel = yreal[i,:]
if ax.firsttime:
ax.plt_r = ax.plot(x, ychannel)[0]
else:
#pass
ax.plt_r.set_data(x, ychannel)
def plot(self):
if self.channels:
channels = self.channels
else:
channels = self.data.channels
thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1])
scope = self.data['scope']
if self.data.flagDataAsBlock:
for i in range(self.data.nProfiles):
wintitle1 = " [Profile = %d] " %i
if self.type == "power":
self.plot_power(self.data.heights,
scope[:,i,:],
channels,
thisDatetime,
wintitle1
)
if self.type == "iq":
self.plot_iq(self.data.heights,
scope[:,i,:],
channels,
thisDatetime,
wintitle1
)
else:
wintitle = " [Profile = %d] " %self.data.profileIndex
if self.type == "power":
self.plot_power(self.data.heights,
scope,
channels,
thisDatetime,
wintitle
)
if self.type == "iq":
self.plot_iq(self.data.heights,
scope,
channels,
thisDatetime,
wintitle
)