|
@@
-1,1349
+1,1350
|
|
1
|
# Copyright (c) 2012-2021 Jicamarca Radio Observatory
|
|
1
|
# Copyright (c) 2012-2021 Jicamarca Radio Observatory
|
|
2
|
# All rights reserved.
|
|
2
|
# All rights reserved.
|
|
3
|
#
|
|
3
|
#
|
|
4
|
# Distributed under the terms of the BSD 3-clause license.
|
|
4
|
# Distributed under the terms of the BSD 3-clause license.
|
|
5
|
"""Classes to plot Spectra data
|
|
5
|
"""Classes to plot Spectra data
|
|
6
|
|
|
6
|
|
|
7
|
"""
|
|
7
|
"""
|
|
8
|
|
|
8
|
|
|
9
|
import os
|
|
9
|
import os
|
|
10
|
import numpy
|
|
10
|
import numpy
|
|
11
|
#import collections.abc
|
|
11
|
#import collections.abc
|
|
12
|
|
|
12
|
|
|
13
|
from schainpy.model.graphics.jroplot_base import Plot, plt, log
|
|
13
|
from schainpy.model.graphics.jroplot_base import Plot, plt, log
|
|
14
|
|
|
14
|
|
|
15
|
class SpectraPlot(Plot):
|
|
15
|
class SpectraPlot(Plot):
|
|
16
|
'''
|
|
16
|
'''
|
|
17
|
Plot for Spectra data
|
|
17
|
Plot for Spectra data
|
|
18
|
'''
|
|
18
|
'''
|
|
19
|
|
|
19
|
|
|
20
|
CODE = 'spc'
|
|
20
|
CODE = 'spc'
|
|
21
|
colormap = 'jet'
|
|
21
|
colormap = 'jet'
|
|
22
|
plot_type = 'pcolor'
|
|
22
|
plot_type = 'pcolor'
|
|
23
|
buffering = False
|
|
23
|
buffering = False
|
|
24
|
|
|
24
|
|
|
25
|
def setup(self):
|
|
25
|
def setup(self):
|
|
26
|
|
|
26
|
|
|
27
|
self.nplots = len(self.data.channels)
|
|
27
|
self.nplots = len(self.data.channels)
|
|
28
|
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
|
|
28
|
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
|
|
29
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
29
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
30
|
self.height = 2.6 * self.nrows
|
|
30
|
self.height = 2.6 * self.nrows
|
|
31
|
self.cb_label = 'dB'
|
|
31
|
self.cb_label = 'dB'
|
|
32
|
if self.showprofile:
|
|
32
|
if self.showprofile:
|
|
33
|
self.width = 4 * self.ncols
|
|
33
|
self.width = 4 * self.ncols
|
|
34
|
else:
|
|
34
|
else:
|
|
35
|
self.width = 3.5 * self.ncols
|
|
35
|
self.width = 3.5 * self.ncols
|
|
36
|
self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18})
|
|
36
|
self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18})
|
|
37
|
self.ylabel = 'Range [km]'
|
|
37
|
self.ylabel = 'Range [km]'
|
|
38
|
|
|
38
|
|
|
39
|
def update(self, dataOut):
|
|
39
|
def update(self, dataOut):
|
|
40
|
|
|
40
|
|
|
41
|
data = {}
|
|
41
|
data = {}
|
|
42
|
meta = {}
|
|
42
|
meta = {}
|
|
43
|
|
|
43
|
|
|
44
|
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
|
|
44
|
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
|
|
45
|
#print("dataOut.normFactor: ", dataOut.normFactor)
|
|
45
|
#print("dataOut.normFactor: ", dataOut.normFactor)
|
|
46
|
#print("spc: ", dataOut.data_spc[0,0,0])
|
|
46
|
#print("spc: ", dataOut.data_spc[0,0,0])
|
|
47
|
#spc = 10*numpy.log10(dataOut.data_spc)
|
|
47
|
#spc = 10*numpy.log10(dataOut.data_spc)
|
|
48
|
#print("Spc: ",spc[0])
|
|
48
|
#print("Spc: ",spc[0])
|
|
49
|
#exit(1)
|
|
49
|
#exit(1)
|
|
50
|
data['spc'] = spc
|
|
50
|
data['spc'] = spc
|
|
51
|
data['rti'] = dataOut.getPower()
|
|
51
|
data['rti'] = dataOut.getPower()
|
|
52
|
#print(data['rti'][0])
|
|
52
|
#print(data['rti'][0])
|
|
53
|
#exit(1)
|
|
53
|
#exit(1)
|
|
54
|
#print("NormFactor: ",dataOut.normFactor)
|
|
54
|
#print("NormFactor: ",dataOut.normFactor)
|
|
55
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
55
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
56
|
if hasattr(dataOut, 'LagPlot'): #Double Pulse
|
|
56
|
if hasattr(dataOut, 'LagPlot'): #Double Pulse
|
|
57
|
max_hei_id = dataOut.nHeights - 2*dataOut.LagPlot
|
|
57
|
max_hei_id = dataOut.nHeights - 2*dataOut.LagPlot
|
|
58
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=46,ymax_index=max_hei_id)/dataOut.normFactor)
|
|
58
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=46,ymax_index=max_hei_id)/dataOut.normFactor)
|
|
59
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=40,ymax_index=max_hei_id)/dataOut.normFactor)
|
|
59
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=40,ymax_index=max_hei_id)/dataOut.normFactor)
|
|
60
|
data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=53,ymax_index=max_hei_id)/dataOut.normFactor)
|
|
60
|
data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=53,ymax_index=max_hei_id)/dataOut.normFactor)
|
|
61
|
data['noise'][0] = 10*numpy.log10(dataOut.getNoise(ymin_index=53)[0]/dataOut.normFactor)
|
|
61
|
data['noise'][0] = 10*numpy.log10(dataOut.getNoise(ymin_index=53)[0]/dataOut.normFactor)
|
|
62
|
#data['noise'][1] = 22.035507
|
|
62
|
#data['noise'][1] = 22.035507
|
|
63
|
else:
|
|
63
|
else:
|
|
64
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
64
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
65
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=26,ymax_index=44)/dataOut.normFactor)
|
|
65
|
#data['noise'] = 10*numpy.log10(dataOut.getNoise(ymin_index=26,ymax_index=44)/dataOut.normFactor)
|
|
66
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
66
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
67
|
|
|
67
|
|
|
68
|
if self.CODE == 'spc_moments':
|
|
68
|
if self.CODE == 'spc_moments':
|
|
69
|
data['moments'] = dataOut.moments
|
|
69
|
data['moments'] = dataOut.moments
|
|
70
|
if self.CODE == 'gaussian_fit':
|
|
70
|
if self.CODE == 'gaussian_fit':
|
|
71
|
data['gaussfit'] = dataOut.DGauFitParams
|
|
71
|
data['gaussfit'] = dataOut.DGauFitParams
|
|
72
|
|
|
72
|
|
|
73
|
return data, meta
|
|
73
|
return data, meta
|
|
74
|
|
|
74
|
|
|
75
|
def plot(self):
|
|
75
|
def plot(self):
|
|
76
|
|
|
76
|
|
|
77
|
if self.xaxis == "frequency":
|
|
77
|
if self.xaxis == "frequency":
|
|
78
|
x = self.data.xrange[0]
|
|
78
|
x = self.data.xrange[0]
|
|
79
|
self.xlabel = "Frequency (kHz)"
|
|
79
|
self.xlabel = "Frequency (kHz)"
|
|
80
|
elif self.xaxis == "time":
|
|
80
|
elif self.xaxis == "time":
|
|
81
|
x = self.data.xrange[1]
|
|
81
|
x = self.data.xrange[1]
|
|
82
|
self.xlabel = "Time (ms)"
|
|
82
|
self.xlabel = "Time (ms)"
|
|
83
|
else:
|
|
83
|
else:
|
|
84
|
x = self.data.xrange[2]
|
|
84
|
x = self.data.xrange[2]
|
|
85
|
self.xlabel = "Velocity (m/s)"
|
|
85
|
self.xlabel = "Velocity (m/s)"
|
|
86
|
|
|
86
|
|
|
87
|
if (self.CODE == 'spc_moments') | (self.CODE == 'gaussian_fit'):
|
|
87
|
if (self.CODE == 'spc_moments') | (self.CODE == 'gaussian_fit'):
|
|
88
|
x = self.data.xrange[2]
|
|
88
|
x = self.data.xrange[2]
|
|
89
|
self.xlabel = "Velocity (m/s)"
|
|
89
|
self.xlabel = "Velocity (m/s)"
|
|
90
|
|
|
90
|
|
|
91
|
self.titles = []
|
|
91
|
self.titles = []
|
|
92
|
|
|
92
|
|
|
93
|
y = self.data.yrange
|
|
93
|
y = self.data.yrange
|
|
94
|
self.y = y
|
|
94
|
self.y = y
|
|
95
|
|
|
95
|
|
|
96
|
data = self.data[-1]
|
|
96
|
data = self.data[-1]
|
|
97
|
z = data['spc']
|
|
97
|
z = data['spc']
|
|
98
|
|
|
98
|
|
|
99
|
self.CODE2 = 'spc_oblique'
|
|
99
|
self.CODE2 = 'spc_oblique'
|
|
100
|
|
|
100
|
|
|
101
|
for n, ax in enumerate(self.axes):
|
|
101
|
for n, ax in enumerate(self.axes):
|
|
102
|
noise = data['noise'][n]
|
|
102
|
noise = data['noise'][n]
|
|
103
|
if self.CODE == 'spc_moments':
|
|
103
|
if self.CODE == 'spc_moments':
|
|
104
|
mean = data['moments'][n, 1]
|
|
104
|
mean = data['moments'][n, 1]
|
|
105
|
if self.CODE == 'gaussian_fit':
|
|
105
|
if self.CODE == 'gaussian_fit':
|
|
106
|
gau0 = data['gaussfit'][n][2,:,0]
|
|
106
|
gau0 = data['gaussfit'][n][2,:,0]
|
|
107
|
gau1 = data['gaussfit'][n][2,:,1]
|
|
107
|
gau1 = data['gaussfit'][n][2,:,1]
|
|
108
|
if ax.firsttime:
|
|
108
|
if ax.firsttime:
|
|
109
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
109
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
110
|
self.xmin = self.xmin if self.xmin else numpy.nanmin(x)#-self.xmax
|
|
110
|
self.xmin = self.xmin if self.xmin else numpy.nanmin(x)#-self.xmax
|
|
111
|
#self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
|
|
111
|
#self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
|
|
112
|
#self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
|
|
112
|
#self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
|
|
113
|
if self.zlimits is not None:
|
|
113
|
if self.zlimits is not None:
|
|
114
|
self.zmin, self.zmax = self.zlimits[n]
|
|
114
|
self.zmin, self.zmax = self.zlimits[n]
|
|
115
|
|
|
115
|
|
|
116
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
116
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
117
|
vmin=self.zmin,
|
|
117
|
vmin=self.zmin,
|
|
118
|
vmax=self.zmax,
|
|
118
|
vmax=self.zmax,
|
|
119
|
cmap=plt.get_cmap(self.colormap),
|
|
119
|
cmap=plt.get_cmap(self.colormap),
|
|
120
|
)
|
|
120
|
)
|
|
121
|
|
|
121
|
|
|
122
|
if self.showprofile:
|
|
122
|
if self.showprofile:
|
|
123
|
ax.plt_profile = self.pf_axes[n].plot(
|
|
123
|
ax.plt_profile = self.pf_axes[n].plot(
|
|
124
|
data['rti'][n], y)[0]
|
|
124
|
data['rti'][n], y)[0]
|
|
125
|
ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
|
|
125
|
ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
|
|
126
|
color="k", linestyle="dashed", lw=1)[0]
|
|
126
|
color="k", linestyle="dashed", lw=1)[0]
|
|
127
|
if self.CODE == 'spc_moments':
|
|
127
|
if self.CODE == 'spc_moments':
|
|
128
|
ax.plt_mean = ax.plot(mean, y, color='k', lw=1)[0]
|
|
128
|
ax.plt_mean = ax.plot(mean, y, color='k', lw=1)[0]
|
|
129
|
if self.CODE == 'gaussian_fit':
|
|
129
|
if self.CODE == 'gaussian_fit':
|
|
130
|
ax.plt_gau0 = ax.plot(gau0, y, color='r', lw=1)[0]
|
|
130
|
ax.plt_gau0 = ax.plot(gau0, y, color='r', lw=1)[0]
|
|
131
|
ax.plt_gau1 = ax.plot(gau1, y, color='y', lw=1)[0]
|
|
131
|
ax.plt_gau1 = ax.plot(gau1, y, color='y', lw=1)[0]
|
|
132
|
else:
|
|
132
|
else:
|
|
133
|
if self.zlimits is not None:
|
|
133
|
if self.zlimits is not None:
|
|
134
|
self.zmin, self.zmax = self.zlimits[n]
|
|
134
|
self.zmin, self.zmax = self.zlimits[n]
|
|
135
|
ax.plt.set_array(z[n].T.ravel())
|
|
135
|
ax.plt.set_array(z[n].T.ravel())
|
|
136
|
if self.showprofile:
|
|
136
|
if self.showprofile:
|
|
137
|
ax.plt_profile.set_data(data['rti'][n], y)
|
|
137
|
ax.plt_profile.set_data(data['rti'][n], y)
|
|
138
|
ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
|
|
138
|
ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
|
|
139
|
if self.CODE == 'spc_moments':
|
|
139
|
if self.CODE == 'spc_moments':
|
|
140
|
ax.plt_mean.set_data(mean, y)
|
|
140
|
ax.plt_mean.set_data(mean, y)
|
|
141
|
if self.CODE == 'gaussian_fit':
|
|
141
|
if self.CODE == 'gaussian_fit':
|
|
142
|
ax.plt_gau0.set_data(gau0, y)
|
|
142
|
ax.plt_gau0.set_data(gau0, y)
|
|
143
|
ax.plt_gau1.set_data(gau1, y)
|
|
143
|
ax.plt_gau1.set_data(gau1, y)
|
|
144
|
self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
|
|
144
|
self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
|
|
145
|
|
|
145
|
|
|
146
|
class SpectraObliquePlot(Plot):
|
|
146
|
class SpectraObliquePlot(Plot):
|
|
147
|
'''
|
|
147
|
'''
|
|
148
|
Plot for Spectra data
|
|
148
|
Plot for Spectra data
|
|
149
|
'''
|
|
149
|
'''
|
|
150
|
|
|
150
|
|
|
151
|
CODE = 'spc_oblique'
|
|
151
|
CODE = 'spc_oblique'
|
|
152
|
colormap = 'jet'
|
|
152
|
colormap = 'jet'
|
|
153
|
plot_type = 'pcolor'
|
|
153
|
plot_type = 'pcolor'
|
|
154
|
|
|
154
|
|
|
155
|
def setup(self):
|
|
155
|
def setup(self):
|
|
156
|
self.xaxis = "oblique"
|
|
156
|
self.xaxis = "oblique"
|
|
157
|
self.nplots = len(self.data.channels)
|
|
157
|
self.nplots = len(self.data.channels)
|
|
158
|
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
|
|
158
|
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
|
|
159
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
159
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
160
|
self.height = 2.6 * self.nrows
|
|
160
|
self.height = 2.6 * self.nrows
|
|
161
|
self.cb_label = 'dB'
|
|
161
|
self.cb_label = 'dB'
|
|
162
|
if self.showprofile:
|
|
162
|
if self.showprofile:
|
|
163
|
self.width = 4 * self.ncols
|
|
163
|
self.width = 4 * self.ncols
|
|
164
|
else:
|
|
164
|
else:
|
|
165
|
self.width = 3.5 * self.ncols
|
|
165
|
self.width = 3.5 * self.ncols
|
|
166
|
self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18})
|
|
166
|
self.plots_adjust.update({'wspace': 0.8, 'hspace':0.2, 'left': 0.2, 'right': 0.9, 'bottom': 0.18})
|
|
167
|
self.ylabel = 'Range [km]'
|
|
167
|
self.ylabel = 'Range [km]'
|
|
168
|
|
|
168
|
|
|
169
|
def update(self, dataOut):
|
|
169
|
def update(self, dataOut):
|
|
170
|
|
|
170
|
|
|
171
|
data = {}
|
|
171
|
data = {}
|
|
172
|
meta = {}
|
|
172
|
meta = {}
|
|
173
|
|
|
173
|
|
|
174
|
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
|
|
174
|
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
|
|
175
|
data['spc'] = spc
|
|
175
|
data['spc'] = spc
|
|
176
|
data['rti'] = dataOut.getPower()
|
|
176
|
data['rti'] = dataOut.getPower()
|
|
177
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
177
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
178
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
178
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
179
|
'''
|
|
179
|
'''
|
|
180
|
data['shift1'] = dataOut.Oblique_params[0,-2,:]
|
|
180
|
data['shift1'] = dataOut.Oblique_params[0,-2,:]
|
|
181
|
data['shift2'] = dataOut.Oblique_params[0,-1,:]
|
|
181
|
data['shift2'] = dataOut.Oblique_params[0,-1,:]
|
|
182
|
data['shift1_error'] = dataOut.Oblique_param_errors[0,-2,:]
|
|
182
|
data['shift1_error'] = dataOut.Oblique_param_errors[0,-2,:]
|
|
183
|
data['shift2_error'] = dataOut.Oblique_param_errors[0,-1,:]
|
|
183
|
data['shift2_error'] = dataOut.Oblique_param_errors[0,-1,:]
|
|
184
|
'''
|
|
184
|
'''
|
|
185
|
'''
|
|
185
|
'''
|
|
186
|
data['shift1'] = dataOut.Oblique_params[0,1,:]
|
|
186
|
data['shift1'] = dataOut.Oblique_params[0,1,:]
|
|
187
|
data['shift2'] = dataOut.Oblique_params[0,4,:]
|
|
187
|
data['shift2'] = dataOut.Oblique_params[0,4,:]
|
|
188
|
data['shift1_error'] = dataOut.Oblique_param_errors[0,1,:]
|
|
188
|
data['shift1_error'] = dataOut.Oblique_param_errors[0,1,:]
|
|
189
|
data['shift2_error'] = dataOut.Oblique_param_errors[0,4,:]
|
|
189
|
data['shift2_error'] = dataOut.Oblique_param_errors[0,4,:]
|
|
190
|
'''
|
|
190
|
'''
|
|
191
|
data['shift1'] = dataOut.Dop_EEJ_T1[0]
|
|
191
|
data['shift1'] = dataOut.Dop_EEJ_T1[0]
|
|
192
|
data['shift2'] = dataOut.Dop_EEJ_T2[0]
|
|
192
|
data['shift2'] = dataOut.Dop_EEJ_T2[0]
|
|
193
|
data['max_val_2'] = dataOut.Oblique_params[0,-1,:]
|
|
193
|
data['max_val_2'] = dataOut.Oblique_params[0,-1,:]
|
|
194
|
data['shift1_error'] = dataOut.Err_Dop_EEJ_T1[0]
|
|
194
|
data['shift1_error'] = dataOut.Err_Dop_EEJ_T1[0]
|
|
195
|
data['shift2_error'] = dataOut.Err_Dop_EEJ_T2[0]
|
|
195
|
data['shift2_error'] = dataOut.Err_Dop_EEJ_T2[0]
|
|
196
|
|
|
196
|
|
|
197
|
return data, meta
|
|
197
|
return data, meta
|
|
198
|
|
|
198
|
|
|
199
|
def plot(self):
|
|
199
|
def plot(self):
|
|
200
|
|
|
200
|
|
|
201
|
if self.xaxis == "frequency":
|
|
201
|
if self.xaxis == "frequency":
|
|
202
|
x = self.data.xrange[0]
|
|
202
|
x = self.data.xrange[0]
|
|
203
|
self.xlabel = "Frequency (kHz)"
|
|
203
|
self.xlabel = "Frequency (kHz)"
|
|
204
|
elif self.xaxis == "time":
|
|
204
|
elif self.xaxis == "time":
|
|
205
|
x = self.data.xrange[1]
|
|
205
|
x = self.data.xrange[1]
|
|
206
|
self.xlabel = "Time (ms)"
|
|
206
|
self.xlabel = "Time (ms)"
|
|
207
|
else:
|
|
207
|
else:
|
|
208
|
x = self.data.xrange[2]
|
|
208
|
x = self.data.xrange[2]
|
|
209
|
self.xlabel = "Velocity (m/s)"
|
|
209
|
self.xlabel = "Velocity (m/s)"
|
|
210
|
|
|
210
|
|
|
211
|
self.titles = []
|
|
211
|
self.titles = []
|
|
212
|
|
|
212
|
|
|
213
|
y = self.data.yrange
|
|
213
|
y = self.data.yrange
|
|
214
|
self.y = y
|
|
214
|
self.y = y
|
|
215
|
|
|
215
|
|
|
216
|
data = self.data[-1]
|
|
216
|
data = self.data[-1]
|
|
217
|
z = data['spc']
|
|
217
|
z = data['spc']
|
|
218
|
|
|
218
|
|
|
219
|
for n, ax in enumerate(self.axes):
|
|
219
|
for n, ax in enumerate(self.axes):
|
|
220
|
noise = self.data['noise'][n][-1]
|
|
220
|
noise = self.data['noise'][n][-1]
|
|
221
|
shift1 = data['shift1']
|
|
221
|
shift1 = data['shift1']
|
|
222
|
#print(shift1)
|
|
222
|
#print(shift1)
|
|
223
|
shift2 = data['shift2']
|
|
223
|
shift2 = data['shift2']
|
|
224
|
max_val_2 = data['max_val_2']
|
|
224
|
max_val_2 = data['max_val_2']
|
|
225
|
err1 = data['shift1_error']
|
|
225
|
err1 = data['shift1_error']
|
|
226
|
err2 = data['shift2_error']
|
|
226
|
err2 = data['shift2_error']
|
|
227
|
if ax.firsttime:
|
|
227
|
if ax.firsttime:
|
|
228
|
|
|
228
|
|
|
229
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
229
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
230
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
230
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
231
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
|
|
231
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(z)
|
|
232
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
|
|
232
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(z)
|
|
233
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
233
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
234
|
vmin=self.zmin,
|
|
234
|
vmin=self.zmin,
|
|
235
|
vmax=self.zmax,
|
|
235
|
vmax=self.zmax,
|
|
236
|
cmap=plt.get_cmap(self.colormap)
|
|
236
|
cmap=plt.get_cmap(self.colormap)
|
|
237
|
)
|
|
237
|
)
|
|
238
|
|
|
238
|
|
|
239
|
if self.showprofile:
|
|
239
|
if self.showprofile:
|
|
240
|
ax.plt_profile = self.pf_axes[n].plot(
|
|
240
|
ax.plt_profile = self.pf_axes[n].plot(
|
|
241
|
self.data['rti'][n][-1], y)[0]
|
|
241
|
self.data['rti'][n][-1], y)[0]
|
|
242
|
ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
|
|
242
|
ax.plt_noise = self.pf_axes[n].plot(numpy.repeat(noise, len(y)), y,
|
|
243
|
color="k", linestyle="dashed", lw=1)[0]
|
|
243
|
color="k", linestyle="dashed", lw=1)[0]
|
|
244
|
|
|
244
|
|
|
245
|
self.ploterr1 = ax.errorbar(shift1, y, xerr=err1, fmt='k^', elinewidth=2.2, marker='o', linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
245
|
self.ploterr1 = ax.errorbar(shift1, y, xerr=err1, fmt='k^', elinewidth=2.2, marker='o', linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
246
|
self.ploterr2 = ax.errorbar(shift2, y, xerr=err2, fmt='m^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
246
|
self.ploterr2 = ax.errorbar(shift2, y, xerr=err2, fmt='m^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
247
|
self.ploterr3 = ax.errorbar(max_val_2, y, xerr=0, fmt='g^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
247
|
self.ploterr3 = ax.errorbar(max_val_2, y, xerr=0, fmt='g^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
248
|
|
|
248
|
|
|
249
|
#print("plotter1: ", self.ploterr1,shift1)
|
|
249
|
#print("plotter1: ", self.ploterr1,shift1)
|
|
250
|
|
|
250
|
|
|
251
|
else:
|
|
251
|
else:
|
|
252
|
#print("else plotter1: ", self.ploterr1,shift1)
|
|
252
|
#print("else plotter1: ", self.ploterr1,shift1)
|
|
253
|
self.ploterr1.remove()
|
|
253
|
self.ploterr1.remove()
|
|
254
|
self.ploterr2.remove()
|
|
254
|
self.ploterr2.remove()
|
|
255
|
self.ploterr3.remove()
|
|
255
|
self.ploterr3.remove()
|
|
256
|
ax.plt.set_array(z[n].T.ravel())
|
|
256
|
ax.plt.set_array(z[n].T.ravel())
|
|
257
|
if self.showprofile:
|
|
257
|
if self.showprofile:
|
|
258
|
ax.plt_profile.set_data(self.data['rti'][n][-1], y)
|
|
258
|
ax.plt_profile.set_data(self.data['rti'][n][-1], y)
|
|
259
|
ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
|
|
259
|
ax.plt_noise.set_data(numpy.repeat(noise, len(y)), y)
|
|
260
|
self.ploterr1 = ax.errorbar(shift1, y, xerr=err1, fmt='k^', elinewidth=2.2, marker='o', linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
260
|
self.ploterr1 = ax.errorbar(shift1, y, xerr=err1, fmt='k^', elinewidth=2.2, marker='o', linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
261
|
self.ploterr2 = ax.errorbar(shift2, y, xerr=err2, fmt='m^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
261
|
self.ploterr2 = ax.errorbar(shift2, y, xerr=err2, fmt='m^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
262
|
self.ploterr3 = ax.errorbar(max_val_2, y, xerr=0, fmt='g^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
262
|
self.ploterr3 = ax.errorbar(max_val_2, y, xerr=0, fmt='g^',elinewidth=2.2,marker='o',linestyle='None',markersize=2.5,capsize=0.3,markeredgewidth=0.2)
|
|
263
|
|
|
263
|
|
|
264
|
self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
|
|
264
|
self.titles.append('CH {}: {:3.2f}dB'.format(n, noise))
|
|
265
|
|
|
265
|
|
|
266
|
|
|
266
|
|
|
267
|
class CrossSpectraPlot(Plot):
|
|
267
|
class CrossSpectraPlot(Plot):
|
|
268
|
|
|
268
|
|
|
269
|
CODE = 'cspc'
|
|
269
|
CODE = 'cspc'
|
|
270
|
colormap = 'jet'
|
|
270
|
colormap = 'jet'
|
|
271
|
plot_type = 'pcolor'
|
|
271
|
plot_type = 'pcolor'
|
|
272
|
zmin_coh = None
|
|
272
|
zmin_coh = None
|
|
273
|
zmax_coh = None
|
|
273
|
zmax_coh = None
|
|
274
|
zmin_phase = None
|
|
274
|
zmin_phase = None
|
|
275
|
zmax_phase = None
|
|
275
|
zmax_phase = None
|
|
276
|
|
|
276
|
|
|
277
|
def setup(self):
|
|
277
|
def setup(self):
|
|
278
|
|
|
278
|
|
|
279
|
self.ncols = 4
|
|
279
|
self.ncols = 4
|
|
280
|
self.nplots = len(self.data.pairs) * 2
|
|
280
|
self.nplots = len(self.data.pairs) * 2
|
|
281
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
281
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
282
|
self.width = 3.1 * self.ncols
|
|
282
|
self.width = 3.1 * self.ncols
|
|
283
|
self.height = 5 * self.nrows
|
|
283
|
self.height = 5 * self.nrows
|
|
284
|
self.ylabel = 'Range [km]'
|
|
284
|
self.ylabel = 'Range [km]'
|
|
285
|
self.showprofile = False
|
|
285
|
self.showprofile = False
|
|
286
|
self.plots_adjust.update({'left': 0.08, 'right': 0.92, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
286
|
self.plots_adjust.update({'left': 0.08, 'right': 0.92, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
287
|
|
|
287
|
|
|
288
|
def update(self, dataOut):
|
|
288
|
def update(self, dataOut):
|
|
289
|
|
|
289
|
|
|
290
|
data = {}
|
|
290
|
data = {}
|
|
291
|
meta = {}
|
|
291
|
meta = {}
|
|
292
|
|
|
292
|
|
|
293
|
spc = dataOut.data_spc
|
|
293
|
spc = dataOut.data_spc
|
|
294
|
cspc = dataOut.data_cspc
|
|
294
|
cspc = dataOut.data_cspc
|
|
295
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
295
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
296
|
meta['pairs'] = dataOut.pairsList
|
|
296
|
meta['pairs'] = dataOut.pairsList
|
|
297
|
|
|
297
|
|
|
298
|
tmp = []
|
|
298
|
tmp = []
|
|
299
|
|
|
299
|
|
|
300
|
for n, pair in enumerate(meta['pairs']):
|
|
300
|
for n, pair in enumerate(meta['pairs']):
|
|
301
|
out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
301
|
out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
302
|
coh = numpy.abs(out)
|
|
302
|
coh = numpy.abs(out)
|
|
303
|
phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
303
|
phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
304
|
tmp.append(coh)
|
|
304
|
tmp.append(coh)
|
|
305
|
tmp.append(phase)
|
|
305
|
tmp.append(phase)
|
|
306
|
|
|
306
|
|
|
307
|
data['cspc'] = numpy.array(tmp)
|
|
307
|
data['cspc'] = numpy.array(tmp)
|
|
308
|
|
|
308
|
|
|
309
|
return data, meta
|
|
309
|
return data, meta
|
|
310
|
|
|
310
|
|
|
311
|
def plot(self):
|
|
311
|
def plot(self):
|
|
312
|
|
|
312
|
|
|
313
|
if self.xaxis == "frequency":
|
|
313
|
if self.xaxis == "frequency":
|
|
314
|
x = self.data.xrange[0]
|
|
314
|
x = self.data.xrange[0]
|
|
315
|
self.xlabel = "Frequency (kHz)"
|
|
315
|
self.xlabel = "Frequency (kHz)"
|
|
316
|
elif self.xaxis == "time":
|
|
316
|
elif self.xaxis == "time":
|
|
317
|
x = self.data.xrange[1]
|
|
317
|
x = self.data.xrange[1]
|
|
318
|
self.xlabel = "Time (ms)"
|
|
318
|
self.xlabel = "Time (ms)"
|
|
319
|
else:
|
|
319
|
else:
|
|
320
|
x = self.data.xrange[2]
|
|
320
|
x = self.data.xrange[2]
|
|
321
|
self.xlabel = "Velocity (m/s)"
|
|
321
|
self.xlabel = "Velocity (m/s)"
|
|
322
|
|
|
322
|
|
|
323
|
self.titles = []
|
|
323
|
self.titles = []
|
|
324
|
|
|
324
|
|
|
325
|
y = self.data.yrange
|
|
325
|
y = self.data.yrange
|
|
326
|
self.y = y
|
|
326
|
self.y = y
|
|
327
|
|
|
327
|
|
|
328
|
data = self.data[-1]
|
|
328
|
data = self.data[-1]
|
|
329
|
cspc = data['cspc']
|
|
329
|
cspc = data['cspc']
|
|
330
|
|
|
330
|
|
|
331
|
for n in range(len(self.data.pairs)):
|
|
331
|
for n in range(len(self.data.pairs)):
|
|
332
|
pair = self.data.pairs[n]
|
|
332
|
pair = self.data.pairs[n]
|
|
333
|
coh = cspc[n*2]
|
|
333
|
coh = cspc[n*2]
|
|
334
|
phase = cspc[n*2+1]
|
|
334
|
phase = cspc[n*2+1]
|
|
335
|
ax = self.axes[2 * n]
|
|
335
|
ax = self.axes[2 * n]
|
|
336
|
if ax.firsttime:
|
|
336
|
if ax.firsttime:
|
|
337
|
ax.plt = ax.pcolormesh(x, y, coh.T,
|
|
337
|
ax.plt = ax.pcolormesh(x, y, coh.T,
|
|
338
|
vmin=0,
|
|
338
|
vmin=0,
|
|
339
|
vmax=1,
|
|
339
|
vmax=1,
|
|
340
|
cmap=plt.get_cmap(self.colormap_coh)
|
|
340
|
cmap=plt.get_cmap(self.colormap_coh)
|
|
341
|
)
|
|
341
|
)
|
|
342
|
else:
|
|
342
|
else:
|
|
343
|
ax.plt.set_array(coh.T.ravel())
|
|
343
|
ax.plt.set_array(coh.T.ravel())
|
|
344
|
self.titles.append(
|
|
344
|
self.titles.append(
|
|
345
|
'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
345
|
'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
346
|
|
|
346
|
|
|
347
|
ax = self.axes[2 * n + 1]
|
|
347
|
ax = self.axes[2 * n + 1]
|
|
348
|
if ax.firsttime:
|
|
348
|
if ax.firsttime:
|
|
349
|
ax.plt = ax.pcolormesh(x, y, phase.T,
|
|
349
|
ax.plt = ax.pcolormesh(x, y, phase.T,
|
|
350
|
vmin=-180,
|
|
350
|
vmin=-180,
|
|
351
|
vmax=180,
|
|
351
|
vmax=180,
|
|
352
|
cmap=plt.get_cmap(self.colormap_phase)
|
|
352
|
cmap=plt.get_cmap(self.colormap_phase)
|
|
353
|
)
|
|
353
|
)
|
|
354
|
else:
|
|
354
|
else:
|
|
355
|
ax.plt.set_array(phase.T.ravel())
|
|
355
|
ax.plt.set_array(phase.T.ravel())
|
|
356
|
self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
|
|
356
|
self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
|
|
357
|
|
|
357
|
|
|
358
|
|
|
358
|
|
|
359
|
class CrossSpectra4Plot(Plot):
|
|
359
|
class CrossSpectra4Plot(Plot):
|
|
360
|
|
|
360
|
|
|
361
|
CODE = 'cspc'
|
|
361
|
CODE = 'cspc'
|
|
362
|
colormap = 'jet'
|
|
362
|
colormap = 'jet'
|
|
363
|
plot_type = 'pcolor'
|
|
363
|
plot_type = 'pcolor'
|
|
364
|
zmin_coh = None
|
|
364
|
zmin_coh = None
|
|
365
|
zmax_coh = None
|
|
365
|
zmax_coh = None
|
|
366
|
zmin_phase = None
|
|
366
|
zmin_phase = None
|
|
367
|
zmax_phase = None
|
|
367
|
zmax_phase = None
|
|
368
|
|
|
368
|
|
|
369
|
def setup(self):
|
|
369
|
def setup(self):
|
|
370
|
|
|
370
|
|
|
371
|
self.ncols = 4
|
|
371
|
self.ncols = 4
|
|
372
|
self.nrows = len(self.data.pairs)
|
|
372
|
self.nrows = len(self.data.pairs)
|
|
373
|
self.nplots = self.nrows * 4
|
|
373
|
self.nplots = self.nrows * 4
|
|
374
|
self.width = 3.1 * self.ncols
|
|
374
|
self.width = 3.1 * self.ncols
|
|
375
|
self.height = 5 * self.nrows
|
|
375
|
self.height = 5 * self.nrows
|
|
376
|
self.ylabel = 'Range [km]'
|
|
376
|
self.ylabel = 'Range [km]'
|
|
377
|
self.showprofile = False
|
|
377
|
self.showprofile = False
|
|
378
|
self.plots_adjust.update({'left': 0.08, 'right': 0.92, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
378
|
self.plots_adjust.update({'left': 0.08, 'right': 0.92, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
379
|
|
|
379
|
|
|
380
|
def plot(self):
|
|
380
|
def plot(self):
|
|
381
|
|
|
381
|
|
|
382
|
if self.xaxis == "frequency":
|
|
382
|
if self.xaxis == "frequency":
|
|
383
|
x = self.data.xrange[0]
|
|
383
|
x = self.data.xrange[0]
|
|
384
|
self.xlabel = "Frequency (kHz)"
|
|
384
|
self.xlabel = "Frequency (kHz)"
|
|
385
|
elif self.xaxis == "time":
|
|
385
|
elif self.xaxis == "time":
|
|
386
|
x = self.data.xrange[1]
|
|
386
|
x = self.data.xrange[1]
|
|
387
|
self.xlabel = "Time (ms)"
|
|
387
|
self.xlabel = "Time (ms)"
|
|
388
|
else:
|
|
388
|
else:
|
|
389
|
x = self.data.xrange[2]
|
|
389
|
x = self.data.xrange[2]
|
|
390
|
self.xlabel = "Velocity (m/s)"
|
|
390
|
self.xlabel = "Velocity (m/s)"
|
|
391
|
|
|
391
|
|
|
392
|
self.titles = []
|
|
392
|
self.titles = []
|
|
393
|
|
|
393
|
|
|
394
|
|
|
394
|
|
|
395
|
y = self.data.heights
|
|
395
|
y = self.data.heights
|
|
396
|
self.y = y
|
|
396
|
self.y = y
|
|
397
|
nspc = self.data['spc']
|
|
397
|
nspc = self.data['spc']
|
|
398
|
#print(numpy.shape(self.data['spc']))
|
|
398
|
#print(numpy.shape(self.data['spc']))
|
|
399
|
spc = self.data['cspc'][0]
|
|
399
|
spc = self.data['cspc'][0]
|
|
400
|
#print(numpy.shape(nspc))
|
|
400
|
#print(numpy.shape(nspc))
|
|
401
|
#exit()
|
|
401
|
#exit()
|
|
402
|
#nspc[1,:,:] = numpy.flip(nspc[1,:,:],axis=0)
|
|
402
|
#nspc[1,:,:] = numpy.flip(nspc[1,:,:],axis=0)
|
|
403
|
#print(numpy.shape(spc))
|
|
403
|
#print(numpy.shape(spc))
|
|
404
|
#exit()
|
|
404
|
#exit()
|
|
405
|
cspc = self.data['cspc'][1]
|
|
405
|
cspc = self.data['cspc'][1]
|
|
406
|
|
|
406
|
|
|
407
|
#xflip=numpy.flip(x)
|
|
407
|
#xflip=numpy.flip(x)
|
|
408
|
#print(numpy.shape(cspc))
|
|
408
|
#print(numpy.shape(cspc))
|
|
409
|
#exit()
|
|
409
|
#exit()
|
|
410
|
|
|
410
|
|
|
411
|
for n in range(self.nrows):
|
|
411
|
for n in range(self.nrows):
|
|
412
|
noise = self.data['noise'][:,-1]
|
|
412
|
noise = self.data['noise'][:,-1]
|
|
413
|
pair = self.data.pairs[n]
|
|
413
|
pair = self.data.pairs[n]
|
|
414
|
#print(pair)
|
|
414
|
#print(pair)
|
|
415
|
#exit()
|
|
415
|
#exit()
|
|
416
|
ax = self.axes[4 * n]
|
|
416
|
ax = self.axes[4 * n]
|
|
417
|
if ax.firsttime:
|
|
417
|
if ax.firsttime:
|
|
418
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
418
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
419
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
419
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
420
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(nspc)
|
|
420
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(nspc)
|
|
421
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(nspc)
|
|
421
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(nspc)
|
|
422
|
ax.plt = ax.pcolormesh(x , y , nspc[pair[0]].T,
|
|
422
|
ax.plt = ax.pcolormesh(x , y , nspc[pair[0]].T,
|
|
423
|
vmin=self.zmin,
|
|
423
|
vmin=self.zmin,
|
|
424
|
vmax=self.zmax,
|
|
424
|
vmax=self.zmax,
|
|
425
|
cmap=plt.get_cmap(self.colormap)
|
|
425
|
cmap=plt.get_cmap(self.colormap)
|
|
426
|
)
|
|
426
|
)
|
|
427
|
else:
|
|
427
|
else:
|
|
428
|
#print(numpy.shape(nspc[pair[0]].T))
|
|
428
|
#print(numpy.shape(nspc[pair[0]].T))
|
|
429
|
#exit()
|
|
429
|
#exit()
|
|
430
|
ax.plt.set_array(nspc[pair[0]].T.ravel())
|
|
430
|
ax.plt.set_array(nspc[pair[0]].T.ravel())
|
|
431
|
self.titles.append('CH {}: {:3.2f}dB'.format(pair[0], noise[pair[0]]))
|
|
431
|
self.titles.append('CH {}: {:3.2f}dB'.format(pair[0], noise[pair[0]]))
|
|
432
|
|
|
432
|
|
|
433
|
ax = self.axes[4 * n + 1]
|
|
433
|
ax = self.axes[4 * n + 1]
|
|
434
|
|
|
434
|
|
|
435
|
if ax.firsttime:
|
|
435
|
if ax.firsttime:
|
|
436
|
ax.plt = ax.pcolormesh(x , y, numpy.flip(nspc[pair[1]],axis=0).T,
|
|
436
|
ax.plt = ax.pcolormesh(x , y, numpy.flip(nspc[pair[1]],axis=0).T,
|
|
437
|
vmin=self.zmin,
|
|
437
|
vmin=self.zmin,
|
|
438
|
vmax=self.zmax,
|
|
438
|
vmax=self.zmax,
|
|
439
|
cmap=plt.get_cmap(self.colormap)
|
|
439
|
cmap=plt.get_cmap(self.colormap)
|
|
440
|
)
|
|
440
|
)
|
|
441
|
else:
|
|
441
|
else:
|
|
442
|
|
|
442
|
|
|
443
|
ax.plt.set_array(numpy.flip(nspc[pair[1]],axis=0).T.ravel())
|
|
443
|
ax.plt.set_array(numpy.flip(nspc[pair[1]],axis=0).T.ravel())
|
|
444
|
self.titles.append('CH {}: {:3.2f}dB'.format(pair[1], noise[pair[1]]))
|
|
444
|
self.titles.append('CH {}: {:3.2f}dB'.format(pair[1], noise[pair[1]]))
|
|
445
|
|
|
445
|
|
|
446
|
out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
446
|
out = cspc[n] / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
447
|
coh = numpy.abs(out)
|
|
447
|
coh = numpy.abs(out)
|
|
448
|
phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
448
|
phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
449
|
|
|
449
|
|
|
450
|
ax = self.axes[4 * n + 2]
|
|
450
|
ax = self.axes[4 * n + 2]
|
|
451
|
if ax.firsttime:
|
|
451
|
if ax.firsttime:
|
|
452
|
ax.plt = ax.pcolormesh(x, y, numpy.flip(coh,axis=0).T,
|
|
452
|
ax.plt = ax.pcolormesh(x, y, numpy.flip(coh,axis=0).T,
|
|
453
|
vmin=0,
|
|
453
|
vmin=0,
|
|
454
|
vmax=1,
|
|
454
|
vmax=1,
|
|
455
|
cmap=plt.get_cmap(self.colormap_coh)
|
|
455
|
cmap=plt.get_cmap(self.colormap_coh)
|
|
456
|
)
|
|
456
|
)
|
|
457
|
else:
|
|
457
|
else:
|
|
458
|
ax.plt.set_array(numpy.flip(coh,axis=0).T.ravel())
|
|
458
|
ax.plt.set_array(numpy.flip(coh,axis=0).T.ravel())
|
|
459
|
self.titles.append(
|
|
459
|
self.titles.append(
|
|
460
|
'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
460
|
'Coherence Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
461
|
|
|
461
|
|
|
462
|
ax = self.axes[4 * n + 3]
|
|
462
|
ax = self.axes[4 * n + 3]
|
|
463
|
if ax.firsttime:
|
|
463
|
if ax.firsttime:
|
|
464
|
ax.plt = ax.pcolormesh(x, y, numpy.flip(phase,axis=0).T,
|
|
464
|
ax.plt = ax.pcolormesh(x, y, numpy.flip(phase,axis=0).T,
|
|
465
|
vmin=-180,
|
|
465
|
vmin=-180,
|
|
466
|
vmax=180,
|
|
466
|
vmax=180,
|
|
467
|
cmap=plt.get_cmap(self.colormap_phase)
|
|
467
|
cmap=plt.get_cmap(self.colormap_phase)
|
|
468
|
)
|
|
468
|
)
|
|
469
|
else:
|
|
469
|
else:
|
|
470
|
ax.plt.set_array(numpy.flip(phase,axis=0).T.ravel())
|
|
470
|
ax.plt.set_array(numpy.flip(phase,axis=0).T.ravel())
|
|
471
|
self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
|
|
471
|
self.titles.append('Phase CH{} * CH{}'.format(pair[0], pair[1]))
|
|
472
|
|
|
472
|
|
|
473
|
|
|
473
|
|
|
474
|
class CrossSpectra2Plot(Plot):
|
|
474
|
class CrossSpectra2Plot(Plot):
|
|
475
|
|
|
475
|
|
|
476
|
CODE = 'cspc'
|
|
476
|
CODE = 'cspc'
|
|
477
|
colormap = 'jet'
|
|
477
|
colormap = 'jet'
|
|
478
|
plot_type = 'pcolor'
|
|
478
|
plot_type = 'pcolor'
|
|
479
|
zmin_coh = None
|
|
479
|
zmin_coh = None
|
|
480
|
zmax_coh = None
|
|
480
|
zmax_coh = None
|
|
481
|
zmin_phase = None
|
|
481
|
zmin_phase = None
|
|
482
|
zmax_phase = None
|
|
482
|
zmax_phase = None
|
|
483
|
|
|
483
|
|
|
484
|
def setup(self):
|
|
484
|
def setup(self):
|
|
485
|
|
|
485
|
|
|
486
|
self.ncols = 1
|
|
486
|
self.ncols = 1
|
|
487
|
self.nrows = len(self.data.pairs)
|
|
487
|
self.nrows = len(self.data.pairs)
|
|
488
|
self.nplots = self.nrows * 1
|
|
488
|
self.nplots = self.nrows * 1
|
|
489
|
self.width = 3.1 * self.ncols
|
|
489
|
self.width = 3.1 * self.ncols
|
|
490
|
self.height = 5 * self.nrows
|
|
490
|
self.height = 5 * self.nrows
|
|
491
|
self.ylabel = 'Range [km]'
|
|
491
|
self.ylabel = 'Range [km]'
|
|
492
|
self.showprofile = False
|
|
492
|
self.showprofile = False
|
|
493
|
self.plots_adjust.update({'left': 0.22, 'right': .90, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
493
|
self.plots_adjust.update({'left': 0.22, 'right': .90, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
494
|
|
|
494
|
|
|
495
|
def plot(self):
|
|
495
|
def plot(self):
|
|
496
|
|
|
496
|
|
|
497
|
if self.xaxis == "frequency":
|
|
497
|
if self.xaxis == "frequency":
|
|
498
|
x = self.data.xrange[0]
|
|
498
|
x = self.data.xrange[0]
|
|
499
|
self.xlabel = "Frequency (kHz)"
|
|
499
|
self.xlabel = "Frequency (kHz)"
|
|
500
|
elif self.xaxis == "time":
|
|
500
|
elif self.xaxis == "time":
|
|
501
|
x = self.data.xrange[1]
|
|
501
|
x = self.data.xrange[1]
|
|
502
|
self.xlabel = "Time (ms)"
|
|
502
|
self.xlabel = "Time (ms)"
|
|
503
|
else:
|
|
503
|
else:
|
|
504
|
x = self.data.xrange[2]
|
|
504
|
x = self.data.xrange[2]
|
|
505
|
self.xlabel = "Velocity (m/s)"
|
|
505
|
self.xlabel = "Velocity (m/s)"
|
|
506
|
|
|
506
|
|
|
507
|
self.titles = []
|
|
507
|
self.titles = []
|
|
508
|
|
|
508
|
|
|
509
|
|
|
509
|
|
|
510
|
y = self.data.heights
|
|
510
|
y = self.data.heights
|
|
511
|
self.y = y
|
|
511
|
self.y = y
|
|
512
|
#nspc = self.data['spc']
|
|
512
|
#nspc = self.data['spc']
|
|
513
|
#print(numpy.shape(self.data['spc']))
|
|
513
|
#print(numpy.shape(self.data['spc']))
|
|
514
|
#spc = self.data['cspc'][0]
|
|
514
|
#spc = self.data['cspc'][0]
|
|
515
|
#print(numpy.shape(spc))
|
|
515
|
#print(numpy.shape(spc))
|
|
516
|
#exit()
|
|
516
|
#exit()
|
|
517
|
cspc = self.data['cspc'][1]
|
|
517
|
cspc = self.data['cspc'][1]
|
|
518
|
#print(numpy.shape(cspc))
|
|
518
|
#print(numpy.shape(cspc))
|
|
519
|
#exit()
|
|
519
|
#exit()
|
|
520
|
|
|
520
|
|
|
521
|
for n in range(self.nrows):
|
|
521
|
for n in range(self.nrows):
|
|
522
|
noise = self.data['noise'][:,-1]
|
|
522
|
noise = self.data['noise'][:,-1]
|
|
523
|
pair = self.data.pairs[n]
|
|
523
|
pair = self.data.pairs[n]
|
|
524
|
#print(pair) #exit()
|
|
524
|
#print(pair) #exit()
|
|
525
|
|
|
525
|
|
|
526
|
|
|
526
|
|
|
527
|
|
|
527
|
|
|
528
|
out = cspc[n]# / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
528
|
out = cspc[n]# / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
529
|
|
|
529
|
|
|
530
|
#print(out[:,53])
|
|
530
|
#print(out[:,53])
|
|
531
|
#exit()
|
|
531
|
#exit()
|
|
532
|
cross = numpy.abs(out)
|
|
532
|
cross = numpy.abs(out)
|
|
533
|
z = cross/self.data.nFactor
|
|
533
|
z = cross/self.data.nFactor
|
|
534
|
#print("here")
|
|
534
|
#print("here")
|
|
535
|
#print(dataOut.data_spc[0,0,0])
|
|
535
|
#print(dataOut.data_spc[0,0,0])
|
|
536
|
#exit()
|
|
536
|
#exit()
|
|
537
|
|
|
537
|
|
|
538
|
cross = 10*numpy.log10(z)
|
|
538
|
cross = 10*numpy.log10(z)
|
|
539
|
#print(numpy.shape(cross))
|
|
539
|
#print(numpy.shape(cross))
|
|
540
|
#print(cross[0,:])
|
|
540
|
#print(cross[0,:])
|
|
541
|
#print(self.data.nFactor)
|
|
541
|
#print(self.data.nFactor)
|
|
542
|
#exit()
|
|
542
|
#exit()
|
|
543
|
#phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
543
|
#phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
544
|
|
|
544
|
|
|
545
|
ax = self.axes[1 * n]
|
|
545
|
ax = self.axes[1 * n]
|
|
546
|
if ax.firsttime:
|
|
546
|
if ax.firsttime:
|
|
547
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
547
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
548
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
548
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
549
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
549
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
550
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
550
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
551
|
ax.plt = ax.pcolormesh(x, y, cross.T,
|
|
551
|
ax.plt = ax.pcolormesh(x, y, cross.T,
|
|
552
|
vmin=self.zmin,
|
|
552
|
vmin=self.zmin,
|
|
553
|
vmax=self.zmax,
|
|
553
|
vmax=self.zmax,
|
|
554
|
cmap=plt.get_cmap(self.colormap)
|
|
554
|
cmap=plt.get_cmap(self.colormap)
|
|
555
|
)
|
|
555
|
)
|
|
556
|
else:
|
|
556
|
else:
|
|
557
|
ax.plt.set_array(cross.T.ravel())
|
|
557
|
ax.plt.set_array(cross.T.ravel())
|
|
558
|
self.titles.append(
|
|
558
|
self.titles.append(
|
|
559
|
'Cross Spectra Power Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
559
|
'Cross Spectra Power Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
560
|
|
|
560
|
|
|
561
|
|
|
561
|
|
|
562
|
class CrossSpectra3Plot(Plot):
|
|
562
|
class CrossSpectra3Plot(Plot):
|
|
563
|
|
|
563
|
|
|
564
|
CODE = 'cspc'
|
|
564
|
CODE = 'cspc'
|
|
565
|
colormap = 'jet'
|
|
565
|
colormap = 'jet'
|
|
566
|
plot_type = 'pcolor'
|
|
566
|
plot_type = 'pcolor'
|
|
567
|
zmin_coh = None
|
|
567
|
zmin_coh = None
|
|
568
|
zmax_coh = None
|
|
568
|
zmax_coh = None
|
|
569
|
zmin_phase = None
|
|
569
|
zmin_phase = None
|
|
570
|
zmax_phase = None
|
|
570
|
zmax_phase = None
|
|
571
|
|
|
571
|
|
|
572
|
def setup(self):
|
|
572
|
def setup(self):
|
|
573
|
|
|
573
|
|
|
574
|
self.ncols = 3
|
|
574
|
self.ncols = 3
|
|
575
|
self.nrows = len(self.data.pairs)
|
|
575
|
self.nrows = len(self.data.pairs)
|
|
576
|
self.nplots = self.nrows * 3
|
|
576
|
self.nplots = self.nrows * 3
|
|
577
|
self.width = 3.1 * self.ncols
|
|
577
|
self.width = 3.1 * self.ncols
|
|
578
|
self.height = 5 * self.nrows
|
|
578
|
self.height = 5 * self.nrows
|
|
579
|
self.ylabel = 'Range [km]'
|
|
579
|
self.ylabel = 'Range [km]'
|
|
580
|
self.showprofile = False
|
|
580
|
self.showprofile = False
|
|
581
|
self.plots_adjust.update({'left': 0.22, 'right': .90, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
581
|
self.plots_adjust.update({'left': 0.22, 'right': .90, 'wspace': 0.5, 'hspace':0.4, 'top':0.95, 'bottom': 0.08})
|
|
582
|
|
|
582
|
|
|
583
|
def plot(self):
|
|
583
|
def plot(self):
|
|
584
|
|
|
584
|
|
|
585
|
if self.xaxis == "frequency":
|
|
585
|
if self.xaxis == "frequency":
|
|
586
|
x = self.data.xrange[0]
|
|
586
|
x = self.data.xrange[0]
|
|
587
|
self.xlabel = "Frequency (kHz)"
|
|
587
|
self.xlabel = "Frequency (kHz)"
|
|
588
|
elif self.xaxis == "time":
|
|
588
|
elif self.xaxis == "time":
|
|
589
|
x = self.data.xrange[1]
|
|
589
|
x = self.data.xrange[1]
|
|
590
|
self.xlabel = "Time (ms)"
|
|
590
|
self.xlabel = "Time (ms)"
|
|
591
|
else:
|
|
591
|
else:
|
|
592
|
x = self.data.xrange[2]
|
|
592
|
x = self.data.xrange[2]
|
|
593
|
self.xlabel = "Velocity (m/s)"
|
|
593
|
self.xlabel = "Velocity (m/s)"
|
|
594
|
|
|
594
|
|
|
595
|
self.titles = []
|
|
595
|
self.titles = []
|
|
596
|
|
|
596
|
|
|
597
|
|
|
597
|
|
|
598
|
y = self.data.heights
|
|
598
|
y = self.data.heights
|
|
599
|
self.y = y
|
|
599
|
self.y = y
|
|
600
|
#nspc = self.data['spc']
|
|
600
|
#nspc = self.data['spc']
|
|
601
|
#print(numpy.shape(self.data['spc']))
|
|
601
|
#print(numpy.shape(self.data['spc']))
|
|
602
|
#spc = self.data['cspc'][0]
|
|
602
|
#spc = self.data['cspc'][0]
|
|
603
|
#print(numpy.shape(spc))
|
|
603
|
#print(numpy.shape(spc))
|
|
604
|
#exit()
|
|
604
|
#exit()
|
|
605
|
cspc = self.data['cspc'][1]
|
|
605
|
cspc = self.data['cspc'][1]
|
|
606
|
#print(numpy.shape(cspc))
|
|
606
|
#print(numpy.shape(cspc))
|
|
607
|
#exit()
|
|
607
|
#exit()
|
|
608
|
|
|
608
|
|
|
609
|
for n in range(self.nrows):
|
|
609
|
for n in range(self.nrows):
|
|
610
|
noise = self.data['noise'][:,-1]
|
|
610
|
noise = self.data['noise'][:,-1]
|
|
611
|
pair = self.data.pairs[n]
|
|
611
|
pair = self.data.pairs[n]
|
|
612
|
#print(pair) #exit()
|
|
612
|
#print(pair) #exit()
|
|
613
|
|
|
613
|
|
|
614
|
|
|
614
|
|
|
615
|
|
|
615
|
|
|
616
|
out = cspc[n]# / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
616
|
out = cspc[n]# / numpy.sqrt(spc[pair[0]] * spc[pair[1]])
|
|
617
|
|
|
617
|
|
|
618
|
#print(out[:,53])
|
|
618
|
#print(out[:,53])
|
|
619
|
#exit()
|
|
619
|
#exit()
|
|
620
|
cross = numpy.abs(out)
|
|
620
|
cross = numpy.abs(out)
|
|
621
|
z = cross/self.data.nFactor
|
|
621
|
z = cross/self.data.nFactor
|
|
622
|
cross = 10*numpy.log10(z)
|
|
622
|
cross = 10*numpy.log10(z)
|
|
623
|
|
|
623
|
|
|
624
|
out_r= out.real/self.data.nFactor
|
|
624
|
out_r= out.real/self.data.nFactor
|
|
625
|
#out_r = 10*numpy.log10(out_r)
|
|
625
|
#out_r = 10*numpy.log10(out_r)
|
|
626
|
|
|
626
|
|
|
627
|
out_i= out.imag/self.data.nFactor
|
|
627
|
out_i= out.imag/self.data.nFactor
|
|
628
|
#out_i = 10*numpy.log10(out_i)
|
|
628
|
#out_i = 10*numpy.log10(out_i)
|
|
629
|
#print(numpy.shape(cross))
|
|
629
|
#print(numpy.shape(cross))
|
|
630
|
#print(cross[0,:])
|
|
630
|
#print(cross[0,:])
|
|
631
|
#print(self.data.nFactor)
|
|
631
|
#print(self.data.nFactor)
|
|
632
|
#exit()
|
|
632
|
#exit()
|
|
633
|
#phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
633
|
#phase = numpy.arctan2(out.imag, out.real) * 180 / numpy.pi
|
|
634
|
|
|
634
|
|
|
635
|
ax = self.axes[3 * n]
|
|
635
|
ax = self.axes[3 * n]
|
|
636
|
if ax.firsttime:
|
|
636
|
if ax.firsttime:
|
|
637
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
637
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
638
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
638
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
639
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
639
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
640
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
640
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
641
|
ax.plt = ax.pcolormesh(x, y, cross.T,
|
|
641
|
ax.plt = ax.pcolormesh(x, y, cross.T,
|
|
642
|
vmin=self.zmin,
|
|
642
|
vmin=self.zmin,
|
|
643
|
vmax=self.zmax,
|
|
643
|
vmax=self.zmax,
|
|
644
|
cmap=plt.get_cmap(self.colormap)
|
|
644
|
cmap=plt.get_cmap(self.colormap)
|
|
645
|
)
|
|
645
|
)
|
|
646
|
else:
|
|
646
|
else:
|
|
647
|
ax.plt.set_array(cross.T.ravel())
|
|
647
|
ax.plt.set_array(cross.T.ravel())
|
|
648
|
self.titles.append(
|
|
648
|
self.titles.append(
|
|
649
|
'Cross Spectra Power Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
649
|
'Cross Spectra Power Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
650
|
|
|
650
|
|
|
651
|
ax = self.axes[3 * n + 1]
|
|
651
|
ax = self.axes[3 * n + 1]
|
|
652
|
if ax.firsttime:
|
|
652
|
if ax.firsttime:
|
|
653
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
653
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
654
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
654
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
655
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
655
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
656
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
656
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
657
|
ax.plt = ax.pcolormesh(x, y, out_r.T,
|
|
657
|
ax.plt = ax.pcolormesh(x, y, out_r.T,
|
|
658
|
vmin=-1.e6,
|
|
658
|
vmin=-1.e6,
|
|
659
|
vmax=0,
|
|
659
|
vmax=0,
|
|
660
|
cmap=plt.get_cmap(self.colormap)
|
|
660
|
cmap=plt.get_cmap(self.colormap)
|
|
661
|
)
|
|
661
|
)
|
|
662
|
else:
|
|
662
|
else:
|
|
663
|
ax.plt.set_array(out_r.T.ravel())
|
|
663
|
ax.plt.set_array(out_r.T.ravel())
|
|
664
|
self.titles.append(
|
|
664
|
self.titles.append(
|
|
665
|
'Cross Spectra Real Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
665
|
'Cross Spectra Real Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
666
|
|
|
666
|
|
|
667
|
ax = self.axes[3 * n + 2]
|
|
667
|
ax = self.axes[3 * n + 2]
|
|
668
|
|
|
668
|
|
|
669
|
|
|
669
|
|
|
670
|
if ax.firsttime:
|
|
670
|
if ax.firsttime:
|
|
671
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
671
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
672
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
672
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
673
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
673
|
self.zmin = self.zmin if self.zmin else numpy.nanmin(cross)
|
|
674
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
674
|
self.zmax = self.zmax if self.zmax else numpy.nanmax(cross)
|
|
675
|
ax.plt = ax.pcolormesh(x, y, out_i.T,
|
|
675
|
ax.plt = ax.pcolormesh(x, y, out_i.T,
|
|
676
|
vmin=-1.e6,
|
|
676
|
vmin=-1.e6,
|
|
677
|
vmax=1.e6,
|
|
677
|
vmax=1.e6,
|
|
678
|
cmap=plt.get_cmap(self.colormap)
|
|
678
|
cmap=plt.get_cmap(self.colormap)
|
|
679
|
)
|
|
679
|
)
|
|
680
|
else:
|
|
680
|
else:
|
|
681
|
ax.plt.set_array(out_i.T.ravel())
|
|
681
|
ax.plt.set_array(out_i.T.ravel())
|
|
682
|
self.titles.append(
|
|
682
|
self.titles.append(
|
|
683
|
'Cross Spectra Imag Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
683
|
'Cross Spectra Imag Ch{} * Ch{}'.format(pair[0], pair[1]))
|
|
684
|
|
|
684
|
|
|
685
|
class RTIPlot(Plot):
|
|
685
|
class RTIPlot(Plot):
|
|
686
|
'''
|
|
686
|
'''
|
|
687
|
Plot for RTI data
|
|
687
|
Plot for RTI data
|
|
688
|
'''
|
|
688
|
'''
|
|
689
|
|
|
689
|
|
|
690
|
CODE = 'rti'
|
|
690
|
CODE = 'rti'
|
|
691
|
colormap = 'jet'
|
|
691
|
colormap = 'jet'
|
|
692
|
plot_type = 'pcolorbuffer'
|
|
692
|
plot_type = 'pcolorbuffer'
|
|
693
|
|
|
693
|
|
|
694
|
def setup(self):
|
|
694
|
def setup(self):
|
|
695
|
self.xaxis = 'time'
|
|
695
|
self.xaxis = 'time'
|
|
696
|
self.ncols = 1
|
|
696
|
self.ncols = 1
|
|
697
|
self.nrows = len(self.data.channels)
|
|
697
|
self.nrows = len(self.data.channels)
|
|
698
|
self.nplots = len(self.data.channels)
|
|
698
|
self.nplots = len(self.data.channels)
|
|
699
|
self.ylabel = 'Range [km]'
|
|
699
|
self.ylabel = 'Range [km]'
|
|
700
|
self.xlabel = 'Time'
|
|
700
|
self.xlabel = 'Time'
|
|
701
|
self.cb_label = 'dB'
|
|
701
|
self.cb_label = 'dB'
|
|
702
|
self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.1, 'right':0.95})
|
|
702
|
self.plots_adjust.update({'hspace':0.8, 'left': 0.1, 'bottom': 0.1, 'right':0.95})
|
|
703
|
self.titles = ['{} Channel {}'.format(
|
|
703
|
self.titles = ['{} Channel {}'.format(
|
|
704
|
self.CODE.upper(), x) for x in range(self.nrows)]
|
|
704
|
self.CODE.upper(), x) for x in range(self.nrows)]
|
|
705
|
|
|
705
|
|
|
706
|
def update(self, dataOut):
|
|
706
|
def update(self, dataOut):
|
|
707
|
|
|
707
|
|
|
708
|
data = {}
|
|
708
|
data = {}
|
|
709
|
meta = {}
|
|
709
|
meta = {}
|
|
710
|
data['rti'] = dataOut.getPower()
|
|
710
|
data['rti'] = dataOut.getPower()
|
|
711
|
#print(numpy.shape(data['rti']))
|
|
711
|
#print(numpy.shape(data['rti']))
|
|
712
|
|
|
712
|
|
|
713
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
713
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor)
|
|
714
|
|
|
714
|
|
|
715
|
return data, meta
|
|
715
|
return data, meta
|
|
716
|
|
|
716
|
|
|
717
|
def plot(self):
|
|
717
|
def plot(self):
|
|
718
|
|
|
718
|
|
|
719
|
self.x = self.data.times
|
|
719
|
self.x = self.data.times
|
|
720
|
self.y = self.data.yrange
|
|
720
|
self.y = self.data.yrange
|
|
721
|
self.z = self.data[self.CODE]
|
|
721
|
self.z = self.data[self.CODE]
|
|
722
|
#print("Inside RTI: ", self.z)
|
|
722
|
#print("Inside RTI: ", self.z)
|
|
723
|
self.z = numpy.ma.masked_invalid(self.z)
|
|
723
|
self.z = numpy.ma.masked_invalid(self.z)
|
|
724
|
|
|
724
|
|
|
725
|
if self.decimation is None:
|
|
725
|
if self.decimation is None:
|
|
726
|
x, y, z = self.fill_gaps(self.x, self.y, self.z)
|
|
726
|
x, y, z = self.fill_gaps(self.x, self.y, self.z)
|
|
727
|
else:
|
|
727
|
else:
|
|
728
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
728
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
729
|
#print("self.z: ", self.z)
|
|
729
|
#print("self.z: ", self.z)
|
|
730
|
#exit(1)
|
|
730
|
#exit(1)
|
|
731
|
'''
|
|
731
|
'''
|
|
732
|
if not isinstance(self.zmin, collections.abc.Sequence):
|
|
732
|
if not isinstance(self.zmin, collections.abc.Sequence):
|
|
733
|
if not self.zmin:
|
|
733
|
if not self.zmin:
|
|
734
|
self.zmin = [numpy.min(self.z)]*len(self.axes)
|
|
734
|
self.zmin = [numpy.min(self.z)]*len(self.axes)
|
|
735
|
else:
|
|
735
|
else:
|
|
736
|
self.zmin = [self.zmin]*len(self.axes)
|
|
736
|
self.zmin = [self.zmin]*len(self.axes)
|
|
737
|
|
|
737
|
|
|
738
|
if not isinstance(self.zmax, collections.abc.Sequence):
|
|
738
|
if not isinstance(self.zmax, collections.abc.Sequence):
|
|
739
|
if not self.zmax:
|
|
739
|
if not self.zmax:
|
|
740
|
self.zmax = [numpy.max(self.z)]*len(self.axes)
|
|
740
|
self.zmax = [numpy.max(self.z)]*len(self.axes)
|
|
741
|
else:
|
|
741
|
else:
|
|
742
|
self.zmax = [self.zmax]*len(self.axes)
|
|
742
|
self.zmax = [self.zmax]*len(self.axes)
|
|
743
|
'''
|
|
743
|
'''
|
|
744
|
for n, ax in enumerate(self.axes):
|
|
744
|
for n, ax in enumerate(self.axes):
|
|
745
|
|
|
745
|
|
|
746
|
self.zmin = self.zmin if self.zmin else numpy.min(self.z)
|
|
746
|
self.zmin = self.zmin if self.zmin else numpy.min(self.z)
|
|
747
|
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
|
|
747
|
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
|
|
748
|
|
|
748
|
|
|
749
|
if ax.firsttime:
|
|
749
|
if ax.firsttime:
|
|
750
|
if self.zlimits is not None:
|
|
750
|
if self.zlimits is not None:
|
|
751
|
self.zmin, self.zmax = self.zlimits[n]
|
|
751
|
self.zmin, self.zmax = self.zlimits[n]
|
|
752
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
752
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
753
|
vmin=self.zmin,
|
|
753
|
vmin=self.zmin,
|
|
754
|
vmax=self.zmax,
|
|
754
|
vmax=self.zmax,
|
|
755
|
cmap=plt.get_cmap(self.colormap)
|
|
755
|
cmap=plt.get_cmap(self.colormap)
|
|
756
|
)
|
|
756
|
)
|
|
757
|
if self.showprofile:
|
|
757
|
if self.showprofile:
|
|
758
|
ax.plot_profile = self.pf_axes[n].plot(
|
|
758
|
ax.plot_profile = self.pf_axes[n].plot(
|
|
759
|
self.data['rti'][n][-1], self.y)[0]
|
|
759
|
self.data['rti'][n][-1], self.y)[0]
|
|
760
|
ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y,
|
|
760
|
ax.plot_noise = self.pf_axes[n].plot(numpy.repeat(self.data['noise'][n][-1], len(self.y)), self.y,
|
|
761
|
color="k", linestyle="dashed", lw=1)[0]
|
|
761
|
color="k", linestyle="dashed", lw=1)[0]
|
|
762
|
else:
|
|
762
|
else:
|
|
763
|
if self.zlimits is not None:
|
|
763
|
if self.zlimits is not None:
|
|
764
|
self.zmin, self.zmax = self.zlimits[n]
|
|
764
|
self.zmin, self.zmax = self.zlimits[n]
|
|
765
|
ax.plt.remove()
|
|
765
|
ax.plt.remove()
|
|
766
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
766
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
767
|
vmin=self.zmin,
|
|
767
|
vmin=self.zmin,
|
|
768
|
vmax=self.zmax,
|
|
768
|
vmax=self.zmax,
|
|
769
|
cmap=plt.get_cmap(self.colormap)
|
|
769
|
cmap=plt.get_cmap(self.colormap)
|
|
770
|
)
|
|
770
|
)
|
|
771
|
if self.showprofile:
|
|
771
|
if self.showprofile:
|
|
772
|
ax.plot_profile.set_data(self.data['rti'][n][-1], self.y)
|
|
772
|
ax.plot_profile.set_data(self.data['rti'][n][-1], self.y)
|
|
773
|
ax.plot_noise.set_data(numpy.repeat(
|
|
773
|
ax.plot_noise.set_data(numpy.repeat(
|
|
774
|
self.data['noise'][n][-1], len(self.y)), self.y)
|
|
774
|
self.data['noise'][n][-1], len(self.y)), self.y)
|
|
775
|
|
|
775
|
|
|
776
|
|
|
776
|
|
|
777
|
class SpectrogramPlot(Plot):
|
|
777
|
class SpectrogramPlot(Plot):
|
|
778
|
'''
|
|
778
|
'''
|
|
779
|
Plot for Spectrogram data
|
|
779
|
Plot for Spectrogram data
|
|
780
|
'''
|
|
780
|
'''
|
|
781
|
|
|
781
|
|
|
782
|
CODE = 'Spectrogram_Profile'
|
|
782
|
CODE = 'Spectrogram_Profile'
|
|
783
|
colormap = 'binary'
|
|
783
|
colormap = 'binary'
|
|
784
|
plot_type = 'pcolorbuffer'
|
|
784
|
plot_type = 'pcolorbuffer'
|
|
785
|
|
|
785
|
|
|
786
|
def setup(self):
|
|
786
|
def setup(self):
|
|
787
|
self.xaxis = 'time'
|
|
787
|
self.xaxis = 'time'
|
|
788
|
self.ncols = 1
|
|
788
|
self.ncols = 1
|
|
789
|
self.nrows = len(self.data.channels)
|
|
789
|
self.nrows = len(self.data.channels)
|
|
790
|
self.nplots = len(self.data.channels)
|
|
790
|
self.nplots = len(self.data.channels)
|
|
791
|
self.xlabel = 'Time'
|
|
791
|
self.xlabel = 'Time'
|
|
792
|
#self.cb_label = 'dB'
|
|
792
|
#self.cb_label = 'dB'
|
|
793
|
self.plots_adjust.update({'hspace':1.2, 'left': 0.1, 'bottom': 0.12, 'right':0.95})
|
|
793
|
self.plots_adjust.update({'hspace':1.2, 'left': 0.1, 'bottom': 0.12, 'right':0.95})
|
|
794
|
self.titles = []
|
|
794
|
self.titles = []
|
|
795
|
|
|
795
|
|
|
796
|
#self.titles = ['{} Channel {} \n H = {} km ({} - {})'.format(
|
|
796
|
#self.titles = ['{} Channel {} \n H = {} km ({} - {})'.format(
|
|
797
|
#self.CODE.upper(), x, self.data.heightList[self.data.hei], self.data.heightList[self.data.hei],self.data.heightList[self.data.hei]+(self.data.DH*self.data.nProfiles)) for x in range(self.nrows)]
|
|
797
|
#self.CODE.upper(), x, self.data.heightList[self.data.hei], self.data.heightList[self.data.hei],self.data.heightList[self.data.hei]+(self.data.DH*self.data.nProfiles)) for x in range(self.nrows)]
|
|
798
|
|
|
798
|
|
|
799
|
self.titles = ['{} Channel {}'.format(
|
|
799
|
self.titles = ['{} Channel {}'.format(
|
|
800
|
self.CODE.upper(), x) for x in range(self.nrows)]
|
|
800
|
self.CODE.upper(), x) for x in range(self.nrows)]
|
|
801
|
|
|
801
|
|
|
802
|
|
|
802
|
|
|
803
|
def update(self, dataOut):
|
|
803
|
def update(self, dataOut):
|
|
804
|
data = {}
|
|
804
|
data = {}
|
|
805
|
meta = {}
|
|
805
|
meta = {}
|
|
806
|
|
|
806
|
|
|
807
|
maxHei = 1620#+12000
|
|
807
|
maxHei = 1620#+12000
|
|
808
|
maxHei = 1180
|
|
808
|
maxHei = 1180
|
|
|
|
|
809
|
maxHei = 500
|
|
809
|
indb = numpy.where(dataOut.heightList <= maxHei)
|
|
810
|
indb = numpy.where(dataOut.heightList <= maxHei)
|
|
810
|
hei = indb[0][-1]
|
|
811
|
hei = indb[0][-1]
|
|
811
|
#print(dataOut.heightList)
|
|
812
|
#print(dataOut.heightList)
|
|
812
|
|
|
813
|
|
|
813
|
factor = dataOut.nIncohInt
|
|
814
|
factor = dataOut.nIncohInt
|
|
814
|
z = dataOut.data_spc[:,:,hei] / factor
|
|
815
|
z = dataOut.data_spc[:,:,hei] / factor
|
|
815
|
z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
|
|
816
|
z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
|
|
816
|
#buffer = 10 * numpy.log10(z)
|
|
817
|
#buffer = 10 * numpy.log10(z)
|
|
817
|
|
|
818
|
|
|
818
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
819
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
819
|
|
|
820
|
|
|
820
|
|
|
821
|
|
|
821
|
#self.hei = hei
|
|
822
|
#self.hei = hei
|
|
822
|
#self.heightList = dataOut.heightList
|
|
823
|
#self.heightList = dataOut.heightList
|
|
823
|
#self.DH = (dataOut.heightList[1] - dataOut.heightList[0])/dataOut.step
|
|
824
|
#self.DH = (dataOut.heightList[1] - dataOut.heightList[0])/dataOut.step
|
|
824
|
#self.nProfiles = dataOut.nProfiles
|
|
825
|
#self.nProfiles = dataOut.nProfiles
|
|
825
|
|
|
826
|
|
|
826
|
data['Spectrogram_Profile'] = 10 * numpy.log10(z)
|
|
827
|
data['Spectrogram_Profile'] = 10 * numpy.log10(z)
|
|
827
|
|
|
828
|
|
|
828
|
data['hei'] = hei
|
|
829
|
data['hei'] = hei
|
|
829
|
data['DH'] = (dataOut.heightList[1] - dataOut.heightList[0])/dataOut.step
|
|
830
|
data['DH'] = (dataOut.heightList[1] - dataOut.heightList[0])/dataOut.step
|
|
830
|
data['nProfiles'] = dataOut.nProfiles
|
|
831
|
data['nProfiles'] = dataOut.nProfiles
|
|
831
|
#meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS]
|
|
832
|
#meta['yrange'] = dataOut.heightList[0:dataOut.NSHTS]
|
|
832
|
'''
|
|
833
|
'''
|
|
833
|
import matplotlib.pyplot as plt
|
|
834
|
import matplotlib.pyplot as plt
|
|
834
|
plt.plot(10 * numpy.log10(z[0,:]))
|
|
835
|
plt.plot(10 * numpy.log10(z[0,:]))
|
|
835
|
plt.show()
|
|
836
|
plt.show()
|
|
836
|
|
|
837
|
|
|
837
|
from time import sleep
|
|
838
|
from time import sleep
|
|
838
|
sleep(10)
|
|
839
|
sleep(10)
|
|
839
|
'''
|
|
840
|
'''
|
|
840
|
return data, meta
|
|
841
|
return data, meta
|
|
841
|
|
|
842
|
|
|
842
|
def plot(self):
|
|
843
|
def plot(self):
|
|
843
|
|
|
844
|
|
|
844
|
self.x = self.data.times
|
|
845
|
self.x = self.data.times
|
|
845
|
self.z = self.data[self.CODE]
|
|
846
|
self.z = self.data[self.CODE]
|
|
846
|
self.y = self.data.xrange[0]
|
|
847
|
self.y = self.data.xrange[0]
|
|
847
|
|
|
848
|
|
|
848
|
hei = self.data['hei'][-1]
|
|
849
|
hei = self.data['hei'][-1]
|
|
849
|
DH = self.data['DH'][-1]
|
|
850
|
DH = self.data['DH'][-1]
|
|
850
|
nProfiles = self.data['nProfiles'][-1]
|
|
851
|
nProfiles = self.data['nProfiles'][-1]
|
|
851
|
|
|
852
|
|
|
852
|
self.ylabel = "Frequency (kHz)"
|
|
853
|
self.ylabel = "Frequency (kHz)"
|
|
853
|
|
|
854
|
|
|
854
|
self.z = numpy.ma.masked_invalid(self.z)
|
|
855
|
self.z = numpy.ma.masked_invalid(self.z)
|
|
855
|
|
|
856
|
|
|
856
|
if self.decimation is None:
|
|
857
|
if self.decimation is None:
|
|
857
|
x, y, z = self.fill_gaps(self.x, self.y, self.z)
|
|
858
|
x, y, z = self.fill_gaps(self.x, self.y, self.z)
|
|
858
|
else:
|
|
859
|
else:
|
|
859
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
860
|
x, y, z = self.fill_gaps(*self.decimate())
|
|
860
|
|
|
861
|
|
|
861
|
for n, ax in enumerate(self.axes):
|
|
862
|
for n, ax in enumerate(self.axes):
|
|
862
|
self.zmin = self.zmin if self.zmin else numpy.min(self.z)
|
|
863
|
self.zmin = self.zmin if self.zmin else numpy.min(self.z)
|
|
863
|
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
|
|
864
|
self.zmax = self.zmax if self.zmax else numpy.max(self.z)
|
|
864
|
data = self.data[-1]
|
|
865
|
data = self.data[-1]
|
|
865
|
if ax.firsttime:
|
|
866
|
if ax.firsttime:
|
|
866
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
867
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
867
|
vmin=self.zmin,
|
|
868
|
vmin=self.zmin,
|
|
868
|
vmax=self.zmax,
|
|
869
|
vmax=self.zmax,
|
|
869
|
cmap=plt.get_cmap(self.colormap)
|
|
870
|
cmap=plt.get_cmap(self.colormap)
|
|
870
|
)
|
|
871
|
)
|
|
871
|
else:
|
|
872
|
else:
|
|
872
|
ax.plt.remove()
|
|
873
|
ax.plt.remove()
|
|
873
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
874
|
ax.plt = ax.pcolormesh(x, y, z[n].T,
|
|
874
|
vmin=self.zmin,
|
|
875
|
vmin=self.zmin,
|
|
875
|
vmax=self.zmax,
|
|
876
|
vmax=self.zmax,
|
|
876
|
cmap=plt.get_cmap(self.colormap)
|
|
877
|
cmap=plt.get_cmap(self.colormap)
|
|
877
|
)
|
|
878
|
)
|
|
878
|
|
|
879
|
|
|
879
|
#self.titles.append('Spectrogram')
|
|
880
|
#self.titles.append('Spectrogram')
|
|
880
|
|
|
881
|
|
|
881
|
#self.titles.append('{} Channel {} \n H = {} km ({} - {})'.format(
|
|
882
|
#self.titles.append('{} Channel {} \n H = {} km ({} - {})'.format(
|
|
882
|
#self.CODE.upper(), x, y[hei], y[hei],y[hei]+(DH*nProfiles)))
|
|
883
|
#self.CODE.upper(), x, y[hei], y[hei],y[hei]+(DH*nProfiles)))
|
|
883
|
|
|
884
|
|
|
884
|
|
|
885
|
|
|
885
|
|
|
886
|
|
|
886
|
|
|
887
|
|
|
887
|
class CoherencePlot(RTIPlot):
|
|
888
|
class CoherencePlot(RTIPlot):
|
|
888
|
'''
|
|
889
|
'''
|
|
889
|
Plot for Coherence data
|
|
890
|
Plot for Coherence data
|
|
890
|
'''
|
|
891
|
'''
|
|
891
|
|
|
892
|
|
|
892
|
CODE = 'coh'
|
|
893
|
CODE = 'coh'
|
|
893
|
|
|
894
|
|
|
894
|
def setup(self):
|
|
895
|
def setup(self):
|
|
895
|
self.xaxis = 'time'
|
|
896
|
self.xaxis = 'time'
|
|
896
|
self.ncols = 1
|
|
897
|
self.ncols = 1
|
|
897
|
self.nrows = len(self.data.pairs)
|
|
898
|
self.nrows = len(self.data.pairs)
|
|
898
|
self.nplots = len(self.data.pairs)
|
|
899
|
self.nplots = len(self.data.pairs)
|
|
899
|
self.ylabel = 'Range [km]'
|
|
900
|
self.ylabel = 'Range [km]'
|
|
900
|
self.xlabel = 'Time'
|
|
901
|
self.xlabel = 'Time'
|
|
901
|
self.plots_adjust.update({'hspace':0.6, 'left': 0.1, 'bottom': 0.1,'right':0.95})
|
|
902
|
self.plots_adjust.update({'hspace':0.6, 'left': 0.1, 'bottom': 0.1,'right':0.95})
|
|
902
|
if self.CODE == 'coh':
|
|
903
|
if self.CODE == 'coh':
|
|
903
|
self.cb_label = ''
|
|
904
|
self.cb_label = ''
|
|
904
|
self.titles = [
|
|
905
|
self.titles = [
|
|
905
|
'Coherence Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
|
|
906
|
'Coherence Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
|
|
906
|
else:
|
|
907
|
else:
|
|
907
|
self.cb_label = 'Degrees'
|
|
908
|
self.cb_label = 'Degrees'
|
|
908
|
self.titles = [
|
|
909
|
self.titles = [
|
|
909
|
'Phase Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
|
|
910
|
'Phase Map Ch{} * Ch{}'.format(x[0], x[1]) for x in self.data.pairs]
|
|
910
|
|
|
911
|
|
|
911
|
def update(self, dataOut):
|
|
912
|
def update(self, dataOut):
|
|
912
|
|
|
913
|
|
|
913
|
data = {}
|
|
914
|
data = {}
|
|
914
|
meta = {}
|
|
915
|
meta = {}
|
|
915
|
data['coh'] = dataOut.getCoherence()
|
|
916
|
data['coh'] = dataOut.getCoherence()
|
|
916
|
meta['pairs'] = dataOut.pairsList
|
|
917
|
meta['pairs'] = dataOut.pairsList
|
|
917
|
|
|
918
|
|
|
918
|
return data, meta
|
|
919
|
return data, meta
|
|
919
|
|
|
920
|
|
|
920
|
class PhasePlot(CoherencePlot):
|
|
921
|
class PhasePlot(CoherencePlot):
|
|
921
|
'''
|
|
922
|
'''
|
|
922
|
Plot for Phase map data
|
|
923
|
Plot for Phase map data
|
|
923
|
'''
|
|
924
|
'''
|
|
924
|
|
|
925
|
|
|
925
|
CODE = 'phase'
|
|
926
|
CODE = 'phase'
|
|
926
|
colormap = 'seismic'
|
|
927
|
colormap = 'seismic'
|
|
927
|
|
|
928
|
|
|
928
|
def update(self, dataOut):
|
|
929
|
def update(self, dataOut):
|
|
929
|
|
|
930
|
|
|
930
|
data = {}
|
|
931
|
data = {}
|
|
931
|
meta = {}
|
|
932
|
meta = {}
|
|
932
|
data['phase'] = dataOut.getCoherence(phase=True)
|
|
933
|
data['phase'] = dataOut.getCoherence(phase=True)
|
|
933
|
meta['pairs'] = dataOut.pairsList
|
|
934
|
meta['pairs'] = dataOut.pairsList
|
|
934
|
|
|
935
|
|
|
935
|
return data, meta
|
|
936
|
return data, meta
|
|
936
|
|
|
937
|
|
|
937
|
class NoisePlot(Plot):
|
|
938
|
class NoisePlot(Plot):
|
|
938
|
'''
|
|
939
|
'''
|
|
939
|
Plot for noise
|
|
940
|
Plot for noise
|
|
940
|
'''
|
|
941
|
'''
|
|
941
|
|
|
942
|
|
|
942
|
CODE = 'noise'
|
|
943
|
CODE = 'noise'
|
|
943
|
plot_type = 'scatterbuffer'
|
|
944
|
plot_type = 'scatterbuffer'
|
|
944
|
|
|
945
|
|
|
945
|
def setup(self):
|
|
946
|
def setup(self):
|
|
946
|
self.xaxis = 'time'
|
|
947
|
self.xaxis = 'time'
|
|
947
|
self.ncols = 1
|
|
948
|
self.ncols = 1
|
|
948
|
self.nrows = 1
|
|
949
|
self.nrows = 1
|
|
949
|
self.nplots = 1
|
|
950
|
self.nplots = 1
|
|
950
|
self.ylabel = 'Intensity [dB]'
|
|
951
|
self.ylabel = 'Intensity [dB]'
|
|
951
|
self.xlabel = 'Time'
|
|
952
|
self.xlabel = 'Time'
|
|
952
|
self.titles = ['Noise']
|
|
953
|
self.titles = ['Noise']
|
|
953
|
self.colorbar = False
|
|
954
|
self.colorbar = False
|
|
954
|
self.plots_adjust.update({'right': 0.85 })
|
|
955
|
self.plots_adjust.update({'right': 0.85 })
|
|
955
|
|
|
956
|
|
|
956
|
def update(self, dataOut):
|
|
957
|
def update(self, dataOut):
|
|
957
|
|
|
958
|
|
|
958
|
data = {}
|
|
959
|
data = {}
|
|
959
|
meta = {}
|
|
960
|
meta = {}
|
|
960
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor).reshape(dataOut.nChannels, 1)
|
|
961
|
data['noise'] = 10*numpy.log10(dataOut.getNoise()/dataOut.normFactor).reshape(dataOut.nChannels, 1)
|
|
961
|
meta['yrange'] = numpy.array([])
|
|
962
|
meta['yrange'] = numpy.array([])
|
|
962
|
|
|
963
|
|
|
963
|
return data, meta
|
|
964
|
return data, meta
|
|
964
|
|
|
965
|
|
|
965
|
def plot(self):
|
|
966
|
def plot(self):
|
|
966
|
|
|
967
|
|
|
967
|
x = self.data.times
|
|
968
|
x = self.data.times
|
|
968
|
xmin = self.data.min_time
|
|
969
|
xmin = self.data.min_time
|
|
969
|
xmax = xmin + self.xrange * 60 * 60
|
|
970
|
xmax = xmin + self.xrange * 60 * 60
|
|
970
|
Y = self.data['noise']
|
|
971
|
Y = self.data['noise']
|
|
971
|
|
|
972
|
|
|
972
|
if self.axes[0].firsttime:
|
|
973
|
if self.axes[0].firsttime:
|
|
973
|
self.ymin = numpy.nanmin(Y) - 5
|
|
974
|
self.ymin = numpy.nanmin(Y) - 5
|
|
974
|
self.ymax = numpy.nanmax(Y) + 5
|
|
975
|
self.ymax = numpy.nanmax(Y) + 5
|
|
975
|
for ch in self.data.channels:
|
|
976
|
for ch in self.data.channels:
|
|
976
|
y = Y[ch]
|
|
977
|
y = Y[ch]
|
|
977
|
self.axes[0].plot(x, y, lw=1, label='Ch{}'.format(ch))
|
|
978
|
self.axes[0].plot(x, y, lw=1, label='Ch{}'.format(ch))
|
|
978
|
plt.legend(bbox_to_anchor=(1.18, 1.0))
|
|
979
|
plt.legend(bbox_to_anchor=(1.18, 1.0))
|
|
979
|
else:
|
|
980
|
else:
|
|
980
|
for ch in self.data.channels:
|
|
981
|
for ch in self.data.channels:
|
|
981
|
y = Y[ch]
|
|
982
|
y = Y[ch]
|
|
982
|
self.axes[0].lines[ch].set_data(x, y)
|
|
983
|
self.axes[0].lines[ch].set_data(x, y)
|
|
983
|
|
|
984
|
|
|
984
|
self.ymin = numpy.nanmin(Y) - 5
|
|
985
|
self.ymin = numpy.nanmin(Y) - 5
|
|
985
|
self.ymax = numpy.nanmax(Y) + 10
|
|
986
|
self.ymax = numpy.nanmax(Y) + 10
|
|
986
|
|
|
987
|
|
|
987
|
|
|
988
|
|
|
988
|
class PowerProfilePlot(Plot):
|
|
989
|
class PowerProfilePlot(Plot):
|
|
989
|
|
|
990
|
|
|
990
|
CODE = 'pow_profile'
|
|
991
|
CODE = 'pow_profile'
|
|
991
|
plot_type = 'scatter'
|
|
992
|
plot_type = 'scatter'
|
|
992
|
|
|
993
|
|
|
993
|
def setup(self):
|
|
994
|
def setup(self):
|
|
994
|
|
|
995
|
|
|
995
|
self.ncols = 1
|
|
996
|
self.ncols = 1
|
|
996
|
self.nrows = 1
|
|
997
|
self.nrows = 1
|
|
997
|
self.nplots = 1
|
|
998
|
self.nplots = 1
|
|
998
|
self.height = 4
|
|
999
|
self.height = 4
|
|
999
|
self.width = 3
|
|
1000
|
self.width = 3
|
|
1000
|
self.ylabel = 'Range [km]'
|
|
1001
|
self.ylabel = 'Range [km]'
|
|
1001
|
self.xlabel = 'Intensity [dB]'
|
|
1002
|
self.xlabel = 'Intensity [dB]'
|
|
1002
|
self.titles = ['Power Profile']
|
|
1003
|
self.titles = ['Power Profile']
|
|
1003
|
self.colorbar = False
|
|
1004
|
self.colorbar = False
|
|
1004
|
|
|
1005
|
|
|
1005
|
def update(self, dataOut):
|
|
1006
|
def update(self, dataOut):
|
|
1006
|
|
|
1007
|
|
|
1007
|
data = {}
|
|
1008
|
data = {}
|
|
1008
|
meta = {}
|
|
1009
|
meta = {}
|
|
1009
|
data[self.CODE] = dataOut.getPower()
|
|
1010
|
data[self.CODE] = dataOut.getPower()
|
|
1010
|
|
|
1011
|
|
|
1011
|
return data, meta
|
|
1012
|
return data, meta
|
|
1012
|
|
|
1013
|
|
|
1013
|
def plot(self):
|
|
1014
|
def plot(self):
|
|
1014
|
|
|
1015
|
|
|
1015
|
y = self.data.yrange
|
|
1016
|
y = self.data.yrange
|
|
1016
|
self.y = y
|
|
1017
|
self.y = y
|
|
1017
|
|
|
1018
|
|
|
1018
|
x = self.data[-1][self.CODE]
|
|
1019
|
x = self.data[-1][self.CODE]
|
|
1019
|
|
|
1020
|
|
|
1020
|
if self.xmin is None: self.xmin = numpy.nanmin(x)*0.9
|
|
1021
|
if self.xmin is None: self.xmin = numpy.nanmin(x)*0.9
|
|
1021
|
if self.xmax is None: self.xmax = numpy.nanmax(x)*1.1
|
|
1022
|
if self.xmax is None: self.xmax = numpy.nanmax(x)*1.1
|
|
1022
|
|
|
1023
|
|
|
1023
|
if self.axes[0].firsttime:
|
|
1024
|
if self.axes[0].firsttime:
|
|
1024
|
for ch in self.data.channels:
|
|
1025
|
for ch in self.data.channels:
|
|
1025
|
self.axes[0].plot(x[ch], y, lw=1, label='Ch{}'.format(ch))
|
|
1026
|
self.axes[0].plot(x[ch], y, lw=1, label='Ch{}'.format(ch))
|
|
1026
|
plt.legend()
|
|
1027
|
plt.legend()
|
|
1027
|
else:
|
|
1028
|
else:
|
|
1028
|
for ch in self.data.channels:
|
|
1029
|
for ch in self.data.channels:
|
|
1029
|
self.axes[0].lines[ch].set_data(x[ch], y)
|
|
1030
|
self.axes[0].lines[ch].set_data(x[ch], y)
|
|
1030
|
|
|
1031
|
|
|
1031
|
|
|
1032
|
|
|
1032
|
class SpectraCutPlot(Plot):
|
|
1033
|
class SpectraCutPlot(Plot):
|
|
1033
|
|
|
1034
|
|
|
1034
|
CODE = 'spc_cut'
|
|
1035
|
CODE = 'spc_cut'
|
|
1035
|
plot_type = 'scatter'
|
|
1036
|
plot_type = 'scatter'
|
|
1036
|
buffering = False
|
|
1037
|
buffering = False
|
|
1037
|
|
|
1038
|
|
|
1038
|
def setup(self):
|
|
1039
|
def setup(self):
|
|
1039
|
|
|
1040
|
|
|
1040
|
self.nplots = len(self.data.channels)
|
|
1041
|
self.nplots = len(self.data.channels)
|
|
1041
|
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
|
|
1042
|
self.ncols = int(numpy.sqrt(self.nplots) + 0.9)
|
|
1042
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
1043
|
self.nrows = int((1.0 * self.nplots / self.ncols) + 0.9)
|
|
1043
|
self.width = 3.4 * self.ncols + 1.5
|
|
1044
|
self.width = 3.4 * self.ncols + 1.5
|
|
1044
|
self.height = 3 * self.nrows
|
|
1045
|
self.height = 3 * self.nrows
|
|
1045
|
self.ylabel = 'Power [dB]'
|
|
1046
|
self.ylabel = 'Power [dB]'
|
|
1046
|
self.colorbar = False
|
|
1047
|
self.colorbar = False
|
|
1047
|
self.plots_adjust.update({'left':0.1, 'hspace':0.3, 'right': 0.75, 'bottom':0.08})
|
|
1048
|
self.plots_adjust.update({'left':0.1, 'hspace':0.3, 'right': 0.75, 'bottom':0.08})
|
|
1048
|
|
|
1049
|
|
|
1049
|
def update(self, dataOut):
|
|
1050
|
def update(self, dataOut):
|
|
1050
|
|
|
1051
|
|
|
1051
|
data = {}
|
|
1052
|
data = {}
|
|
1052
|
meta = {}
|
|
1053
|
meta = {}
|
|
1053
|
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
|
|
1054
|
spc = 10*numpy.log10(dataOut.data_spc/dataOut.normFactor)
|
|
1054
|
data['spc'] = spc
|
|
1055
|
data['spc'] = spc
|
|
1055
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
1056
|
meta['xrange'] = (dataOut.getFreqRange(1)/1000., dataOut.getAcfRange(1), dataOut.getVelRange(1))
|
|
1056
|
if self.CODE == 'cut_gaussian_fit':
|
|
1057
|
if self.CODE == 'cut_gaussian_fit':
|
|
1057
|
data['gauss_fit0'] = 10*numpy.log10(dataOut.GaussFit0/dataOut.normFactor)
|
|
1058
|
data['gauss_fit0'] = 10*numpy.log10(dataOut.GaussFit0/dataOut.normFactor)
|
|
1058
|
data['gauss_fit1'] = 10*numpy.log10(dataOut.GaussFit1/dataOut.normFactor)
|
|
1059
|
data['gauss_fit1'] = 10*numpy.log10(dataOut.GaussFit1/dataOut.normFactor)
|
|
1059
|
return data, meta
|
|
1060
|
return data, meta
|
|
1060
|
|
|
1061
|
|
|
1061
|
def plot(self):
|
|
1062
|
def plot(self):
|
|
1062
|
if self.xaxis == "frequency":
|
|
1063
|
if self.xaxis == "frequency":
|
|
1063
|
x = self.data.xrange[0][1:]
|
|
1064
|
x = self.data.xrange[0][1:]
|
|
1064
|
self.xlabel = "Frequency (kHz)"
|
|
1065
|
self.xlabel = "Frequency (kHz)"
|
|
1065
|
elif self.xaxis == "time":
|
|
1066
|
elif self.xaxis == "time":
|
|
1066
|
x = self.data.xrange[1]
|
|
1067
|
x = self.data.xrange[1]
|
|
1067
|
self.xlabel = "Time (ms)"
|
|
1068
|
self.xlabel = "Time (ms)"
|
|
1068
|
else:
|
|
1069
|
else:
|
|
1069
|
x = self.data.xrange[2][:-1]
|
|
1070
|
x = self.data.xrange[2][:-1]
|
|
1070
|
self.xlabel = "Velocity (m/s)"
|
|
1071
|
self.xlabel = "Velocity (m/s)"
|
|
1071
|
|
|
1072
|
|
|
1072
|
if self.CODE == 'cut_gaussian_fit':
|
|
1073
|
if self.CODE == 'cut_gaussian_fit':
|
|
1073
|
x = self.data.xrange[2][:-1]
|
|
1074
|
x = self.data.xrange[2][:-1]
|
|
1074
|
self.xlabel = "Velocity (m/s)"
|
|
1075
|
self.xlabel = "Velocity (m/s)"
|
|
1075
|
|
|
1076
|
|
|
1076
|
self.titles = []
|
|
1077
|
self.titles = []
|
|
1077
|
|
|
1078
|
|
|
1078
|
y = self.data.yrange
|
|
1079
|
y = self.data.yrange
|
|
1079
|
data = self.data[-1]
|
|
1080
|
data = self.data[-1]
|
|
1080
|
z = data['spc']
|
|
1081
|
z = data['spc']
|
|
1081
|
|
|
1082
|
|
|
1082
|
if self.height_index:
|
|
1083
|
if self.height_index:
|
|
1083
|
index = numpy.array(self.height_index)
|
|
1084
|
index = numpy.array(self.height_index)
|
|
1084
|
else:
|
|
1085
|
else:
|
|
1085
|
index = numpy.arange(0, len(y), int((len(y))/9))
|
|
1086
|
index = numpy.arange(0, len(y), int((len(y))/9))
|
|
1086
|
|
|
1087
|
|
|
1087
|
for n, ax in enumerate(self.axes):
|
|
1088
|
for n, ax in enumerate(self.axes):
|
|
1088
|
if self.CODE == 'cut_gaussian_fit':
|
|
1089
|
if self.CODE == 'cut_gaussian_fit':
|
|
1089
|
gau0 = data['gauss_fit0']
|
|
1090
|
gau0 = data['gauss_fit0']
|
|
1090
|
gau1 = data['gauss_fit1']
|
|
1091
|
gau1 = data['gauss_fit1']
|
|
1091
|
if ax.firsttime:
|
|
1092
|
if ax.firsttime:
|
|
1092
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
1093
|
self.xmax = self.xmax if self.xmax else numpy.nanmax(x)
|
|
1093
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
1094
|
self.xmin = self.xmin if self.xmin else -self.xmax
|
|
1094
|
self.ymin = self.ymin if self.ymin else numpy.nanmin(z[:,:,index])
|
|
1095
|
self.ymin = self.ymin if self.ymin else numpy.nanmin(z[:,:,index])
|
|
1095
|
self.ymax = self.ymax if self.ymax else numpy.nanmax(z[:,:,index])
|
|
1096
|
self.ymax = self.ymax if self.ymax else numpy.nanmax(z[:,:,index])
|
|
1096
|
#print(self.ymax)
|
|
1097
|
#print(self.ymax)
|
|
1097
|
#print(z[n, :, index])
|
|
1098
|
#print(z[n, :, index])
|
|
1098
|
ax.plt = ax.plot(x, z[n, :, index].T, lw=0.25)
|
|
1099
|
ax.plt = ax.plot(x, z[n, :, index].T, lw=0.25)
|
|
1099
|
if self.CODE == 'cut_gaussian_fit':
|
|
1100
|
if self.CODE == 'cut_gaussian_fit':
|
|
1100
|
ax.plt_gau0 = ax.plot(x, gau0[n, :, index].T, lw=1, linestyle='-.')
|
|
1101
|
ax.plt_gau0 = ax.plot(x, gau0[n, :, index].T, lw=1, linestyle='-.')
|
|
1101
|
for i, line in enumerate(ax.plt_gau0):
|
|
1102
|
for i, line in enumerate(ax.plt_gau0):
|
|
1102
|
line.set_color(ax.plt[i].get_color())
|
|
1103
|
line.set_color(ax.plt[i].get_color())
|
|
1103
|
ax.plt_gau1 = ax.plot(x, gau1[n, :, index].T, lw=1, linestyle='--')
|
|
1104
|
ax.plt_gau1 = ax.plot(x, gau1[n, :, index].T, lw=1, linestyle='--')
|
|
1104
|
for i, line in enumerate(ax.plt_gau1):
|
|
1105
|
for i, line in enumerate(ax.plt_gau1):
|
|
1105
|
line.set_color(ax.plt[i].get_color())
|
|
1106
|
line.set_color(ax.plt[i].get_color())
|
|
1106
|
labels = ['Range = {:2.1f}km'.format(y[i]) for i in index]
|
|
1107
|
labels = ['Range = {:2.1f}km'.format(y[i]) for i in index]
|
|
1107
|
self.figures[0].legend(ax.plt, labels, loc='center right')
|
|
1108
|
self.figures[0].legend(ax.plt, labels, loc='center right')
|
|
1108
|
else:
|
|
1109
|
else:
|
|
1109
|
for i, line in enumerate(ax.plt):
|
|
1110
|
for i, line in enumerate(ax.plt):
|
|
1110
|
line.set_data(x, z[n, :, index[i]].T)
|
|
1111
|
line.set_data(x, z[n, :, index[i]].T)
|
|
1111
|
for i, line in enumerate(ax.plt_gau0):
|
|
1112
|
for i, line in enumerate(ax.plt_gau0):
|
|
1112
|
line.set_data(x, gau0[n, :, index[i]].T)
|
|
1113
|
line.set_data(x, gau0[n, :, index[i]].T)
|
|
1113
|
line.set_color(ax.plt[i].get_color())
|
|
1114
|
line.set_color(ax.plt[i].get_color())
|
|
1114
|
for i, line in enumerate(ax.plt_gau1):
|
|
1115
|
for i, line in enumerate(ax.plt_gau1):
|
|
1115
|
line.set_data(x, gau1[n, :, index[i]].T)
|
|
1116
|
line.set_data(x, gau1[n, :, index[i]].T)
|
|
1116
|
line.set_color(ax.plt[i].get_color())
|
|
1117
|
line.set_color(ax.plt[i].get_color())
|
|
1117
|
self.titles.append('CH {}'.format(n))
|
|
1118
|
self.titles.append('CH {}'.format(n))
|
|
1118
|
|
|
1119
|
|
|
1119
|
|
|
1120
|
|
|
1120
|
class BeaconPhase(Plot):
|
|
1121
|
class BeaconPhase(Plot):
|
|
1121
|
|
|
1122
|
|
|
1122
|
__isConfig = None
|
|
1123
|
__isConfig = None
|
|
1123
|
__nsubplots = None
|
|
1124
|
__nsubplots = None
|
|
1124
|
|
|
1125
|
|
|
1125
|
PREFIX = 'beacon_phase'
|
|
1126
|
PREFIX = 'beacon_phase'
|
|
1126
|
|
|
1127
|
|
|
1127
|
def __init__(self):
|
|
1128
|
def __init__(self):
|
|
1128
|
Plot.__init__(self)
|
|
1129
|
Plot.__init__(self)
|
|
1129
|
self.timerange = 24*60*60
|
|
1130
|
self.timerange = 24*60*60
|
|
1130
|
self.isConfig = False
|
|
1131
|
self.isConfig = False
|
|
1131
|
self.__nsubplots = 1
|
|
1132
|
self.__nsubplots = 1
|
|
1132
|
self.counter_imagwr = 0
|
|
1133
|
self.counter_imagwr = 0
|
|
1133
|
self.WIDTH = 800
|
|
1134
|
self.WIDTH = 800
|
|
1134
|
self.HEIGHT = 400
|
|
1135
|
self.HEIGHT = 400
|
|
1135
|
self.WIDTHPROF = 120
|
|
1136
|
self.WIDTHPROF = 120
|
|
1136
|
self.HEIGHTPROF = 0
|
|
1137
|
self.HEIGHTPROF = 0
|
|
1137
|
self.xdata = None
|
|
1138
|
self.xdata = None
|
|
1138
|
self.ydata = None
|
|
1139
|
self.ydata = None
|
|
1139
|
|
|
1140
|
|
|
1140
|
self.PLOT_CODE = BEACON_CODE
|
|
1141
|
self.PLOT_CODE = BEACON_CODE
|
|
1141
|
|
|
1142
|
|
|
1142
|
self.FTP_WEI = None
|
|
1143
|
self.FTP_WEI = None
|
|
1143
|
self.EXP_CODE = None
|
|
1144
|
self.EXP_CODE = None
|
|
1144
|
self.SUB_EXP_CODE = None
|
|
1145
|
self.SUB_EXP_CODE = None
|
|
1145
|
self.PLOT_POS = None
|
|
1146
|
self.PLOT_POS = None
|
|
1146
|
|
|
1147
|
|
|
1147
|
self.filename_phase = None
|
|
1148
|
self.filename_phase = None
|
|
1148
|
|
|
1149
|
|
|
1149
|
self.figfile = None
|
|
1150
|
self.figfile = None
|
|
1150
|
|
|
1151
|
|
|
1151
|
self.xmin = None
|
|
1152
|
self.xmin = None
|
|
1152
|
self.xmax = None
|
|
1153
|
self.xmax = None
|
|
1153
|
|
|
1154
|
|
|
1154
|
def getSubplots(self):
|
|
1155
|
def getSubplots(self):
|
|
1155
|
|
|
1156
|
|
|
1156
|
ncol = 1
|
|
1157
|
ncol = 1
|
|
1157
|
nrow = 1
|
|
1158
|
nrow = 1
|
|
1158
|
|
|
1159
|
|
|
1159
|
return nrow, ncol
|
|
1160
|
return nrow, ncol
|
|
1160
|
|
|
1161
|
|
|
1161
|
def setup(self, id, nplots, wintitle, showprofile=True, show=True):
|
|
1162
|
def setup(self, id, nplots, wintitle, showprofile=True, show=True):
|
|
1162
|
|
|
1163
|
|
|
1163
|
self.__showprofile = showprofile
|
|
1164
|
self.__showprofile = showprofile
|
|
1164
|
self.nplots = nplots
|
|
1165
|
self.nplots = nplots
|
|
1165
|
|
|
1166
|
|
|
1166
|
ncolspan = 7
|
|
1167
|
ncolspan = 7
|
|
1167
|
colspan = 6
|
|
1168
|
colspan = 6
|
|
1168
|
self.__nsubplots = 2
|
|
1169
|
self.__nsubplots = 2
|
|
1169
|
|
|
1170
|
|
|
1170
|
self.createFigure(id = id,
|
|
1171
|
self.createFigure(id = id,
|
|
1171
|
wintitle = wintitle,
|
|
1172
|
wintitle = wintitle,
|
|
1172
|
widthplot = self.WIDTH+self.WIDTHPROF,
|
|
1173
|
widthplot = self.WIDTH+self.WIDTHPROF,
|
|
1173
|
heightplot = self.HEIGHT+self.HEIGHTPROF,
|
|
1174
|
heightplot = self.HEIGHT+self.HEIGHTPROF,
|
|
1174
|
show=show)
|
|
1175
|
show=show)
|
|
1175
|
|
|
1176
|
|
|
1176
|
nrow, ncol = self.getSubplots()
|
|
1177
|
nrow, ncol = self.getSubplots()
|
|
1177
|
|
|
1178
|
|
|
1178
|
self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
|
|
1179
|
self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1)
|
|
1179
|
|
|
1180
|
|
|
1180
|
def save_phase(self, filename_phase):
|
|
1181
|
def save_phase(self, filename_phase):
|
|
1181
|
f = open(filename_phase,'w+')
|
|
1182
|
f = open(filename_phase,'w+')
|
|
1182
|
f.write('\n\n')
|
|
1183
|
f.write('\n\n')
|
|
1183
|
f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n')
|
|
1184
|
f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n')
|
|
1184
|
f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' )
|
|
1185
|
f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' )
|
|
1185
|
f.close()
|
|
1186
|
f.close()
|
|
1186
|
|
|
1187
|
|
|
1187
|
def save_data(self, filename_phase, data, data_datetime):
|
|
1188
|
def save_data(self, filename_phase, data, data_datetime):
|
|
1188
|
f=open(filename_phase,'a')
|
|
1189
|
f=open(filename_phase,'a')
|
|
1189
|
timetuple_data = data_datetime.timetuple()
|
|
1190
|
timetuple_data = data_datetime.timetuple()
|
|
1190
|
day = str(timetuple_data.tm_mday)
|
|
1191
|
day = str(timetuple_data.tm_mday)
|
|
1191
|
month = str(timetuple_data.tm_mon)
|
|
1192
|
month = str(timetuple_data.tm_mon)
|
|
1192
|
year = str(timetuple_data.tm_year)
|
|
1193
|
year = str(timetuple_data.tm_year)
|
|
1193
|
hour = str(timetuple_data.tm_hour)
|
|
1194
|
hour = str(timetuple_data.tm_hour)
|
|
1194
|
minute = str(timetuple_data.tm_min)
|
|
1195
|
minute = str(timetuple_data.tm_min)
|
|
1195
|
second = str(timetuple_data.tm_sec)
|
|
1196
|
second = str(timetuple_data.tm_sec)
|
|
1196
|
f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n')
|
|
1197
|
f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n')
|
|
1197
|
f.close()
|
|
1198
|
f.close()
|
|
1198
|
|
|
1199
|
|
|
1199
|
def plot(self):
|
|
1200
|
def plot(self):
|
|
1200
|
log.warning('TODO: Not yet implemented...')
|
|
1201
|
log.warning('TODO: Not yet implemented...')
|
|
1201
|
|
|
1202
|
|
|
1202
|
def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
|
|
1203
|
def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
|
|
1203
|
xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None,
|
|
1204
|
xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None,
|
|
1204
|
timerange=None,
|
|
1205
|
timerange=None,
|
|
1205
|
save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
|
|
1206
|
save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
|
|
1206
|
server=None, folder=None, username=None, password=None,
|
|
1207
|
server=None, folder=None, username=None, password=None,
|
|
1207
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
1208
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
1208
|
|
|
1209
|
|
|
1209
|
if dataOut.flagNoData:
|
|
1210
|
if dataOut.flagNoData:
|
|
1210
|
return dataOut
|
|
1211
|
return dataOut
|
|
1211
|
|
|
1212
|
|
|
1212
|
if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
|
|
1213
|
if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
|
|
1213
|
return
|
|
1214
|
return
|
|
1214
|
|
|
1215
|
|
|
1215
|
if pairsList == None:
|
|
1216
|
if pairsList == None:
|
|
1216
|
pairsIndexList = dataOut.pairsIndexList[:10]
|
|
1217
|
pairsIndexList = dataOut.pairsIndexList[:10]
|
|
1217
|
else:
|
|
1218
|
else:
|
|
1218
|
pairsIndexList = []
|
|
1219
|
pairsIndexList = []
|
|
1219
|
for pair in pairsList:
|
|
1220
|
for pair in pairsList:
|
|
1220
|
if pair not in dataOut.pairsList:
|
|
1221
|
if pair not in dataOut.pairsList:
|
|
1221
|
raise ValueError("Pair %s is not in dataOut.pairsList" %(pair))
|
|
1222
|
raise ValueError("Pair %s is not in dataOut.pairsList" %(pair))
|
|
1222
|
pairsIndexList.append(dataOut.pairsList.index(pair))
|
|
1223
|
pairsIndexList.append(dataOut.pairsList.index(pair))
|
|
1223
|
|
|
1224
|
|
|
1224
|
if pairsIndexList == []:
|
|
1225
|
if pairsIndexList == []:
|
|
1225
|
return
|
|
1226
|
return
|
|
1226
|
|
|
1227
|
|
|
1227
|
# if len(pairsIndexList) > 4:
|
|
1228
|
# if len(pairsIndexList) > 4:
|
|
1228
|
# pairsIndexList = pairsIndexList[0:4]
|
|
1229
|
# pairsIndexList = pairsIndexList[0:4]
|
|
1229
|
|
|
1230
|
|
|
1230
|
hmin_index = None
|
|
1231
|
hmin_index = None
|
|
1231
|
hmax_index = None
|
|
1232
|
hmax_index = None
|
|
1232
|
|
|
1233
|
|
|
1233
|
if hmin != None and hmax != None:
|
|
1234
|
if hmin != None and hmax != None:
|
|
1234
|
indexes = numpy.arange(dataOut.nHeights)
|
|
1235
|
indexes = numpy.arange(dataOut.nHeights)
|
|
1235
|
hmin_list = indexes[dataOut.heightList >= hmin]
|
|
1236
|
hmin_list = indexes[dataOut.heightList >= hmin]
|
|
1236
|
hmax_list = indexes[dataOut.heightList <= hmax]
|
|
1237
|
hmax_list = indexes[dataOut.heightList <= hmax]
|
|
1237
|
|
|
1238
|
|
|
1238
|
if hmin_list.any():
|
|
1239
|
if hmin_list.any():
|
|
1239
|
hmin_index = hmin_list[0]
|
|
1240
|
hmin_index = hmin_list[0]
|
|
1240
|
|
|
1241
|
|
|
1241
|
if hmax_list.any():
|
|
1242
|
if hmax_list.any():
|
|
1242
|
hmax_index = hmax_list[-1]+1
|
|
1243
|
hmax_index = hmax_list[-1]+1
|
|
1243
|
|
|
1244
|
|
|
1244
|
x = dataOut.getTimeRange()
|
|
1245
|
x = dataOut.getTimeRange()
|
|
1245
|
|
|
1246
|
|
|
1246
|
thisDatetime = dataOut.datatime
|
|
1247
|
thisDatetime = dataOut.datatime
|
|
1247
|
|
|
1248
|
|
|
1248
|
title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
1249
|
title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
1249
|
xlabel = "Local Time"
|
|
1250
|
xlabel = "Local Time"
|
|
1250
|
ylabel = "Phase (degrees)"
|
|
1251
|
ylabel = "Phase (degrees)"
|
|
1251
|
|
|
1252
|
|
|
1252
|
update_figfile = False
|
|
1253
|
update_figfile = False
|
|
1253
|
|
|
1254
|
|
|
1254
|
nplots = len(pairsIndexList)
|
|
1255
|
nplots = len(pairsIndexList)
|
|
1255
|
#phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
|
|
1256
|
#phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
|
|
1256
|
phase_beacon = numpy.zeros(len(pairsIndexList))
|
|
1257
|
phase_beacon = numpy.zeros(len(pairsIndexList))
|
|
1257
|
for i in range(nplots):
|
|
1258
|
for i in range(nplots):
|
|
1258
|
pair = dataOut.pairsList[pairsIndexList[i]]
|
|
1259
|
pair = dataOut.pairsList[pairsIndexList[i]]
|
|
1259
|
ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0)
|
|
1260
|
ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0)
|
|
1260
|
powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0)
|
|
1261
|
powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0)
|
|
1261
|
powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0)
|
|
1262
|
powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0)
|
|
1262
|
avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
|
|
1263
|
avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
|
|
1263
|
phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
|
|
1264
|
phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
|
|
1264
|
|
|
1265
|
|
|
1265
|
if dataOut.beacon_heiIndexList:
|
|
1266
|
if dataOut.beacon_heiIndexList:
|
|
1266
|
phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
|
|
1267
|
phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
|
|
1267
|
else:
|
|
1268
|
else:
|
|
1268
|
phase_beacon[i] = numpy.average(phase)
|
|
1269
|
phase_beacon[i] = numpy.average(phase)
|
|
1269
|
|
|
1270
|
|
|
1270
|
if not self.isConfig:
|
|
1271
|
if not self.isConfig:
|
|
1271
|
|
|
1272
|
|
|
1272
|
nplots = len(pairsIndexList)
|
|
1273
|
nplots = len(pairsIndexList)
|
|
1273
|
|
|
1274
|
|
|
1274
|
self.setup(id=id,
|
|
1275
|
self.setup(id=id,
|
|
1275
|
nplots=nplots,
|
|
1276
|
nplots=nplots,
|
|
1276
|
wintitle=wintitle,
|
|
1277
|
wintitle=wintitle,
|
|
1277
|
showprofile=showprofile,
|
|
1278
|
showprofile=showprofile,
|
|
1278
|
show=show)
|
|
1279
|
show=show)
|
|
1279
|
|
|
1280
|
|
|
1280
|
if timerange != None:
|
|
1281
|
if timerange != None:
|
|
1281
|
self.timerange = timerange
|
|
1282
|
self.timerange = timerange
|
|
1282
|
|
|
1283
|
|
|
1283
|
self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
|
|
1284
|
self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
|
|
1284
|
|
|
1285
|
|
|
1285
|
if ymin == None: ymin = 0
|
|
1286
|
if ymin == None: ymin = 0
|
|
1286
|
if ymax == None: ymax = 360
|
|
1287
|
if ymax == None: ymax = 360
|
|
1287
|
|
|
1288
|
|
|
1288
|
self.FTP_WEI = ftp_wei
|
|
1289
|
self.FTP_WEI = ftp_wei
|
|
1289
|
self.EXP_CODE = exp_code
|
|
1290
|
self.EXP_CODE = exp_code
|
|
1290
|
self.SUB_EXP_CODE = sub_exp_code
|
|
1291
|
self.SUB_EXP_CODE = sub_exp_code
|
|
1291
|
self.PLOT_POS = plot_pos
|
|
1292
|
self.PLOT_POS = plot_pos
|
|
1292
|
|
|
1293
|
|
|
1293
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
1294
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
1294
|
self.isConfig = True
|
|
1295
|
self.isConfig = True
|
|
1295
|
self.figfile = figfile
|
|
1296
|
self.figfile = figfile
|
|
1296
|
self.xdata = numpy.array([])
|
|
1297
|
self.xdata = numpy.array([])
|
|
1297
|
self.ydata = numpy.array([])
|
|
1298
|
self.ydata = numpy.array([])
|
|
1298
|
|
|
1299
|
|
|
1299
|
update_figfile = True
|
|
1300
|
update_figfile = True
|
|
1300
|
|
|
1301
|
|
|
1301
|
#open file beacon phase
|
|
1302
|
#open file beacon phase
|
|
1302
|
path = '%s%03d' %(self.PREFIX, self.id)
|
|
1303
|
path = '%s%03d' %(self.PREFIX, self.id)
|
|
1303
|
beacon_file = os.path.join(path,'%s.txt'%self.name)
|
|
1304
|
beacon_file = os.path.join(path,'%s.txt'%self.name)
|
|
1304
|
self.filename_phase = os.path.join(figpath,beacon_file)
|
|
1305
|
self.filename_phase = os.path.join(figpath,beacon_file)
|
|
1305
|
#self.save_phase(self.filename_phase)
|
|
1306
|
#self.save_phase(self.filename_phase)
|
|
1306
|
|
|
1307
|
|
|
1307
|
|
|
1308
|
|
|
1308
|
#store data beacon phase
|
|
1309
|
#store data beacon phase
|
|
1309
|
#self.save_data(self.filename_phase, phase_beacon, thisDatetime)
|
|
1310
|
#self.save_data(self.filename_phase, phase_beacon, thisDatetime)
|
|
1310
|
|
|
1311
|
|
|
1311
|
self.setWinTitle(title)
|
|
1312
|
self.setWinTitle(title)
|
|
1312
|
|
|
1313
|
|
|
1313
|
|
|
1314
|
|
|
1314
|
title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
1315
|
title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
1315
|
|
|
1316
|
|
|
1316
|
legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList]
|
|
1317
|
legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList]
|
|
1317
|
|
|
1318
|
|
|
1318
|
axes = self.axesList[0]
|
|
1319
|
axes = self.axesList[0]
|
|
1319
|
|
|
1320
|
|
|
1320
|
self.xdata = numpy.hstack((self.xdata, x[0:1]))
|
|
1321
|
self.xdata = numpy.hstack((self.xdata, x[0:1]))
|
|
1321
|
|
|
1322
|
|
|
1322
|
if len(self.ydata)==0:
|
|
1323
|
if len(self.ydata)==0:
|
|
1323
|
self.ydata = phase_beacon.reshape(-1,1)
|
|
1324
|
self.ydata = phase_beacon.reshape(-1,1)
|
|
1324
|
else:
|
|
1325
|
else:
|
|
1325
|
self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1)))
|
|
1326
|
self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1)))
|
|
1326
|
|
|
1327
|
|
|
1327
|
|
|
1328
|
|
|
1328
|
axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
|
|
1329
|
axes.pmultilineyaxis(x=self.xdata, y=self.ydata,
|
|
1329
|
xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax,
|
|
1330
|
xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax,
|
|
1330
|
xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
|
|
1331
|
xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid",
|
|
1331
|
XAxisAsTime=True, grid='both'
|
|
1332
|
XAxisAsTime=True, grid='both'
|
|
1332
|
)
|
|
1333
|
)
|
|
1333
|
|
|
1334
|
|
|
1334
|
self.draw()
|
|
1335
|
self.draw()
|
|
1335
|
|
|
1336
|
|
|
1336
|
if dataOut.ltctime >= self.xmax:
|
|
1337
|
if dataOut.ltctime >= self.xmax:
|
|
1337
|
self.counter_imagwr = wr_period
|
|
1338
|
self.counter_imagwr = wr_period
|
|
1338
|
self.isConfig = False
|
|
1339
|
self.isConfig = False
|
|
1339
|
update_figfile = True
|
|
1340
|
update_figfile = True
|
|
1340
|
|
|
1341
|
|
|
1341
|
self.save(figpath=figpath,
|
|
1342
|
self.save(figpath=figpath,
|
|
1342
|
figfile=figfile,
|
|
1343
|
figfile=figfile,
|
|
1343
|
save=save,
|
|
1344
|
save=save,
|
|
1344
|
ftp=ftp,
|
|
1345
|
ftp=ftp,
|
|
1345
|
wr_period=wr_period,
|
|
1346
|
wr_period=wr_period,
|
|
1346
|
thisDatetime=thisDatetime,
|
|
1347
|
thisDatetime=thisDatetime,
|
|
1347
|
update_figfile=update_figfile)
|
|
1348
|
update_figfile=update_figfile)
|
|
1348
|
|
|
1349
|
|
|
1349
|
return dataOut
|
|
1350
|
return dataOut
|