@@ -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 |
|
|
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_me |
|
|
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_me |
|
|
82 |
mean = self.data['me |
|
|
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_me |
|
|
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_me |
|
|
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 SpectraMe |
|
|
208 | class SpectralMomentsPlot(SpectraPlot): | |
|
210 | 209 | ''' |
|
211 |
Plot for Spectra |
|
|
210 | Plot for Spectral Moments | |
|
212 | 211 | ''' |
|
213 |
CODE = 'spc_me |
|
|
212 | CODE = 'spc_moments' | |
|
214 | 213 | colormap = 'jro' |
|
215 | 214 | |
|
216 | 215 |
@@ -290,10 +290,10 class SpcParamPlot_(Figure): | |||
|
290 | 290 | raise ValueError("Channel %d is not in dataOut.channelList" %channel) |
|
291 | 291 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
292 | 292 | |
|
293 | # if normFactor is None: | |
|
294 | # factor = dataOut.normFactor | |
|
295 | # else: | |
|
296 | # factor = normFactor | |
|
293 | # if normFactor is None: | |
|
294 | # factor = dataOut.normFactor | |
|
295 | # else: | |
|
296 | # factor = normFactor | |
|
297 | 297 | if xaxis == "frequency": |
|
298 | 298 | x = dataOut.spcparam_range[0] |
|
299 | 299 | xlabel = "Frequency (kHz)" |
@@ -594,8 +594,8 class SkyMapPlot_(Figure): | |||
|
594 | 594 | self.isConfig = False |
|
595 | 595 | self.__nsubplots = 1 |
|
596 | 596 | |
|
597 | # self.WIDTH = 280 | |
|
598 | # self.HEIGHT = 250 | |
|
597 | # self.WIDTH = 280 | |
|
598 | # self.HEIGHT = 250 | |
|
599 | 599 | self.WIDTH = 600 |
|
600 | 600 | self.HEIGHT = 600 |
|
601 | 601 | self.WIDTHPROF = 120 |
@@ -828,11 +828,11 class WindProfilerPlot_(Figure): | |||
|
828 | 828 | if dataOut.flagNoData: |
|
829 | 829 | return dataOut |
|
830 | 830 | |
|
831 | # if timerange is not None: | |
|
832 | # self.timerange = timerange | |
|
833 | # | |
|
834 | # tmin = None | |
|
835 | # tmax = None | |
|
831 | # if timerange is not None: | |
|
832 | # self.timerange = timerange | |
|
833 | # | |
|
834 | # tmin = None | |
|
835 | # tmax = None | |
|
836 | 836 | |
|
837 | 837 | x = dataOut.getTimeRange1(dataOut.paramInterval) |
|
838 | 838 | y = dataOut.heightList |
@@ -1082,7 +1082,7 class ParametersPlot_(Figure): | |||
|
1082 | 1082 | z[ind] = numpy.nan |
|
1083 | 1083 | |
|
1084 | 1084 | thisDatetime = dataOut.datatime |
|
1085 | # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |
|
1085 | # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |
|
1086 | 1086 | title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1087 | 1087 | xlabel = "" |
|
1088 | 1088 | ylabel = "Range (km)" |
@@ -1129,24 +1129,24 class ParametersPlot_(Figure): | |||
|
1129 | 1129 | |
|
1130 | 1130 | self.setWinTitle(title) |
|
1131 | 1131 | |
|
1132 | # for i in range(self.nchan): | |
|
1133 | # index = channelIndexList[i] | |
|
1134 | # title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) | |
|
1135 | # axes = self.axesList[i*self.plotFact] | |
|
1136 | # z1 = z[i,:].reshape((1,-1)) | |
|
1137 | # axes.pcolorbuffer(x, y, z1, | |
|
1138 | # xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
|
1139 | # xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
|
1140 | # ticksize=9, cblabel='', cbsize="1%",colormap=colormap) | |
|
1141 | # | |
|
1142 | # if showSNR: | |
|
1143 | # title = "Channel %d SNR: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) | |
|
1144 | # axes = self.axesList[i*self.plotFact + 1] | |
|
1145 | # SNRdB1 = SNRdB[i,:].reshape((1,-1)) | |
|
1146 | # axes.pcolorbuffer(x, y, SNRdB1, | |
|
1147 | # xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, | |
|
1148 | # xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
|
1149 | # ticksize=9, cblabel='', cbsize="1%",colormap='jet') | |
|
1132 | # for i in range(self.nchan): | |
|
1133 | # index = channelIndexList[i] | |
|
1134 | # title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) | |
|
1135 | # axes = self.axesList[i*self.plotFact] | |
|
1136 | # z1 = z[i,:].reshape((1,-1)) | |
|
1137 | # axes.pcolorbuffer(x, y, z1, | |
|
1138 | # xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
|
1139 | # xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
|
1140 | # ticksize=9, cblabel='', cbsize="1%",colormap=colormap) | |
|
1141 | # | |
|
1142 | # if showSNR: | |
|
1143 | # title = "Channel %d SNR: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) | |
|
1144 | # axes = self.axesList[i*self.plotFact + 1] | |
|
1145 | # SNRdB1 = SNRdB[i,:].reshape((1,-1)) | |
|
1146 | # axes.pcolorbuffer(x, y, SNRdB1, | |
|
1147 | # xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, | |
|
1148 | # xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, | |
|
1149 | # ticksize=9, cblabel='', cbsize="1%",colormap='jet') | |
|
1150 | 1150 | |
|
1151 | 1151 | i=0 |
|
1152 | 1152 | index = channelIndexList[i] |
@@ -1587,11 +1587,11 class SpectralFittingPlot_(Figure): | |||
|
1587 | 1587 | for f in range(nGroups): |
|
1588 | 1588 | groupChann = groupArray[f,:] |
|
1589 | 1589 | p = dataOut.data_param[f,:,heightindex] |
|
1590 | # p = numpy.array([ 89.343967,0.14036615,0.17086219,18.89835291,1.58388365,1.55099167]) | |
|
1590 | # p = numpy.array([ 89.343967,0.14036615,0.17086219,18.89835291,1.58388365,1.55099167]) | |
|
1591 | 1591 | fitLineAux = dataOut.library.modelFunction(p, constants)*nProfiles |
|
1592 | 1592 | fitLineAux = fitLineAux.reshape((nChannels,nProfiles)) |
|
1593 | 1593 | spcFitLine[groupChann,:] = fitLineAux |
|
1594 | # spcFitLine = spcFitLine/factor | |
|
1594 | # spcFitLine = spcFitLine/factor | |
|
1595 | 1595 | |
|
1596 | 1596 | z = z[listChannels,:] |
|
1597 | 1597 | spcFitLine = spcFitLine[listChannels,:] |
@@ -1623,7 +1623,7 class SpectralFittingPlot_(Figure): | |||
|
1623 | 1623 | |
|
1624 | 1624 | self.setWinTitle(title) |
|
1625 | 1625 | for i in range(self.nplots): |
|
1626 | # title = "Channel %d: %4.2fdB" %(dataOut.channelList[i]+1, noisedB[i]) | |
|
1626 | # title = "Channel %d: %4.2fdB" %(dataOut.channelList[i]+1, noisedB[i]) | |
|
1627 | 1627 | title = "Height %4.1f km\nChannel %d:" %(cutHeight, listChannels[i]) |
|
1628 | 1628 | axes = self.axesList[i*self.__nsubplots] |
|
1629 | 1629 | if fit == False: |
@@ -1747,7 +1747,7 class EWDriftsPlot_(Figure): | |||
|
1747 | 1747 | tmax = None |
|
1748 | 1748 | |
|
1749 | 1749 | x = dataOut.getTimeRange1(dataOut.outputInterval) |
|
1750 | # y = dataOut.heightList | |
|
1750 | # y = dataOut.heightList | |
|
1751 | 1751 | y = dataOut.heightList |
|
1752 | 1752 | |
|
1753 | 1753 | z = dataOut.data_output |
@@ -1774,7 +1774,7 class EWDriftsPlot_(Figure): | |||
|
1774 | 1774 | |
|
1775 | 1775 | |
|
1776 | 1776 | showprofile = False |
|
1777 | # thisDatetime = dataOut.datatime | |
|
1777 | # thisDatetime = dataOut.datatime | |
|
1778 | 1778 | thisDatetime = datetime.datetime.utcfromtimestamp(x[1]) |
|
1779 | 1779 | title = wintitle + " EW Drifts" |
|
1780 | 1780 | xlabel = "" |
@@ -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 | |
@@ -358,7 +359,7 class CrossSpectraPlot_(Figure): | |||
|
358 | 359 | #thisDatetime = dataOut.datatime |
|
359 | 360 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
360 | 361 | title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
361 | # xlabel = "Velocity (m/s)" | |
|
362 | # xlabel = "Velocity (m/s)" | |
|
362 | 363 | ylabel = "Range (Km)" |
|
363 | 364 | |
|
364 | 365 | if xaxis == "frequency": |
@@ -428,7 +429,7 class CrossSpectraPlot_(Figure): | |||
|
428 | 429 | |
|
429 | 430 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:] / numpy.sqrt( dataOut.data_spc[chan_index0,:,:]*dataOut.data_spc[chan_index1,:,:] ) |
|
430 | 431 | coherence = numpy.abs(coherenceComplex) |
|
431 | # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi | |
|
432 | # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi | |
|
432 | 433 | phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi |
|
433 | 434 | |
|
434 | 435 | title = "Coherence Ch%d * Ch%d" %(pair[0], pair[1]) |
@@ -1461,8 +1462,8 class BeaconPhase_(Figure): | |||
|
1461 | 1462 | if pairsIndexList == []: |
|
1462 | 1463 | return |
|
1463 | 1464 | |
|
1464 | # if len(pairsIndexList) > 4: | |
|
1465 | # pairsIndexList = pairsIndexList[0:4] | |
|
1465 | # if len(pairsIndexList) > 4: | |
|
1466 | # pairsIndexList = pairsIndexList[0:4] | |
|
1466 | 1467 | |
|
1467 | 1468 | hmin_index = None |
|
1468 | 1469 | hmax_index = None |
@@ -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 |
@@ -1197,8 +1197,8 class SpectralMoments(Operation): | |||
|
1197 | 1197 | self.dataOut.noise : Noise level per channel |
|
1198 | 1198 | |
|
1199 | 1199 | Affected: |
|
1200 | self.dataOut.moments : Parameters per channel | |
|
1201 |
self.dataOut.data_SNR |
|
|
1200 | self.dataOut.moments : Parameters per channel | |
|
1201 | self.dataOut.data_SNR : SNR per channel | |
|
1202 | 1202 | |
|
1203 | 1203 | ''' |
|
1204 | 1204 |
General Comments 0
You need to be logged in to leave comments.
Login now