@@ -1,938 +1,941 | |||
|
1 | 1 | """ |
|
2 | 2 | Created on Feb 7, 2012 |
|
3 | 3 | |
|
4 | 4 | @autor $Author$ |
|
5 | 5 | @version $Id$ |
|
6 | 6 | |
|
7 | 7 | """ |
|
8 | 8 | |
|
9 | 9 | import numpy |
|
10 | 10 | import sys |
|
11 | 11 | import time |
|
12 | 12 | import datetime |
|
13 | 13 | import time |
|
14 | 14 | import plplot |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | def cmap1_init(colormap="gray"): |
|
18 | 18 | |
|
19 | 19 | if colormap == None: |
|
20 | 20 | return |
|
21 | 21 | |
|
22 | 22 | ncolor = None |
|
23 | 23 | rgb_lvl = None |
|
24 | 24 | |
|
25 | 25 | # Routine for defining a specific color map 1 in HLS space. |
|
26 | 26 | # if gray is true, use basic grayscale variation from half-dark to light. |
|
27 | 27 | # otherwise use false color variation from blue (240 deg) to red (360 deg). |
|
28 | 28 | |
|
29 | 29 | # Independent variable of control points. |
|
30 | 30 | i = numpy.array((0., 1.)) |
|
31 | 31 | if colormap=="gray": |
|
32 | 32 | ncolor = 256 |
|
33 | 33 | # Hue for control points. Doesn't matter since saturation is zero. |
|
34 | 34 | h = numpy.array((0., 0.)) |
|
35 | 35 | # Lightness ranging from half-dark (for interest) to light. |
|
36 | 36 | l = numpy.array((0.5, 1.)) |
|
37 | 37 | # Gray scale has zero saturation |
|
38 | 38 | s = numpy.array((0., 0.)) |
|
39 | 39 | |
|
40 | 40 | # number of cmap1 colours is 256 in this case. |
|
41 | 41 | plplot.plscmap1n(ncolor) |
|
42 | 42 | # Interpolate between control points to set up cmap1. |
|
43 | 43 | plplot.plscmap1l(0, i, h, l, s) |
|
44 | 44 | |
|
45 | 45 | return None |
|
46 | 46 | |
|
47 | 47 | if colormap == 'jet': |
|
48 | 48 | ncolor = 256 |
|
49 | 49 | pos = numpy.zeros((ncolor)) |
|
50 | 50 | r = numpy.zeros((ncolor)) |
|
51 | 51 | g = numpy.zeros((ncolor)) |
|
52 | 52 | b = numpy.zeros((ncolor)) |
|
53 | 53 | |
|
54 | 54 | for i in range(ncolor): |
|
55 | 55 | if(i <= 35.0/100*(ncolor-1)): rf = 0.0 |
|
56 | 56 | elif (i <= 66.0/100*(ncolor-1)): rf = (100.0/31)*i/(ncolor-1) - 35.0/31 |
|
57 | 57 | elif (i <= 89.0/100*(ncolor-1)): rf = 1.0 |
|
58 | 58 | else: rf = (-100.0/22)*i/(ncolor-1) + 111.0/22 |
|
59 | 59 | |
|
60 | 60 | if(i <= 12.0/100*(ncolor-1)): gf = 0.0 |
|
61 | 61 | elif(i <= 38.0/100*(ncolor-1)): gf = (100.0/26)*i/(ncolor-1) - 12.0/26 |
|
62 | 62 | elif(i <= 64.0/100*(ncolor-1)): gf = 1.0 |
|
63 | 63 | elif(i <= 91.0/100*(ncolor-1)): gf = (-100.0/27)*i/(ncolor-1) + 91.0/27 |
|
64 | 64 | else: gf = 0.0 |
|
65 | 65 | |
|
66 | 66 | if(i <= 11.0/100*(ncolor-1)): bf = (50.0/11)*i/(ncolor-1) + 0.5 |
|
67 | 67 | elif(i <= 34.0/100*(ncolor-1)): bf = 1.0 |
|
68 | 68 | elif(i <= 65.0/100*(ncolor-1)): bf = (-100.0/31)*i/(ncolor-1) + 65.0/31 |
|
69 | 69 | else: bf = 0 |
|
70 | 70 | |
|
71 | 71 | r[i] = rf |
|
72 | 72 | g[i] = gf |
|
73 | 73 | b[i] = bf |
|
74 | 74 | |
|
75 | 75 | pos[i] = float(i)/float(ncolor-1) |
|
76 | 76 | |
|
77 | 77 | |
|
78 | 78 | plplot.plscmap1n(ncolor) |
|
79 | 79 | plplot.plscmap1l(1, pos, r, g, b) |
|
80 | 80 | |
|
81 | 81 | |
|
82 | 82 | |
|
83 | 83 | if colormap=="br_green": |
|
84 | 84 | ncolor = 256 |
|
85 | 85 | # Hue ranges from blue (240 deg) to red (0 or 360 deg) |
|
86 | 86 | h = numpy.array((240., 0.)) |
|
87 | 87 | # Lightness and saturation are constant (values taken from C example). |
|
88 | 88 | l = numpy.array((0.6, 0.6)) |
|
89 | 89 | s = numpy.array((0.8, 0.8)) |
|
90 | 90 | |
|
91 | 91 | # number of cmap1 colours is 256 in this case. |
|
92 | 92 | plplot.plscmap1n(ncolor) |
|
93 | 93 | # Interpolate between control points to set up cmap1. |
|
94 | 94 | plplot.plscmap1l(0, i, h, l, s) |
|
95 | 95 | |
|
96 | 96 | return None |
|
97 | 97 | |
|
98 | 98 | if colormap=="tricolor": |
|
99 | 99 | ncolor = 3 |
|
100 | 100 | # Hue ranges from blue (240 deg) to red (0 or 360 deg) |
|
101 | 101 | h = numpy.array((240., 0.)) |
|
102 | 102 | # Lightness and saturation are constant (values taken from C example). |
|
103 | 103 | l = numpy.array((0.6, 0.6)) |
|
104 | 104 | s = numpy.array((0.8, 0.8)) |
|
105 | 105 | |
|
106 | 106 | # number of cmap1 colours is 256 in this case. |
|
107 | 107 | plplot.plscmap1n(ncolor) |
|
108 | 108 | # Interpolate between control points to set up cmap1. |
|
109 | 109 | plplot.plscmap1l(0, i, h, l, s) |
|
110 | 110 | |
|
111 | 111 | return None |
|
112 | 112 | |
|
113 | 113 | if colormap == 'rgb' or colormap == 'rgb666': |
|
114 | 114 | |
|
115 | 115 | color_sz = 6 |
|
116 | 116 | ncolor = color_sz*color_sz*color_sz |
|
117 | 117 | pos = numpy.zeros((ncolor)) |
|
118 | 118 | r = numpy.zeros((ncolor)) |
|
119 | 119 | g = numpy.zeros((ncolor)) |
|
120 | 120 | b = numpy.zeros((ncolor)) |
|
121 | 121 | ind = 0 |
|
122 | 122 | for ri in range(color_sz): |
|
123 | 123 | for gi in range(color_sz): |
|
124 | 124 | for bi in range(color_sz): |
|
125 | 125 | r[ind] = ri/(color_sz-1.0) |
|
126 | 126 | g[ind] = gi/(color_sz-1.0) |
|
127 | 127 | b[ind] = bi/(color_sz-1.0) |
|
128 | 128 | pos[ind] = ind/(ncolor-1.0) |
|
129 | 129 | ind += 1 |
|
130 | 130 | rgb_lvl = [6,6,6] #Levels for RGB colors |
|
131 | 131 | |
|
132 | 132 | if colormap == 'rgb676': |
|
133 | 133 | ncolor = 6*7*6 |
|
134 | 134 | pos = numpy.zeros((ncolor)) |
|
135 | 135 | r = numpy.zeros((ncolor)) |
|
136 | 136 | g = numpy.zeros((ncolor)) |
|
137 | 137 | b = numpy.zeros((ncolor)) |
|
138 | 138 | ind = 0 |
|
139 | 139 | for ri in range(8): |
|
140 | 140 | for gi in range(8): |
|
141 | 141 | for bi in range(4): |
|
142 | 142 | r[ind] = ri/(6-1.0) |
|
143 | 143 | g[ind] = gi/(7-1.0) |
|
144 | 144 | b[ind] = bi/(6-1.0) |
|
145 | 145 | pos[ind] = ind/(ncolor-1.0) |
|
146 | 146 | ind += 1 |
|
147 | 147 | rgb_lvl = [6,7,6] #Levels for RGB colors |
|
148 | 148 | |
|
149 | 149 | if colormap == 'rgb685': |
|
150 | 150 | ncolor = 6*8*5 |
|
151 | 151 | pos = numpy.zeros((ncolor)) |
|
152 | 152 | r = numpy.zeros((ncolor)) |
|
153 | 153 | g = numpy.zeros((ncolor)) |
|
154 | 154 | b = numpy.zeros((ncolor)) |
|
155 | 155 | ind = 0 |
|
156 | 156 | for ri in range(8): |
|
157 | 157 | for gi in range(8): |
|
158 | 158 | for bi in range(4): |
|
159 | 159 | r[ind] = ri/(6-1.0) |
|
160 | 160 | g[ind] = gi/(8-1.0) |
|
161 | 161 | b[ind] = bi/(5-1.0) |
|
162 | 162 | pos[ind] = ind/(ncolor-1.0) |
|
163 | 163 | ind += 1 |
|
164 | 164 | rgb_lvl = [6,8,5] #Levels for RGB colors |
|
165 | 165 | |
|
166 | 166 | if colormap == 'rgb884': |
|
167 | 167 | ncolor = 8*8*4 |
|
168 | 168 | pos = numpy.zeros((ncolor)) |
|
169 | 169 | r = numpy.zeros((ncolor)) |
|
170 | 170 | g = numpy.zeros((ncolor)) |
|
171 | 171 | b = numpy.zeros((ncolor)) |
|
172 | 172 | ind = 0 |
|
173 | 173 | for ri in range(8): |
|
174 | 174 | for gi in range(8): |
|
175 | 175 | for bi in range(4): |
|
176 | 176 | r[ind] = ri/(8-1.0) |
|
177 | 177 | g[ind] = gi/(8-1.0) |
|
178 | 178 | b[ind] = bi/(4-1.0) |
|
179 | 179 | pos[ind] = ind/(ncolor-1.0) |
|
180 | 180 | ind += 1 |
|
181 | 181 | rgb_lvl = [8,8,4] #Levels for RGB colors |
|
182 | 182 | |
|
183 | 183 | if ncolor == None: |
|
184 | 184 | raise ValueError, "The colormap selected is not valid" |
|
185 | 185 | |
|
186 | 186 | plplot.plscmap1n(ncolor) |
|
187 | 187 | plplot.plscmap1l(1, pos, r, g, b) |
|
188 | 188 | |
|
189 | 189 | return rgb_lvl |
|
190 | 190 | |
|
191 | 191 | def setColormap(colormap="jet"): |
|
192 | 192 | cmap1_init(colormap) |
|
193 | 193 | |
|
194 | 194 | def initPlplot(indexPlot,ncol,nrow,winTitle,width,height): |
|
195 | 195 | plplot.plsstrm(indexPlot) |
|
196 | 196 | plplot.plparseopts([winTitle],plplot.PL_PARSE_FULL) |
|
197 | 197 | plplot.plsetopt("geometry", "%dx%d"%(width*ncol,height*nrow)) |
|
198 | 198 | plplot.plsdev("xwin") |
|
199 | 199 | plplot.plscolbg(255,255,255) |
|
200 | 200 | plplot.plscol0(1,0,0,0) |
|
201 | 201 | plplot.plinit() |
|
202 | 202 | plplot.plspause(False) |
|
203 | 203 | plplot.plssub(ncol,nrow) |
|
204 | 204 | |
|
205 | 205 | def clearData(objGraph): |
|
206 | 206 | objGraph.plotBox(objGraph.xrange[0], objGraph.xrange[1], objGraph.yrange[0], objGraph.yrange[1], "bc", "bc") |
|
207 | 207 | |
|
208 | 208 | objGraph.setColor(15) #Setting Line Color to White |
|
209 | 209 | |
|
210 | 210 | if objGraph.datatype == "complex": |
|
211 | 211 | objGraph.basicXYPlot(objGraph.xdata,objGraph.ydata.real) |
|
212 | 212 | objGraph.basicXYPlot(objGraph.xdata,objGraph.ydata.imag) |
|
213 | 213 | |
|
214 | 214 | if objGraph.datatype == "real": |
|
215 | 215 | objGraph.basicXYPlot(objGraph.xdata,objGraph.ydata) |
|
216 | 216 | |
|
217 | 217 | objGraph.setColor(1) #Setting Line Color to Black |
|
218 | 218 | # objGraph.setLineStyle(2) |
|
219 | 219 | # objGraph.plotBox(objGraph.xrange[0], objGraph.xrange[1], objGraph.yrange[0], objGraph.yrange[1], "bcntg", "bc") |
|
220 | 220 | # objGraph.setLineStyle(1) |
|
221 | 221 | |
|
222 | 222 | def setStrm(indexPlot): |
|
223 | 223 | plplot.plsstrm(indexPlot) |
|
224 | 224 | |
|
225 | 225 | def plFlush(): |
|
226 | 226 | plplot.plflush() |
|
227 | 227 | |
|
228 | 228 | def setPlTitle(pltitle,color): |
|
229 | 229 | setSubpages(1, 0) |
|
230 | 230 | plplot.pladv(0) |
|
231 | 231 | plplot.plvpor(0., 1., 0., 1.) |
|
232 | 232 | |
|
233 | 233 | if color == "black": |
|
234 | 234 | plplot.plcol0(1) |
|
235 | 235 | if color == "white": |
|
236 | 236 | plplot.plcol0(15) |
|
237 | 237 | |
|
238 | 238 | plplot.plmtex("t",-1., 0.5, 0.5, pltitle) |
|
239 | 239 | |
|
240 | 240 | def setSubpages(ncol,nrow): |
|
241 | 241 | plplot.plssub(ncol,nrow) |
|
242 | 242 | |
|
243 | 243 | class BaseGraph: |
|
244 | 244 | __name = None |
|
245 | 245 | __xpos = None |
|
246 | 246 | __ypos = None |
|
247 | 247 | __subplot = None |
|
248 | 248 | __xg = None |
|
249 | 249 | __yg = None |
|
250 | 250 | xdata = None |
|
251 | 251 | ydata = None |
|
252 | 252 | getGrid = True |
|
253 | 253 | xaxisIsTime = False |
|
254 | 254 | deltax = None |
|
255 | 255 | xmin = None |
|
256 | 256 | xmax = None |
|
257 | 257 | def __init__(self,name,subplot,xpos,ypos,xlabel,ylabel,title,szchar,xrange,yrange,zrange=None,deltax=1.0): |
|
258 | 258 | self.setName(name) |
|
259 | 259 | self.setScreenPos(xpos, ypos) |
|
260 | 260 | self.setLabels(xlabel,ylabel,title) |
|
261 | 261 | self.setSubPlot(subplot) |
|
262 | 262 | self.setSizeOfChar(szchar) |
|
263 | 263 | self.setXYZrange(xrange,yrange,zrange) |
|
264 | 264 | self.getGrid = True |
|
265 | 265 | self.xaxisIsTime = False |
|
266 | 266 | self.deltax = deltax |
|
267 | 267 | |
|
268 | 268 | def setXYZrange(self,xrange,yrange,zrange): |
|
269 | 269 | self.xrange = xrange |
|
270 | 270 | self.yrange = yrange |
|
271 | 271 | self.zrange = zrange |
|
272 | 272 | |
|
273 | 273 | def setName(self, name): |
|
274 | 274 | self.__name = name |
|
275 | 275 | |
|
276 | 276 | def setScreenPos(self,xpos,ypos): |
|
277 | 277 | self.__xpos = xpos |
|
278 | 278 | self.__ypos = ypos |
|
279 | 279 | |
|
280 | 280 | def setXYData(self,xdata=None,ydata=None,datatype="real"): |
|
281 | 281 | if((xdata != None) and (ydata != None)): |
|
282 | 282 | self.xdata = xdata |
|
283 | 283 | self.ydata = ydata |
|
284 | 284 | self.datatype = datatype |
|
285 | 285 | |
|
286 | 286 | if((self.xdata == None) and (self.ydata == None)): |
|
287 | 287 | return None |
|
288 | 288 | |
|
289 | 289 | return 1 |
|
290 | 290 | |
|
291 | 291 | |
|
292 | 292 | def setLabels(self,xlabel=None,ylabel=None,title=None): |
|
293 | 293 | if xlabel != None: self.xlabel = xlabel |
|
294 | 294 | if ylabel != None: self.ylabel = ylabel |
|
295 | 295 | if title != None: self.title = title |
|
296 | 296 | |
|
297 | 297 | def setSubPlot(self,subplot): |
|
298 | 298 | self.__subplot = subplot |
|
299 | 299 | |
|
300 | 300 | def setSizeOfChar(self,szchar): |
|
301 | 301 | self.__szchar = szchar |
|
302 | 302 | |
|
303 | 303 | def setLineStyle(self,style): |
|
304 | 304 | plplot.pllsty(style) |
|
305 | 305 | |
|
306 | 306 | def setColor(self,color): |
|
307 | 307 | plplot.plcol0(color) |
|
308 | 308 | |
|
309 | 309 | def setXAxisAsTime(self,value=False): |
|
310 | 310 | self.xaxisIsTime = value |
|
311 | 311 | |
|
312 | 312 | def basicLineTimePlot(self, x, y, xmin=None, xmax=None, ymin=None, ymax=None, colline=1): |
|
313 | 313 | |
|
314 | 314 | if xmin == None: xmin = x[0] |
|
315 | 315 | if xmax == None: xmax = x[-1] |
|
316 | 316 | if ymin == None: ymin = y[0] |
|
317 | 317 | if ymax == None: ymax = y[-1] |
|
318 | 318 | |
|
319 | 319 | plplot.plcol0(colline) |
|
320 | 320 | plplot.plline(x, y) |
|
321 | 321 | plplot.plcol0(1) |
|
322 | 322 | |
|
323 | 323 | def basicXYPlot(self, x, y, xmin=None, xmax=None, ymin=None, ymax=None): |
|
324 | 324 | |
|
325 | 325 | if xmin == None: xmin = x[0] |
|
326 | 326 | if xmax == None: xmax = x[-1] |
|
327 | 327 | if ymin == None: ymin = y[0] |
|
328 | 328 | if ymax == None: ymax = y[-1] |
|
329 | 329 | |
|
330 | 330 | plplot.plline(x, y) |
|
331 | 331 | |
|
332 | 332 | def basicPcolorPlot(self, data, x, y, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): |
|
333 | 333 | """ |
|
334 | 334 | """ |
|
335 | 335 | if xmin == None: xmin = x[0] |
|
336 | 336 | if xmax == None: xmax = x[-1] |
|
337 | 337 | if ymin == None: ymin = y[0] |
|
338 | 338 | if ymax == None: ymax = y[-1] |
|
339 | 339 | if zmin == None: zmin = numpy.nanmin(data) |
|
340 | 340 | if zmax == None: zmax = numpy.nanmax(data) |
|
341 | 341 | |
|
342 | 342 | plplot.plimage(data, |
|
343 | 343 | float(x[0]), |
|
344 | 344 | float(x[-1]), |
|
345 | 345 | float(y[0]), |
|
346 | 346 | float(y[-1]), |
|
347 | 347 | float(zmin), |
|
348 | 348 | float(zmax), |
|
349 | 349 | float(xmin), |
|
350 | 350 | float(xmax), |
|
351 | 351 | float(ymin), |
|
352 | 352 | float(ymax) |
|
353 | 353 | ) |
|
354 | 354 | |
|
355 | 355 | def __getBoxpltr(self, x, y, deltax=None, deltay=None): |
|
356 | 356 | |
|
357 | 357 | if not(len(x)>0 and len(y)>0): |
|
358 | 358 | raise ValueError, "x axis and y axis are empty" |
|
359 | 359 | |
|
360 | 360 | if deltax == None: deltax = x[-1] - x[-2] |
|
361 | 361 | if deltay == None: deltay = y[-1] - y[-2] |
|
362 | 362 | |
|
363 | 363 | x1 = numpy.append(x, x[-1] + deltax) |
|
364 | 364 | y1 = numpy.append(y, y[-1] + deltay) |
|
365 | 365 | |
|
366 | 366 | xg = (numpy.multiply.outer(x1, numpy.ones(len(y1)))) |
|
367 | 367 | yg = (numpy.multiply.outer(numpy.ones(len(x1)), y1)) |
|
368 | 368 | |
|
369 | 369 | self.__xg = xg |
|
370 | 370 | self.__yg = yg |
|
371 | 371 | |
|
372 | 372 | return xg, yg |
|
373 | 373 | |
|
374 | 374 | |
|
375 | 375 | def advPcolorPlot(self, data, x, y, xmin=None, xmax=None, ymin=None, ymax=None, zmin=0., zmax=0., deltax=1.0, deltay=None, getGrid = True): |
|
376 | 376 | if getGrid: |
|
377 | 377 | xg, yg = self.__getBoxpltr(x, y, deltax, deltay) |
|
378 | 378 | else: |
|
379 | 379 | xg = self.__xg |
|
380 | 380 | yg = self.__yg |
|
381 | 381 | |
|
382 | 382 | plplot.plimagefr(data, |
|
383 | 383 | float(xmin), |
|
384 | 384 | float(xmax), |
|
385 | 385 | float(ymin), |
|
386 | 386 | float(ymax), |
|
387 | 387 | 0., |
|
388 | 388 | 0., |
|
389 | 389 | float(zmin), |
|
390 | 390 | float(zmax), |
|
391 | 391 | plplot.pltr2, |
|
392 | 392 | xg, |
|
393 | 393 | yg) |
|
394 | 394 | |
|
395 | 395 | |
|
396 | 396 | def colorbarPlot(self, xmin=0., xmax=1., ymin=0., ymax=1.): |
|
397 | 397 | data = numpy.arange(256) |
|
398 | 398 | data = numpy.reshape(data, (1,-1)) |
|
399 | 399 | |
|
400 | 400 | plplot.plimage(data, |
|
401 | 401 | float(xmin), |
|
402 | 402 | float(xmax), |
|
403 | 403 | float(ymin), |
|
404 | 404 | float(ymax), |
|
405 | 405 | 0., |
|
406 | 406 | 255., |
|
407 | 407 | float(xmin), |
|
408 | 408 | float(xmax), |
|
409 | 409 | float(ymin), |
|
410 | 410 | float(ymax)) |
|
411 | 411 | |
|
412 | 412 | def plotBox(self, xmin, xmax, ymin, ymax, xopt, yopt, nolabels=False): |
|
413 | 413 | |
|
414 | 414 | plplot.plschr(0.0,self.__szchar-0.05) |
|
415 | 415 | plplot.pladv(self.__subplot) |
|
416 | 416 | plplot.plvpor(self.__xpos[0], self.__xpos[1], self.__ypos[0], self.__ypos[1]) |
|
417 | 417 | plplot.plwind(float(xmin), # self.xrange[0] |
|
418 | 418 | float(xmax), # self.xrange[1] |
|
419 | 419 | float(ymin), # self.yrange[0] |
|
420 | 420 | float(ymax) # self.yrange[1] |
|
421 | 421 | ) |
|
422 | 422 | |
|
423 | 423 | |
|
424 | 424 | |
|
425 | 425 | if self.xaxisIsTime: |
|
426 | 426 | plplot.pltimefmt("%H:%M") |
|
427 | 427 | timedelta = (xmax - xmin + 1)/8. |
|
428 | 428 | plplot.plbox(xopt, timedelta, 3, yopt, 0.0, 0) |
|
429 | 429 | else: |
|
430 | 430 | plplot.plbox(xopt, 0.0, 0, yopt, 0.0, 0) |
|
431 | 431 | |
|
432 | 432 | |
|
433 | 433 | if not(nolabels): |
|
434 | 434 | plplot.pllab(self.xlabel, self.ylabel, self.title) |
|
435 | 435 | |
|
436 | 436 | |
|
437 | 437 | def delLabels(self): |
|
438 | 438 | self.setColor(15) #Setting Line Color to White |
|
439 | 439 | plplot.pllab(self.xlabel, self.ylabel, self.title) |
|
440 | 440 | self.setColor(1) #Setting Line Color to Black |
|
441 | 441 | |
|
442 | 442 | |
|
443 | 443 | |
|
444 | 444 | def plotImage(self,x,y,z,xrange,yrange,zrange): |
|
445 | 445 | xi = x[0] |
|
446 | 446 | xf = x[-1] |
|
447 | 447 | yi = y[0] |
|
448 | 448 | yf = y[-1] |
|
449 | 449 | |
|
450 | 450 | plplot.plimage(z, |
|
451 | 451 | float(xi), |
|
452 | 452 | float(xf), |
|
453 | 453 | float(yi), |
|
454 | 454 | float(yf), |
|
455 | 455 | float(zrange[0]), |
|
456 | 456 | float(zrange[1]), |
|
457 | 457 | float(xi), |
|
458 | 458 | float(xf), |
|
459 | 459 | float(yrange[0]), |
|
460 | 460 | yrange[1]) |
|
461 | 461 | |
|
462 | 462 | class LinearPlot: |
|
463 | 463 | linearObjDic = {} |
|
464 | 464 | __xpos = None |
|
465 | 465 | __ypos = None |
|
466 | 466 | def __init__(self,indexPlot,nsubplot,winTitle): |
|
467 | 467 | self.width = 700 |
|
468 | 468 | self.height = 150 |
|
469 | 469 | ncol = 1 |
|
470 | 470 | nrow = nsubplot |
|
471 | 471 | initPlplot(indexPlot,ncol,nrow,winTitle,self.width,self.height) |
|
472 | 472 | |
|
473 | 473 | |
|
474 | 474 | def setFigure(self,indexPlot): |
|
475 | 475 | setStrm(indexPlot) |
|
476 | 476 | |
|
477 | 477 | def setPosition(self): |
|
478 | 478 | |
|
479 | 479 | xi = 0.07; xf = 0.9 #0.8,0.7,0.5 |
|
480 | 480 | yi = 0.15; yf = 0.8 |
|
481 | 481 | |
|
482 | 482 | xpos = [xi,xf] |
|
483 | 483 | ypos = [yi,yf] |
|
484 | 484 | |
|
485 | 485 | self.__xpos = xpos |
|
486 | 486 | self.__ypos = ypos |
|
487 | 487 | |
|
488 | 488 | return xpos,ypos |
|
489 | 489 | |
|
490 | 490 | def refresh(self): |
|
491 | 491 | plFlush() |
|
492 | 492 | |
|
493 | 493 | def setup(self,subplot,xmin,xmax,ymin,ymax,title,xlabel,ylabel): |
|
494 | 494 | szchar = 1.10 |
|
495 | 495 | name = "linear" |
|
496 | 496 | key = name + "%d"%subplot |
|
497 | 497 | xrange = [xmin,xmax] |
|
498 | 498 | yrange = [ymin,ymax] |
|
499 | 499 | |
|
500 | 500 | xpos,ypos = self.setPosition() |
|
501 | 501 | linearObj = BaseGraph(name,subplot,xpos,ypos,xlabel,ylabel,title,szchar,xrange,yrange) |
|
502 | 502 | linearObj.plotBox(linearObj.xrange[0], linearObj.xrange[1], linearObj.yrange[0], linearObj.yrange[1], "bcnst", "bcnstv") |
|
503 | 503 | self.linearObjDic[key] = linearObj |
|
504 | 504 | |
|
505 | 505 | def plot(self,subplot,x,y,type="power"): |
|
506 | 506 | name = "linear" |
|
507 | 507 | key = name + "%d"%subplot |
|
508 | 508 | |
|
509 | 509 | linearObj = self.linearObjDic[key] |
|
510 | 510 | linearObj.plotBox(linearObj.xrange[0], linearObj.xrange[1], linearObj.yrange[0], linearObj.yrange[1], "bcst", "bcst") |
|
511 | 511 | |
|
512 | 512 | if linearObj.setXYData() != None: |
|
513 | 513 | clearData(linearObj) |
|
514 | 514 | |
|
515 | 515 | else: |
|
516 | 516 | if type.lower() == 'power': |
|
517 | 517 | linearObj.setXYData(x,abs(y),"real") |
|
518 | 518 | if type.lower() == 'iq': |
|
519 | 519 | linearObj.setXYData(x,y,"complex") |
|
520 | 520 | |
|
521 | 521 | if type.lower() == 'power': |
|
522 | 522 | colline = 9 |
|
523 | 523 | linearObj.basicLineTimePlot(x, abs(y), xmin, xmax, ymin, ymax, colline) |
|
524 | 524 | linearObj.setXYData(x,abs(y),"real") |
|
525 | 525 | |
|
526 | 526 | if type.lower() == 'iq': |
|
527 | 527 | colline = 9 |
|
528 | 528 | linearObj.basicLineTimePlot(x=x, y=y.real, colline=colline) |
|
529 | 529 | colline = 13 |
|
530 | 530 | linearObj.basicLineTimePlot(x=x, y=y.imag, colline=colline) |
|
531 | 531 | |
|
532 | 532 | linearObj.setXYData(x,y,"complex") |
|
533 | 533 | |
|
534 | 534 | linearObj.plotBox(linearObj.xrange[0], linearObj.xrange[1], linearObj.yrange[0], linearObj.yrange[1], "bcst", "bcst") |
|
535 | 535 | |
|
536 | 536 | |
|
537 | 537 | # linearObj.plotBox(linearObj.xrange[0], linearObj.xrange[1], linearObj.yrange[0], linearObj.yrange[1], "bc", "bc") |
|
538 | 538 | # linearObj.basicXYPlot(data,y) |
|
539 | 539 | # linearObj.setXYData(data,y) |
|
540 | 540 | |
|
541 | 541 | |
|
542 | 542 | |
|
543 | 543 | class SpectraPlot: |
|
544 | 544 | pcolorObjDic = {} |
|
545 | 545 | colorbarObjDic = {} |
|
546 | 546 | pwprofileObjDic = {} |
|
547 | 547 | showColorbar = None |
|
548 | 548 | showPowerProfile = None |
|
549 | 549 | XAxisAsTime = None |
|
550 | 550 | widht = None |
|
551 | 551 | height = None |
|
552 | 552 | __spcxpos = None |
|
553 | 553 | __spcypos = None |
|
554 | 554 | __cmapxpos = None |
|
555 | 555 | __cmapypos = None |
|
556 | 556 | __profxpos = None |
|
557 | 557 | __profypos = None |
|
558 | 558 | __lastTitle = None |
|
559 | 559 | |
|
560 | 560 | def __init__(self,indexPlot,nsubplot,winTitle,colormap,showColorbar,showPowerProfile,XAxisAsTime): |
|
561 | 561 | self.width = 460 |
|
562 | 562 | self.height = 300 |
|
563 | 563 | self.showColorbar = showColorbar |
|
564 | 564 | self.showPowerProfile = showPowerProfile |
|
565 | 565 | self.XAxisAsTime = XAxisAsTime |
|
566 | 566 | |
|
567 | 567 | nrow = 2 |
|
568 | 568 | if (nsubplot%2)==0: |
|
569 | 569 | ncol = nsubplot/nrow |
|
570 | 570 | else: |
|
571 | 571 | ncol = int(nsubplot)/nrow + 1 |
|
572 | 572 | |
|
573 | 573 | initPlplot(indexPlot,ncol,nrow,winTitle,self.width,self.height) |
|
574 | 574 | setColormap(colormap) |
|
575 | 575 | self.ncol = ncol |
|
576 | 576 | self.nrow = nrow |
|
577 | 577 | |
|
578 | 578 | def setFigure(self,indexPlot): |
|
579 | 579 | setStrm(indexPlot) |
|
580 | 580 | |
|
581 | 581 | def setSpectraPos(self): #modificar valores de acuerdo al colorbar y pwprofile |
|
582 | 582 | if self.showPowerProfile: xi = 0.09; xf = 0.6 #0.075 |
|
583 | 583 | else: xi = 0.15; xf = 0.8 #0.8,0.7,0.5 |
|
584 | 584 | yi = 0.15; yf = 0.80 |
|
585 | 585 | |
|
586 | 586 | xpos = [xi,xf] |
|
587 | 587 | ypos = [yi,yf] |
|
588 | 588 | |
|
589 | 589 | self.__spcxpos = xpos |
|
590 | 590 | self.__spcypos = ypos |
|
591 | 591 | |
|
592 | 592 | return xpos,ypos |
|
593 | 593 | |
|
594 | 594 | def setColorbarScreenPos(self): |
|
595 | 595 | |
|
596 | 596 | xi = self.__spcxpos[1] + 0.03; xf = xi + 0.03 |
|
597 | 597 | yi = self.__spcypos[0]; yf = self.__spcypos[1] |
|
598 | 598 | |
|
599 | 599 | xpos = [xi,xf] |
|
600 | 600 | ypos = [yi,yf] |
|
601 | 601 | |
|
602 | 602 | self.__cmapxpos = xpos |
|
603 | 603 | self.__cmapypos = ypos |
|
604 | 604 | |
|
605 | 605 | return xpos,ypos |
|
606 | 606 | |
|
607 | 607 | def setPowerprofileScreenPos(self): |
|
608 | 608 | |
|
609 | 609 | xi = self.__cmapxpos[1] + 0.07; xf = xi + 0.25 |
|
610 | 610 | yi = self.__spcypos[0]; yf = self.__spcypos[1] |
|
611 | 611 | |
|
612 | 612 | xpos = [xi,xf] |
|
613 | 613 | ypos = [yi,yf] |
|
614 | 614 | |
|
615 | 615 | self.__profxpos = [xi,xf] |
|
616 | 616 | self.__profypos = [yi,yf] |
|
617 | 617 | |
|
618 | 618 | return xpos,ypos |
|
619 | 619 | |
|
620 | 620 | def setup(self,subplot,xmin,xmax,ymin,ymax,zmin,zmax,title,xlabel,ylabel): |
|
621 | 621 | # Config Spectra plot |
|
622 | 622 | szchar = 0.7 |
|
623 | 623 | name = "spc" |
|
624 | 624 | key = name + "%d"%subplot |
|
625 | 625 | xrange = [xmin,xmax] |
|
626 | 626 | yrange = [ymin,ymax] |
|
627 | 627 | zrange = [zmin,zmax] |
|
628 | 628 | |
|
629 | 629 | xpos,ypos = self.setSpectraPos() |
|
630 | 630 | pcolorObj = BaseGraph(name,subplot,xpos,ypos,xlabel,ylabel,title,szchar,xrange,yrange,zrange) |
|
631 | 631 | pcolorObj.plotBox(pcolorObj.xrange[0], pcolorObj.xrange[1], pcolorObj.yrange[0], pcolorObj.yrange[1], "bcnst", "bcnstv") |
|
632 | 632 | self.pcolorObjDic[key] = pcolorObj |
|
633 | 633 | |
|
634 | 634 | # Config Colorbar |
|
635 | 635 | if self.showColorbar: |
|
636 | 636 | szchar = 0.65 |
|
637 | 637 | name = "colorbar" |
|
638 | 638 | key = name + "%d"%subplot |
|
639 | 639 | |
|
640 | 640 | xpos,ypos = self.setColorbarScreenPos() |
|
641 | 641 | xrange = [0.,1.] |
|
642 | 642 | yrange = [zmin,zmax] |
|
643 | 643 | cmapObj = BaseGraph(name,subplot,xpos,ypos,"","","dB",szchar,xrange,yrange) |
|
644 | 644 | cmapObj.plotBox(cmapObj.xrange[0], cmapObj.xrange[1], cmapObj.yrange[0], cmapObj.yrange[1], "bc", "bcm") |
|
645 | 645 | cmapObj.colorbarPlot(cmapObj.xrange[0], cmapObj.xrange[1], cmapObj.yrange[0], cmapObj.yrange[1]) |
|
646 | 646 | cmapObj.plotBox(cmapObj.xrange[0], cmapObj.xrange[1], cmapObj.yrange[0], cmapObj.yrange[1], "bc", "bcmtsv") |
|
647 | 647 | self.colorbarObjDic[key] = cmapObj |
|
648 | 648 | |
|
649 | 649 | # Config Power profile |
|
650 | 650 | if self.showPowerProfile: |
|
651 | 651 | szchar = 0.55 |
|
652 | 652 | name = "pwprofile" |
|
653 | 653 | key = name + "%d"%subplot |
|
654 | 654 | |
|
655 | 655 | xpos,ypos = self.setPowerprofileScreenPos() |
|
656 | 656 | xrange = [zmin,zmax] |
|
657 | 657 | yrange = [ymin,ymax] |
|
658 | 658 | powObj = BaseGraph(name,subplot,xpos,ypos,"dB","","Power Profile",szchar,xrange,yrange) |
|
659 | 659 | powObj.setLineStyle(2) |
|
660 | 660 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bcntg", "bc") |
|
661 | 661 | powObj.setLineStyle(1) |
|
662 | 662 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bc", "bc") |
|
663 | 663 | self.pwprofileObjDic[key] = powObj |
|
664 | 664 | |
|
665 | 665 | def printTitle(self,pltitle): |
|
666 | 666 | if self.__lastTitle != None: |
|
667 | 667 | setPlTitle(self.__lastTitle,"white") |
|
668 | 668 | |
|
669 | 669 | self.__lastTitle = pltitle |
|
670 | 670 | |
|
671 | 671 | setPlTitle(pltitle,"black") |
|
672 | 672 | |
|
673 | 673 | setSubpages(self.ncol,self.nrow) |
|
674 | 674 | |
|
675 | 675 | def plot(self,subplot,x,y,z,subtitle): |
|
676 | 676 | # Spectra plot |
|
677 | 677 | |
|
678 | 678 | name = "spc" |
|
679 | 679 | key = name + "%d"%subplot |
|
680 | 680 | |
|
681 | 681 | # newx = [x[0],x[-1]] |
|
682 | 682 | pcolorObj = self.pcolorObjDic[key] |
|
683 | 683 | pcolorObj.plotBox(pcolorObj.xrange[0], pcolorObj.xrange[1], pcolorObj.yrange[0], pcolorObj.yrange[1], "bcst", "bcst") |
|
684 | 684 | pcolorObj.delLabels() |
|
685 | 685 | pcolorObj.setLabels(title=subtitle) |
|
686 | 686 | |
|
687 | 687 | deltax = None; deltay = None |
|
688 | 688 | |
|
689 | 689 | pcolorObj.advPcolorPlot(z, |
|
690 | 690 | x, |
|
691 | 691 | y, |
|
692 | 692 | xmin=pcolorObj.xrange[0], |
|
693 | 693 | xmax=pcolorObj.xrange[1], |
|
694 | 694 | ymin=pcolorObj.yrange[0], |
|
695 | 695 | ymax=pcolorObj.yrange[1], |
|
696 | 696 | zmin=pcolorObj.zrange[0], |
|
697 | 697 | zmax=pcolorObj.zrange[1], |
|
698 | 698 | deltax=deltax, |
|
699 | 699 | deltay=deltay, |
|
700 | 700 | getGrid=pcolorObj.getGrid) |
|
701 | 701 | |
|
702 | 702 | pcolorObj.getGrid = False |
|
703 | 703 | |
|
704 | 704 | pcolorObj.plotBox(pcolorObj.xrange[0], pcolorObj.xrange[1], pcolorObj.yrange[0], pcolorObj.yrange[1], "bcst", "bcst") |
|
705 | 705 | |
|
706 | 706 | # Power Profile |
|
707 | 707 | if self.showPowerProfile: |
|
708 | 708 | power = numpy.average(z, axis=0) |
|
709 | 709 | name = "pwprofile" |
|
710 | 710 | key = name + "%d"%subplot |
|
711 | 711 | powObj = self.pwprofileObjDic[key] |
|
712 | 712 | |
|
713 | 713 | if powObj.setXYData() != None: |
|
714 | 714 | clearData(powObj) |
|
715 | powObj.setLineStyle(2) | |
|
716 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bcntg", "bc") | |
|
717 | powObj.setLineStyle(1) | |
|
715 | 718 | else: |
|
716 | 719 | powObj.setXYData(power,y) |
|
717 | 720 | |
|
718 | 721 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bc", "bc") |
|
719 | 722 | powObj.basicXYPlot(power,y) |
|
720 | 723 | powObj.setXYData(power,y) |
|
721 | 724 | |
|
722 | 725 | def refresh(self): |
|
723 | 726 | plFlush() |
|
724 | 727 | |
|
725 | 728 | class RtiPlot: |
|
726 | 729 | |
|
727 | 730 | pcolorObjDic = {} |
|
728 | 731 | colorbarObjDic = {} |
|
729 | 732 | pwprofileObjDic = {} |
|
730 | 733 | showColorbar = None |
|
731 | 734 | showPowerProfile = None |
|
732 | 735 | XAxisAsTime = None |
|
733 | 736 | widht = None |
|
734 | 737 | height = None |
|
735 | 738 | __rtixpos = None |
|
736 | 739 | __rtiypos = None |
|
737 | 740 | __cmapxpos = None |
|
738 | 741 | __cmapypos = None |
|
739 | 742 | __profxpos = None |
|
740 | 743 | __profypos = None |
|
741 | 744 | |
|
742 | 745 | def __init__(self,indexPlot,nsubplot,winTitle,colormap,showColorbar,showPowerProfile,XAxisAsTime): |
|
743 | 746 | self.width = 700 |
|
744 | 747 | self.height = 150 |
|
745 | 748 | self.showColorbar = showColorbar |
|
746 | 749 | self.showPowerProfile = showPowerProfile |
|
747 | 750 | self.XAxisAsTime = XAxisAsTime |
|
748 | 751 | |
|
749 | 752 | ncol = 1 |
|
750 | 753 | nrow = nsubplot |
|
751 | 754 | initPlplot(indexPlot,ncol,nrow,winTitle,self.width,self.height) |
|
752 | 755 | setColormap(colormap) |
|
753 | 756 | |
|
754 | 757 | def setFigure(self,indexPlot): |
|
755 | 758 | setStrm(indexPlot) |
|
756 | 759 | |
|
757 | 760 | def setRtiScreenPos(self): |
|
758 | 761 | |
|
759 | 762 | if self.showPowerProfile: xi = 0.07; xf = 0.65 |
|
760 | 763 | else: xi = 0.07; xf = 0.9 |
|
761 | 764 | yi = 0.15; yf = 0.80 |
|
762 | 765 | |
|
763 | 766 | xpos = [xi,xf] |
|
764 | 767 | ypos = [yi,yf] |
|
765 | 768 | |
|
766 | 769 | self.__rtixpos = xpos |
|
767 | 770 | self.__rtiypos = ypos |
|
768 | 771 | |
|
769 | 772 | return xpos,ypos |
|
770 | 773 | |
|
771 | 774 | def setColorbarScreenPos(self): |
|
772 | 775 | |
|
773 | 776 | xi = self.__rtixpos[1] + 0.03; xf = xi + 0.03 |
|
774 | 777 | |
|
775 | 778 | yi = self.__rtiypos[0]; yf = self.__rtiypos[1] |
|
776 | 779 | |
|
777 | 780 | xpos = [xi,xf] |
|
778 | 781 | ypos = [yi,yf] |
|
779 | 782 | |
|
780 | 783 | self.__cmapxpos = xpos |
|
781 | 784 | self.__cmapypos = ypos |
|
782 | 785 | |
|
783 | 786 | return xpos,ypos |
|
784 | 787 | |
|
785 | 788 | def setPowerprofileScreenPos(self): |
|
786 | 789 | |
|
787 | 790 | xi = self.__cmapxpos[1] + 0.05; xf = xi + 0.20 |
|
788 | 791 | |
|
789 | 792 | yi = self.__rtiypos[0]; yf = self.__rtiypos[1] |
|
790 | 793 | |
|
791 | 794 | xpos = [xi,xf] |
|
792 | 795 | ypos = [yi,yf] |
|
793 | 796 | |
|
794 | 797 | self.__profxpos = [xi,xf] |
|
795 | 798 | self.__profypos = [yi,yf] |
|
796 | 799 | |
|
797 | 800 | return xpos,ypos |
|
798 | 801 | |
|
799 | 802 | def setup(self,subplot,xmin,xmax,ymin,ymax,zmin,zmax,title,xlabel,ylabel,timedata,timezone="lt",npoints=100): |
|
800 | 803 | # Config Rti plot |
|
801 | 804 | szchar = 1.10 |
|
802 | 805 | name = "rti" |
|
803 | 806 | key = name + "%d"%subplot |
|
804 | 807 | |
|
805 | 808 | # xmin, xmax --> minHour, max Hour : valores que definen el ejex x=[horaInicio,horaFinal] |
|
806 | 809 | thisDateTime = datetime.datetime.fromtimestamp(timedata) |
|
807 | 810 | startDateTime = datetime.datetime(thisDateTime.year,thisDateTime.month,thisDateTime.day,xmin,0,0) |
|
808 | 811 | endDateTime = datetime.datetime(thisDateTime.year,thisDateTime.month,thisDateTime.day,xmax,59,59) |
|
809 | 812 | deltaTime = 0 |
|
810 | 813 | if timezone == "lt": |
|
811 | 814 | deltaTime = time.timezone |
|
812 | 815 | startTimeInSecs = time.mktime(startDateTime.timetuple()) - deltaTime |
|
813 | 816 | endTimeInSecs = time.mktime(endDateTime.timetuple()) - deltaTime |
|
814 | 817 | |
|
815 | 818 | xrange = [startTimeInSecs,endTimeInSecs] |
|
816 | 819 | totalTimeInXrange = endTimeInSecs - startTimeInSecs + 1. |
|
817 | 820 | deltax = totalTimeInXrange / npoints |
|
818 | 821 | |
|
819 | 822 | yrange = [ymin,ymax] |
|
820 | 823 | zrange = [zmin,zmax] |
|
821 | 824 | |
|
822 | 825 | xpos,ypos = self.setRtiScreenPos() |
|
823 | 826 | pcolorObj = BaseGraph(name,subplot,xpos,ypos,xlabel,ylabel,title,szchar,xrange,yrange,zrange,deltax) |
|
824 | 827 | if self.XAxisAsTime: |
|
825 | 828 | pcolorObj.setXAxisAsTime(self.XAxisAsTime) |
|
826 | 829 | xopt = "bcnstd" |
|
827 | 830 | yopt = "bcnstv" |
|
828 | 831 | else: |
|
829 | 832 | xopt = "bcnst" |
|
830 | 833 | yopt = "bcnstv" |
|
831 | 834 | |
|
832 | 835 | pcolorObj.plotBox(pcolorObj.xrange[0], pcolorObj.xrange[1], pcolorObj.yrange[0], pcolorObj.yrange[1], xopt, yopt) |
|
833 | 836 | self.pcolorObjDic[key] = pcolorObj |
|
834 | 837 | |
|
835 | 838 | |
|
836 | 839 | # Config Colorbar |
|
837 | 840 | if self.showColorbar: |
|
838 | 841 | szchar = 0.9 |
|
839 | 842 | name = "colorbar" |
|
840 | 843 | key = name + "%d"%subplot |
|
841 | 844 | |
|
842 | 845 | xpos,ypos = self.setColorbarScreenPos() |
|
843 | 846 | xrange = [0.,1.] |
|
844 | 847 | yrange = [zmin,zmax] |
|
845 | 848 | cmapObj = BaseGraph(name,subplot,xpos,ypos,"","","dB",szchar,xrange,yrange) |
|
846 | 849 | cmapObj.plotBox(cmapObj.xrange[0], cmapObj.xrange[1], cmapObj.yrange[0], cmapObj.yrange[1], "bc", "bcm") |
|
847 | 850 | cmapObj.colorbarPlot(cmapObj.xrange[0], cmapObj.xrange[1], cmapObj.yrange[0], cmapObj.yrange[1]) |
|
848 | 851 | cmapObj.plotBox(cmapObj.xrange[0], cmapObj.xrange[1], cmapObj.yrange[0], cmapObj.yrange[1], "bc", "bcmtsv") |
|
849 | 852 | self.colorbarObjDic[key] = cmapObj |
|
850 | 853 | |
|
851 | 854 | |
|
852 | 855 | # Config Power profile |
|
853 | 856 | if self.showPowerProfile: |
|
854 | 857 | szchar = 0.8 |
|
855 | 858 | name = "pwprofile" |
|
856 | 859 | key = name + "%d"%subplot |
|
857 | 860 | |
|
858 | 861 | xpos,ypos = self.setPowerprofileScreenPos() |
|
859 | 862 | xrange = [zmin,zmax] |
|
860 | 863 | yrange = [ymin,ymax] |
|
861 | 864 | powObj = BaseGraph(name,subplot,xpos,ypos,"dB","","Power Profile",szchar,xrange,yrange) |
|
862 | 865 | powObj.setLineStyle(2) |
|
863 | 866 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bcntg", "bc") |
|
864 | 867 | powObj.setLineStyle(1) |
|
865 | 868 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bc", "bc") |
|
866 | 869 | self.pwprofileObjDic[key] = powObj |
|
867 | 870 | |
|
868 | 871 | |
|
869 | 872 | def plot(self,subplot,x,y,z): |
|
870 | 873 | # RTI plot |
|
871 | 874 | name = "rti" |
|
872 | 875 | key = name + "%d"%subplot |
|
873 | 876 | |
|
874 | 877 | data = numpy.reshape(z, (1,-1)) |
|
875 | 878 | data = numpy.abs(data) |
|
876 | 879 | data = 10*numpy.log10(data) |
|
877 | 880 | newx = [x,x+1] |
|
878 | 881 | |
|
879 | 882 | pcolorObj = self.pcolorObjDic[key] |
|
880 | 883 | |
|
881 | 884 | if pcolorObj.xaxisIsTime: |
|
882 | 885 | xopt = "bcstd" |
|
883 | 886 | yopt = "bcst" |
|
884 | 887 | else: |
|
885 | 888 | xopt = "bcst" |
|
886 | 889 | yopt = "bcst" |
|
887 | 890 | |
|
888 | 891 | pcolorObj.plotBox(pcolorObj.xrange[0], pcolorObj.xrange[1], pcolorObj.yrange[0], pcolorObj.yrange[1], xopt, yopt) |
|
889 | 892 | |
|
890 | 893 | deltax = pcolorObj.deltax |
|
891 | 894 | deltay = None |
|
892 | 895 | |
|
893 | 896 | if pcolorObj.xmin == None and pcolorObj.xmax == None: |
|
894 | 897 | pcolorObj.xmin = x |
|
895 | 898 | pcolorObj.xmax = x |
|
896 | 899 | |
|
897 | 900 | if x >= pcolorObj.xmax: |
|
898 | 901 | xmin = x |
|
899 | 902 | xmax = x + deltax |
|
900 | 903 | x = [x] |
|
901 | 904 | pcolorObj.advPcolorPlot(data, |
|
902 | 905 | x, |
|
903 | 906 | y, |
|
904 | 907 | xmin=xmin, |
|
905 | 908 | xmax=xmax, |
|
906 | 909 | ymin=pcolorObj.yrange[0], |
|
907 | 910 | ymax=pcolorObj.yrange[1], |
|
908 | 911 | zmin=pcolorObj.zrange[0], |
|
909 | 912 | zmax=pcolorObj.zrange[1], |
|
910 | 913 | deltax=deltax, |
|
911 | 914 | deltay=deltay, |
|
912 | 915 | getGrid=pcolorObj.getGrid) |
|
913 | 916 | |
|
914 | 917 | pcolorObj.xmin = xmin |
|
915 | 918 | pcolorObj.xmax = xmax |
|
916 | 919 | |
|
917 | 920 | |
|
918 | 921 | # Power Profile |
|
919 | 922 | if self.showPowerProfile: |
|
920 | 923 | data = numpy.reshape(data,(numpy.size(data))) |
|
921 | 924 | name = "pwprofile" |
|
922 | 925 | key = name + "%d"%subplot |
|
923 | 926 | powObj = self.pwprofileObjDic[key] |
|
924 | 927 | |
|
925 | 928 | if powObj.setXYData() != None: |
|
926 | 929 | clearData(powObj) |
|
927 | 930 | powObj.setLineStyle(2) |
|
928 | 931 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bcntg", "bc") |
|
929 | 932 | powObj.setLineStyle(1) |
|
930 | 933 | else: |
|
931 | 934 | powObj.setXYData(data,y) |
|
932 | 935 | |
|
933 | 936 | powObj.plotBox(powObj.xrange[0], powObj.xrange[1], powObj.yrange[0], powObj.yrange[1], "bc", "bc") |
|
934 | 937 | powObj.basicXYPlot(data,y) |
|
935 | 938 | powObj.setXYData(data,y) |
|
936 | 939 | |
|
937 | 940 | def refresh(self): |
|
938 | 941 | plFlush() No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now