##// END OF EJS Templates
Fix SpectralMoments Plot
Juan C. Espinoza -
r1207:15feaa6e0b57
parent child
Show More
@@ -1163,9 +1163,11 class PlotterData(object):
1163 1163 for plot in self.plottypes:
1164 1164 if 'snr' in plot:
1165 1165 plot = 'snr'
1166 elif 'spc_moments' == plot:
1167 plot = 'moments'
1166 1168 self.data[plot] = {}
1167 1169
1168 if 'spc' in self.data or 'rti' in self.data or 'cspc' in self.data:
1170 if 'spc' in self.data or 'rti' in self.data or 'cspc' in self.data or 'moments' in self.data:
1169 1171 self.data['noise'] = {}
1170 1172 if 'noise' not in self.plottypes:
1171 1173 self.plottypes.append('noise')
@@ -1199,7 +1201,7 class PlotterData(object):
1199 1201 self.channels = dataOut.channelList
1200 1202 self.interval = dataOut.getTimeInterval()
1201 1203 self.localtime = dataOut.useLocalTime
1202 if 'spc' in self.plottypes or 'cspc' in self.plottypes:
1204 if 'spc' in self.plottypes or 'cspc' in self.plottypes or 'spc_moments' in self.plottypes:
1203 1205 self.xrange = (dataOut.getFreqRange(1)/1000.,
1204 1206 dataOut.getAcfRange(1), dataOut.getVelRange(1))
1205 1207 self.factor = dataOut.normFactor
@@ -1208,7 +1210,7 class PlotterData(object):
1208 1210 self.__times.append(tm)
1209 1211
1210 1212 for plot in self.plottypes:
1211 if plot == 'spc':
1213 if plot in ('spc', 'spc_moments'):
1212 1214 z = dataOut.data_spc/dataOut.normFactor
1213 1215 buffer = 10*numpy.log10(z)
1214 1216 if plot == 'cspc':
@@ -1246,6 +1248,9 class PlotterData(object):
1246 1248 elif plot == 'cspc':
1247 1249 self.data['spc'] = buffer[0]
1248 1250 self.data['cspc'] = buffer[1]
1251 elif plot == 'spc_moments':
1252 self.data['spc'] = buffer
1253 self.data['moments'][tm] = dataOut.moments
1249 1254 else:
1250 1255 if self.buffering:
1251 1256 self.data[plot][tm] = buffer
@@ -66,7 +66,7 class SpectraPlot(Plot):
66 66 x = self.data.xrange[2]
67 67 self.xlabel = "Velocity (m/s)"
68 68
69 if self.CODE == 'spc_mean':
69 if self.CODE == 'spc_moments':
70 70 x = self.data.xrange[2]
71 71 self.xlabel = "Velocity (m/s)"
72 72
@@ -78,8 +78,8 class SpectraPlot(Plot):
78 78
79 79 for n, ax in enumerate(self.axes):
80 80 noise = self.data['noise'][n][-1]
81 if self.CODE == 'spc_mean':
82 mean = self.data['mean'][n][-1]
81 if self.CODE == 'spc_moments':
82 mean = self.data['moments'][n, :, 1, :][-1]
83 83 if ax.firsttime:
84 84 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
85 85 self.xmin = self.xmin if self.xmin else -self.xmax
@@ -96,16 +96,15 class SpectraPlot(Plot):
96 96 self.data['rti'][n][-1], y)[0]
97 97 ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
98 98 color="k", linestyle="dashed", lw=1)[0]
99 if self.CODE == 'spc_mean':
99 if self.CODE == 'spc_moments':
100 100 ax.plt_mean = ax.plot(mean, y, color='k')[0]
101 101 else:
102 102 ax.plt.set_array(z[n].T.ravel())
103 103 if self.showprofile:
104 104 ax.plt_profile.set_data(self.data['rti'][n][-1], y)
105 105 ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
106 if self.CODE == 'spc_mean':
106 if self.CODE == 'spc_moments':
107 107 ax.plt_mean.set_data(mean, y)
108
109 108 self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
110 109
111 110
@@ -206,11 +205,11 class CrossSpectraPlot(Plot):
206 205 self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
207 206
208 207
209 class SpectraMeanPlot(SpectraPlot):
208 class SpectralMomentsPlot(SpectraPlot):
210 209 '''
211 Plot for Spectra and Mean
210 Plot for Spectral Moments
212 211 '''
213 CODE = 'spc_mean'
212 CODE = 'spc_moments'
214 213 colormap = 'jro'
215 214
216 215
1 NO CONTENT: modified file
@@ -228,6 +228,7 class SpectraPlot_(Figure):
228 228
229 229
230 230 return dataOut
231
231 232 @MPDecorator
232 233 class CrossSpectraPlot_(Figure):
233 234
@@ -2,37 +2,7 import os
2 2 import sys
3 3 import datetime
4 4 import numpy
5 import matplotlib
6
7 if 'BACKEND' in os.environ:
8 matplotlib.use(os.environ['BACKEND'])
9 elif 'linux' in sys.platform:
10 matplotlib.use("TkAgg")
11 elif 'darwin' in sys.platform:
12 matplotlib.use('TkAgg')
13 else:
14 from schainpy.utils import log
15 log.warning('Using default Backend="Agg"', 'INFO')
16 matplotlib.use('Agg')
17 # Qt4Agg', 'GTK', 'GTKAgg', 'ps', 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'template', 'TkAgg', 'GTK3Cairo', 'GTK3Agg', 'svg', 'WebAgg', 'CocoaAgg', 'emf', 'gdk', 'WX'
18 import matplotlib.pyplot
19
20 from mpl_toolkits.axes_grid1 import make_axes_locatable
21 from matplotlib.ticker import FuncFormatter, LinearLocator
22
23 ###########################################
24 # Actualizacion de las funciones del driver
25 ###########################################
26
27 # create jro colormap
28
29 jet_values = matplotlib.pyplot.get_cmap("jet", 100)(numpy.arange(100))[10:90]
30 blu_values = matplotlib.pyplot.get_cmap(
31 "seismic_r", 20)(numpy.arange(20))[10:15]
32 ncmap = matplotlib.colors.LinearSegmentedColormap.from_list(
33 "jro", numpy.vstack((blu_values, jet_values)))
34 matplotlib.pyplot.register_cmap(cmap=ncmap)
35
5 from .jroplot_base import matplotlib, make_axes_locatable, FuncFormatter, LinearLocator
36 6
37 7 def createFigure(id, wintitle, width, height, facecolor="w", show=True, dpi=80):
38 8
1 NO CONTENT: modified file
General Comments 0
You need to be logged in to leave comments. Login now