##// END OF EJS Templates
Se cambió los títulos en SpectraPlot y RTIPlot para que muestre los canales reales luego de la operación selectChannels
joabAM -
r1386:029f5a79c540
parent child
Show More
@@ -21,12 +21,14 class SpectraPlot(Plot):
21 21 colormap = 'jet'
22 22 plot_type = 'pcolor'
23 23 buffering = False
24 channelList = None
24 25
25 26 def setup(self):
26 27 self.nplots = len(self.data.channels)
27 28 self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
28 29 self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
29 30 self.height = 2.6 * self.nrows
31
30 32 self.cb_label = 'dB'
31 33 if self.showprofile:
32 34 self.width = 4 * self.ncols
@@ -36,7 +38,8 class SpectraPlot(Plot):
36 38 self.ylabel = 'Range [km]'
37 39
38 40 def update(self, dataOut):
39
41 if self.channelList == None:
42 self.channelList = dataOut.channelList
40 43 data = {}
41 44 meta = {}
42 45 spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
@@ -46,9 +49,9 class SpectraPlot(Plot):
46 49 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
47 50 if self.CODE == 'spc_moments':
48 51 data['moments'] = dataOut.moments
49
50 return data, meta
51
52
53 return data, meta
54
52 55 def plot(self):
53 56 if self.xaxis == "frequency":
54 57 x = self.data.xrange[0]
@@ -101,7 +104,7 class SpectraPlot(Plot):
101 104 ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
102 105 if self.CODE == 'spc_moments':
103 106 ax.plt_mean.set_data(mean, y)
104 self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
107 self.titles.append('CH {}: {:3.2f}dB'.format(self.channelList[n], noise))
105 108
106 109
107 110 class CrossSpectraPlot(Plot):
@@ -146,8 +149,8 class CrossSpectraPlot(Plot):
146 149
147 150 data['cspc'] = numpy.array(tmp)
148 151
149 return data, meta
150
152 return data, meta
153
151 154 def plot(self):
152 155
153 156 if self.xaxis == "frequency":
@@ -159,7 +162,7 class CrossSpectraPlot(Plot):
159 162 else:
160 163 x = self.data.xrange[2]
161 164 self.xlabel = "Velocity (m/s)"
162
165
163 166 self.titles = []
164 167
165 168 y = self.data.yrange
@@ -183,13 +186,13 class CrossSpectraPlot(Plot):
183 186 ax.plt.set_array(coh.T.ravel())
184 187 self.titles.append(
185 188 'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
186
189
187 190 ax = self.axes[2 * n + 1]
188 191 if ax.firsttime:
189 192 ax.plt = ax.pcolormesh(x, y, phase.T,
190 193 vmin=-180,
191 194 vmax=180,
192 cmap=plt.get_cmap(self.colormap_phase)
195 cmap=plt.get_cmap(self.colormap_phase)
193 196 )
194 197 else:
195 198 ax.plt.set_array(phase.T.ravel())
@@ -204,6 +207,8 class RTIPlot(Plot):
204 207 CODE = 'rti'
205 208 colormap = 'jet'
206 209 plot_type = 'pcolorbuffer'
210 titles = None
211 channelList = None
207 212
208 213 def setup(self):
209 214 self.xaxis = 'time'
@@ -215,10 +220,11 class RTIPlot(Plot):
215 220 self.cb_label = 'dB'
216 221 self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.08, 'right':0.95})
217 222 self.titles = ['{} Channel {}'.format(
218 self.CODE.upper(), x) for x in range(self.nrows)]
223 self.CODE.upper(), x) for x in range(self.nplots)]
219 224
220 225 def update(self, dataOut):
221
226 if self.channelList == None:
227 self.channelList = dataOut.channelList
222 228 data = {}
223 229 meta = {}
224 230 data['rti'] = dataOut.getPower()
@@ -231,6 +237,9 class RTIPlot(Plot):
231 237 self.y = self.data.yrange
232 238 self.z = self.data[self.CODE]
233 239 self.z = numpy.ma.masked_invalid(self.z)
240 if self.channelList != None:
241 self.titles = ['{} Channel {}'.format(
242 self.CODE.upper(), x) for x in self.channelList]
234 243
235 244 if self.decimation is None:
236 245 x, y, z = self.fill_gaps(self.x, self.y, self.z)
@@ -317,7 +326,7 class PhasePlot(CoherencePlot):
317 326
318 327 class NoisePlot(Plot):
319 328 '''
320 Plot for noise
329 Plot for noise
321 330 '''
322 331
323 332 CODE = 'noise'
@@ -362,7 +371,7 class NoisePlot(Plot):
362 371 y = Y[ch]
363 372 self.axes[0].lines[ch].set_data(x, y)
364 373
365
374
366 375 class PowerProfilePlot(Plot):
367 376
368 377 CODE = 'pow_profile'
@@ -394,10 +403,10 class PowerProfilePlot(Plot):
394 403 self.y = y
395 404
396 405 x = self.data[-1][self.CODE]
397
406
398 407 if self.xmin is None: self.xmin = numpy.nanmin(x)*0.9
399 408 if self.xmax is None: self.xmax = numpy.nanmax(x)*1.1
400
409
401 410 if self.axes[0].firsttime:
402 411 for ch in self.data.channels:
403 412 self.axes[0].plot(x[ch], y, lw=1, label='Ch{}'.format(ch))
@@ -559,7 +568,7 class BeaconPhase(Plot):
559 568 server=None, folder=None, username=None, password=None,
560 569 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
561 570
562 if dataOut.flagNoData:
571 if dataOut.flagNoData:
563 572 return dataOut
564 573
565 574 if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
@@ -699,4 +708,4 class BeaconPhase(Plot):
699 708 thisDatetime=thisDatetime,
700 709 update_figfile=update_figfile)
701 710
702 return dataOut No newline at end of file
711 return dataOut
@@ -507,8 +507,7 class CleanRayleigh(Operation):
507 507 self.buffer = 0
508 508 self.buffer2 = 0
509 509 self.buffer3 = 0
510 #self.min_hei = None
511 #self.max_hei = None
510
512 511
513 512 def setup(self,dataOut,min_hei,max_hei,n, timeInterval,factor_stdv):
514 513
@@ -545,8 +544,7 class CleanRayleigh(Operation):
545 544 self.currentTime = self.__initime
546 545 self.pairsArray = numpy.array(dataOut.pairsList)
547 546 self.factor_stdv = factor_stdv
548
549
547 print("CHANNELS: ",[x for x in self.channels])
550 548
551 549 if n != None :
552 550 self.byProfiles = True
@@ -678,7 +676,7 class CleanRayleigh(Operation):
678 676 dataOut.data_dc = self.buffer3
679 677 dataOut.nIncohInt *= self.nIntProfiles
680 678 dataOut.utctime = self.currentTime #tiempo promediado
681 print("Time: ",time.localtime(dataOut.utctime))
679 #print("Time: ",time.localtime(dataOut.utctime))
682 680 # dataOut.data_spc = sat_spectra
683 681 # dataOut.data_cspc = sat_cspectra
684 682 self.buffer = 0
@@ -763,26 +761,27 class CleanRayleigh(Operation):
763 761 if len(noval[0]) > 0: #forma de array (N,) es igual a longitud (N)
764 762 novall = ((func2clean - mode) >= (factor_stdv*stdv)).nonzero()
765 763 #print(novall)
766 #print(" ")
764 #print(" ",self.pairsArray[ii])
767 765 cross_pairs = self.pairsArray[ii]
768 766 #Getting coherent echoes which are removed.
769 if len(novall[0]) > 0:
770
771 val_spc[novall[0],cross_pairs[0],ifreq,ih] = 1
772 val_spc[novall[0],cross_pairs[1],ifreq,ih] = 1
773 val_cspc[novall[0],ii,ifreq,ih] = 1
767 # if len(novall[0]) > 0:
768 #
769 # val_spc[novall[0],cross_pairs[0],ifreq,ih] = 1
770 # val_spc[novall[0],cross_pairs[1],ifreq,ih] = 1
771 # val_cspc[novall[0],ii,ifreq,ih] = 1
774 772 #print("OUT NOVALL 1")
775 773 #Removing coherent from ISR data
774 chA = self.channels.index(cross_pairs[0])
775 chB = self.channels.index(cross_pairs[1])
776 776
777 #print(spectra[:,ii,ifreq,ih])
778 777 new_a = numpy.delete(cspectra[:,ii,ifreq,ih], noval[0])
779 778 mean_cspc = numpy.mean(new_a)
780 new_b = numpy.delete(spectra[:,cross_pairs[0],ifreq,ih], noval[0])
779 new_b = numpy.delete(spectra[:,chA,ifreq,ih], noval[0])
781 780 mean_spc0 = numpy.mean(new_b)
782 new_c = numpy.delete(spectra[:,cross_pairs[1],ifreq,ih], noval[0])
781 new_c = numpy.delete(spectra[:,chB,ifreq,ih], noval[0])
783 782 mean_spc1 = numpy.mean(new_c)
784 spectra[noval,cross_pairs[0],ifreq,ih] = mean_spc0
785 spectra[noval,cross_pairs[1],ifreq,ih] = mean_spc1
783 spectra[noval,chA,ifreq,ih] = mean_spc0
784 spectra[noval,chB,ifreq,ih] = mean_spc1
786 785 cspectra[noval,ii,ifreq,ih] = mean_cspc
787 786
788 787 '''
@@ -112,7 +112,7 class selectChannels(Operation):
112 112 self.dataOut.data_dc = data_dc
113 113
114 114 # self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
115 self.dataOut.channelList = range(len(channelIndexList))
115 self.dataOut.channelList = channelIndexList
116 116 self.__selectPairsByChannel(channelIndexList)
117 117
118 118 return 1
General Comments 0
You need to be logged in to leave comments. Login now