@@ -1,976 +1,976 | |||
|
1 | 1 | import numpy |
|
2 | 2 | import time, datetime |
|
3 | 3 | from graphics.figure import * |
|
4 | 4 | |
|
5 | 5 | class CrossSpectraPlot(Figure): |
|
6 | 6 | |
|
7 | 7 | __isConfig = None |
|
8 | 8 | __nsubplots = None |
|
9 | 9 | |
|
10 | 10 | WIDTH = None |
|
11 | 11 | HEIGHT = None |
|
12 | 12 | WIDTHPROF = None |
|
13 | 13 | HEIGHTPROF = None |
|
14 | 14 | PREFIX = 'cspc' |
|
15 | 15 | |
|
16 | 16 | def __init__(self): |
|
17 | 17 | |
|
18 | 18 | self.__isConfig = False |
|
19 | 19 | self.__nsubplots = 4 |
|
20 | 20 | |
|
21 | 21 | self.WIDTH = 250 |
|
22 | 22 | self.HEIGHT = 250 |
|
23 | 23 | self.WIDTHPROF = 0 |
|
24 | 24 | self.HEIGHTPROF = 0 |
|
25 | 25 | |
|
26 | 26 | def getSubplots(self): |
|
27 | 27 | |
|
28 | 28 | ncol = 4 |
|
29 | 29 | nrow = self.nplots |
|
30 | 30 | |
|
31 | 31 | return nrow, ncol |
|
32 | 32 | |
|
33 | 33 | def setup(self, idfigure, nplots, wintitle, showprofile=True): |
|
34 | 34 | |
|
35 | 35 | self.__showprofile = showprofile |
|
36 | 36 | self.nplots = nplots |
|
37 | 37 | |
|
38 | 38 | ncolspan = 1 |
|
39 | 39 | colspan = 1 |
|
40 | 40 | |
|
41 | 41 | self.createFigure(idfigure = idfigure, |
|
42 | 42 | wintitle = wintitle, |
|
43 | 43 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
44 | 44 | heightplot = self.HEIGHT + self.HEIGHTPROF) |
|
45 | 45 | |
|
46 | 46 | nrow, ncol = self.getSubplots() |
|
47 | 47 | |
|
48 | 48 | counter = 0 |
|
49 | 49 | for y in range(nrow): |
|
50 | 50 | for x in range(ncol): |
|
51 | 51 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
52 | 52 | |
|
53 | 53 | counter += 1 |
|
54 | 54 | |
|
55 | 55 | def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True', |
|
56 | 56 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
57 | 57 | save=False, figpath='./', figfile=None): |
|
58 | 58 | |
|
59 | 59 | """ |
|
60 | 60 | |
|
61 | 61 | Input: |
|
62 | 62 | dataOut : |
|
63 | 63 | idfigure : |
|
64 | 64 | wintitle : |
|
65 | 65 | channelList : |
|
66 | 66 | showProfile : |
|
67 | 67 | xmin : None, |
|
68 | 68 | xmax : None, |
|
69 | 69 | ymin : None, |
|
70 | 70 | ymax : None, |
|
71 | 71 | zmin : None, |
|
72 | 72 | zmax : None |
|
73 | 73 | """ |
|
74 | 74 | |
|
75 | 75 | if pairsList == None: |
|
76 | 76 | pairsIndexList = dataOut.pairsIndexList |
|
77 | 77 | else: |
|
78 | 78 | pairsIndexList = [] |
|
79 | 79 | for pair in pairsList: |
|
80 | 80 | if pair not in dataOut.pairsList: |
|
81 | 81 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
82 | 82 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
83 | 83 | |
|
84 | 84 | if pairsIndexList == []: |
|
85 | 85 | return |
|
86 | 86 | |
|
87 | 87 | if len(pairsIndexList) > 4: |
|
88 | 88 | pairsIndexList = pairsIndexList[0:4] |
|
89 | 89 | |
|
90 |
x = dataOut.get |
|
|
90 | x = dataOut.getVelRange(1) | |
|
91 | 91 | y = dataOut.getHeiRange() |
|
92 | 92 | z = 10.*numpy.log10(dataOut.data_spc[:,:,:]) |
|
93 | 93 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
94 | 94 | avg = numpy.average(numpy.abs(z), axis=1) |
|
95 | 95 | |
|
96 | 96 | noise = dataOut.getNoise() |
|
97 | 97 | |
|
98 | 98 | if not self.__isConfig: |
|
99 | 99 | |
|
100 | 100 | nplots = len(pairsIndexList) |
|
101 | 101 | |
|
102 | 102 | self.setup(idfigure=idfigure, |
|
103 | 103 | nplots=nplots, |
|
104 | 104 | wintitle=wintitle, |
|
105 | 105 | showprofile=showprofile) |
|
106 | 106 | |
|
107 | 107 | if xmin == None: xmin = numpy.nanmin(x) |
|
108 | 108 | if xmax == None: xmax = numpy.nanmax(x) |
|
109 | 109 | if ymin == None: ymin = numpy.nanmin(y) |
|
110 | 110 | if ymax == None: ymax = numpy.nanmax(y) |
|
111 | 111 | if zmin == None: zmin = numpy.nanmin(avg)*0.9 |
|
112 | 112 | if zmax == None: zmax = numpy.nanmax(avg)*0.9 |
|
113 | 113 | |
|
114 | 114 | self.__isConfig = True |
|
115 | 115 | |
|
116 | 116 | thisDatetime = dataOut.datatime |
|
117 | 117 | title = "Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
118 | 118 | xlabel = "Velocity (m/s)" |
|
119 | 119 | ylabel = "Range (Km)" |
|
120 | 120 | |
|
121 | 121 | self.setWinTitle(title) |
|
122 | 122 | |
|
123 | 123 | for i in range(self.nplots): |
|
124 | 124 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
125 | 125 | |
|
126 | 126 | title = "Channel %d: %4.2fdB" %(pair[0], noise[pair[0]]) |
|
127 | 127 | z = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:]) |
|
128 | 128 | axes0 = self.axesList[i*self.__nsubplots] |
|
129 | 129 | axes0.pcolor(x, y, z, |
|
130 | 130 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
131 | 131 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
132 | 132 | ticksize=9, cblabel='') |
|
133 | 133 | |
|
134 | 134 | title = "Channel %d: %4.2fdB" %(pair[1], noise[pair[1]]) |
|
135 | 135 | z = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:]) |
|
136 | 136 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
137 | 137 | axes0.pcolor(x, y, z, |
|
138 | 138 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
139 | 139 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
140 | 140 | ticksize=9, cblabel='') |
|
141 | 141 | |
|
142 | 142 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:]) |
|
143 | 143 | coherence = numpy.abs(coherenceComplex) |
|
144 | 144 | phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi |
|
145 | 145 | |
|
146 | 146 | |
|
147 | 147 | title = "Coherence %d%d" %(pair[0], pair[1]) |
|
148 | 148 | axes0 = self.axesList[i*self.__nsubplots+2] |
|
149 | 149 | axes0.pcolor(x, y, coherence, |
|
150 | 150 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, |
|
151 | 151 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
152 | 152 | ticksize=9, cblabel='') |
|
153 | 153 | |
|
154 | 154 | title = "Phase %d%d" %(pair[0], pair[1]) |
|
155 | 155 | axes0 = self.axesList[i*self.__nsubplots+3] |
|
156 | 156 | axes0.pcolor(x, y, phase, |
|
157 | 157 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, |
|
158 | 158 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
159 | ticksize=9, cblabel='', colormap='RdBu') | |
|
159 | ticksize=9, cblabel='', colormap='RdBu_r') | |
|
160 | 160 | |
|
161 | 161 | |
|
162 | 162 | |
|
163 | 163 | self.draw() |
|
164 | 164 | |
|
165 | 165 | if save: |
|
166 | 166 | date = thisDatetime.strftime("%Y%m%d") |
|
167 | 167 | if figfile == None: |
|
168 | 168 | figfile = self.getFilename(name = date) |
|
169 | 169 | |
|
170 | 170 | self.saveFigure(figpath, figfile) |
|
171 | 171 | |
|
172 | 172 | |
|
173 | 173 | class RTIPlot(Figure): |
|
174 | 174 | |
|
175 | 175 | __isConfig = None |
|
176 | 176 | __nsubplots = None |
|
177 | 177 | |
|
178 | 178 | WIDTHPROF = None |
|
179 | 179 | HEIGHTPROF = None |
|
180 | 180 | PREFIX = 'rti' |
|
181 | 181 | |
|
182 | 182 | def __init__(self): |
|
183 | 183 | |
|
184 |
self.timerange = 2 |
|
|
184 | self.timerange = 2*60*60 | |
|
185 | 185 | self.__isConfig = False |
|
186 | 186 | self.__nsubplots = 1 |
|
187 | 187 | |
|
188 | 188 | self.WIDTH = 800 |
|
189 | 189 | self.HEIGHT = 200 |
|
190 | 190 | self.WIDTHPROF = 120 |
|
191 | 191 | self.HEIGHTPROF = 0 |
|
192 | 192 | |
|
193 | 193 | def getSubplots(self): |
|
194 | 194 | |
|
195 | 195 | ncol = 1 |
|
196 | 196 | nrow = self.nplots |
|
197 | 197 | |
|
198 | 198 | return nrow, ncol |
|
199 | 199 | |
|
200 | 200 | def setup(self, idfigure, nplots, wintitle, showprofile=True): |
|
201 | 201 | |
|
202 | 202 | self.__showprofile = showprofile |
|
203 | 203 | self.nplots = nplots |
|
204 | 204 | |
|
205 | 205 | ncolspan = 1 |
|
206 | 206 | colspan = 1 |
|
207 | 207 | if showprofile: |
|
208 | 208 | ncolspan = 7 |
|
209 | 209 | colspan = 6 |
|
210 | 210 | self.__nsubplots = 2 |
|
211 | 211 | |
|
212 | 212 | self.createFigure(idfigure = idfigure, |
|
213 | 213 | wintitle = wintitle, |
|
214 | 214 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
215 | 215 | heightplot = self.HEIGHT + self.HEIGHTPROF) |
|
216 | 216 | |
|
217 | 217 | nrow, ncol = self.getSubplots() |
|
218 | 218 | |
|
219 | 219 | counter = 0 |
|
220 | 220 | for y in range(nrow): |
|
221 | 221 | for x in range(ncol): |
|
222 | 222 | |
|
223 | 223 | if counter >= self.nplots: |
|
224 | 224 | break |
|
225 | 225 | |
|
226 | 226 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
227 | 227 | |
|
228 | 228 | if showprofile: |
|
229 | 229 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
230 | 230 | |
|
231 | 231 | counter += 1 |
|
232 | 232 | |
|
233 | 233 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
234 | 234 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
235 | 235 | timerange=None, |
|
236 | 236 | save=False, figpath='./', figfile=None): |
|
237 | 237 | |
|
238 | 238 | """ |
|
239 | 239 | |
|
240 | 240 | Input: |
|
241 | 241 | dataOut : |
|
242 | 242 | idfigure : |
|
243 | 243 | wintitle : |
|
244 | 244 | channelList : |
|
245 | 245 | showProfile : |
|
246 | 246 | xmin : None, |
|
247 | 247 | xmax : None, |
|
248 | 248 | ymin : None, |
|
249 | 249 | ymax : None, |
|
250 | 250 | zmin : None, |
|
251 | 251 | zmax : None |
|
252 | 252 | """ |
|
253 | 253 | |
|
254 | 254 | if channelList == None: |
|
255 | 255 | channelIndexList = dataOut.channelIndexList |
|
256 | 256 | else: |
|
257 | 257 | channelIndexList = [] |
|
258 | 258 | for channel in channelList: |
|
259 | 259 | if channel not in dataOut.channelList: |
|
260 | 260 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
261 | 261 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
262 | 262 | |
|
263 | 263 | if timerange != None: |
|
264 | 264 | self.timerange = timerange |
|
265 | 265 | |
|
266 | 266 | tmin = None |
|
267 | 267 | tmax = None |
|
268 | 268 | x = dataOut.getTimeRange() |
|
269 | 269 | y = dataOut.getHeiRange() |
|
270 | 270 | z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:]) |
|
271 | 271 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
272 | 272 | avg = numpy.average(z, axis=1) |
|
273 | 273 | |
|
274 | 274 | noise = dataOut.getNoise() |
|
275 | 275 | |
|
276 | 276 | thisDatetime = dataOut.datatime |
|
277 | 277 | title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
278 | 278 | xlabel = "Velocity (m/s)" |
|
279 | 279 | ylabel = "Range (Km)" |
|
280 | 280 | |
|
281 | 281 | if not self.__isConfig: |
|
282 | 282 | |
|
283 | 283 | nplots = len(channelIndexList) |
|
284 | 284 | |
|
285 | 285 | self.setup(idfigure=idfigure, |
|
286 | 286 | nplots=nplots, |
|
287 | 287 | wintitle=wintitle, |
|
288 | 288 | showprofile=showprofile) |
|
289 | 289 | |
|
290 | 290 | tmin, tmax = self.getTimeLim(x, xmin, xmax) |
|
291 | 291 | if ymin == None: ymin = numpy.nanmin(y) |
|
292 | 292 | if ymax == None: ymax = numpy.nanmax(y) |
|
293 | 293 | if zmin == None: zmin = numpy.nanmin(avg)*0.9 |
|
294 | 294 | if zmax == None: zmax = numpy.nanmax(avg)*0.9 |
|
295 | 295 | |
|
296 | 296 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
297 | 297 | self.__isConfig = True |
|
298 | 298 | |
|
299 | 299 | |
|
300 | 300 | self.setWinTitle(title) |
|
301 | 301 | |
|
302 | 302 | for i in range(self.nplots): |
|
303 | 303 | title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
304 | 304 | axes = self.axesList[i*self.__nsubplots] |
|
305 | 305 | z = avg[i].reshape((1,-1)) |
|
306 | 306 | axes.pcolor(x, y, z, |
|
307 | 307 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
308 | 308 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
309 | 309 | ticksize=9, cblabel='', cbsize="1%") |
|
310 | 310 | |
|
311 | 311 | if self.__showprofile: |
|
312 | 312 | axes = self.axesList[i*self.__nsubplots +1] |
|
313 | 313 | axes.pline(avg[i], y, |
|
314 | 314 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
315 | 315 | xlabel='dB', ylabel='', title='', |
|
316 | 316 | ytick_visible=False, |
|
317 | 317 | grid='x') |
|
318 | 318 | |
|
319 | 319 | self.draw() |
|
320 | 320 | |
|
321 | 321 | if save: |
|
322 | 322 | |
|
323 | 323 | if figfile == None: |
|
324 | 324 | figfile = self.getFilename(name = self.name) |
|
325 | 325 | |
|
326 | 326 | self.saveFigure(figpath, figfile) |
|
327 | 327 | |
|
328 | 328 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
329 | 329 | self.__isConfig = False |
|
330 | 330 | |
|
331 | 331 | class SpectraPlot(Figure): |
|
332 | 332 | |
|
333 | 333 | __isConfig = None |
|
334 | 334 | __nsubplots = None |
|
335 | 335 | |
|
336 | 336 | WIDTHPROF = None |
|
337 | 337 | HEIGHTPROF = None |
|
338 | 338 | PREFIX = 'spc' |
|
339 | 339 | |
|
340 | 340 | def __init__(self): |
|
341 | 341 | |
|
342 | 342 | self.__isConfig = False |
|
343 | 343 | self.__nsubplots = 1 |
|
344 | 344 | |
|
345 | 345 | self.WIDTH = 230 |
|
346 | 346 | self.HEIGHT = 250 |
|
347 | 347 | self.WIDTHPROF = 120 |
|
348 | 348 | self.HEIGHTPROF = 0 |
|
349 | 349 | |
|
350 | 350 | def getSubplots(self): |
|
351 | 351 | |
|
352 | 352 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
353 | 353 | nrow = int(self.nplots*1./ncol + 0.9) |
|
354 | 354 | |
|
355 | 355 | return nrow, ncol |
|
356 | 356 | |
|
357 | 357 | def setup(self, idfigure, nplots, wintitle, showprofile=True): |
|
358 | 358 | |
|
359 | 359 | self.__showprofile = showprofile |
|
360 | 360 | self.nplots = nplots |
|
361 | 361 | |
|
362 | 362 | ncolspan = 1 |
|
363 | 363 | colspan = 1 |
|
364 | 364 | if showprofile: |
|
365 | 365 | ncolspan = 3 |
|
366 | 366 | colspan = 2 |
|
367 | 367 | self.__nsubplots = 2 |
|
368 | 368 | |
|
369 | 369 | self.createFigure(idfigure = idfigure, |
|
370 | 370 | wintitle = wintitle, |
|
371 | 371 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
372 | 372 | heightplot = self.HEIGHT + self.HEIGHTPROF) |
|
373 | 373 | |
|
374 | 374 | nrow, ncol = self.getSubplots() |
|
375 | 375 | |
|
376 | 376 | counter = 0 |
|
377 | 377 | for y in range(nrow): |
|
378 | 378 | for x in range(ncol): |
|
379 | 379 | |
|
380 | 380 | if counter >= self.nplots: |
|
381 | 381 | break |
|
382 | 382 | |
|
383 | 383 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
384 | 384 | |
|
385 | 385 | if showprofile: |
|
386 | 386 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
387 | 387 | |
|
388 | 388 | counter += 1 |
|
389 | 389 | |
|
390 | 390 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
391 | 391 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
392 | 392 | save=False, figpath='./', figfile=None): |
|
393 | 393 | |
|
394 | 394 | """ |
|
395 | 395 | |
|
396 | 396 | Input: |
|
397 | 397 | dataOut : |
|
398 | 398 | idfigure : |
|
399 | 399 | wintitle : |
|
400 | 400 | channelList : |
|
401 | 401 | showProfile : |
|
402 | 402 | xmin : None, |
|
403 | 403 | xmax : None, |
|
404 | 404 | ymin : None, |
|
405 | 405 | ymax : None, |
|
406 | 406 | zmin : None, |
|
407 | 407 | zmax : None |
|
408 | 408 | """ |
|
409 | 409 | |
|
410 | 410 | if channelList == None: |
|
411 | 411 | channelIndexList = dataOut.channelIndexList |
|
412 | 412 | else: |
|
413 | 413 | channelIndexList = [] |
|
414 | 414 | for channel in channelList: |
|
415 | 415 | if channel not in dataOut.channelList: |
|
416 | 416 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
417 | 417 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
418 | 418 | |
|
419 | 419 | x = dataOut.getVelRange(1) |
|
420 | 420 | y = dataOut.getHeiRange() |
|
421 | 421 | |
|
422 | 422 | z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:]) |
|
423 | 423 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
424 | 424 | avg = numpy.average(z, axis=1) |
|
425 | 425 | |
|
426 | 426 | noise = dataOut.getNoise() |
|
427 | 427 | |
|
428 | 428 | if not self.__isConfig: |
|
429 | 429 | |
|
430 | 430 | nplots = len(channelIndexList) |
|
431 | 431 | |
|
432 | 432 | self.setup(idfigure=idfigure, |
|
433 | 433 | nplots=nplots, |
|
434 | 434 | wintitle=wintitle, |
|
435 | 435 | showprofile=showprofile) |
|
436 | 436 | |
|
437 | 437 | if xmin == None: xmin = numpy.nanmin(x) |
|
438 | 438 | if xmax == None: xmax = numpy.nanmax(x) |
|
439 | 439 | if ymin == None: ymin = numpy.nanmin(y) |
|
440 | 440 | if ymax == None: ymax = numpy.nanmax(y) |
|
441 | 441 | if zmin == None: zmin = numpy.nanmin(avg)*0.9 |
|
442 | 442 | if zmax == None: zmax = numpy.nanmax(avg)*0.9 |
|
443 | 443 | |
|
444 | 444 | self.__isConfig = True |
|
445 | 445 | |
|
446 | 446 | thisDatetime = dataOut.datatime |
|
447 | 447 | title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
448 | 448 | xlabel = "Velocity (m/s)" |
|
449 | 449 | ylabel = "Range (Km)" |
|
450 | 450 | |
|
451 | 451 | self.setWinTitle(title) |
|
452 | 452 | |
|
453 | 453 | for i in range(self.nplots): |
|
454 | 454 | title = "Channel %d: %4.2fdB" %(dataOut.channelList[i], noise[i]) |
|
455 | 455 | axes = self.axesList[i*self.__nsubplots] |
|
456 | 456 | axes.pcolor(x, y, z[i,:,:], |
|
457 | 457 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
458 | 458 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
459 | 459 | ticksize=9, cblabel='') |
|
460 | 460 | |
|
461 | 461 | if self.__showprofile: |
|
462 | 462 | axes = self.axesList[i*self.__nsubplots +1] |
|
463 | 463 | axes.pline(avg[i], y, |
|
464 | 464 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
465 | 465 | xlabel='dB', ylabel='', title='', |
|
466 | 466 | ytick_visible=False, |
|
467 | 467 | grid='x') |
|
468 | 468 | |
|
469 | 469 | self.draw() |
|
470 | 470 | |
|
471 | 471 | if save: |
|
472 | 472 | date = thisDatetime.strftime("%Y%m%d") |
|
473 | 473 | if figfile == None: |
|
474 | 474 | figfile = self.getFilename(name = date) |
|
475 | 475 | |
|
476 | 476 | self.saveFigure(figpath, figfile) |
|
477 | 477 | |
|
478 | 478 | class Scope(Figure): |
|
479 | 479 | |
|
480 | 480 | __isConfig = None |
|
481 | 481 | |
|
482 | 482 | def __init__(self): |
|
483 | 483 | |
|
484 | 484 | self.__isConfig = False |
|
485 | 485 | self.WIDTH = 600 |
|
486 | 486 | self.HEIGHT = 200 |
|
487 | 487 | |
|
488 | 488 | def getSubplots(self): |
|
489 | 489 | |
|
490 | 490 | nrow = self.nplots |
|
491 | 491 | ncol = 3 |
|
492 | 492 | return nrow, ncol |
|
493 | 493 | |
|
494 | 494 | def setup(self, idfigure, nplots, wintitle): |
|
495 | 495 | |
|
496 | 496 | self.nplots = nplots |
|
497 | 497 | |
|
498 | 498 | self.createFigure(idfigure, wintitle) |
|
499 | 499 | |
|
500 | 500 | nrow,ncol = self.getSubplots() |
|
501 | 501 | colspan = 3 |
|
502 | 502 | rowspan = 1 |
|
503 | 503 | |
|
504 | 504 | for i in range(nplots): |
|
505 | 505 | self.addAxes(nrow, ncol, i, 0, colspan, rowspan) |
|
506 | 506 | |
|
507 | 507 | |
|
508 | 508 | |
|
509 | 509 | def run(self, dataOut, idfigure, wintitle="", channelList=None, |
|
510 | 510 | xmin=None, xmax=None, ymin=None, ymax=None, save=False, filename=None): |
|
511 | 511 | |
|
512 | 512 | """ |
|
513 | 513 | |
|
514 | 514 | Input: |
|
515 | 515 | dataOut : |
|
516 | 516 | idfigure : |
|
517 | 517 | wintitle : |
|
518 | 518 | channelList : |
|
519 | 519 | xmin : None, |
|
520 | 520 | xmax : None, |
|
521 | 521 | ymin : None, |
|
522 | 522 | ymax : None, |
|
523 | 523 | """ |
|
524 | 524 | |
|
525 | 525 | if channelList == None: |
|
526 | 526 | channelIndexList = dataOut.channelIndexList |
|
527 | 527 | else: |
|
528 | 528 | channelIndexList = [] |
|
529 | 529 | for channel in channelList: |
|
530 | 530 | if channel not in dataOut.channelList: |
|
531 | 531 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
532 | 532 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
533 | 533 | |
|
534 | 534 | x = dataOut.heightList |
|
535 | 535 | y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) |
|
536 | 536 | y = y.real |
|
537 | 537 | |
|
538 | 538 | if not self.__isConfig: |
|
539 | 539 | nplots = len(channelIndexList) |
|
540 | 540 | |
|
541 | 541 | self.setup(idfigure=idfigure, |
|
542 | 542 | nplots=nplots, |
|
543 | 543 | wintitle=wintitle) |
|
544 | 544 | |
|
545 | 545 | if xmin == None: xmin = numpy.nanmin(x) |
|
546 | 546 | if xmax == None: xmax = numpy.nanmax(x) |
|
547 | 547 | if ymin == None: ymin = numpy.nanmin(y) |
|
548 | 548 | if ymax == None: ymax = numpy.nanmax(y) |
|
549 | 549 | |
|
550 | 550 | self.__isConfig = True |
|
551 | 551 | |
|
552 | 552 | |
|
553 | 553 | thisDatetime = dataOut.datatime |
|
554 | 554 | title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
555 | 555 | xlabel = "Range (Km)" |
|
556 | 556 | ylabel = "Intensity" |
|
557 | 557 | |
|
558 | 558 | self.setWinTitle(title) |
|
559 | 559 | |
|
560 | 560 | for i in range(len(self.axesList)): |
|
561 | 561 | title = "Channel %d" %(i) |
|
562 | 562 | axes = self.axesList[i] |
|
563 | 563 | ychannel = y[i,:] |
|
564 | 564 | axes.pline(x, ychannel, |
|
565 | 565 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
566 | 566 | xlabel=xlabel, ylabel=ylabel, title=title) |
|
567 | 567 | |
|
568 | 568 | self.draw() |
|
569 | 569 | |
|
570 | 570 | if save: |
|
571 | 571 | self.saveFigure(filename) |
|
572 | 572 | |
|
573 | 573 | class ProfilePlot(Figure): |
|
574 | 574 | __isConfig = None |
|
575 | 575 | __nsubplots = None |
|
576 | 576 | |
|
577 | 577 | WIDTHPROF = None |
|
578 | 578 | HEIGHTPROF = None |
|
579 | 579 | PREFIX = 'spcprofile' |
|
580 | 580 | |
|
581 | 581 | def __init__(self): |
|
582 | 582 | self.__isConfig = False |
|
583 | 583 | self.__nsubplots = 1 |
|
584 | 584 | |
|
585 | 585 | self.WIDTH = 300 |
|
586 | 586 | self.HEIGHT = 500 |
|
587 | 587 | |
|
588 | 588 | def getSubplots(self): |
|
589 | 589 | ncol = 1 |
|
590 | 590 | nrow = 1 |
|
591 | 591 | |
|
592 | 592 | return nrow, ncol |
|
593 | 593 | |
|
594 | 594 | def setup(self, idfigure, nplots, wintitle): |
|
595 | 595 | |
|
596 | 596 | self.nplots = nplots |
|
597 | 597 | |
|
598 | 598 | ncolspan = 1 |
|
599 | 599 | colspan = 1 |
|
600 | 600 | |
|
601 | 601 | self.createFigure(idfigure = idfigure, |
|
602 | 602 | wintitle = wintitle, |
|
603 | 603 | widthplot = self.WIDTH, |
|
604 | 604 | heightplot = self.HEIGHT) |
|
605 | 605 | |
|
606 | 606 | nrow, ncol = self.getSubplots() |
|
607 | 607 | |
|
608 | 608 | counter = 0 |
|
609 | 609 | for y in range(nrow): |
|
610 | 610 | for x in range(ncol): |
|
611 | 611 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
612 | 612 | |
|
613 | 613 | def run(self, dataOut, idfigure, wintitle="", channelList=None, |
|
614 | 614 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
615 | 615 | save=False, figpath='./', figfile=None): |
|
616 | 616 | |
|
617 | 617 | if channelList == None: |
|
618 | 618 | channelIndexList = dataOut.channelIndexList |
|
619 | 619 | channelList = dataOut.channelList |
|
620 | 620 | else: |
|
621 | 621 | channelIndexList = [] |
|
622 | 622 | for channel in channelList: |
|
623 | 623 | if channel not in dataOut.channelList: |
|
624 | 624 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
625 | 625 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
626 | 626 | |
|
627 | 627 | |
|
628 | 628 | y = dataOut.getHeiRange() |
|
629 | 629 | x = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:]) |
|
630 | 630 | avg = numpy.average(x, axis=1) |
|
631 | 631 | |
|
632 | 632 | |
|
633 | 633 | if not self.__isConfig: |
|
634 | 634 | |
|
635 | 635 | nplots = 1 |
|
636 | 636 | |
|
637 | 637 | self.setup(idfigure=idfigure, |
|
638 | 638 | nplots=nplots, |
|
639 | 639 | wintitle=wintitle) |
|
640 | 640 | |
|
641 | 641 | if ymin == None: ymin = numpy.nanmin(y) |
|
642 | 642 | if ymax == None: ymax = numpy.nanmax(y) |
|
643 | 643 | if xmin == None: xmin = numpy.nanmin(avg)*0.9 |
|
644 | 644 | if xmax == None: xmax = numpy.nanmax(avg)*0.9 |
|
645 | 645 | |
|
646 | 646 | self.__isConfig = True |
|
647 | 647 | |
|
648 | 648 | thisDatetime = dataOut.datatime |
|
649 | 649 | title = "Power Profile" |
|
650 | 650 | xlabel = "dB" |
|
651 | 651 | ylabel = "Range (Km)" |
|
652 | 652 | |
|
653 | 653 | self.setWinTitle(title) |
|
654 | 654 | |
|
655 | 655 | |
|
656 | 656 | title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
657 | 657 | axes = self.axesList[0] |
|
658 | 658 | |
|
659 | 659 | legendlabels = ["channel %d"%x for x in channelList] |
|
660 | 660 | axes.pmultiline(avg, y, |
|
661 | 661 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
662 | 662 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
663 | 663 | ytick_visible=True, nxticks=5, |
|
664 | 664 | grid='x') |
|
665 | 665 | |
|
666 | 666 | self.draw() |
|
667 | 667 | |
|
668 | 668 | if save: |
|
669 | 669 | date = thisDatetime.strftime("%Y%m%d") |
|
670 | 670 | if figfile == None: |
|
671 | 671 | figfile = self.getFilename(name = date) |
|
672 | 672 | |
|
673 | 673 | self.saveFigure(figpath, figfile) |
|
674 | 674 | |
|
675 | 675 | class CoherenceMap(Figure): |
|
676 | 676 | __isConfig = None |
|
677 | 677 | __nsubplots = None |
|
678 | 678 | |
|
679 | 679 | WIDTHPROF = None |
|
680 | 680 | HEIGHTPROF = None |
|
681 | 681 | PREFIX = 'coherencemap' |
|
682 | 682 | |
|
683 | 683 | def __init__(self): |
|
684 |
self.timerange = 2 |
|
|
684 | self.timerange = 2*60*60 | |
|
685 | 685 | self.__isConfig = False |
|
686 | 686 | self.__nsubplots = 1 |
|
687 | 687 | |
|
688 | 688 | self.WIDTH = 800 |
|
689 | 689 | self.HEIGHT = 200 |
|
690 | 690 | self.WIDTHPROF = 120 |
|
691 | 691 | self.HEIGHTPROF = 0 |
|
692 | 692 | |
|
693 | 693 | def getSubplots(self): |
|
694 | 694 | ncol = 1 |
|
695 | 695 | nrow = self.nplots*2 |
|
696 | 696 | |
|
697 | 697 | return nrow, ncol |
|
698 | 698 | |
|
699 | 699 | def setup(self, idfigure, nplots, wintitle, showprofile=True): |
|
700 | 700 | self.__showprofile = showprofile |
|
701 | 701 | self.nplots = nplots |
|
702 | 702 | |
|
703 | 703 | ncolspan = 1 |
|
704 | 704 | colspan = 1 |
|
705 | 705 | if showprofile: |
|
706 | 706 | ncolspan = 7 |
|
707 | 707 | colspan = 6 |
|
708 | 708 | self.__nsubplots = 2 |
|
709 | 709 | |
|
710 | 710 | self.createFigure(idfigure = idfigure, |
|
711 | 711 | wintitle = wintitle, |
|
712 | 712 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
713 | 713 | heightplot = self.HEIGHT + self.HEIGHTPROF) |
|
714 | 714 | |
|
715 | 715 | nrow, ncol = self.getSubplots() |
|
716 | 716 | |
|
717 | 717 | for y in range(nrow): |
|
718 | 718 | for x in range(ncol): |
|
719 | 719 | |
|
720 | 720 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
721 | 721 | |
|
722 | 722 | if showprofile: |
|
723 | 723 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
724 | 724 | |
|
725 | 725 | def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True', |
|
726 | 726 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
727 | 727 | timerange=None, |
|
728 | 728 | save=False, figpath='./', figfile=None): |
|
729 | 729 | |
|
730 | 730 | if pairsList == None: |
|
731 | 731 | pairsIndexList = dataOut.pairsIndexList |
|
732 | 732 | else: |
|
733 | 733 | pairsIndexList = [] |
|
734 | 734 | for pair in pairsList: |
|
735 | 735 | if pair not in dataOut.pairsList: |
|
736 | 736 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
737 | 737 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
738 | 738 | |
|
739 | 739 | if timerange != None: |
|
740 | 740 | self.timerange = timerange |
|
741 | 741 | |
|
742 | 742 | if pairsIndexList == []: |
|
743 | 743 | return |
|
744 | 744 | |
|
745 | 745 | if len(pairsIndexList) > 4: |
|
746 | 746 | pairsIndexList = pairsIndexList[0:4] |
|
747 | 747 | |
|
748 | 748 | tmin = None |
|
749 | 749 | tmax = None |
|
750 | 750 | x = dataOut.getTimeRange() |
|
751 | 751 | y = dataOut.getHeiRange() |
|
752 | 752 | |
|
753 | 753 | if not self.__isConfig: |
|
754 | 754 | nplots = len(pairsIndexList) |
|
755 | 755 | self.setup(idfigure=idfigure, |
|
756 | 756 | nplots=nplots, |
|
757 | 757 | wintitle=wintitle, |
|
758 | 758 | showprofile=showprofile) |
|
759 | 759 | |
|
760 | 760 | tmin, tmax = self.getTimeLim(x, xmin, xmax) |
|
761 | 761 | if ymin == None: ymin = numpy.nanmin(y) |
|
762 | 762 | if ymax == None: ymax = numpy.nanmax(y) |
|
763 | 763 | |
|
764 | 764 | self.__isConfig = True |
|
765 | 765 | |
|
766 | 766 | thisDatetime = dataOut.datatime |
|
767 | 767 | title = "CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
768 | 768 | xlabel = "" |
|
769 | 769 | ylabel = "Range (Km)" |
|
770 | 770 | |
|
771 | 771 | self.setWinTitle(title) |
|
772 | 772 | |
|
773 | 773 | for i in range(self.nplots): |
|
774 | 774 | |
|
775 | 775 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
776 | 776 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:]) |
|
777 | 777 | coherence = numpy.abs(coherenceComplex) |
|
778 | 778 | avg = numpy.average(coherence, axis=0) |
|
779 | 779 | z = avg.reshape((1,-1)) |
|
780 | 780 | |
|
781 | 781 | counter = 0 |
|
782 | 782 | |
|
783 | 783 | title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
784 | 784 | axes = self.axesList[i*self.__nsubplots*2] |
|
785 | 785 | axes.pcolor(x, y, z, |
|
786 | 786 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1, |
|
787 | 787 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
788 | 788 | ticksize=9, cblabel='', cbsize="1%") |
|
789 | 789 | |
|
790 | 790 | if self.__showprofile: |
|
791 | 791 | counter += 1 |
|
792 | 792 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
793 | 793 | axes.pline(avg, y, |
|
794 | 794 | xmin=0, xmax=1, ymin=ymin, ymax=ymax, |
|
795 | 795 | xlabel='', ylabel='', title='', ticksize=7, |
|
796 | 796 | ytick_visible=False, nxticks=5, |
|
797 | 797 | grid='x') |
|
798 | 798 | |
|
799 | 799 | counter += 1 |
|
800 | 800 | phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi |
|
801 | 801 | avg = numpy.average(phase, axis=0) |
|
802 | 802 | z = avg.reshape((1,-1)) |
|
803 | 803 | |
|
804 | 804 | title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
805 | 805 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
806 | 806 | axes.pcolor(x, y, z, |
|
807 | 807 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180, |
|
808 | 808 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
809 | 809 | ticksize=9, cblabel='', colormap='RdBu', cbsize="1%") |
|
810 | 810 | |
|
811 | 811 | if self.__showprofile: |
|
812 | 812 | counter += 1 |
|
813 | 813 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
814 | 814 | axes.pline(avg, y, |
|
815 | 815 | xmin=-180, xmax=180, ymin=ymin, ymax=ymax, |
|
816 | 816 | xlabel='', ylabel='', title='', ticksize=7, |
|
817 | 817 | ytick_visible=False, nxticks=4, |
|
818 | 818 | grid='x') |
|
819 | 819 | |
|
820 | 820 | self.draw() |
|
821 | 821 | |
|
822 | 822 | if save: |
|
823 | 823 | date = thisDatetime.strftime("%Y%m%d") |
|
824 | 824 | if figfile == None: |
|
825 | 825 | figfile = self.getFilename(name = date) |
|
826 | 826 | |
|
827 | 827 | self.saveFigure(figpath, figfile) |
|
828 | 828 | |
|
829 | 829 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
830 | 830 | self.__isConfig = False |
|
831 | 831 | |
|
832 | 832 | class RTIfromNoise(Figure): |
|
833 | 833 | |
|
834 | 834 | __isConfig = None |
|
835 | 835 | __nsubplots = None |
|
836 | 836 | |
|
837 | 837 | WIDTHPROF = None |
|
838 | 838 | HEIGHTPROF = None |
|
839 | 839 | PREFIX = 'rti' |
|
840 | 840 | |
|
841 | 841 | def __init__(self): |
|
842 | 842 | |
|
843 | 843 | self.__timerange = 24*60*60 |
|
844 | 844 | self.__isConfig = False |
|
845 | 845 | self.__nsubplots = 1 |
|
846 | 846 | |
|
847 | 847 | self.WIDTH = 800 |
|
848 | 848 | self.HEIGHT = 200 |
|
849 | 849 | |
|
850 | 850 | def getSubplots(self): |
|
851 | 851 | |
|
852 | 852 | ncol = 1 |
|
853 | 853 | nrow = self.nplots |
|
854 | 854 | |
|
855 | 855 | return nrow, ncol |
|
856 | 856 | |
|
857 | 857 | def setup(self, idfigure, nplots, wintitle, showprofile=True): |
|
858 | 858 | |
|
859 | 859 | self.__showprofile = showprofile |
|
860 | 860 | self.nplots = nplots |
|
861 | 861 | |
|
862 | 862 | ncolspan = 1 |
|
863 | 863 | colspan = 1 |
|
864 | 864 | |
|
865 | 865 | self.createFigure(idfigure = idfigure, |
|
866 | 866 | wintitle = wintitle, |
|
867 | 867 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
868 | 868 | heightplot = self.HEIGHT + self.HEIGHTPROF) |
|
869 | 869 | |
|
870 | 870 | nrow, ncol = self.getSubplots() |
|
871 | 871 | |
|
872 | 872 | self.addAxes(nrow, ncol, 0, 0, 1, 1) |
|
873 | 873 | |
|
874 | 874 | |
|
875 | 875 | |
|
876 | 876 | def __getTimeLim(self, x, xmin, xmax): |
|
877 | 877 | |
|
878 | 878 | thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x)) |
|
879 | 879 | thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0)) |
|
880 | 880 | |
|
881 | 881 | #################################################### |
|
882 | 882 | #If the x is out of xrange |
|
883 | 883 | if xmax < (thisdatetime - thisdate).seconds/(60*60.): |
|
884 | 884 | xmin = None |
|
885 | 885 | xmax = None |
|
886 | 886 | |
|
887 | 887 | if xmin == None: |
|
888 | 888 | td = thisdatetime - thisdate |
|
889 | 889 | xmin = td.seconds/(60*60.) |
|
890 | 890 | |
|
891 | 891 | if xmax == None: |
|
892 | 892 | xmax = xmin + self.__timerange/(60*60.) |
|
893 | 893 | |
|
894 | 894 | mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin) |
|
895 | 895 | tmin = time.mktime(mindt.timetuple()) |
|
896 | 896 | |
|
897 | 897 | maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax) |
|
898 | 898 | tmax = time.mktime(maxdt.timetuple()) |
|
899 | 899 | |
|
900 | 900 | self.__timerange = tmax - tmin |
|
901 | 901 | |
|
902 | 902 | return tmin, tmax |
|
903 | 903 | |
|
904 | 904 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', |
|
905 | 905 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
906 | 906 | timerange=None, |
|
907 | 907 | save=False, figpath='./', figfile=None): |
|
908 | 908 | |
|
909 | 909 | if channelList == None: |
|
910 | 910 | channelIndexList = dataOut.channelIndexList |
|
911 | 911 | else: |
|
912 | 912 | channelIndexList = [] |
|
913 | 913 | for channel in channelList: |
|
914 | 914 | if channel not in dataOut.channelList: |
|
915 | 915 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
916 | 916 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
917 | 917 | |
|
918 | 918 | if timerange != None: |
|
919 | 919 | self.__timerange = timerange |
|
920 | 920 | |
|
921 | 921 | tmin = None |
|
922 | 922 | tmax = None |
|
923 | 923 | x = dataOut.getTimeRange() |
|
924 | 924 | y = dataOut.getHeiRange() |
|
925 | 925 | x1 = dataOut.datatime |
|
926 | 926 | # z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:]) |
|
927 | 927 | # avg = numpy.average(z, axis=1) |
|
928 | 928 | |
|
929 | 929 | noise = dataOut.getNoise() |
|
930 | 930 | |
|
931 | 931 | if not self.__isConfig: |
|
932 | 932 | |
|
933 | 933 | nplots = len(channelIndexList) |
|
934 | 934 | |
|
935 | 935 | self.setup(idfigure=idfigure, |
|
936 | 936 | nplots=nplots, |
|
937 | 937 | wintitle=wintitle, |
|
938 | 938 | showprofile=showprofile) |
|
939 | 939 | |
|
940 | 940 | tmin, tmax = self.__getTimeLim(x, xmin, xmax) |
|
941 | 941 | if ymin == None: ymin = numpy.nanmin(y) |
|
942 | 942 | if ymax == None: ymax = numpy.nanmax(y) |
|
943 | 943 | if zmin == None: zmin = numpy.nanmin(avg)*0.9 |
|
944 | 944 | if zmax == None: zmax = numpy.nanmax(avg)*0.9 |
|
945 | 945 | |
|
946 | 946 | self.__isConfig = True |
|
947 | 947 | |
|
948 | 948 | thisDatetime = dataOut.datatime |
|
949 | 949 | title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
950 | 950 | xlabel = "Velocity (m/s)" |
|
951 | 951 | ylabel = "Range (Km)" |
|
952 | 952 | |
|
953 | 953 | self.setWinTitle(title) |
|
954 | 954 | |
|
955 | 955 | for i in range(self.nplots): |
|
956 | 956 | title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
957 | 957 | axes = self.axesList[i*self.__nsubplots] |
|
958 | 958 | z = avg[i].reshape((1,-1)) |
|
959 | 959 | axes.pcolor(x, y, z, |
|
960 | 960 | xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
961 | 961 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
962 | 962 | ticksize=9, cblabel='', cbsize="1%") |
|
963 | 963 | |
|
964 | 964 | |
|
965 | 965 | self.draw() |
|
966 | 966 | |
|
967 | 967 | if save: |
|
968 | 968 | date = thisDatetime.strftime("%Y%m%d") |
|
969 | 969 | if figfile == None: |
|
970 | 970 | figfile = self.getFilename(name = date) |
|
971 | 971 | |
|
972 | 972 | self.saveFigure(figpath, figfile) |
|
973 | 973 | |
|
974 | 974 | if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax: |
|
975 | 975 | self.__isConfig = False |
|
976 | 976 | No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now