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