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