@@ -1,1373 +1,1373 | |||
|
1 | 1 | import os |
|
2 | 2 | import datetime |
|
3 | 3 | import numpy |
|
4 | 4 | |
|
5 | 5 | from figure import Figure, isRealtime |
|
6 | 6 | from plotting_codes import * |
|
7 | 7 | |
|
8 | 8 | class MomentsPlot(Figure): |
|
9 | 9 | |
|
10 | 10 | isConfig = None |
|
11 | 11 | __nsubplots = None |
|
12 | 12 | |
|
13 | 13 | WIDTHPROF = None |
|
14 | 14 | HEIGHTPROF = None |
|
15 | 15 | PREFIX = 'prm' |
|
16 | 16 | |
|
17 | 17 | def __init__(self): |
|
18 | 18 | |
|
19 | 19 | self.isConfig = False |
|
20 | 20 | self.__nsubplots = 1 |
|
21 | 21 | |
|
22 | 22 | self.WIDTH = 280 |
|
23 | 23 | self.HEIGHT = 250 |
|
24 | 24 | self.WIDTHPROF = 120 |
|
25 | 25 | self.HEIGHTPROF = 0 |
|
26 | 26 | self.counter_imagwr = 0 |
|
27 | 27 | |
|
28 | 28 | self.PLOT_CODE = MOMENTS_CODE |
|
29 | 29 | |
|
30 | 30 | self.FTP_WEI = None |
|
31 | 31 | self.EXP_CODE = None |
|
32 | 32 | self.SUB_EXP_CODE = None |
|
33 | 33 | self.PLOT_POS = None |
|
34 | 34 | |
|
35 | 35 | def getSubplots(self): |
|
36 | 36 | |
|
37 | 37 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
38 | 38 | nrow = int(self.nplots*1./ncol + 0.9) |
|
39 | 39 | |
|
40 | 40 | return nrow, ncol |
|
41 | 41 | |
|
42 | 42 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
43 | 43 | |
|
44 | 44 | self.__showprofile = showprofile |
|
45 | 45 | self.nplots = nplots |
|
46 | 46 | |
|
47 | 47 | ncolspan = 1 |
|
48 | 48 | colspan = 1 |
|
49 | 49 | if showprofile: |
|
50 | 50 | ncolspan = 3 |
|
51 | 51 | colspan = 2 |
|
52 | 52 | self.__nsubplots = 2 |
|
53 | 53 | |
|
54 | 54 | self.createFigure(id = id, |
|
55 | 55 | wintitle = wintitle, |
|
56 | 56 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
57 | 57 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
58 | 58 | show=show) |
|
59 | 59 | |
|
60 | 60 | nrow, ncol = self.getSubplots() |
|
61 | 61 | |
|
62 | 62 | counter = 0 |
|
63 | 63 | for y in range(nrow): |
|
64 | 64 | for x in range(ncol): |
|
65 | 65 | |
|
66 | 66 | if counter >= self.nplots: |
|
67 | 67 | break |
|
68 | 68 | |
|
69 | 69 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
70 | 70 | |
|
71 | 71 | if showprofile: |
|
72 | 72 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
73 | 73 | |
|
74 | 74 | counter += 1 |
|
75 | 75 | |
|
76 | 76 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, |
|
77 | 77 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
78 | 78 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
79 | 79 | server=None, folder=None, username=None, password=None, |
|
80 | 80 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False): |
|
81 | 81 | |
|
82 | 82 | """ |
|
83 | 83 | |
|
84 | 84 | Input: |
|
85 | 85 | dataOut : |
|
86 | 86 | id : |
|
87 | 87 | wintitle : |
|
88 | 88 | channelList : |
|
89 | 89 | showProfile : |
|
90 | 90 | xmin : None, |
|
91 | 91 | xmax : None, |
|
92 | 92 | ymin : None, |
|
93 | 93 | ymax : None, |
|
94 | 94 | zmin : None, |
|
95 | 95 | zmax : None |
|
96 | 96 | """ |
|
97 | 97 | |
|
98 | 98 | if dataOut.flagNoData: |
|
99 | 99 | return None |
|
100 | 100 | |
|
101 | 101 | if realtime: |
|
102 | 102 | if not(isRealtime(utcdatatime = dataOut.utctime)): |
|
103 | 103 | print 'Skipping this plot function' |
|
104 | 104 | return |
|
105 | 105 | |
|
106 | 106 | if channelList == None: |
|
107 | 107 | channelIndexList = dataOut.channelIndexList |
|
108 | 108 | else: |
|
109 | 109 | channelIndexList = [] |
|
110 | 110 | for channel in channelList: |
|
111 | 111 | if channel not in dataOut.channelList: |
|
112 | 112 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
113 | 113 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
114 | 114 | |
|
115 | 115 | factor = dataOut.normFactor |
|
116 | 116 | x = dataOut.abscissaList |
|
117 | 117 | y = dataOut.heightList |
|
118 | 118 | |
|
119 | 119 | z = dataOut.data_pre[channelIndexList,:,:]/factor |
|
120 | 120 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
121 | 121 | avg = numpy.average(z, axis=1) |
|
122 | 122 | noise = dataOut.noise/factor |
|
123 | 123 | |
|
124 | 124 | zdB = 10*numpy.log10(z) |
|
125 | 125 | avgdB = 10*numpy.log10(avg) |
|
126 | 126 | noisedB = 10*numpy.log10(noise) |
|
127 | 127 | |
|
128 | 128 | #thisDatetime = dataOut.datatime |
|
129 | 129 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
130 | 130 | title = wintitle + " Parameters" |
|
131 | 131 | xlabel = "Velocity (m/s)" |
|
132 | 132 | ylabel = "Range (Km)" |
|
133 | 133 | |
|
134 | 134 | update_figfile = False |
|
135 | 135 | |
|
136 | 136 | if not self.isConfig: |
|
137 | 137 | |
|
138 | 138 | nplots = len(channelIndexList) |
|
139 | 139 | |
|
140 | 140 | self.setup(id=id, |
|
141 | 141 | nplots=nplots, |
|
142 | 142 | wintitle=wintitle, |
|
143 | 143 | showprofile=showprofile, |
|
144 | 144 | show=show) |
|
145 | 145 | |
|
146 | 146 | if xmin == None: xmin = numpy.nanmin(x) |
|
147 | 147 | if xmax == None: xmax = numpy.nanmax(x) |
|
148 | 148 | if ymin == None: ymin = numpy.nanmin(y) |
|
149 | 149 | if ymax == None: ymax = numpy.nanmax(y) |
|
150 | 150 | if zmin == None: zmin = numpy.nanmin(avgdB)*0.9 |
|
151 | 151 | if zmax == None: zmax = numpy.nanmax(avgdB)*0.9 |
|
152 | 152 | |
|
153 | 153 | self.FTP_WEI = ftp_wei |
|
154 | 154 | self.EXP_CODE = exp_code |
|
155 | 155 | self.SUB_EXP_CODE = sub_exp_code |
|
156 | 156 | self.PLOT_POS = plot_pos |
|
157 | 157 | |
|
158 | 158 | self.isConfig = True |
|
159 | 159 | update_figfile = True |
|
160 | 160 | |
|
161 | 161 | self.setWinTitle(title) |
|
162 | 162 | |
|
163 | 163 | for i in range(self.nplots): |
|
164 | 164 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
165 | 165 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[i], noisedB[i], str_datetime) |
|
166 | 166 | axes = self.axesList[i*self.__nsubplots] |
|
167 | 167 | axes.pcolor(x, y, zdB[i,:,:], |
|
168 | 168 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
169 | 169 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
170 | 170 | ticksize=9, cblabel='') |
|
171 | 171 | #Mean Line |
|
172 | 172 | mean = dataOut.data_param[i, 1, :] |
|
173 | 173 | axes.addpline(mean, y, idline=0, color="black", linestyle="solid", lw=1) |
|
174 | 174 | |
|
175 | 175 | if self.__showprofile: |
|
176 | 176 | axes = self.axesList[i*self.__nsubplots +1] |
|
177 | 177 | axes.pline(avgdB[i], y, |
|
178 | 178 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
179 | 179 | xlabel='dB', ylabel='', title='', |
|
180 | 180 | ytick_visible=False, |
|
181 | 181 | grid='x') |
|
182 | 182 | |
|
183 | 183 | noiseline = numpy.repeat(noisedB[i], len(y)) |
|
184 | 184 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) |
|
185 | 185 | |
|
186 | 186 | self.draw() |
|
187 | 187 | |
|
188 | 188 | self.save(figpath=figpath, |
|
189 | 189 | figfile=figfile, |
|
190 | 190 | save=save, |
|
191 | 191 | ftp=ftp, |
|
192 | 192 | wr_period=wr_period, |
|
193 | 193 | thisDatetime=thisDatetime) |
|
194 | 194 | |
|
195 | 195 | |
|
196 | 196 | |
|
197 | 197 | class SkyMapPlot(Figure): |
|
198 | 198 | |
|
199 | 199 | __isConfig = None |
|
200 | 200 | __nsubplots = None |
|
201 | 201 | |
|
202 | 202 | WIDTHPROF = None |
|
203 | 203 | HEIGHTPROF = None |
|
204 | 204 | PREFIX = 'mmap' |
|
205 | 205 | |
|
206 | 206 | def __init__(self): |
|
207 | 207 | |
|
208 | 208 | self.isConfig = False |
|
209 | 209 | self.__nsubplots = 1 |
|
210 | 210 | |
|
211 | 211 | # self.WIDTH = 280 |
|
212 | 212 | # self.HEIGHT = 250 |
|
213 | 213 | self.WIDTH = 600 |
|
214 | 214 | self.HEIGHT = 600 |
|
215 | 215 | self.WIDTHPROF = 120 |
|
216 | 216 | self.HEIGHTPROF = 0 |
|
217 | 217 | self.counter_imagwr = 0 |
|
218 | 218 | |
|
219 | 219 | self.PLOT_CODE = MSKYMAP_CODE |
|
220 | 220 | |
|
221 | 221 | self.FTP_WEI = None |
|
222 | 222 | self.EXP_CODE = None |
|
223 | 223 | self.SUB_EXP_CODE = None |
|
224 | 224 | self.PLOT_POS = None |
|
225 | 225 | |
|
226 | 226 | def getSubplots(self): |
|
227 | 227 | |
|
228 | 228 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
229 | 229 | nrow = int(self.nplots*1./ncol + 0.9) |
|
230 | 230 | |
|
231 | 231 | return nrow, ncol |
|
232 | 232 | |
|
233 | 233 | def setup(self, id, nplots, wintitle, showprofile=False, show=True): |
|
234 | 234 | |
|
235 | 235 | self.__showprofile = showprofile |
|
236 | 236 | self.nplots = nplots |
|
237 | 237 | |
|
238 | 238 | ncolspan = 1 |
|
239 | 239 | colspan = 1 |
|
240 | 240 | |
|
241 | 241 | self.createFigure(id = id, |
|
242 | 242 | wintitle = wintitle, |
|
243 | 243 | widthplot = self.WIDTH, #+ self.WIDTHPROF, |
|
244 | 244 | heightplot = self.HEIGHT,# + self.HEIGHTPROF, |
|
245 | 245 | show=show) |
|
246 | 246 | |
|
247 | 247 | nrow, ncol = 1,1 |
|
248 | 248 | counter = 0 |
|
249 | 249 | x = 0 |
|
250 | 250 | y = 0 |
|
251 | 251 | self.addAxes(1, 1, 0, 0, 1, 1, True) |
|
252 | 252 | |
|
253 | 253 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=False, |
|
254 | 254 | tmin=None, tmax=None, timerange=None, |
|
255 | 255 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
256 | 256 | server=None, folder=None, username=None, password=None, |
|
257 | 257 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False): |
|
258 | 258 | |
|
259 | 259 | """ |
|
260 | 260 | |
|
261 | 261 | Input: |
|
262 | 262 | dataOut : |
|
263 | 263 | id : |
|
264 | 264 | wintitle : |
|
265 | 265 | channelList : |
|
266 | 266 | showProfile : |
|
267 | 267 | xmin : None, |
|
268 | 268 | xmax : None, |
|
269 | 269 | ymin : None, |
|
270 | 270 | ymax : None, |
|
271 | 271 | zmin : None, |
|
272 | 272 | zmax : None |
|
273 | 273 | """ |
|
274 | 274 | |
|
275 | 275 | arrayParameters = dataOut.data_param[0,:] |
|
276 | 276 | error = arrayParameters[:,-1] |
|
277 | 277 | indValid = numpy.where(error == 0)[0] |
|
278 | 278 | finalMeteor = arrayParameters[indValid,:] |
|
279 | 279 | finalAzimuth = finalMeteor[:,4] |
|
280 | 280 | finalZenith = finalMeteor[:,5] |
|
281 | 281 | |
|
282 | 282 | x = finalAzimuth*numpy.pi/180 |
|
283 | 283 | y = finalZenith |
|
284 | 284 | x1 = dataOut.getTimeRange() |
|
285 | 285 | |
|
286 | 286 | #thisDatetime = dataOut.datatime |
|
287 | 287 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
288 | 288 | title = wintitle + " Parameters" |
|
289 | 289 | xlabel = "Zonal Zenith Angle (deg) " |
|
290 | 290 | ylabel = "Meridional Zenith Angle (deg)" |
|
291 | 291 | update_figfile = False |
|
292 | 292 | |
|
293 | 293 | if not self.isConfig: |
|
294 | 294 | |
|
295 | 295 | nplots = 1 |
|
296 | 296 | |
|
297 | 297 | self.setup(id=id, |
|
298 | 298 | nplots=nplots, |
|
299 | 299 | wintitle=wintitle, |
|
300 | 300 | showprofile=showprofile, |
|
301 | 301 | show=show) |
|
302 | 302 | |
|
303 | 303 | if self.xmin is None and self.xmax is None: |
|
304 | 304 | self.xmin, self.xmax = self.getTimeLim(x1, tmin, tmax, timerange) |
|
305 | 305 | |
|
306 | 306 | if timerange != None: |
|
307 | 307 | self.timerange = timerange |
|
308 | 308 | else: |
|
309 | 309 | self.timerange = self.xmax - self.xmin |
|
310 | 310 | |
|
311 | 311 | self.FTP_WEI = ftp_wei |
|
312 | 312 | self.EXP_CODE = exp_code |
|
313 | 313 | self.SUB_EXP_CODE = sub_exp_code |
|
314 | 314 | self.PLOT_POS = plot_pos |
|
315 | 315 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
316 | 316 | self.firstdate = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
317 | 317 | self.isConfig = True |
|
318 | 318 | update_figfile = True |
|
319 | 319 | |
|
320 | 320 | self.setWinTitle(title) |
|
321 | 321 | |
|
322 | 322 | i = 0 |
|
323 | 323 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
324 | 324 | |
|
325 | 325 | axes = self.axesList[i*self.__nsubplots] |
|
326 | 326 | nevents = axes.x_buffer.shape[0] + x.shape[0] |
|
327 | 327 | title = "Meteor Detection Sky Map\n %s - %s \n Number of events: %5.0f\n" %(self.firstdate,str_datetime,nevents) |
|
328 | 328 | axes.polar(x, y, |
|
329 | 329 | title=title, xlabel=xlabel, ylabel=ylabel, |
|
330 | 330 | ticksize=9, cblabel='') |
|
331 | 331 | |
|
332 | 332 | self.draw() |
|
333 | 333 | |
|
334 | 334 | self.save(figpath=figpath, |
|
335 | 335 | figfile=figfile, |
|
336 | 336 | save=save, |
|
337 | 337 | ftp=ftp, |
|
338 | 338 | wr_period=wr_period, |
|
339 | 339 | thisDatetime=thisDatetime, |
|
340 | 340 | update_figfile=update_figfile) |
|
341 | 341 | |
|
342 | 342 | if dataOut.ltctime >= self.xmax: |
|
343 | self.isConfigmagwr = wr_period | |
|
343 | self.isConfigmagwr = wr_period | |
|
344 | 344 | self.isConfig = False |
|
345 | 345 | update_figfile = True |
|
346 | 346 | axes.__firsttime = True |
|
347 | 347 | self.xmin += self.timerange |
|
348 | 348 | self.xmax += self.timerange |
|
349 | 349 | |
|
350 | 350 | |
|
351 | 351 | |
|
352 | 352 | |
|
353 | 353 | class WindProfilerPlot(Figure): |
|
354 | 354 | |
|
355 | 355 | __isConfig = None |
|
356 | 356 | __nsubplots = None |
|
357 | 357 | |
|
358 | 358 | WIDTHPROF = None |
|
359 | 359 | HEIGHTPROF = None |
|
360 | 360 | PREFIX = 'wind' |
|
361 | 361 | |
|
362 | 362 | def __init__(self): |
|
363 | 363 | |
|
364 | 364 | self.timerange = None |
|
365 | 365 | self.isConfig = False |
|
366 | 366 | self.__nsubplots = 1 |
|
367 | 367 | |
|
368 | 368 | self.WIDTH = 800 |
|
369 | 369 | self.HEIGHT = 150 |
|
370 | 370 | self.WIDTHPROF = 120 |
|
371 | 371 | self.HEIGHTPROF = 0 |
|
372 | 372 | self.counter_imagwr = 0 |
|
373 | 373 | |
|
374 | 374 | self.PLOT_CODE = WIND_CODE |
|
375 | 375 | |
|
376 | 376 | self.FTP_WEI = None |
|
377 | 377 | self.EXP_CODE = None |
|
378 | 378 | self.SUB_EXP_CODE = None |
|
379 | 379 | self.PLOT_POS = None |
|
380 | 380 | self.tmin = None |
|
381 | 381 | self.tmax = None |
|
382 | 382 | |
|
383 | 383 | self.xmin = None |
|
384 | 384 | self.xmax = None |
|
385 | 385 | |
|
386 | 386 | self.figfile = None |
|
387 | 387 | |
|
388 | 388 | def getSubplots(self): |
|
389 | 389 | |
|
390 | 390 | ncol = 1 |
|
391 | 391 | nrow = self.nplots |
|
392 | 392 | |
|
393 | 393 | return nrow, ncol |
|
394 | 394 | |
|
395 | 395 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
396 | 396 | |
|
397 | 397 | self.__showprofile = showprofile |
|
398 | 398 | self.nplots = nplots |
|
399 | 399 | |
|
400 | 400 | ncolspan = 1 |
|
401 | 401 | colspan = 1 |
|
402 | 402 | |
|
403 | 403 | self.createFigure(id = id, |
|
404 | 404 | wintitle = wintitle, |
|
405 | 405 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
406 | 406 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
407 | 407 | show=show) |
|
408 | 408 | |
|
409 | 409 | nrow, ncol = self.getSubplots() |
|
410 | 410 | |
|
411 | 411 | counter = 0 |
|
412 | 412 | for y in range(nrow): |
|
413 | 413 | if counter >= self.nplots: |
|
414 | 414 | break |
|
415 | 415 | |
|
416 | 416 | self.addAxes(nrow, ncol*ncolspan, y, 0, colspan, 1) |
|
417 | 417 | counter += 1 |
|
418 | 418 | |
|
419 | 419 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='False', |
|
420 | 420 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
421 | 421 | zmax_ver = None, zmin_ver = None, SNRmin = None, SNRmax = None, |
|
422 | 422 | timerange=None, SNRthresh = None, |
|
423 | 423 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
424 | 424 | server=None, folder=None, username=None, password=None, |
|
425 | 425 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
426 | 426 | """ |
|
427 | 427 | |
|
428 | 428 | Input: |
|
429 | 429 | dataOut : |
|
430 | 430 | id : |
|
431 | 431 | wintitle : |
|
432 | 432 | channelList : |
|
433 | 433 | showProfile : |
|
434 | 434 | xmin : None, |
|
435 | 435 | xmax : None, |
|
436 | 436 | ymin : None, |
|
437 | 437 | ymax : None, |
|
438 | 438 | zmin : None, |
|
439 | 439 | zmax : None |
|
440 | 440 | """ |
|
441 | 441 | |
|
442 | 442 | if channelList == None: |
|
443 | 443 | channelIndexList = dataOut.channelIndexList |
|
444 | 444 | else: |
|
445 | 445 | channelIndexList = [] |
|
446 | 446 | for channel in channelList: |
|
447 | 447 | if channel not in dataOut.channelList: |
|
448 | 448 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
449 | 449 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
450 | 450 | |
|
451 | 451 | # if timerange is not None: |
|
452 | 452 | # self.timerange = timerange |
|
453 | 453 | # |
|
454 | 454 | # tmin = None |
|
455 | 455 | # tmax = None |
|
456 | 456 | |
|
457 | 457 | x = dataOut.getTimeRange1() |
|
458 | 458 | # y = dataOut.heightList |
|
459 | 459 | y = dataOut.heightList |
|
460 | 460 | |
|
461 | 461 | z = dataOut.data_output.copy() |
|
462 | 462 | nplots = z.shape[0] #Number of wind dimensions estimated |
|
463 | 463 | nplotsw = nplots |
|
464 | 464 | |
|
465 | 465 | #If there is a SNR function defined |
|
466 | 466 | if dataOut.data_SNR is not None: |
|
467 | 467 | nplots += 1 |
|
468 | 468 | SNR = dataOut.data_SNR |
|
469 | 469 | SNRavg = numpy.average(SNR, axis=0) |
|
470 | 470 | |
|
471 | 471 | SNRdB = 10*numpy.log10(SNR) |
|
472 | 472 | SNRavgdB = 10*numpy.log10(SNRavg) |
|
473 | 473 | |
|
474 | 474 | if SNRthresh == None: SNRthresh = -5.0 |
|
475 | 475 | ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0] |
|
476 | 476 | |
|
477 | 477 | for i in range(nplotsw): |
|
478 | 478 | z[i,ind] = numpy.nan |
|
479 | 479 | |
|
480 | 480 | |
|
481 | 481 | # showprofile = False |
|
482 | 482 | # thisDatetime = dataOut.datatime |
|
483 | 483 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
484 | 484 | title = wintitle + "Wind" |
|
485 | 485 | xlabel = "" |
|
486 | 486 | ylabel = "Range (Km)" |
|
487 | 487 | update_figfile = False |
|
488 | 488 | |
|
489 | 489 | if not self.isConfig: |
|
490 | 490 | |
|
491 | 491 | self.setup(id=id, |
|
492 | 492 | nplots=nplots, |
|
493 | 493 | wintitle=wintitle, |
|
494 | 494 | showprofile=showprofile, |
|
495 | 495 | show=show) |
|
496 | 496 | |
|
497 | 497 | if timerange is not None: |
|
498 | 498 | self.timerange = timerange |
|
499 | 499 | |
|
500 | 500 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
501 | 501 | |
|
502 | 502 | if ymin == None: ymin = numpy.nanmin(y) |
|
503 | 503 | if ymax == None: ymax = numpy.nanmax(y) |
|
504 | 504 | |
|
505 | 505 | if zmax == None: zmax = numpy.nanmax(abs(z[range(2),:])) |
|
506 | 506 | #if numpy.isnan(zmax): zmax = 50 |
|
507 | 507 | if zmin == None: zmin = -zmax |
|
508 | 508 | |
|
509 | 509 | if nplotsw == 3: |
|
510 | 510 | if zmax_ver == None: zmax_ver = numpy.nanmax(abs(z[2,:])) |
|
511 | 511 | if zmin_ver == None: zmin_ver = -zmax_ver |
|
512 | 512 | |
|
513 | 513 | if dataOut.data_SNR is not None: |
|
514 | 514 | if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB) |
|
515 | 515 | if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB) |
|
516 | 516 | |
|
517 | 517 | |
|
518 | 518 | self.FTP_WEI = ftp_wei |
|
519 | 519 | self.EXP_CODE = exp_code |
|
520 | 520 | self.SUB_EXP_CODE = sub_exp_code |
|
521 | 521 | self.PLOT_POS = plot_pos |
|
522 | 522 | |
|
523 | 523 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
524 | 524 | self.isConfig = True |
|
525 | 525 | self.figfile = figfile |
|
526 | 526 | update_figfile = True |
|
527 | 527 | |
|
528 | 528 | self.setWinTitle(title) |
|
529 | 529 | |
|
530 | 530 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
531 | 531 | x[1] = self.xmax |
|
532 | 532 | |
|
533 | 533 | strWind = ['Zonal', 'Meridional', 'Vertical'] |
|
534 | 534 | strCb = ['Velocity (m/s)','Velocity (m/s)','Velocity (cm/s)'] |
|
535 | 535 | zmaxVector = [zmax, zmax, zmax_ver] |
|
536 | 536 | zminVector = [zmin, zmin, zmin_ver] |
|
537 | 537 | windFactor = [1,1,100] |
|
538 | 538 | |
|
539 | 539 | for i in range(nplotsw): |
|
540 | 540 | |
|
541 | 541 | title = "%s Wind: %s" %(strWind[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
542 | 542 | axes = self.axesList[i*self.__nsubplots] |
|
543 | 543 | |
|
544 | 544 | z1 = z[i,:].reshape((1,-1))*windFactor[i] |
|
545 | 545 | |
|
546 | 546 | axes.pcolorbuffer(x, y, z1, |
|
547 | 547 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zminVector[i], zmax=zmaxVector[i], |
|
548 | 548 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
549 | 549 | ticksize=9, cblabel=strCb[i], cbsize="1%", colormap="RdBu_r" ) |
|
550 | 550 | |
|
551 | 551 | if dataOut.data_SNR is not None: |
|
552 | 552 | i += 1 |
|
553 | 553 | title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
554 | 554 | axes = self.axesList[i*self.__nsubplots] |
|
555 | 555 | |
|
556 | 556 | SNRavgdB = SNRavgdB.reshape((1,-1)) |
|
557 | 557 | |
|
558 | 558 | axes.pcolorbuffer(x, y, SNRavgdB, |
|
559 | 559 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
560 | 560 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
561 | 561 | ticksize=9, cblabel='', cbsize="1%", colormap="jet") |
|
562 | 562 | |
|
563 | 563 | self.draw() |
|
564 | 564 | |
|
565 | 565 | if dataOut.ltctime >= self.xmax: |
|
566 | 566 | self.counter_imagwr = wr_period |
|
567 | 567 | self.isConfig = False |
|
568 | 568 | update_figfile = True |
|
569 | 569 | |
|
570 | 570 | self.save(figpath=figpath, |
|
571 | 571 | figfile=figfile, |
|
572 | 572 | save=save, |
|
573 | 573 | ftp=ftp, |
|
574 | 574 | wr_period=wr_period, |
|
575 | 575 | thisDatetime=thisDatetime, |
|
576 | 576 | update_figfile=update_figfile) |
|
577 | 577 | |
|
578 | 578 | |
|
579 | 579 | |
|
580 | 580 | class ParametersPlot(Figure): |
|
581 | 581 | |
|
582 | 582 | __isConfig = None |
|
583 | 583 | __nsubplots = None |
|
584 | 584 | |
|
585 | 585 | WIDTHPROF = None |
|
586 | 586 | HEIGHTPROF = None |
|
587 | 587 | PREFIX = 'prm' |
|
588 | 588 | |
|
589 | 589 | def __init__(self): |
|
590 | 590 | |
|
591 | 591 | self.timerange = 2*60*60 |
|
592 | 592 | self.isConfig = False |
|
593 | 593 | self.__nsubplots = 1 |
|
594 | 594 | |
|
595 | 595 | self.WIDTH = 800 |
|
596 | 596 | self.HEIGHT = 150 |
|
597 | 597 | self.WIDTHPROF = 120 |
|
598 | 598 | self.HEIGHTPROF = 0 |
|
599 | 599 | self.counter_imagwr = 0 |
|
600 | 600 | |
|
601 | 601 | self.PLOT_CODE = PARMS_CODE |
|
602 | 602 | |
|
603 | 603 | self.FTP_WEI = None |
|
604 | 604 | self.EXP_CODE = None |
|
605 | 605 | self.SUB_EXP_CODE = None |
|
606 | 606 | self.PLOT_POS = None |
|
607 | 607 | self.tmin = None |
|
608 | 608 | self.tmax = None |
|
609 | 609 | |
|
610 | 610 | self.xmin = None |
|
611 | 611 | self.xmax = None |
|
612 | 612 | |
|
613 | 613 | self.figfile = None |
|
614 | 614 | |
|
615 | 615 | def getSubplots(self): |
|
616 | 616 | |
|
617 | 617 | ncol = 1 |
|
618 | 618 | nrow = self.nplots |
|
619 | 619 | |
|
620 | 620 | return nrow, ncol |
|
621 | 621 | |
|
622 | 622 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
623 | 623 | |
|
624 | 624 | self.__showprofile = showprofile |
|
625 | 625 | self.nplots = nplots |
|
626 | 626 | |
|
627 | 627 | ncolspan = 1 |
|
628 | 628 | colspan = 1 |
|
629 | 629 | |
|
630 | 630 | self.createFigure(id = id, |
|
631 | 631 | wintitle = wintitle, |
|
632 | 632 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
633 | 633 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
634 | 634 | show=show) |
|
635 | 635 | |
|
636 | 636 | nrow, ncol = self.getSubplots() |
|
637 | 637 | |
|
638 | 638 | counter = 0 |
|
639 | 639 | for y in range(nrow): |
|
640 | 640 | for x in range(ncol): |
|
641 | 641 | |
|
642 | 642 | if counter >= self.nplots: |
|
643 | 643 | break |
|
644 | 644 | |
|
645 | 645 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
646 | 646 | |
|
647 | 647 | if showprofile: |
|
648 | 648 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
649 | 649 | |
|
650 | 650 | counter += 1 |
|
651 | 651 | |
|
652 | 652 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=False, |
|
653 | 653 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,timerange=None, |
|
654 | 654 | parameterIndex = None, onlyPositive = False, |
|
655 | 655 | SNRthresh = -numpy.inf, SNR = True, SNRmin = None, SNRmax = None, onlySNR = False, |
|
656 | 656 | DOP = True, |
|
657 | 657 | zlabel = "", parameterName = "", parameterObject = "data_param", |
|
658 | 658 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
659 | 659 | server=None, folder=None, username=None, password=None, |
|
660 | 660 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
661 | 661 | |
|
662 | 662 | """ |
|
663 | 663 | |
|
664 | 664 | Input: |
|
665 | 665 | dataOut : |
|
666 | 666 | id : |
|
667 | 667 | wintitle : |
|
668 | 668 | channelList : |
|
669 | 669 | showProfile : |
|
670 | 670 | xmin : None, |
|
671 | 671 | xmax : None, |
|
672 | 672 | ymin : None, |
|
673 | 673 | ymax : None, |
|
674 | 674 | zmin : None, |
|
675 | 675 | zmax : None |
|
676 | 676 | """ |
|
677 | 677 | |
|
678 | 678 | data_param = getattr(dataOut, parameterObject) |
|
679 | 679 | |
|
680 | 680 | if channelList == None: |
|
681 | 681 | channelIndexList = numpy.arange(data_param.shape[0]) |
|
682 | 682 | else: |
|
683 | 683 | channelIndexList = numpy.array(channelList) |
|
684 | 684 | |
|
685 | 685 | nchan = len(channelIndexList) #Number of channels being plotted |
|
686 | 686 | |
|
687 | 687 | if nchan < 1: |
|
688 | 688 | return |
|
689 | 689 | |
|
690 | 690 | nGraphsByChannel = 0 |
|
691 | 691 | |
|
692 | 692 | if SNR: |
|
693 | 693 | nGraphsByChannel += 1 |
|
694 | 694 | if DOP: |
|
695 | 695 | nGraphsByChannel += 1 |
|
696 | 696 | |
|
697 | 697 | if nGraphsByChannel < 1: |
|
698 | 698 | return |
|
699 | 699 | |
|
700 | 700 | nplots = nGraphsByChannel*nchan |
|
701 | 701 | |
|
702 | 702 | if timerange is not None: |
|
703 | 703 | self.timerange = timerange |
|
704 | 704 | |
|
705 | 705 | #tmin = None |
|
706 | 706 | #tmax = None |
|
707 | 707 | if parameterIndex == None: |
|
708 | 708 | parameterIndex = 1 |
|
709 | 709 | |
|
710 | 710 | x = dataOut.getTimeRange1() |
|
711 | 711 | y = dataOut.heightList |
|
712 | 712 | z = data_param[channelIndexList,parameterIndex,:].copy() |
|
713 | 713 | |
|
714 | 714 | zRange = dataOut.abscissaList |
|
715 | 715 | # nChannels = z.shape[0] #Number of wind dimensions estimated |
|
716 | 716 | # thisDatetime = dataOut.datatime |
|
717 | 717 | |
|
718 | 718 | if dataOut.data_SNR is not None: |
|
719 | 719 | SNRarray = dataOut.data_SNR[channelIndexList,:] |
|
720 | 720 | SNRdB = 10*numpy.log10(SNRarray) |
|
721 | 721 | # SNRavgdB = 10*numpy.log10(SNRavg) |
|
722 | 722 | ind = numpy.where(SNRdB < 10**(SNRthresh/10)) |
|
723 | 723 | z[ind] = numpy.nan |
|
724 | 724 | |
|
725 | 725 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
726 | 726 | title = wintitle + " Parameters Plot" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
727 | 727 | xlabel = "" |
|
728 | 728 | ylabel = "Range (Km)" |
|
729 | 729 | |
|
730 | 730 | if (SNR and not onlySNR): nplots = 2*nplots |
|
731 | 731 | |
|
732 | 732 | if onlyPositive: |
|
733 | 733 | colormap = "jet" |
|
734 | 734 | zmin = 0 |
|
735 | 735 | else: colormap = "RdBu_r" |
|
736 | 736 | |
|
737 | 737 | if not self.isConfig: |
|
738 | 738 | |
|
739 | 739 | self.setup(id=id, |
|
740 | 740 | nplots=nplots, |
|
741 | 741 | wintitle=wintitle, |
|
742 | 742 | showprofile=showprofile, |
|
743 | 743 | show=show) |
|
744 | 744 | |
|
745 | 745 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
746 | 746 | |
|
747 | 747 | if ymin == None: ymin = numpy.nanmin(y) |
|
748 | 748 | if ymax == None: ymax = numpy.nanmax(y) |
|
749 | 749 | if zmin == None: zmin = numpy.nanmin(zRange) |
|
750 | 750 | if zmax == None: zmax = numpy.nanmax(zRange) |
|
751 | 751 | |
|
752 | 752 | if SNR: |
|
753 | 753 | if SNRmin == None: SNRmin = numpy.nanmin(SNRdB) |
|
754 | 754 | if SNRmax == None: SNRmax = numpy.nanmax(SNRdB) |
|
755 | 755 | |
|
756 | 756 | self.FTP_WEI = ftp_wei |
|
757 | 757 | self.EXP_CODE = exp_code |
|
758 | 758 | self.SUB_EXP_CODE = sub_exp_code |
|
759 | 759 | self.PLOT_POS = plot_pos |
|
760 | 760 | |
|
761 | 761 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
762 | 762 | self.isConfig = True |
|
763 | 763 | self.figfile = figfile |
|
764 | 764 | |
|
765 | 765 | self.setWinTitle(title) |
|
766 | 766 | |
|
767 | 767 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
768 | 768 | x[1] = self.xmax |
|
769 | 769 | |
|
770 | 770 | for i in range(nchan): |
|
771 | 771 | |
|
772 | 772 | if (SNR and not onlySNR): j = 2*i |
|
773 | 773 | else: j = i |
|
774 | 774 | |
|
775 | 775 | j = nGraphsByChannel*i |
|
776 | 776 | |
|
777 | 777 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
778 | 778 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
779 | 779 | |
|
780 | 780 | if not onlySNR: |
|
781 | 781 | axes = self.axesList[j*self.__nsubplots] |
|
782 | 782 | z1 = z[i,:].reshape((1,-1)) |
|
783 | 783 | axes.pcolorbuffer(x, y, z1, |
|
784 | 784 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
785 | 785 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap=colormap, |
|
786 | 786 | ticksize=9, cblabel=zlabel, cbsize="1%") |
|
787 | 787 | |
|
788 | 788 | if DOP: |
|
789 | 789 | title = "%s Channel %d: %s" %(parameterName, channelIndexList[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
790 | 790 | |
|
791 | 791 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
792 | 792 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
793 | 793 | axes = self.axesList[j] |
|
794 | 794 | z1 = z[i,:].reshape((1,-1)) |
|
795 | 795 | axes.pcolorbuffer(x, y, z1, |
|
796 | 796 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
797 | 797 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap=colormap, |
|
798 | 798 | ticksize=9, cblabel=zlabel, cbsize="1%") |
|
799 | 799 | |
|
800 | 800 | if SNR: |
|
801 | 801 | title = "Channel %d Signal Noise Ratio (SNR): %s" %(channelIndexList[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
802 | 802 | axes = self.axesList[(j)*self.__nsubplots] |
|
803 | 803 | if not onlySNR: |
|
804 | 804 | axes = self.axesList[(j + 1)*self.__nsubplots] |
|
805 | 805 | |
|
806 | 806 | axes = self.axesList[(j + nGraphsByChannel-1)] |
|
807 | 807 | |
|
808 | 808 | z1 = SNRdB[i,:].reshape((1,-1)) |
|
809 | 809 | axes.pcolorbuffer(x, y, z1, |
|
810 | 810 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
811 | 811 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,colormap="jet", |
|
812 | 812 | ticksize=9, cblabel=zlabel, cbsize="1%") |
|
813 | 813 | |
|
814 | 814 | |
|
815 | 815 | |
|
816 | 816 | self.draw() |
|
817 | 817 | |
|
818 | 818 | if x[1] >= self.axesList[0].xmax: |
|
819 | 819 | self.counter_imagwr = wr_period |
|
820 | 820 | self.isConfig = False |
|
821 | 821 | self.figfile = None |
|
822 | 822 | |
|
823 | 823 | self.save(figpath=figpath, |
|
824 | 824 | figfile=figfile, |
|
825 | 825 | save=save, |
|
826 | 826 | ftp=ftp, |
|
827 | 827 | wr_period=wr_period, |
|
828 | 828 | thisDatetime=thisDatetime, |
|
829 | 829 | update_figfile=False) |
|
830 | 830 | |
|
831 | 831 | class SpectralFittingPlot(Figure): |
|
832 | 832 | |
|
833 | 833 | __isConfig = None |
|
834 | 834 | __nsubplots = None |
|
835 | 835 | |
|
836 | 836 | WIDTHPROF = None |
|
837 | 837 | HEIGHTPROF = None |
|
838 | 838 | PREFIX = 'prm' |
|
839 | 839 | |
|
840 | 840 | |
|
841 | 841 | N = None |
|
842 | 842 | ippSeconds = None |
|
843 | 843 | |
|
844 | 844 | def __init__(self): |
|
845 | 845 | self.isConfig = False |
|
846 | 846 | self.__nsubplots = 1 |
|
847 | 847 | |
|
848 | 848 | self.PLOT_CODE = SPECFIT_CODE |
|
849 | 849 | |
|
850 | 850 | self.WIDTH = 450 |
|
851 | 851 | self.HEIGHT = 250 |
|
852 | 852 | self.WIDTHPROF = 0 |
|
853 | 853 | self.HEIGHTPROF = 0 |
|
854 | 854 | |
|
855 | 855 | def getSubplots(self): |
|
856 | 856 | |
|
857 | 857 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
858 | 858 | nrow = int(self.nplots*1./ncol + 0.9) |
|
859 | 859 | |
|
860 | 860 | return nrow, ncol |
|
861 | 861 | |
|
862 | 862 | def setup(self, id, nplots, wintitle, showprofile=False, show=True): |
|
863 | 863 | |
|
864 | 864 | showprofile = False |
|
865 | 865 | self.__showprofile = showprofile |
|
866 | 866 | self.nplots = nplots |
|
867 | 867 | |
|
868 | 868 | ncolspan = 5 |
|
869 | 869 | colspan = 4 |
|
870 | 870 | if showprofile: |
|
871 | 871 | ncolspan = 5 |
|
872 | 872 | colspan = 4 |
|
873 | 873 | self.__nsubplots = 2 |
|
874 | 874 | |
|
875 | 875 | self.createFigure(id = id, |
|
876 | 876 | wintitle = wintitle, |
|
877 | 877 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
878 | 878 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
879 | 879 | show=show) |
|
880 | 880 | |
|
881 | 881 | nrow, ncol = self.getSubplots() |
|
882 | 882 | |
|
883 | 883 | counter = 0 |
|
884 | 884 | for y in range(nrow): |
|
885 | 885 | for x in range(ncol): |
|
886 | 886 | |
|
887 | 887 | if counter >= self.nplots: |
|
888 | 888 | break |
|
889 | 889 | |
|
890 | 890 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
891 | 891 | |
|
892 | 892 | if showprofile: |
|
893 | 893 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
894 | 894 | |
|
895 | 895 | counter += 1 |
|
896 | 896 | |
|
897 | 897 | def run(self, dataOut, id, cutHeight=None, fit=False, wintitle="", channelList=None, showprofile=True, |
|
898 | 898 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
899 | 899 | save=False, figpath='./', figfile=None, show=True): |
|
900 | 900 | |
|
901 | 901 | """ |
|
902 | 902 | |
|
903 | 903 | Input: |
|
904 | 904 | dataOut : |
|
905 | 905 | id : |
|
906 | 906 | wintitle : |
|
907 | 907 | channelList : |
|
908 | 908 | showProfile : |
|
909 | 909 | xmin : None, |
|
910 | 910 | xmax : None, |
|
911 | 911 | zmin : None, |
|
912 | 912 | zmax : None |
|
913 | 913 | """ |
|
914 | 914 | |
|
915 | 915 | if cutHeight==None: |
|
916 | 916 | h=270 |
|
917 | 917 | heightindex = numpy.abs(cutHeight - dataOut.heightList).argmin() |
|
918 | 918 | cutHeight = dataOut.heightList[heightindex] |
|
919 | 919 | |
|
920 | 920 | factor = dataOut.normFactor |
|
921 | 921 | x = dataOut.abscissaList[:-1] |
|
922 | 922 | #y = dataOut.getHeiRange() |
|
923 | 923 | |
|
924 | 924 | z = dataOut.data_pre[:,:,heightindex]/factor |
|
925 | 925 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
926 | 926 | avg = numpy.average(z, axis=1) |
|
927 | 927 | listChannels = z.shape[0] |
|
928 | 928 | |
|
929 | 929 | #Reconstruct Function |
|
930 | 930 | if fit==True: |
|
931 | 931 | groupArray = dataOut.groupList |
|
932 | 932 | listChannels = groupArray.reshape((groupArray.size)) |
|
933 | 933 | listChannels.sort() |
|
934 | 934 | spcFitLine = numpy.zeros(z.shape) |
|
935 | 935 | constants = dataOut.constants |
|
936 | 936 | |
|
937 | 937 | nGroups = groupArray.shape[0] |
|
938 | 938 | nChannels = groupArray.shape[1] |
|
939 | 939 | nProfiles = z.shape[1] |
|
940 | 940 | |
|
941 | 941 | for f in range(nGroups): |
|
942 | 942 | groupChann = groupArray[f,:] |
|
943 | 943 | p = dataOut.data_param[f,:,heightindex] |
|
944 | 944 | # p = numpy.array([ 89.343967,0.14036615,0.17086219,18.89835291,1.58388365,1.55099167]) |
|
945 | 945 | fitLineAux = dataOut.library.modelFunction(p, constants)*nProfiles |
|
946 | 946 | fitLineAux = fitLineAux.reshape((nChannels,nProfiles)) |
|
947 | 947 | spcFitLine[groupChann,:] = fitLineAux |
|
948 | 948 | # spcFitLine = spcFitLine/factor |
|
949 | 949 | |
|
950 | 950 | z = z[listChannels,:] |
|
951 | 951 | spcFitLine = spcFitLine[listChannels,:] |
|
952 | 952 | spcFitLinedB = 10*numpy.log10(spcFitLine) |
|
953 | 953 | |
|
954 | 954 | zdB = 10*numpy.log10(z) |
|
955 | 955 | #thisDatetime = dataOut.datatime |
|
956 | 956 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
957 | 957 | title = wintitle + " Doppler Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
958 | 958 | xlabel = "Velocity (m/s)" |
|
959 | 959 | ylabel = "Spectrum" |
|
960 | 960 | |
|
961 | 961 | if not self.isConfig: |
|
962 | 962 | |
|
963 | 963 | nplots = listChannels.size |
|
964 | 964 | |
|
965 | 965 | self.setup(id=id, |
|
966 | 966 | nplots=nplots, |
|
967 | 967 | wintitle=wintitle, |
|
968 | 968 | showprofile=showprofile, |
|
969 | 969 | show=show) |
|
970 | 970 | |
|
971 | 971 | if xmin == None: xmin = numpy.nanmin(x) |
|
972 | 972 | if xmax == None: xmax = numpy.nanmax(x) |
|
973 | 973 | if ymin == None: ymin = numpy.nanmin(zdB) |
|
974 | 974 | if ymax == None: ymax = numpy.nanmax(zdB)+2 |
|
975 | 975 | |
|
976 | 976 | self.isConfig = True |
|
977 | 977 | |
|
978 | 978 | self.setWinTitle(title) |
|
979 | 979 | for i in range(self.nplots): |
|
980 | 980 | # title = "Channel %d: %4.2fdB" %(dataOut.channelList[i]+1, noisedB[i]) |
|
981 | 981 | title = "Height %4.1f km\nChannel %d:" %(cutHeight, listChannels[i]) |
|
982 | 982 | axes = self.axesList[i*self.__nsubplots] |
|
983 | 983 | if fit == False: |
|
984 | 984 | axes.pline(x, zdB[i,:], |
|
985 | 985 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
986 | 986 | xlabel=xlabel, ylabel=ylabel, title=title |
|
987 | 987 | ) |
|
988 | 988 | if fit == True: |
|
989 | 989 | fitline=spcFitLinedB[i,:] |
|
990 | 990 | y=numpy.vstack([zdB[i,:],fitline] ) |
|
991 | 991 | legendlabels=['Data','Fitting'] |
|
992 | 992 | axes.pmultilineyaxis(x, y, |
|
993 | 993 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
994 | 994 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
995 | 995 | legendlabels=legendlabels, marker=None, |
|
996 | 996 | linestyle='solid', grid='both') |
|
997 | 997 | |
|
998 | 998 | self.draw() |
|
999 | 999 | |
|
1000 | 1000 | self.save(figpath=figpath, |
|
1001 | 1001 | figfile=figfile, |
|
1002 | 1002 | save=save, |
|
1003 | 1003 | ftp=ftp, |
|
1004 | 1004 | wr_period=wr_period, |
|
1005 | 1005 | thisDatetime=thisDatetime) |
|
1006 | 1006 | |
|
1007 | 1007 | |
|
1008 | 1008 | class EWDriftsPlot(Figure): |
|
1009 | 1009 | |
|
1010 | 1010 | __isConfig = None |
|
1011 | 1011 | __nsubplots = None |
|
1012 | 1012 | |
|
1013 | 1013 | WIDTHPROF = None |
|
1014 | 1014 | HEIGHTPROF = None |
|
1015 | 1015 | PREFIX = 'drift' |
|
1016 | 1016 | |
|
1017 | 1017 | def __init__(self): |
|
1018 | 1018 | |
|
1019 | 1019 | self.timerange = 2*60*60 |
|
1020 | 1020 | self.isConfig = False |
|
1021 | 1021 | self.__nsubplots = 1 |
|
1022 | 1022 | |
|
1023 | 1023 | self.WIDTH = 800 |
|
1024 | 1024 | self.HEIGHT = 150 |
|
1025 | 1025 | self.WIDTHPROF = 120 |
|
1026 | 1026 | self.HEIGHTPROF = 0 |
|
1027 | 1027 | self.counter_imagwr = 0 |
|
1028 | 1028 | |
|
1029 | 1029 | self.PLOT_CODE = EWDRIFT_CODE |
|
1030 | 1030 | |
|
1031 | 1031 | self.FTP_WEI = None |
|
1032 | 1032 | self.EXP_CODE = None |
|
1033 | 1033 | self.SUB_EXP_CODE = None |
|
1034 | 1034 | self.PLOT_POS = None |
|
1035 | 1035 | self.tmin = None |
|
1036 | 1036 | self.tmax = None |
|
1037 | 1037 | |
|
1038 | 1038 | self.xmin = None |
|
1039 | 1039 | self.xmax = None |
|
1040 | 1040 | |
|
1041 | 1041 | self.figfile = None |
|
1042 | 1042 | |
|
1043 | 1043 | def getSubplots(self): |
|
1044 | 1044 | |
|
1045 | 1045 | ncol = 1 |
|
1046 | 1046 | nrow = self.nplots |
|
1047 | 1047 | |
|
1048 | 1048 | return nrow, ncol |
|
1049 | 1049 | |
|
1050 | 1050 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1051 | 1051 | |
|
1052 | 1052 | self.__showprofile = showprofile |
|
1053 | 1053 | self.nplots = nplots |
|
1054 | 1054 | |
|
1055 | 1055 | ncolspan = 1 |
|
1056 | 1056 | colspan = 1 |
|
1057 | 1057 | |
|
1058 | 1058 | self.createFigure(id = id, |
|
1059 | 1059 | wintitle = wintitle, |
|
1060 | 1060 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
1061 | 1061 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
1062 | 1062 | show=show) |
|
1063 | 1063 | |
|
1064 | 1064 | nrow, ncol = self.getSubplots() |
|
1065 | 1065 | |
|
1066 | 1066 | counter = 0 |
|
1067 | 1067 | for y in range(nrow): |
|
1068 | 1068 | if counter >= self.nplots: |
|
1069 | 1069 | break |
|
1070 | 1070 | |
|
1071 | 1071 | self.addAxes(nrow, ncol*ncolspan, y, 0, colspan, 1) |
|
1072 | 1072 | counter += 1 |
|
1073 | 1073 | |
|
1074 | 1074 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
1075 | 1075 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
1076 | 1076 | zmaxVertical = None, zminVertical = None, zmaxZonal = None, zminZonal = None, |
|
1077 | 1077 | timerange=None, SNRthresh = -numpy.inf, SNRmin = None, SNRmax = None, SNR_1 = False, |
|
1078 | 1078 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
1079 | 1079 | server=None, folder=None, username=None, password=None, |
|
1080 | 1080 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1081 | 1081 | """ |
|
1082 | 1082 | |
|
1083 | 1083 | Input: |
|
1084 | 1084 | dataOut : |
|
1085 | 1085 | id : |
|
1086 | 1086 | wintitle : |
|
1087 | 1087 | channelList : |
|
1088 | 1088 | showProfile : |
|
1089 | 1089 | xmin : None, |
|
1090 | 1090 | xmax : None, |
|
1091 | 1091 | ymin : None, |
|
1092 | 1092 | ymax : None, |
|
1093 | 1093 | zmin : None, |
|
1094 | 1094 | zmax : None |
|
1095 | 1095 | """ |
|
1096 | 1096 | |
|
1097 | 1097 | if timerange is not None: |
|
1098 | 1098 | self.timerange = timerange |
|
1099 | 1099 | |
|
1100 | 1100 | tmin = None |
|
1101 | 1101 | tmax = None |
|
1102 | 1102 | |
|
1103 | 1103 | x = dataOut.getTimeRange1() |
|
1104 | 1104 | # y = dataOut.heightList |
|
1105 | 1105 | y = dataOut.heightList |
|
1106 | 1106 | |
|
1107 | 1107 | z = dataOut.data_output |
|
1108 | 1108 | nplots = z.shape[0] #Number of wind dimensions estimated |
|
1109 | 1109 | nplotsw = nplots |
|
1110 | 1110 | |
|
1111 | 1111 | #If there is a SNR function defined |
|
1112 | 1112 | if dataOut.data_SNR is not None: |
|
1113 | 1113 | nplots += 1 |
|
1114 | 1114 | SNR = dataOut.data_SNR |
|
1115 | 1115 | |
|
1116 | 1116 | if SNR_1: |
|
1117 | 1117 | SNR += 1 |
|
1118 | 1118 | |
|
1119 | 1119 | SNRavg = numpy.average(SNR, axis=0) |
|
1120 | 1120 | |
|
1121 | 1121 | SNRdB = 10*numpy.log10(SNR) |
|
1122 | 1122 | SNRavgdB = 10*numpy.log10(SNRavg) |
|
1123 | 1123 | |
|
1124 | 1124 | ind = numpy.where(SNRavg < 10**(SNRthresh/10))[0] |
|
1125 | 1125 | |
|
1126 | 1126 | for i in range(nplotsw): |
|
1127 | 1127 | z[i,ind] = numpy.nan |
|
1128 | 1128 | |
|
1129 | 1129 | |
|
1130 | 1130 | showprofile = False |
|
1131 | 1131 | # thisDatetime = dataOut.datatime |
|
1132 | 1132 | thisDatetime = datetime.datetime.utcfromtimestamp(x[1]) |
|
1133 | 1133 | title = wintitle + " EW Drifts" |
|
1134 | 1134 | xlabel = "" |
|
1135 | 1135 | ylabel = "Height (Km)" |
|
1136 | 1136 | |
|
1137 | 1137 | if not self.isConfig: |
|
1138 | 1138 | |
|
1139 | 1139 | self.setup(id=id, |
|
1140 | 1140 | nplots=nplots, |
|
1141 | 1141 | wintitle=wintitle, |
|
1142 | 1142 | showprofile=showprofile, |
|
1143 | 1143 | show=show) |
|
1144 | 1144 | |
|
1145 | 1145 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1146 | 1146 | |
|
1147 | 1147 | if ymin == None: ymin = numpy.nanmin(y) |
|
1148 | 1148 | if ymax == None: ymax = numpy.nanmax(y) |
|
1149 | 1149 | |
|
1150 | 1150 | if zmaxZonal == None: zmaxZonal = numpy.nanmax(abs(z[0,:])) |
|
1151 | 1151 | if zminZonal == None: zminZonal = -zmaxZonal |
|
1152 | 1152 | if zmaxVertical == None: zmaxVertical = numpy.nanmax(abs(z[1,:])) |
|
1153 | 1153 | if zminVertical == None: zminVertical = -zmaxVertical |
|
1154 | 1154 | |
|
1155 | 1155 | if dataOut.data_SNR is not None: |
|
1156 | 1156 | if SNRmin == None: SNRmin = numpy.nanmin(SNRavgdB) |
|
1157 | 1157 | if SNRmax == None: SNRmax = numpy.nanmax(SNRavgdB) |
|
1158 | 1158 | |
|
1159 | 1159 | self.FTP_WEI = ftp_wei |
|
1160 | 1160 | self.EXP_CODE = exp_code |
|
1161 | 1161 | self.SUB_EXP_CODE = sub_exp_code |
|
1162 | 1162 | self.PLOT_POS = plot_pos |
|
1163 | 1163 | |
|
1164 | 1164 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1165 | 1165 | self.isConfig = True |
|
1166 | 1166 | |
|
1167 | 1167 | |
|
1168 | 1168 | self.setWinTitle(title) |
|
1169 | 1169 | |
|
1170 | 1170 | if ((self.xmax - x[1]) < (x[1]-x[0])): |
|
1171 | 1171 | x[1] = self.xmax |
|
1172 | 1172 | |
|
1173 | 1173 | strWind = ['Zonal','Vertical'] |
|
1174 | 1174 | strCb = 'Velocity (m/s)' |
|
1175 | 1175 | zmaxVector = [zmaxZonal, zmaxVertical] |
|
1176 | 1176 | zminVector = [zminZonal, zminVertical] |
|
1177 | 1177 | |
|
1178 | 1178 | for i in range(nplotsw): |
|
1179 | 1179 | |
|
1180 | 1180 | title = "%s Drifts: %s" %(strWind[i], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1181 | 1181 | axes = self.axesList[i*self.__nsubplots] |
|
1182 | 1182 | |
|
1183 | 1183 | z1 = z[i,:].reshape((1,-1)) |
|
1184 | 1184 | |
|
1185 | 1185 | axes.pcolorbuffer(x, y, z1, |
|
1186 | 1186 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zminVector[i], zmax=zmaxVector[i], |
|
1187 | 1187 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
1188 | 1188 | ticksize=9, cblabel=strCb, cbsize="1%", colormap="RdBu_r") |
|
1189 | 1189 | |
|
1190 | 1190 | if dataOut.data_SNR is not None: |
|
1191 | 1191 | i += 1 |
|
1192 | 1192 | if SNR_1: |
|
1193 | 1193 | title = "Signal Noise Ratio + 1 (SNR+1): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1194 | 1194 | else: |
|
1195 | 1195 | title = "Signal Noise Ratio (SNR): %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1196 | 1196 | axes = self.axesList[i*self.__nsubplots] |
|
1197 | 1197 | SNRavgdB = SNRavgdB.reshape((1,-1)) |
|
1198 | 1198 | |
|
1199 | 1199 | axes.pcolorbuffer(x, y, SNRavgdB, |
|
1200 | 1200 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=SNRmin, zmax=SNRmax, |
|
1201 | 1201 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
1202 | 1202 | ticksize=9, cblabel='', cbsize="1%", colormap="jet") |
|
1203 | 1203 | |
|
1204 | 1204 | self.draw() |
|
1205 | 1205 | |
|
1206 | 1206 | if x[1] >= self.axesList[0].xmax: |
|
1207 | 1207 | self.counter_imagwr = wr_period |
|
1208 | 1208 | self.isConfig = False |
|
1209 | 1209 | self.figfile = None |
|
1210 | 1210 | |
|
1211 | 1211 | |
|
1212 | 1212 | |
|
1213 | 1213 | |
|
1214 | 1214 | class PhasePlot(Figure): |
|
1215 | 1215 | |
|
1216 | 1216 | __isConfig = None |
|
1217 | 1217 | __nsubplots = None |
|
1218 | 1218 | |
|
1219 | 1219 | PREFIX = 'mphase' |
|
1220 | 1220 | |
|
1221 | 1221 | def __init__(self): |
|
1222 | 1222 | |
|
1223 | 1223 | self.timerange = 24*60*60 |
|
1224 | 1224 | self.isConfig = False |
|
1225 | 1225 | self.__nsubplots = 1 |
|
1226 | 1226 | self.counter_imagwr = 0 |
|
1227 | 1227 | self.WIDTH = 600 |
|
1228 | 1228 | self.HEIGHT = 300 |
|
1229 | 1229 | self.WIDTHPROF = 120 |
|
1230 | 1230 | self.HEIGHTPROF = 0 |
|
1231 | 1231 | self.xdata = None |
|
1232 | 1232 | self.ydata = None |
|
1233 | 1233 | |
|
1234 | 1234 | self.PLOT_CODE = MPHASE_CODE |
|
1235 | 1235 | |
|
1236 | 1236 | self.FTP_WEI = None |
|
1237 | 1237 | self.EXP_CODE = None |
|
1238 | 1238 | self.SUB_EXP_CODE = None |
|
1239 | 1239 | self.PLOT_POS = None |
|
1240 | 1240 | |
|
1241 | 1241 | |
|
1242 | 1242 | self.filename_phase = None |
|
1243 | 1243 | |
|
1244 | 1244 | self.figfile = None |
|
1245 | 1245 | |
|
1246 | 1246 | def getSubplots(self): |
|
1247 | 1247 | |
|
1248 | 1248 | ncol = 1 |
|
1249 | 1249 | nrow = 1 |
|
1250 | 1250 | |
|
1251 | 1251 | return nrow, ncol |
|
1252 | 1252 | |
|
1253 | 1253 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1254 | 1254 | |
|
1255 | 1255 | self.__showprofile = showprofile |
|
1256 | 1256 | self.nplots = nplots |
|
1257 | 1257 | |
|
1258 | 1258 | ncolspan = 7 |
|
1259 | 1259 | colspan = 6 |
|
1260 | 1260 | self.__nsubplots = 2 |
|
1261 | 1261 | |
|
1262 | 1262 | self.createFigure(id = id, |
|
1263 | 1263 | wintitle = wintitle, |
|
1264 | 1264 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1265 | 1265 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1266 | 1266 | show=show) |
|
1267 | 1267 | |
|
1268 | 1268 | nrow, ncol = self.getSubplots() |
|
1269 | 1269 | |
|
1270 | 1270 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1271 | 1271 | |
|
1272 | 1272 | |
|
1273 | 1273 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
1274 | 1274 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1275 | 1275 | timerange=None, |
|
1276 | 1276 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1277 | 1277 | server=None, folder=None, username=None, password=None, |
|
1278 | 1278 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1279 | 1279 | |
|
1280 | 1280 | |
|
1281 | 1281 | tmin = None |
|
1282 | 1282 | tmax = None |
|
1283 | 1283 | x = dataOut.getTimeRange1() |
|
1284 | 1284 | y = dataOut.getHeiRange() |
|
1285 | 1285 | |
|
1286 | 1286 | |
|
1287 | 1287 | #thisDatetime = dataOut.datatime |
|
1288 | 1288 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
1289 | 1289 | title = wintitle + " Phase of Beacon Signal" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1290 | 1290 | xlabel = "Local Time" |
|
1291 | 1291 | ylabel = "Phase" |
|
1292 | 1292 | |
|
1293 | 1293 | |
|
1294 | 1294 | #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList))) |
|
1295 | 1295 | phase_beacon = dataOut.data_output |
|
1296 | 1296 | update_figfile = False |
|
1297 | 1297 | |
|
1298 | 1298 | if not self.isConfig: |
|
1299 | 1299 | |
|
1300 | 1300 | self.nplots = phase_beacon.size |
|
1301 | 1301 | |
|
1302 | 1302 | self.setup(id=id, |
|
1303 | 1303 | nplots=self.nplots, |
|
1304 | 1304 | wintitle=wintitle, |
|
1305 | 1305 | showprofile=showprofile, |
|
1306 | 1306 | show=show) |
|
1307 | 1307 | |
|
1308 | 1308 | if timerange is not None: |
|
1309 | 1309 | self.timerange = timerange |
|
1310 | 1310 | |
|
1311 | 1311 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1312 | 1312 | |
|
1313 | 1313 | if ymin == None: ymin = numpy.nanmin(phase_beacon) - 10.0 |
|
1314 | 1314 | if ymax == None: ymax = numpy.nanmax(phase_beacon) + 10.0 |
|
1315 | 1315 | |
|
1316 | 1316 | self.FTP_WEI = ftp_wei |
|
1317 | 1317 | self.EXP_CODE = exp_code |
|
1318 | 1318 | self.SUB_EXP_CODE = sub_exp_code |
|
1319 | 1319 | self.PLOT_POS = plot_pos |
|
1320 | 1320 | |
|
1321 | 1321 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1322 | 1322 | self.isConfig = True |
|
1323 | 1323 | self.figfile = figfile |
|
1324 | 1324 | self.xdata = numpy.array([]) |
|
1325 | 1325 | self.ydata = numpy.array([]) |
|
1326 | 1326 | |
|
1327 | 1327 | #open file beacon phase |
|
1328 | 1328 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1329 | 1329 | beacon_file = os.path.join(path,'%s.txt'%self.name) |
|
1330 | 1330 | self.filename_phase = os.path.join(figpath,beacon_file) |
|
1331 | 1331 | update_figfile = True |
|
1332 | 1332 | |
|
1333 | 1333 | |
|
1334 | 1334 | #store data beacon phase |
|
1335 | 1335 | #self.save_data(self.filename_phase, phase_beacon, thisDatetime) |
|
1336 | 1336 | |
|
1337 | 1337 | self.setWinTitle(title) |
|
1338 | 1338 | |
|
1339 | 1339 | |
|
1340 | 1340 | title = "Phase Offset %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1341 | 1341 | |
|
1342 | 1342 | legendlabels = ["phase %d"%(chan) for chan in numpy.arange(self.nplots)] |
|
1343 | 1343 | |
|
1344 | 1344 | axes = self.axesList[0] |
|
1345 | 1345 | |
|
1346 | 1346 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1347 | 1347 | |
|
1348 | 1348 | if len(self.ydata)==0: |
|
1349 | 1349 | self.ydata = phase_beacon.reshape(-1,1) |
|
1350 | 1350 | else: |
|
1351 | 1351 | self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1))) |
|
1352 | 1352 | |
|
1353 | 1353 | |
|
1354 | 1354 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1355 | 1355 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1356 | 1356 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1357 | 1357 | XAxisAsTime=True, grid='both' |
|
1358 | 1358 | ) |
|
1359 | 1359 | |
|
1360 | 1360 | self.draw() |
|
1361 | 1361 | |
|
1362 | 1362 | if dataOut.ltctime >= self.xmax: |
|
1363 | 1363 | self.counter_imagwr = wr_period |
|
1364 | 1364 | self.isConfig = False |
|
1365 | 1365 | update_figfile = True |
|
1366 | 1366 | |
|
1367 | 1367 | self.save(figpath=figpath, |
|
1368 | 1368 | figfile=figfile, |
|
1369 | 1369 | save=save, |
|
1370 | 1370 | ftp=ftp, |
|
1371 | 1371 | wr_period=wr_period, |
|
1372 | 1372 | thisDatetime=thisDatetime, |
|
1373 | 1373 | update_figfile=update_figfile) |
General Comments 0
You need to be logged in to leave comments.
Login now