##// END OF EJS Templates
Se inclute SpectralMoments y DoubleGaussianPlot de tipo SpectraPlot
Danny Scipión -
r1358:fd32f6159d97
parent child
Show More
1 NO CONTENT: new file 100644, binary diff hidden
@@ -3,7 +3,7 import datetime
3 3 import numpy
4 4
5 5 from schainpy.model.graphics.jroplot_base import Plot, plt
6 from schainpy.model.graphics.jroplot_spectra import SpectraPlot, RTIPlot, CoherencePlot
6 from schainpy.model.graphics.jroplot_spectra import SpectraPlot, RTIPlot, CoherencePlot, SpectraCutPlot
7 7 from schainpy.utils import log
8 8
9 9 EARTH_RADIUS = 6.3710e3
@@ -35,9 +35,22 class SpectralMomentsPlot(SpectraPlot):
35 35 Plot for Spectral Moments
36 36 '''
37 37 CODE = 'spc_moments'
38 colormap = 'jet'
39 plot_type = 'pcolor'
38 # colormap = 'jet'
39 # plot_type = 'pcolor'
40
41 class DobleGaussianPlot(SpectraPlot):
42 '''
43 Plot for Double Gaussian Plot
44 '''
45 CODE = 'gaussian_fit'
46 # colormap = 'jet'
47 # plot_type = 'pcolor'
40 48
49 class DoubleGaussianSpectraCutPlot(SpectraCutPlot):
50 '''
51 Plot SpectraCut with Double Gaussian Fit
52 '''
53 CODE = 'cut_gaussian_fit'
41 54
42 55 class SnrPlot(RTIPlot):
43 56 '''
@@ -82,7 +95,7 class PowerPlot(RTIPlot):
82 95 def update(self, dataOut):
83 96
84 97 data = {
85 'pow': 10*numpy.log10(dataOut.data_pow)
98 'pow': 10*numpy.log10(dataOut.data_pow/dataOut.normFactor)
86 99 }
87 100
88 101 return data, {}
@@ -170,7 +183,7 class GenericRTIPlot(Plot):
170 183 if not self.xlabel:
171 184 self.xlabel = 'Time'
172 185
173 self.ylabel = 'Height [km]'
186 self.ylabel = 'Range [km]'
174 187 if not self.titles:
175 188 self.titles = self.data.parameters \
176 189 if self.data.parameters else ['Param {}'.format(x) for x in range(self.nrows)]
@@ -1,4 +1,4
1 # Copyright (c) 2012-2020 Jicamarca Radio Observatory
1 # Copyright (c) 2012-2021 Jicamarca Radio Observatory
2 2 # All rights reserved.
3 3 #
4 4 # Distributed under the terms of the BSD 3-clause license.
@@ -44,8 +44,14 class SpectraPlot(Plot):
44 44 data['rti'] = dataOut.getPower()
45 45 data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
46 46 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
47
47 48 if self.CODE == 'spc_moments':
48 49 data['moments'] = dataOut.moments
50 # data['spc'] = 10*numpy.log10(dataOut.data_pre[0]/dataOut.normFactor)
51 if self.CODE == 'gaussian_fit':
52 # data['moments'] = dataOut.moments
53 data['gaussfit'] = dataOut.DGauFitParams
54 # data['spc'] = 10*numpy.log10(dataOut.data_pre[0]/dataOut.normFactor)
49 55
50 56 return data, meta
51 57
@@ -60,7 +66,7 class SpectraPlot(Plot):
60 66 x = self.data.xrange[2]
61 67 self.xlabel = "Velocity (m/s)"
62 68
63 if self.CODE == 'spc_moments':
69 if (self.CODE == 'spc_moments') | (self.CODE == 'gaussian_fit'):
64 70 x = self.data.xrange[2]
65 71 self.xlabel = "Velocity (m/s)"
66 72
@@ -75,7 +81,11 class SpectraPlot(Plot):
75 81 for n, ax in enumerate(self.axes):
76 82 noise = data['noise'][n]
77 83 if self.CODE == 'spc_moments':
78 mean = data['moments'][n, 2]
84 mean = data['moments'][n, 1]
85 if self.CODE == 'gaussian_fit':
86 # mean = data['moments'][n, 1]
87 gau0 = data['gaussfit'][n][2,:,0]
88 gau1 = data['gaussfit'][n][2,:,1]
79 89 if ax.firsttime:
80 90 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
81 91 self.xmin = self.xmin if self.xmin else -self.xmax
@@ -93,7 +103,11 class SpectraPlot(Plot):
93 103 ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
94 104 color="k", linestyle="dashed", lw=1)[0]
95 105 if self.CODE == 'spc_moments':
96 ax.plt_mean = ax.plot(mean, y, color='k')[0]
106 ax.plt_mean = ax.plot(mean, y, color='k', lw=1)[0]
107 if self.CODE == 'gaussian_fit':
108 # ax.plt_mean = ax.plot(mean, y, color='k', lw=1)[0]
109 ax.plt_gau0 = ax.plot(gau0, y, color='r', lw=1)[0]
110 ax.plt_gau1 = ax.plot(gau1, y, color='y', lw=1)[0]
97 111 else:
98 112 ax.plt.set_array(z[n].T.ravel())
99 113 if self.showprofile:
@@ -101,6 +115,10 class SpectraPlot(Plot):
101 115 ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
102 116 if self.CODE == 'spc_moments':
103 117 ax.plt_mean.set_data(mean, y)
118 if self.CODE == 'gaussian_fit':
119 # ax.plt_mean.set_data(mean, y)
120 ax.plt_gau0.set_data(gau0, y)
121 ax.plt_gau1.set_data(gau1, y)
104 122 self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
105 123
106 124
@@ -428,10 +446,12 class SpectraCutPlot(Plot):
428 446
429 447 data = {}
430 448 meta = {}
431 spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
449 spc = 10*numpy.log10(dataOut.data_pre[0]/dataOut.normFactor)
432 450 data['spc'] = spc
433 451 meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
434
452 if self.CODE == 'cut_gaussian_fit':
453 data['gauss_fit0'] = 10*numpy.log10(dataOut.GaussFit0/dataOut.normFactor)
454 data['gauss_fit1'] = 10*numpy.log10(dataOut.GaussFit1/dataOut.normFactor)
435 455 return data, meta
436 456
437 457 def plot(self):
@@ -442,13 +462,18 class SpectraCutPlot(Plot):
442 462 x = self.data.xrange[1]
443 463 self.xlabel = "Time (ms)"
444 464 else:
445 x = self.data.xrange[2]
465 x = self.data.xrange[2][:-1]
466 self.xlabel = "Velocity (m/s)"
467
468 if self.CODE == 'cut_gaussian_fit':
469 x = self.data.xrange[2][:-1]
446 470 self.xlabel = "Velocity (m/s)"
447 471
448 472 self.titles = []
449 473
450 474 y = self.data.yrange
451 z = self.data[-1]['spc']
475 data = self.data[-1]
476 z = data['spc']
452 477
453 478 if self.height_index:
454 479 index = numpy.array(self.height_index)
@@ -456,17 +481,33 class SpectraCutPlot(Plot):
456 481 index = numpy.arange(0, len(y), int((len(y))/9))
457 482
458 483 for n, ax in enumerate(self.axes):
484 if self.CODE == 'cut_gaussian_fit':
485 gau0 = data['gauss_fit0']
486 gau1 = data['gauss_fit1']
459 487 if ax.firsttime:
460 488 self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
461 489 self.xmin = self.xmin if self.xmin else -self.xmax
462 490 self.ymin = self.ymin if self.ymin else numpy.nanmin(z)
463 491 self.ymax = self.ymax if self.ymax else numpy.nanmax(z)
464 ax.plt = ax.plot(x, z[n, :, index].T)
492 ax.plt = ax.plot(x, z[n, :, index].T, lw=0.25)
493 if self.CODE == 'cut_gaussian_fit':
494 ax.plt_gau0 = ax.plot(x, gau0[n, :, index].T, lw=1, linestyle='-.')
495 for i, line in enumerate(ax.plt_gau0):
496 line.set_color(ax.plt[i].get_color())
497 ax.plt_gau1 = ax.plot(x, gau1[n, :, index].T, lw=1, linestyle='--')
498 for i, line in enumerate(ax.plt_gau1):
499 line.set_color(ax.plt[i].get_color())
465 500 labels = ['Range = {:2.1f}km'.format(y[i]) for i in index]
466 501 self.figures[0].legend(ax.plt, labels, loc='center right')
467 502 else:
468 503 for i, line in enumerate(ax.plt):
469 line.set_data(x, z[n, :, i])
504 line.set_data(x, z[n, :, index[i]].T)
505 for i, line in enumerate(ax.plt_gau0):
506 line.set_data(x, gau0[n, :, index[i]].T)
507 line.set_color(ax.plt[i].get_color())
508 for i, line in enumerate(ax.plt_gau1):
509 line.set_data(x, gau1[n, :, index[i]].T)
510 line.set_color(ax.plt[i].get_color())
470 511 self.titles.append('CH {}'.format(n))
471 512
472 513
General Comments 0
You need to be logged in to leave comments. Login now