##// END OF EJS Templates
Agrega la clase ProfileSelector y el metodo filterByHeights en jroprocessing.py...
Daniel Valdez -
r233:1c9beb790bbb
parent child
Show More
@@ -1,823 +1,967
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 WIDTHPROF = None
11 11 HEIGHTPROF = None
12 12 PREFIX = 'cspc'
13 13
14 14 def __init__(self):
15 15
16 16 self.__isConfig = False
17 17 self.__nsubplots = 4
18 18
19 19 self.WIDTH = 300
20 20 self.HEIGHT = 400
21 21 self.WIDTHPROF = 0
22 22 self.HEIGHTPROF = 0
23 23
24 24 def getSubplots(self):
25 25
26 26 ncol = 4
27 27 nrow = self.nplots
28 28
29 29 return nrow, ncol
30 30
31 31 def setup(self, idfigure, nplots, wintitle, showprofile=True):
32 32
33 33 self.__showprofile = showprofile
34 34 self.nplots = nplots
35 35
36 36 ncolspan = 1
37 37 colspan = 1
38 38
39 39 self.createFigure(idfigure = idfigure,
40 40 wintitle = wintitle,
41 41 widthplot = self.WIDTH + self.WIDTHPROF,
42 42 heightplot = self.HEIGHT + self.HEIGHTPROF)
43 43
44 44 nrow, ncol = self.getSubplots()
45 45
46 46 counter = 0
47 47 for y in range(nrow):
48 48 for x in range(ncol):
49 49 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
50 50
51 51 counter += 1
52 52
53 53 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
54 54 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
55 55 save=False, figpath='./', figfile=None):
56 56
57 57 """
58 58
59 59 Input:
60 60 dataOut :
61 61 idfigure :
62 62 wintitle :
63 63 channelList :
64 64 showProfile :
65 65 xmin : None,
66 66 xmax : None,
67 67 ymin : None,
68 68 ymax : None,
69 69 zmin : None,
70 70 zmax : None
71 71 """
72 72
73 73 if pairsList == None:
74 74 pairsIndexList = dataOut.pairsIndexList
75 75 else:
76 76 pairsIndexList = []
77 77 for pair in pairsList:
78 78 if pair not in dataOut.pairsList:
79 79 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
80 80 pairsIndexList.append(dataOut.pairsList.index(pair))
81 81
82 82 if pairsIndexList == []:
83 83 return
84 84
85 85 if len(pairsIndexList) > 4:
86 86 pairsIndexList = pairsIndexList[0:4]
87 87
88 88 x = dataOut.getFreqRange(1)
89 89 y = dataOut.getHeiRange()
90 90 z = 10.*numpy.log10(dataOut.data_spc[:,:,:])
91 91 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
92 92 avg = numpy.average(numpy.abs(z), axis=1)
93 93
94 94 noise = dataOut.getNoise()
95 95
96 96 if not self.__isConfig:
97 97
98 98 nplots = len(pairsIndexList)
99 99
100 100 self.setup(idfigure=idfigure,
101 101 nplots=nplots,
102 102 wintitle=wintitle,
103 103 showprofile=showprofile)
104 104
105 105 if xmin == None: xmin = numpy.nanmin(x)
106 106 if xmax == None: xmax = numpy.nanmax(x)
107 107 if ymin == None: ymin = numpy.nanmin(y)
108 108 if ymax == None: ymax = numpy.nanmax(y)
109 109 if zmin == None: zmin = numpy.nanmin(avg)*0.9
110 110 if zmax == None: zmax = numpy.nanmax(avg)*0.9
111 111
112 112 self.__isConfig = True
113 113
114 114 thisDatetime = dataOut.datatime
115 115 title = "Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
116 116 xlabel = "Velocity (m/s)"
117 117 ylabel = "Range (Km)"
118 118
119 119 self.setWinTitle(title)
120 120
121 121 for i in range(self.nplots):
122 122 pair = dataOut.pairsList[pairsIndexList[i]]
123 123
124 124 title = "Channel %d: %4.2fdB" %(pair[0], noise[pair[0]])
125 125 z = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:])
126 126 axes0 = self.axesList[i*self.__nsubplots]
127 127 axes0.pcolor(x, y, z,
128 128 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
129 129 xlabel=xlabel, ylabel=ylabel, title=title,
130 130 ticksize=9, cblabel='')
131 131
132 132 title = "Channel %d: %4.2fdB" %(pair[1], noise[pair[1]])
133 133 z = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:])
134 134 axes0 = self.axesList[i*self.__nsubplots+1]
135 135 axes0.pcolor(x, y, z,
136 136 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
137 137 xlabel=xlabel, ylabel=ylabel, title=title,
138 138 ticksize=9, cblabel='')
139 139
140 140 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
141 141 coherence = numpy.abs(coherenceComplex)
142 142 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
143 143
144 144
145 145 title = "Coherence %d%d" %(pair[0], pair[1])
146 146 axes0 = self.axesList[i*self.__nsubplots+2]
147 147 axes0.pcolor(x, y, coherence,
148 148 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
149 149 xlabel=xlabel, ylabel=ylabel, title=title,
150 150 ticksize=9, cblabel='')
151 151
152 152 title = "Phase %d%d" %(pair[0], pair[1])
153 153 axes0 = self.axesList[i*self.__nsubplots+3]
154 154 axes0.pcolor(x, y, phase,
155 155 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
156 156 xlabel=xlabel, ylabel=ylabel, title=title,
157 157 ticksize=9, cblabel='', colormap='RdBu')
158 158
159 159
160 160
161 161 self.draw()
162 162
163 163 if save:
164 164 date = thisDatetime.strftime("%Y%m%d")
165 165 if figfile == None:
166 166 figfile = self.getFilename(name = date)
167 167
168 168 self.saveFigure(figpath, figfile)
169 169
170 170
171 171 class RTIPlot(Figure):
172 172
173 173 __isConfig = None
174 174 __nsubplots = None
175 175
176 176 WIDTHPROF = None
177 177 HEIGHTPROF = None
178 178 PREFIX = 'rti'
179 179
180 180 def __init__(self):
181 181
182 182 self.timerange = 24*60*60
183 183 self.__isConfig = False
184 184 self.__nsubplots = 1
185 185
186 186 self.WIDTH = 800
187 187 self.HEIGHT = 200
188 188 self.WIDTHPROF = 120
189 189 self.HEIGHTPROF = 0
190 190
191 191 def getSubplots(self):
192 192
193 193 ncol = 1
194 194 nrow = self.nplots
195 195
196 196 return nrow, ncol
197 197
198 198 def setup(self, idfigure, nplots, wintitle, showprofile=True):
199 199
200 200 self.__showprofile = showprofile
201 201 self.nplots = nplots
202 202
203 203 ncolspan = 1
204 204 colspan = 1
205 205 if showprofile:
206 206 ncolspan = 7
207 207 colspan = 6
208 208 self.__nsubplots = 2
209 209
210 210 self.createFigure(idfigure = idfigure,
211 211 wintitle = wintitle,
212 212 widthplot = self.WIDTH + self.WIDTHPROF,
213 213 heightplot = self.HEIGHT + self.HEIGHTPROF)
214 214
215 215 nrow, ncol = self.getSubplots()
216 216
217 217 counter = 0
218 218 for y in range(nrow):
219 219 for x in range(ncol):
220 220
221 221 if counter >= self.nplots:
222 222 break
223 223
224 224 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
225 225
226 226 if showprofile:
227 227 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
228 228
229 229 counter += 1
230 230
231 231 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
232 232 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
233 233 timerange=None,
234 234 save=False, figpath='./', figfile=None):
235 235
236 236 """
237 237
238 238 Input:
239 239 dataOut :
240 240 idfigure :
241 241 wintitle :
242 242 channelList :
243 243 showProfile :
244 244 xmin : None,
245 245 xmax : None,
246 246 ymin : None,
247 247 ymax : None,
248 248 zmin : None,
249 249 zmax : None
250 250 """
251 251
252 252 if channelList == None:
253 253 channelIndexList = dataOut.channelIndexList
254 254 else:
255 255 channelIndexList = []
256 256 for channel in channelList:
257 257 if channel not in dataOut.channelList:
258 258 raise ValueError, "Channel %d is not in dataOut.channelList"
259 259 channelIndexList.append(dataOut.channelList.index(channel))
260 260
261 261 if timerange != None:
262 262 self.timerange = timerange
263 263
264 264 tmin = None
265 265 tmax = None
266 266 x = dataOut.getTimeRange()
267 267 y = dataOut.getHeiRange()
268 268 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
269 269 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
270 270 avg = numpy.average(z, axis=1)
271 271
272 272 noise = dataOut.getNoise()
273 273
274 274 if not self.__isConfig:
275 275
276 276 nplots = len(channelIndexList)
277 277
278 278 self.setup(idfigure=idfigure,
279 279 nplots=nplots,
280 280 wintitle=wintitle,
281 281 showprofile=showprofile)
282 282
283 283 tmin, tmax = self.getTimeLim(x, xmin, xmax)
284 284 if ymin == None: ymin = numpy.nanmin(y)
285 285 if ymax == None: ymax = numpy.nanmax(y)
286 286 if zmin == None: zmin = numpy.nanmin(avg)*0.9
287 287 if zmax == None: zmax = numpy.nanmax(avg)*0.9
288 288
289 289 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
290 290 self.__isConfig = True
291 291
292 292 thisDatetime = dataOut.datatime
293 293 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
294 294 xlabel = "Velocity (m/s)"
295 295 ylabel = "Range (Km)"
296 296
297 297 self.setWinTitle(title)
298 298
299 299 for i in range(self.nplots):
300 300 title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
301 301 axes = self.axesList[i*self.__nsubplots]
302 302 z = avg[i].reshape((1,-1))
303 303 axes.pcolor(x, y, z,
304 304 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
305 305 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
306 306 ticksize=9, cblabel='', cbsize="1%")
307 307
308 308 if self.__showprofile:
309 309 axes = self.axesList[i*self.__nsubplots +1]
310 310 axes.pline(avg[i], y,
311 311 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
312 312 xlabel='dB', ylabel='', title='',
313 313 ytick_visible=False,
314 314 grid='x')
315 315
316 316 self.draw()
317 317
318 318 if save:
319 319
320 320 if figfile == None:
321 321 figfile = self.getFilename(name = self.name)
322 322
323 323 self.saveFigure(figpath, figfile)
324 324
325 325 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
326 326 self.__isConfig = False
327 327
328 328 class SpectraPlot(Figure):
329 329
330 330 __isConfig = None
331 331 __nsubplots = None
332 332
333 333 WIDTHPROF = None
334 334 HEIGHTPROF = None
335 335 PREFIX = 'spc'
336 336
337 337 def __init__(self):
338 338
339 339 self.__isConfig = False
340 340 self.__nsubplots = 1
341 341
342 342 self.WIDTH = 300
343 343 self.HEIGHT = 400
344 344 self.WIDTHPROF = 120
345 345 self.HEIGHTPROF = 0
346 346
347 347 def getSubplots(self):
348 348
349 349 ncol = int(numpy.sqrt(self.nplots)+0.9)
350 350 nrow = int(self.nplots*1./ncol + 0.9)
351 351
352 352 return nrow, ncol
353 353
354 354 def setup(self, idfigure, nplots, wintitle, showprofile=True):
355 355
356 356 self.__showprofile = showprofile
357 357 self.nplots = nplots
358 358
359 359 ncolspan = 1
360 360 colspan = 1
361 361 if showprofile:
362 362 ncolspan = 3
363 363 colspan = 2
364 364 self.__nsubplots = 2
365 365
366 366 self.createFigure(idfigure = idfigure,
367 367 wintitle = wintitle,
368 368 widthplot = self.WIDTH + self.WIDTHPROF,
369 369 heightplot = self.HEIGHT + self.HEIGHTPROF)
370 370
371 371 nrow, ncol = self.getSubplots()
372 372
373 373 counter = 0
374 374 for y in range(nrow):
375 375 for x in range(ncol):
376 376
377 377 if counter >= self.nplots:
378 378 break
379 379
380 380 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
381 381
382 382 if showprofile:
383 383 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
384 384
385 385 counter += 1
386 386
387 387 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
388 388 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
389 389 save=False, figpath='./', figfile=None):
390 390
391 391 """
392 392
393 393 Input:
394 394 dataOut :
395 395 idfigure :
396 396 wintitle :
397 397 channelList :
398 398 showProfile :
399 399 xmin : None,
400 400 xmax : None,
401 401 ymin : None,
402 402 ymax : None,
403 403 zmin : None,
404 404 zmax : None
405 405 """
406 406
407 407 if channelList == None:
408 408 channelIndexList = dataOut.channelIndexList
409 409 else:
410 410 channelIndexList = []
411 411 for channel in channelList:
412 412 if channel not in dataOut.channelList:
413 413 raise ValueError, "Channel %d is not in dataOut.channelList"
414 414 channelIndexList.append(dataOut.channelList.index(channel))
415 415
416 416 x = dataOut.getVelRange(1)
417 417 y = dataOut.getHeiRange()
418 418
419 419 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
420 420 z = numpy.where(numpy.isfinite(z), z, numpy.NAN)
421 421 avg = numpy.average(z, axis=1)
422 422
423 423 noise = dataOut.getNoise()
424 424
425 425 if not self.__isConfig:
426 426
427 427 nplots = len(channelIndexList)
428 428
429 429 self.setup(idfigure=idfigure,
430 430 nplots=nplots,
431 431 wintitle=wintitle,
432 432 showprofile=showprofile)
433 433
434 434 if xmin == None: xmin = numpy.nanmin(x)
435 435 if xmax == None: xmax = numpy.nanmax(x)
436 436 if ymin == None: ymin = numpy.nanmin(y)
437 437 if ymax == None: ymax = numpy.nanmax(y)
438 438 if zmin == None: zmin = numpy.nanmin(avg)*0.9
439 439 if zmax == None: zmax = numpy.nanmax(avg)*0.9
440 440
441 441 self.__isConfig = True
442 442
443 443 thisDatetime = dataOut.datatime
444 444 title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
445 445 xlabel = "Velocity (m/s)"
446 446 ylabel = "Range (Km)"
447 447
448 448 self.setWinTitle(title)
449 449
450 450 for i in range(self.nplots):
451 451 title = "Channel %d: %4.2fdB" %(dataOut.channelList[i], noise[i])
452 452 axes = self.axesList[i*self.__nsubplots]
453 453 axes.pcolor(x, y, z[i,:,:],
454 454 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
455 455 xlabel=xlabel, ylabel=ylabel, title=title,
456 456 ticksize=9, cblabel='')
457 457
458 458 if self.__showprofile:
459 459 axes = self.axesList[i*self.__nsubplots +1]
460 460 axes.pline(avg[i], y,
461 461 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
462 462 xlabel='dB', ylabel='', title='',
463 463 ytick_visible=False,
464 464 grid='x')
465 465
466 466 self.draw()
467 467
468 468 if save:
469 469 date = thisDatetime.strftime("%Y%m%d")
470 470 if figfile == None:
471 471 figfile = self.getFilename(name = date)
472 472
473 473 self.saveFigure(figpath, figfile)
474 474
475 475 class Scope(Figure):
476 476
477 477 __isConfig = None
478 478
479 479 def __init__(self):
480 480
481 481 self.__isConfig = False
482 482 self.WIDTH = 600
483 483 self.HEIGHT = 200
484 484
485 485 def getSubplots(self):
486 486
487 487 nrow = self.nplots
488 488 ncol = 3
489 489 return nrow, ncol
490 490
491 491 def setup(self, idfigure, nplots, wintitle):
492 492
493 493 self.nplots = nplots
494 494
495 495 self.createFigure(idfigure, wintitle)
496 496
497 497 nrow,ncol = self.getSubplots()
498 498 colspan = 3
499 499 rowspan = 1
500 500
501 501 for i in range(nplots):
502 502 self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
503 503
504 504
505 505
506 506 def run(self, dataOut, idfigure, wintitle="", channelList=None,
507 507 xmin=None, xmax=None, ymin=None, ymax=None, save=False, filename=None):
508 508
509 509 """
510 510
511 511 Input:
512 512 dataOut :
513 513 idfigure :
514 514 wintitle :
515 515 channelList :
516 516 xmin : None,
517 517 xmax : None,
518 518 ymin : None,
519 519 ymax : None,
520 520 """
521 521
522 522 if channelList == None:
523 523 channelIndexList = dataOut.channelIndexList
524 524 else:
525 525 channelIndexList = []
526 526 for channel in channelList:
527 527 if channel not in dataOut.channelList:
528 528 raise ValueError, "Channel %d is not in dataOut.channelList"
529 529 channelIndexList.append(dataOut.channelList.index(channel))
530 530
531 531 x = dataOut.heightList
532 532 y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:])
533 533 y = y.real
534 534
535 535 if not self.__isConfig:
536 536 nplots = len(channelIndexList)
537 537
538 538 self.setup(idfigure=idfigure,
539 539 nplots=nplots,
540 540 wintitle=wintitle)
541 541
542 542 if xmin == None: xmin = numpy.nanmin(x)
543 543 if xmax == None: xmax = numpy.nanmax(x)
544 544 if ymin == None: ymin = numpy.nanmin(y)
545 545 if ymax == None: ymax = numpy.nanmax(y)
546 546
547 547 self.__isConfig = True
548 548
549 549
550 550 thisDatetime = dataOut.datatime
551 551 title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
552 552 xlabel = "Range (Km)"
553 553 ylabel = "Intensity"
554 554
555 555 self.setWinTitle(title)
556 556
557 557 for i in range(len(self.axesList)):
558 558 title = "Channel %d" %(i)
559 559 axes = self.axesList[i]
560 560 ychannel = y[i,:]
561 561 axes.pline(x, ychannel,
562 562 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
563 563 xlabel=xlabel, ylabel=ylabel, title=title)
564 564
565 565 self.draw()
566 566
567 567 if save:
568 568 self.saveFigure(filename)
569 569
570 570 class ProfilePlot(Figure):
571 571 __isConfig = None
572 572 __nsubplots = None
573 573
574 574 WIDTHPROF = None
575 575 HEIGHTPROF = None
576 576 PREFIX = 'spcprofile'
577 577
578 578 def __init__(self):
579 579 self.__isConfig = False
580 580 self.__nsubplots = 1
581 581
582 582 self.WIDTH = 300
583 583 self.HEIGHT = 500
584 584
585 585 def getSubplots(self):
586 586 ncol = 1
587 587 nrow = 1
588 588
589 589 return nrow, ncol
590 590
591 591 def setup(self, idfigure, nplots, wintitle):
592 592
593 593 self.nplots = nplots
594 594
595 595 ncolspan = 1
596 596 colspan = 1
597 597
598 598 self.createFigure(idfigure = idfigure,
599 599 wintitle = wintitle,
600 600 widthplot = self.WIDTH,
601 601 heightplot = self.HEIGHT)
602 602
603 603 nrow, ncol = self.getSubplots()
604 604
605 605 counter = 0
606 606 for y in range(nrow):
607 607 for x in range(ncol):
608 608 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
609 609
610 610 def run(self, dataOut, idfigure, wintitle="", channelList=None,
611 611 xmin=None, xmax=None, ymin=None, ymax=None,
612 612 save=False, figpath='./', figfile=None):
613 613
614 614 if channelList == None:
615 615 channelIndexList = dataOut.channelIndexList
616 616 channelList = dataOut.channelList
617 617 else:
618 618 channelIndexList = []
619 619 for channel in channelList:
620 620 if channel not in dataOut.channelList:
621 621 raise ValueError, "Channel %d is not in dataOut.channelList"
622 622 channelIndexList.append(dataOut.channelList.index(channel))
623 623
624 624
625 625 y = dataOut.getHeiRange()
626 626 x = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
627 627 avg = numpy.average(x, axis=1)
628 628
629 629
630 630 if not self.__isConfig:
631 631
632 632 nplots = 1
633 633
634 634 self.setup(idfigure=idfigure,
635 635 nplots=nplots,
636 636 wintitle=wintitle)
637 637
638 638 if ymin == None: ymin = numpy.nanmin(y)
639 639 if ymax == None: ymax = numpy.nanmax(y)
640 640 if xmin == None: xmin = numpy.nanmin(avg)*0.9
641 641 if xmax == None: xmax = numpy.nanmax(avg)*0.9
642 642
643 643 self.__isConfig = True
644 644
645 645 thisDatetime = dataOut.datatime
646 646 title = "Power Profile"
647 647 xlabel = "dB"
648 648 ylabel = "Range (Km)"
649 649
650 650 self.setWinTitle(title)
651 651
652 652
653 653 title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
654 654 axes = self.axesList[0]
655 655
656 656 legendlabels = ["channel %d"%x for x in channelList]
657 657 axes.pmultiline(avg, y,
658 658 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
659 659 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
660 660 ytick_visible=True, nxticks=5,
661 661 grid='x')
662 662
663 663 self.draw()
664 664
665 665 if save:
666 666 date = thisDatetime.strftime("%Y%m%d")
667 667 if figfile == None:
668 668 figfile = self.getFilename(name = date)
669 669
670 670 self.saveFigure(figpath, figfile)
671 671
672 672 class CoherencePlot(Figure):
673 673 __isConfig = None
674 674 __nsubplots = None
675 675
676 676 WIDTHPROF = None
677 677 HEIGHTPROF = None
678 678 PREFIX = 'coherencemap'
679 679
680 680 def __init__(self):
681 681 self.timerange = 24*60*60
682 682 self.__isConfig = False
683 683 self.__nsubplots = 1
684 684
685 685 self.WIDTH = 800
686 686 self.HEIGHT = 200
687 687 self.WIDTHPROF = 120
688 688 self.HEIGHTPROF = 0
689 689
690 690 def getSubplots(self):
691 691 ncol = 1
692 692 nrow = self.nplots*2
693 693
694 694 return nrow, ncol
695 695
696 696 def setup(self, idfigure, nplots, wintitle, showprofile=True):
697 697 self.__showprofile = showprofile
698 698 self.nplots = nplots
699 699
700 700 ncolspan = 1
701 701 colspan = 1
702 702 if showprofile:
703 703 ncolspan = 7
704 704 colspan = 6
705 705 self.__nsubplots = 2
706 706
707 707 self.createFigure(idfigure = idfigure,
708 708 wintitle = wintitle,
709 709 widthplot = self.WIDTH + self.WIDTHPROF,
710 710 heightplot = self.HEIGHT + self.HEIGHTPROF)
711 711
712 712 nrow, ncol = self.getSubplots()
713 713
714 714 for y in range(nrow):
715 715 for x in range(ncol):
716 716
717 717 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
718 718
719 719 if showprofile:
720 720 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
721 721
722 722 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
723 723 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
724 724 timerange=None,
725 725 save=False, figpath='./', figfile=None):
726 726
727 727 if pairsList == None:
728 728 pairsIndexList = dataOut.pairsIndexList
729 729 else:
730 730 pairsIndexList = []
731 731 for pair in pairsList:
732 732 if pair not in dataOut.pairsList:
733 733 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
734 734 pairsIndexList.append(dataOut.pairsList.index(pair))
735 735
736 736 if timerange != None:
737 737 self.timerange = timerange
738 738
739 739 tmin = None
740 740 tmax = None
741 741 x = dataOut.getTimeRange()
742 742 y = dataOut.getHeiRange()
743 743
744 744 if not self.__isConfig:
745 745 nplots = len(pairsIndexList)
746 746 self.setup(idfigure=idfigure,
747 747 nplots=nplots,
748 748 wintitle=wintitle,
749 749 showprofile=showprofile)
750 750
751 751 tmin, tmax = self.getTimeLim(x, xmin, xmax)
752 752 if ymin == None: ymin = numpy.nanmin(y)
753 753 if ymax == None: ymax = numpy.nanmax(y)
754 754
755 755 self.__isConfig = True
756 756
757 757 thisDatetime = dataOut.datatime
758 758 title = "CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y"))
759 759 xlabel = ""
760 760 ylabel = "Range (Km)"
761 761
762 762 self.setWinTitle(title)
763 763
764 764 for i in range(self.nplots):
765 765
766 766 pair = dataOut.pairsList[pairsIndexList[i]]
767 767 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
768 768 coherence = numpy.abs(coherenceComplex)
769 769 avg = numpy.average(coherence, axis=0)
770 770 z = avg.reshape((1,-1))
771 771
772 772 counter = 0
773 773
774 774 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
775 775 axes = self.axesList[i*self.__nsubplots*2]
776 776 axes.pcolor(x, y, z,
777 777 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
778 778 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
779 779 ticksize=9, cblabel='', cbsize="1%")
780 780
781 781 if self.__showprofile:
782 782 counter += 1
783 783 axes = self.axesList[i*self.__nsubplots*2 + counter]
784 784 axes.pline(avg, y,
785 785 xmin=0, xmax=1, ymin=ymin, ymax=ymax,
786 786 xlabel='', ylabel='', title='', ticksize=7,
787 787 ytick_visible=False, nxticks=5,
788 788 grid='x')
789 789
790 790 counter += 1
791 791 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
792 792 avg = numpy.average(phase, axis=0)
793 793 z = avg.reshape((1,-1))
794 794
795 795 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
796 796 axes = self.axesList[i*self.__nsubplots*2 + counter]
797 797 axes.pcolor(x, y, z,
798 798 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
799 799 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
800 800 ticksize=9, cblabel='', colormap='RdBu', cbsize="1%")
801 801
802 802 if self.__showprofile:
803 803 counter += 1
804 804 axes = self.axesList[i*self.__nsubplots*2 + counter]
805 805 axes.pline(avg, y,
806 806 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
807 807 xlabel='', ylabel='', title='', ticksize=7,
808 808 ytick_visible=False, nxticks=4,
809 809 grid='x')
810 810
811 811 self.draw()
812 812
813 813 if save:
814 814 date = thisDatetime.strftime("%Y%m%d")
815 815 if figfile == None:
816 816 figfile = self.getFilename(name = date)
817 817
818 818 self.saveFigure(figpath, figfile)
819 819
820 820 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
821 821 self.__isConfig = False
822 822
823 No newline at end of file
823 class RTIfromNoise(Figure):
824
825 __isConfig = None
826 __nsubplots = None
827
828 WIDTHPROF = None
829 HEIGHTPROF = None
830 PREFIX = 'rti'
831
832 def __init__(self):
833
834 self.__timerange = 24*60*60
835 self.__isConfig = False
836 self.__nsubplots = 1
837
838 self.WIDTH = 800
839 self.HEIGHT = 200
840
841 def getSubplots(self):
842
843 ncol = 1
844 nrow = self.nplots
845
846 return nrow, ncol
847
848 def setup(self, idfigure, nplots, wintitle, showprofile=True):
849
850 self.__showprofile = showprofile
851 self.nplots = nplots
852
853 ncolspan = 1
854 colspan = 1
855
856 self.createFigure(idfigure = idfigure,
857 wintitle = wintitle,
858 widthplot = self.WIDTH + self.WIDTHPROF,
859 heightplot = self.HEIGHT + self.HEIGHTPROF)
860
861 nrow, ncol = self.getSubplots()
862
863 self.addAxes(nrow, ncol, 0, 0, 1, 1)
864
865
866
867 def __getTimeLim(self, x, xmin, xmax):
868
869 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
870 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
871
872 ####################################################
873 #If the x is out of xrange
874 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
875 xmin = None
876 xmax = None
877
878 if xmin == None:
879 td = thisdatetime - thisdate
880 xmin = td.seconds/(60*60.)
881
882 if xmax == None:
883 xmax = xmin + self.__timerange/(60*60.)
884
885 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
886 tmin = time.mktime(mindt.timetuple())
887
888 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
889 tmax = time.mktime(maxdt.timetuple())
890
891 self.__timerange = tmax - tmin
892
893 return tmin, tmax
894
895 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
896 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
897 timerange=None,
898 save=False, figpath='./', figfile=None):
899
900 if channelList == None:
901 channelIndexList = dataOut.channelIndexList
902 else:
903 channelIndexList = []
904 for channel in channelList:
905 if channel not in dataOut.channelList:
906 raise ValueError, "Channel %d is not in dataOut.channelList"
907 channelIndexList.append(dataOut.channelList.index(channel))
908
909 if timerange != None:
910 self.__timerange = timerange
911
912 tmin = None
913 tmax = None
914 x = dataOut.getTimeRange()
915 y = dataOut.getHeiRange()
916 x1 = dataOut.datatime
917 # z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
918 # avg = numpy.average(z, axis=1)
919
920 noise = dataOut.getNoise()
921
922 if not self.__isConfig:
923
924 nplots = len(channelIndexList)
925
926 self.setup(idfigure=idfigure,
927 nplots=nplots,
928 wintitle=wintitle,
929 showprofile=showprofile)
930
931 tmin, tmax = self.__getTimeLim(x, xmin, xmax)
932 if ymin == None: ymin = numpy.nanmin(y)
933 if ymax == None: ymax = numpy.nanmax(y)
934 if zmin == None: zmin = numpy.nanmin(avg)*0.9
935 if zmax == None: zmax = numpy.nanmax(avg)*0.9
936
937 self.__isConfig = True
938
939 thisDatetime = dataOut.datatime
940 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
941 xlabel = "Velocity (m/s)"
942 ylabel = "Range (Km)"
943
944 self.setWinTitle(title)
945
946 for i in range(self.nplots):
947 title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
948 axes = self.axesList[i*self.__nsubplots]
949 z = avg[i].reshape((1,-1))
950 axes.pcolor(x, y, z,
951 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
952 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
953 ticksize=9, cblabel='', cbsize="1%")
954
955
956 self.draw()
957
958 if save:
959 date = thisDatetime.strftime("%Y%m%d")
960 if figfile == None:
961 figfile = self.getFilename(name = date)
962
963 self.saveFigure(figpath, figfile)
964
965 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
966 self.__isConfig = False
967 No newline at end of file
@@ -1,1074 +1,1150
1 1 '''
2 2
3 3 $Author: dsuarez $
4 4 $Id: Processor.py 1 2012-11-12 18:56:07Z dsuarez $
5 5 '''
6 6 import os
7 7 import numpy
8 8 import datetime
9 9 import time
10 10
11 11 from jrodata import *
12 12 from jrodataIO import *
13 13 from jroplot import *
14 14
15 15 class ProcessingUnit:
16 16
17 17 """
18 18 Esta es la clase base para el procesamiento de datos.
19 19
20 20 Contiene el metodo "call" para llamar operaciones. Las operaciones pueden ser:
21 21 - Metodos internos (callMethod)
22 22 - Objetos del tipo Operation (callObject). Antes de ser llamados, estos objetos
23 23 tienen que ser agreagados con el metodo "add".
24 24
25 25 """
26 26 # objeto de datos de entrada (Voltage, Spectra o Correlation)
27 27 dataIn = None
28 28
29 29 # objeto de datos de entrada (Voltage, Spectra o Correlation)
30 30 dataOut = None
31 31
32 32
33 33 objectDict = None
34 34
35 35 def __init__(self):
36 36
37 37 self.objectDict = {}
38 38
39 39 def init(self):
40 40
41 41 raise ValueError, "Not implemented"
42 42
43 43 def addOperation(self, object, objId):
44 44
45 45 """
46 46 Agrega el objeto "object" a la lista de objetos "self.objectList" y retorna el
47 47 identificador asociado a este objeto.
48 48
49 49 Input:
50 50
51 51 object : objeto de la clase "Operation"
52 52
53 53 Return:
54 54
55 55 objId : identificador del objeto, necesario para ejecutar la operacion
56 56 """
57 57
58 58 self.objectDict[objId] = object
59 59
60 60 return objId
61 61
62 62 def operation(self, **kwargs):
63 63
64 64 """
65 65 Operacion directa sobre la data (dataOut.data). Es necesario actualizar los valores de los
66 66 atributos del objeto dataOut
67 67
68 68 Input:
69 69
70 70 **kwargs : Diccionario de argumentos de la funcion a ejecutar
71 71 """
72 72
73 73 raise ValueError, "ImplementedError"
74 74
75 75 def callMethod(self, name, **kwargs):
76 76
77 77 """
78 78 Ejecuta el metodo con el nombre "name" y con argumentos **kwargs de la propia clase.
79 79
80 80 Input:
81 81 name : nombre del metodo a ejecutar
82 82
83 83 **kwargs : diccionario con los nombres y valores de la funcion a ejecutar.
84 84
85 85 """
86 86 if name != 'run':
87 87
88 88 if name == 'init' and self.dataIn.isEmpty():
89 89 self.dataOut.flagNoData = True
90 90 return False
91 91
92 92 if name != 'init' and self.dataOut.isEmpty():
93 93 return False
94 94
95 95 methodToCall = getattr(self, name)
96 96
97 97 methodToCall(**kwargs)
98 98
99 99 if name != 'run':
100 100 return True
101 101
102 102 if self.dataOut.isEmpty():
103 103 return False
104 104
105 105 return True
106 106
107 107 def callObject(self, objId, **kwargs):
108 108
109 109 """
110 110 Ejecuta la operacion asociada al identificador del objeto "objId"
111 111
112 112 Input:
113 113
114 114 objId : identificador del objeto a ejecutar
115 115
116 116 **kwargs : diccionario con los nombres y valores de la funcion a ejecutar.
117 117
118 118 Return:
119 119
120 120 None
121 121 """
122 122
123 123 if self.dataOut.isEmpty():
124 124 return False
125 125
126 126 object = self.objectDict[objId]
127 127
128 128 object.run(self.dataOut, **kwargs)
129 129
130 130 return True
131 131
132 132 def call(self, operationConf, **kwargs):
133 133
134 134 """
135 135 Return True si ejecuta la operacion "operationConf.name" con los
136 136 argumentos "**kwargs". False si la operacion no se ha ejecutado.
137 137 La operacion puede ser de dos tipos:
138 138
139 139 1. Un metodo propio de esta clase:
140 140
141 141 operation.type = "self"
142 142
143 143 2. El metodo "run" de un objeto del tipo Operation o de un derivado de ella:
144 144 operation.type = "other".
145 145
146 146 Este objeto de tipo Operation debe de haber sido agregado antes con el metodo:
147 147 "addOperation" e identificado con el operation.id
148 148
149 149
150 150 con el id de la operacion.
151 151
152 152 Input:
153 153
154 154 Operation : Objeto del tipo operacion con los atributos: name, type y id.
155 155
156 156 """
157 157
158 158 if operationConf.type == 'self':
159 159 sts = self.callMethod(operationConf.name, **kwargs)
160 160
161 161 if operationConf.type == 'other':
162 162 sts = self.callObject(operationConf.id, **kwargs)
163 163
164 164 return sts
165 165
166 166 def setInput(self, dataIn):
167 167
168 168 self.dataIn = dataIn
169 169
170 170 def getOutput(self):
171 171
172 172 return self.dataOut
173 173
174 174 class Operation():
175 175
176 176 """
177 177 Clase base para definir las operaciones adicionales que se pueden agregar a la clase ProcessingUnit
178 178 y necesiten acumular informacion previa de los datos a procesar. De preferencia usar un buffer de
179 179 acumulacion dentro de esta clase
180 180
181 181 Ejemplo: Integraciones coherentes, necesita la informacion previa de los n perfiles anteriores (bufffer)
182 182
183 183 """
184 184
185 185 __buffer = None
186 186 __isConfig = False
187 187
188 188 def __init__(self):
189 189
190 190 pass
191 191
192 192 def run(self, dataIn, **kwargs):
193 193
194 194 """
195 195 Realiza las operaciones necesarias sobre la dataIn.data y actualiza los atributos del objeto dataIn.
196 196
197 197 Input:
198 198
199 199 dataIn : objeto del tipo JROData
200 200
201 201 Return:
202 202
203 203 None
204 204
205 205 Affected:
206 206 __buffer : buffer de recepcion de datos.
207 207
208 208 """
209 209
210 210 raise ValueError, "ImplementedError"
211 211
212 212 class VoltageProc(ProcessingUnit):
213 213
214 214
215 215 def __init__(self):
216 216
217 217 self.objectDict = {}
218 218 self.dataOut = Voltage()
219 219
220 220 def init(self):
221 221
222 222 self.dataOut.copy(self.dataIn)
223 223 # No necesita copiar en cada init() los atributos de dataIn
224 224 # la copia deberia hacerse por cada nuevo bloque de datos
225 225
226 226 def selectChannels(self, channelList):
227 227
228 228 channelIndexList = []
229 229
230 230 for channel in channelList:
231 231 index = self.dataOut.channelList.index(channel)
232 232 channelIndexList.append(index)
233 233
234 234 self.selectChannelsByIndex(channelIndexList)
235 235
236 236 def selectChannelsByIndex(self, channelIndexList):
237 237 """
238 238 Selecciona un bloque de datos en base a canales segun el channelIndexList
239 239
240 240 Input:
241 241 channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7]
242 242
243 243 Affected:
244 244 self.dataOut.data
245 245 self.dataOut.channelIndexList
246 246 self.dataOut.nChannels
247 247 self.dataOut.m_ProcessingHeader.totalSpectra
248 248 self.dataOut.systemHeaderObj.numChannels
249 249 self.dataOut.m_ProcessingHeader.blockSize
250 250
251 251 Return:
252 252 None
253 253 """
254 254
255 255 for channelIndex in channelIndexList:
256 256 if channelIndex not in self.dataOut.channelIndexList:
257 257 print channelIndexList
258 258 raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex
259 259
260 260 nChannels = len(channelIndexList)
261 261
262 262 data = self.dataOut.data[channelIndexList,:]
263 263
264 264 self.dataOut.data = data
265 265 self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
266 266 # self.dataOut.nChannels = nChannels
267 267
268 268 return 1
269 269
270 270 def selectHeights(self, minHei, maxHei):
271 271 """
272 272 Selecciona un bloque de datos en base a un grupo de valores de alturas segun el rango
273 273 minHei <= height <= maxHei
274 274
275 275 Input:
276 276 minHei : valor minimo de altura a considerar
277 277 maxHei : valor maximo de altura a considerar
278 278
279 279 Affected:
280 280 Indirectamente son cambiados varios valores a travez del metodo selectHeightsByIndex
281 281
282 282 Return:
283 283 1 si el metodo se ejecuto con exito caso contrario devuelve 0
284 284 """
285 285 if (minHei < self.dataOut.heightList[0]) or (minHei > maxHei):
286 286 raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
287 287
288 288 if (maxHei > self.dataOut.heightList[-1]):
289 289 maxHei = self.dataOut.heightList[-1]
290 290 # raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei)
291 291
292 292 minIndex = 0
293 293 maxIndex = 0
294 294 data = self.dataOut.heightList
295 295
296 296 for i,val in enumerate(data):
297 297 if val < minHei:
298 298 continue
299 299 else:
300 300 minIndex = i;
301 301 break
302 302
303 303 for i,val in enumerate(data):
304 304 if val <= maxHei:
305 305 maxIndex = i;
306 306 else:
307 307 break
308 308
309 309 self.selectHeightsByIndex(minIndex, maxIndex)
310 310
311 311 return 1
312 312
313 313
314 314 def selectHeightsByIndex(self, minIndex, maxIndex):
315 315 """
316 316 Selecciona un bloque de datos en base a un grupo indices de alturas segun el rango
317 317 minIndex <= index <= maxIndex
318 318
319 319 Input:
320 320 minIndex : valor de indice minimo de altura a considerar
321 321 maxIndex : valor de indice maximo de altura a considerar
322 322
323 323 Affected:
324 324 self.dataOut.data
325 325 self.dataOut.heightList
326 326
327 327 Return:
328 328 1 si el metodo se ejecuto con exito caso contrario devuelve 0
329 329 """
330 330
331 331 if (minIndex < 0) or (minIndex > maxIndex):
332 332 raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
333 333
334 334 if (maxIndex >= self.dataOut.nHeights):
335 335 maxIndex = self.dataOut.nHeights-1
336 336 # raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex)
337 337
338 338 nHeights = maxIndex - minIndex + 1
339 339
340 340 #voltage
341 341 data = self.dataOut.data[:,minIndex:maxIndex+1]
342 342
343 343 firstHeight = self.dataOut.heightList[minIndex]
344 344
345 345 self.dataOut.data = data
346 346 self.dataOut.heightList = self.dataOut.heightList[minIndex:maxIndex+1]
347 347
348 348 return 1
349 349
350
351 def filterByHeights(self, window):
352 deltaHeight = self.dataOut.heightList[1] - self.dataOut.heightList[0]
353
354 if window == None:
355 window = self.dataOut.radarControllerHeaderObj.txA / deltaHeight
356
357 newdelta = deltaHeight * window
358 r = self.dataOut.data.shape[1] % window
359 buffer = self.dataOut.data[:,0:self.dataOut.data.shape[1]-r]
360 buffer = buffer.reshape(self.dataOut.data.shape[0],self.dataOut.data.shape[1]/window,window)
361 buffer = numpy.average(buffer,2)
362 self.dataOut.data = buffer
363 self.dataOut.heightList = numpy.arange(self.dataOut.heightList[0],newdelta*self.dataOut.nHeights/window,newdelta)
364
365
350 366
351 367 class CohInt(Operation):
352 368
353 369 __isConfig = False
354 370
355 371 __profIndex = 0
356 372 __withOverapping = False
357 373
358 374 __byTime = False
359 375 __initime = None
360 376 __lastdatatime = None
361 377 __integrationtime = None
362 378
363 379 __buffer = None
364 380
365 381 __dataReady = False
366 382
367 383 n = None
368 384
369 385
370 386 def __init__(self):
371 387
372 388 self.__isConfig = False
373 389
374 390 def setup(self, n=None, timeInterval=None, overlapping=False):
375 391 """
376 392 Set the parameters of the integration class.
377 393
378 394 Inputs:
379 395
380 396 n : Number of coherent integrations
381 397 timeInterval : Time of integration. If the parameter "n" is selected this one does not work
382 398 overlapping :
383 399
384 400 """
385 401
386 402 self.__initime = None
387 403 self.__lastdatatime = 0
388 404 self.__buffer = None
389 405 self.__dataReady = False
390 406
391 407
392 408 if n == None and timeInterval == None:
393 409 raise ValueError, "n or timeInterval should be specified ..."
394 410
395 411 if n != None:
396 412 self.n = n
397 413 self.__byTime = False
398 414 else:
399 415 self.__integrationtime = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line
400 416 self.n = 9999
401 417 self.__byTime = True
402 418
403 419 if overlapping:
404 420 self.__withOverapping = True
405 421 self.__buffer = None
406 422 else:
407 423 self.__withOverapping = False
408 424 self.__buffer = 0
409 425
410 426 self.__profIndex = 0
411 427
412 428 def putData(self, data):
413 429
414 430 """
415 431 Add a profile to the __buffer and increase in one the __profileIndex
416 432
417 433 """
418 434
419 435 if not self.__withOverapping:
420 436 self.__buffer += data.copy()
421 437 self.__profIndex += 1
422 438 return
423 439
424 440 #Overlapping data
425 441 nChannels, nHeis = data.shape
426 442 data = numpy.reshape(data, (1, nChannels, nHeis))
427 443
428 444 #If the buffer is empty then it takes the data value
429 445 if self.__buffer == None:
430 446 self.__buffer = data
431 447 self.__profIndex += 1
432 448 return
433 449
434 450 #If the buffer length is lower than n then stakcing the data value
435 451 if self.__profIndex < self.n:
436 452 self.__buffer = numpy.vstack((self.__buffer, data))
437 453 self.__profIndex += 1
438 454 return
439 455
440 456 #If the buffer length is equal to n then replacing the last buffer value with the data value
441 457 self.__buffer = numpy.roll(self.__buffer, -1, axis=0)
442 458 self.__buffer[self.n-1] = data
443 459 self.__profIndex = self.n
444 460 return
445 461
446 462
447 463 def pushData(self):
448 464 """
449 465 Return the sum of the last profiles and the profiles used in the sum.
450 466
451 467 Affected:
452 468
453 469 self.__profileIndex
454 470
455 471 """
456 472
457 473 if not self.__withOverapping:
458 474 data = self.__buffer
459 475 n = self.__profIndex
460 476
461 477 self.__buffer = 0
462 478 self.__profIndex = 0
463 479
464 480 return data, n
465 481
466 482 #Integration with Overlapping
467 483 data = numpy.sum(self.__buffer, axis=0)
468 484 n = self.__profIndex
469 485
470 486 return data, n
471 487
472 488 def byProfiles(self, data):
473 489
474 490 self.__dataReady = False
475 491 avgdata = None
476 492 n = None
477 493
478 494 self.putData(data)
479 495
480 496 if self.__profIndex == self.n:
481 497
482 498 avgdata, n = self.pushData()
483 499 self.__dataReady = True
484 500
485 501 return avgdata
486 502
487 503 def byTime(self, data, datatime):
488 504
489 505 self.__dataReady = False
490 506 avgdata = None
491 507 n = None
492 508
493 509 self.putData(data)
494 510
495 511 if (datatime - self.__initime) >= self.__integrationtime:
496 512 avgdata, n = self.pushData()
497 513 self.n = n
498 514 self.__dataReady = True
499 515
500 516 return avgdata
501 517
502 518 def integrate(self, data, datatime=None):
503 519
504 520 if self.__initime == None:
505 521 self.__initime = datatime
506 522
507 523 if self.__byTime:
508 524 avgdata = self.byTime(data, datatime)
509 525 else:
510 526 avgdata = self.byProfiles(data)
511 527
512 528
513 529 self.__lastdatatime = datatime
514 530
515 531 if avgdata == None:
516 532 return None, None
517 533
518 534 avgdatatime = self.__initime
519 535
520 536 deltatime = datatime -self.__lastdatatime
521 537
522 538 if not self.__withOverapping:
523 539 self.__initime = datatime
524 540 else:
525 541 self.__initime += deltatime
526 542
527 543 return avgdata, avgdatatime
528 544
529 545 def run(self, dataOut, **kwargs):
530 546
531 547 if not self.__isConfig:
532 548 self.setup(**kwargs)
533 549 self.__isConfig = True
534 550
535 551 avgdata, avgdatatime = self.integrate(dataOut.data, dataOut.utctime)
536 552
537 553 # dataOut.timeInterval *= n
538 554 dataOut.flagNoData = True
539 555
540 556 if self.__dataReady:
541 557 dataOut.data = avgdata
542 558 dataOut.nCohInt *= self.n
543 559 dataOut.utctime = avgdatatime
544 560 dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt
545 561 dataOut.flagNoData = False
546 562
563
547 564 class Decoder(Operation):
548 565
549 566 __isConfig = False
550 567 __profIndex = 0
551 568
552 569 code = None
553 570
554 571 nCode = None
555 572 nBaud = None
556 573
557 574 def __init__(self):
558 575
559 576 self.__isConfig = False
560 577
561 578 def setup(self, code):
562 579
563 580 self.__profIndex = 0
564 581
565 582 self.code = code
566 583
567 584 self.nCode = len(code)
568 585 self.nBaud = len(code[0])
569 586
570 587 def convolutionInFreq(self, data):
571 588
572 589 ndata = data.shape[1]
573 590 newcode = numpy.zeros(ndata)
574 591 newcode[0:self.nBaud] = self.code[self.__profIndex]
575 592
576 593 fft_data = numpy.fft.fft(data, axis=1)
577 594 fft_code = numpy.conj(numpy.fft.fft(newcode))
578 595 fft_code = fft_code.reshape(1,len(fft_code))
579 596
580 597 # conv = fft_data.copy()
581 598 # conv.fill(0)
582 599
583 600 conv = fft_data*fft_code
584 601
585 602 data = numpy.fft.ifft(conv,axis=1)
586 603
587 604 datadec = data[:,:-self.nBaud+1]
588 605 ndatadec = ndata - self.nBaud + 1
589 606
590 607 if self.__profIndex == self.nCode:
591 608 self.__profIndex = 0
592 609
593 610 self.__profIndex += 1
594 611
595 612 return ndatadec, datadec
596 613
597 614
598 615 def convolutionInTime(self, data):
599 616
600 617 nchannel = data.shape[1]
601 618 newcode = self.code[self.__profIndex]
602 619
603 620 datadec = data.copy()
604 621
605 622 for i in range(nchannel):
606 623 datadec[i,:] = numpy.correlate(data[i,:], newcode)
607 624
608 625 ndatadec = ndata - self.nBaud + 1
609 626
610 627 if self.__profIndex == self.nCode:
611 628 self.__profIndex = 0
612 629
613 630 self.__profIndex += 1
614 631
615 632 return ndatadec, datadec
616 633
617 634 def run(self, dataOut, code=None, mode = 0):
618 635
619 636 if not self.__isConfig:
620 637
621 638 if code == None:
622 639 code = dataOut.code
623 640
624 641 self.setup(code)
625 642 self.__isConfig = True
626 643
627 644 if mode == 0:
628 645 ndatadec, datadec = self.convolutionInFreq(data)
629 646
630 647 if mode == 1:
631 648 ndatadec, datadec = self.convolutionInTime(data)
632
649
633 650 dataOut.data = datadec
634 651
635 652 dataOut.heightList = dataOut.heightList[0:ndatadec+1]
636 653
637 654 dataOut.flagDecodeData = True #asumo q la data no esta decodificada
638 655
639 656 # dataOut.flagDeflipData = True #asumo q la data no esta sin flip
640 657
641
642 658
643 659 class SpectraProc(ProcessingUnit):
644 660
645 661 def __init__(self):
646 662
647 663 self.objectDict = {}
648 664 self.buffer = None
649 665 self.firstdatatime = None
650 666 self.profIndex = 0
651 667 self.dataOut = Spectra()
652 668
653 669 def __updateObjFromInput(self):
654 670
655 671 self.dataOut.radarControllerHeaderObj = self.dataIn.radarControllerHeaderObj.copy()
656 672 self.dataOut.systemHeaderObj = self.dataIn.systemHeaderObj.copy()
657 673 self.dataOut.channelList = self.dataIn.channelList
658 674 self.dataOut.heightList = self.dataIn.heightList
659 675 self.dataOut.dtype = self.dataIn.dtype
660 676 # self.dataOut.nHeights = self.dataIn.nHeights
661 677 # self.dataOut.nChannels = self.dataIn.nChannels
662 678 self.dataOut.nBaud = self.dataIn.nBaud
663 679 self.dataOut.nCode = self.dataIn.nCode
664 680 self.dataOut.code = self.dataIn.code
665 681 self.dataOut.nProfiles = self.dataOut.nFFTPoints
666 682 # self.dataOut.channelIndexList = self.dataIn.channelIndexList
667 683 self.dataOut.flagTimeBlock = self.dataIn.flagTimeBlock
668 684 self.dataOut.utctime = self.firstdatatime
669 685 self.dataOut.flagDecodeData = self.dataIn.flagDecodeData #asumo q la data esta decodificada
670 686 self.dataOut.flagDeflipData = self.dataIn.flagDeflipData #asumo q la data esta sin flip
671 687 self.dataOut.flagShiftFFT = self.dataIn.flagShiftFFT
672 688 self.dataOut.nCohInt = self.dataIn.nCohInt
673 689 self.dataOut.nIncohInt = 1
674 690 self.dataOut.ippSeconds = self.dataIn.ippSeconds
675 691
676 692 self.dataOut.timeInterval = self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nIncohInt
677 693
678 694 def __getFft(self):
679 695 """
680 696 Convierte valores de Voltaje a Spectra
681 697
682 698 Affected:
683 699 self.dataOut.data_spc
684 700 self.dataOut.data_cspc
685 701 self.dataOut.data_dc
686 702 self.dataOut.heightList
687 703 self.profIndex
688 704 self.buffer
689 705 self.dataOut.flagNoData
690 706 """
691 707 fft_volt = numpy.fft.fft(self.buffer,axis=1)
692 708 dc = fft_volt[:,0,:]
693 709
694 710 #calculo de self-spectra
695 711 fft_volt = numpy.fft.fftshift(fft_volt,axes=(1,))
696 712 spc = fft_volt * numpy.conjugate(fft_volt)
697 713 spc = spc.real
698 714
699 715 blocksize = 0
700 716 blocksize += dc.size
701 717 blocksize += spc.size
702 718
703 719 cspc = None
704 720 pairIndex = 0
705 721 if self.dataOut.pairsList != None:
706 722 #calculo de cross-spectra
707 723 cspc = numpy.zeros((self.dataOut.nPairs, self.dataOut.nFFTPoints, self.dataOut.nHeights), dtype='complex')
708 724 for pair in self.dataOut.pairsList:
709 725 cspc[pairIndex,:,:] = fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:])
710 726 pairIndex += 1
711 727 blocksize += cspc.size
712 728
713 729 self.dataOut.data_spc = spc
714 730 self.dataOut.data_cspc = cspc
715 731 self.dataOut.data_dc = dc
716 732 self.dataOut.blockSize = blocksize
717 733
718 734 def init(self, nFFTPoints=None, pairsList=None):
719 735
720 736 self.dataOut.flagNoData = True
721 737
722 738 if self.dataIn.type == "Spectra":
723 739 self.dataOut.copy(self.dataIn)
724 740 return
725 741
726 742 if self.dataIn.type == "Voltage":
727 743
728 744 if nFFTPoints == None:
729 745 raise ValueError, "This SpectraProc.init() need nFFTPoints input variable"
730 746
731 747 if pairsList == None:
732 748 nPairs = 0
733 749 else:
734 750 nPairs = len(pairsList)
735 751
736 752 self.dataOut.nFFTPoints = nFFTPoints
737 753 self.dataOut.pairsList = pairsList
738 754 self.dataOut.nPairs = nPairs
739 755
740 756 if self.buffer == None:
741 757 self.buffer = numpy.zeros((self.dataIn.nChannels,
742 758 self.dataOut.nFFTPoints,
743 759 self.dataIn.nHeights),
744 760 dtype='complex')
745 761
746 762
747 763 self.buffer[:,self.profIndex,:] = self.dataIn.data.copy()
748 764 self.profIndex += 1
749 765
750 766 if self.firstdatatime == None:
751 767 self.firstdatatime = self.dataIn.utctime
752 768
753 769 if self.profIndex == self.dataOut.nFFTPoints:
754 770 self.__updateObjFromInput()
755 771 self.__getFft()
756 772
757 773 self.dataOut.flagNoData = False
758 774
759 775 self.buffer = None
760 776 self.firstdatatime = None
761 777 self.profIndex = 0
762 778
763 779 return
764 780
765 781 raise ValuError, "The type object %s is not valid"%(self.dataIn.type)
766 782
767 783 def selectChannels(self, channelList):
768 784
769 785 channelIndexList = []
770 786
771 787 for channel in channelList:
772 788 index = self.dataOut.channelList.index(channel)
773 789 channelIndexList.append(index)
774 790
775 791 self.selectChannelsByIndex(channelIndexList)
776 792
777 793 def selectChannelsByIndex(self, channelIndexList):
778 794 """
779 795 Selecciona un bloque de datos en base a canales segun el channelIndexList
780 796
781 797 Input:
782 798 channelIndexList : lista sencilla de canales a seleccionar por ej. [2,3,7]
783 799
784 800 Affected:
785 801 self.dataOut.data_spc
786 802 self.dataOut.channelIndexList
787 803 self.dataOut.nChannels
788 804
789 805 Return:
790 806 None
791 807 """
792 808
793 809 for channelIndex in channelIndexList:
794 810 if channelIndex not in self.dataOut.channelIndexList:
795 811 print channelIndexList
796 812 raise ValueError, "The value %d in channelIndexList is not valid" %channelIndex
797 813
798 814 nChannels = len(channelIndexList)
799 815
800 816 data_spc = self.dataOut.data_spc[channelIndexList,:]
801 817
802 818 self.dataOut.data_spc = data_spc
803 819 self.dataOut.channelList = [self.dataOut.channelList[i] for i in channelIndexList]
804 820 # self.dataOut.nChannels = nChannels
805 821
806 822 return 1
807 823
808 824
809 825 class IncohInt(Operation):
810 826
811 827
812 828 __profIndex = 0
813 829 __withOverapping = False
814 830
815 831 __byTime = False
816 832 __initime = None
817 833 __lastdatatime = None
818 834 __integrationtime = None
819 835
820 836 __buffer_spc = None
821 837 __buffer_cspc = None
822 838 __buffer_dc = None
823 839
824 840 __dataReady = False
825 841
826 842 n = None
827 843
828 844
829 845 def __init__(self):
830 846
831 847 self.__isConfig = False
832 848
833 849 def setup(self, n=None, timeInterval=None, overlapping=False):
834 850 """
835 851 Set the parameters of the integration class.
836 852
837 853 Inputs:
838 854
839 855 n : Number of coherent integrations
840 856 timeInterval : Time of integration. If the parameter "n" is selected this one does not work
841 857 overlapping :
842 858
843 859 """
844 860
845 861 self.__initime = None
846 862 self.__lastdatatime = 0
847 863 self.__buffer_spc = None
848 864 self.__buffer_cspc = None
849 865 self.__buffer_dc = None
850 866 self.__dataReady = False
851 867
852 868
853 869 if n == None and timeInterval == None:
854 870 raise ValueError, "n or timeInterval should be specified ..."
855 871
856 872 if n != None:
857 873 self.n = n
858 874 self.__byTime = False
859 875 else:
860 876 self.__integrationtime = timeInterval * 60. #if (type(timeInterval)!=integer) -> change this line
861 877 self.n = 9999
862 878 self.__byTime = True
863 879
864 880 if overlapping:
865 881 self.__withOverapping = True
866 882 else:
867 883 self.__withOverapping = False
868 884 self.__buffer_spc = 0
869 885 self.__buffer_cspc = 0
870 886 self.__buffer_dc = 0
871 887
872 888 self.__profIndex = 0
873 889
874 890 def putData(self, data_spc, data_cspc, data_dc):
875 891
876 892 """
877 893 Add a profile to the __buffer_spc and increase in one the __profileIndex
878 894
879 895 """
880 896
881 897 if not self.__withOverapping:
882 898 self.__buffer_spc += data_spc
883 899
884 900 if data_cspc == None:
885 901 self.__buffer_cspc = None
886 902 else:
887 903 self.__buffer_cspc += data_cspc
888 904
889 905 if data_dc == None:
890 906 self.__buffer_dc = None
891 907 else:
892 908 self.__buffer_dc += data_dc
893 909
894 910 self.__profIndex += 1
895 911 return
896 912
897 913 #Overlapping data
898 914 nChannels, nFFTPoints, nHeis = data_spc.shape
899 915 data_spc = numpy.reshape(data_spc, (1, nChannels, nFFTPoints, nHeis))
900 916 if data_cspc != None:
901 917 data_cspc = numpy.reshape(data_cspc, (1, -1, nFFTPoints, nHeis))
902 918 if data_dc != None:
903 919 data_dc = numpy.reshape(data_dc, (1, -1, nHeis))
904 920
905 921 #If the buffer is empty then it takes the data value
906 922 if self.__buffer_spc == None:
907 923 self.__buffer_spc = data_spc
908 924
909 925 if data_cspc == None:
910 926 self.__buffer_cspc = None
911 927 else:
912 928 self.__buffer_cspc += data_cspc
913 929
914 930 if data_dc == None:
915 931 self.__buffer_dc = None
916 932 else:
917 933 self.__buffer_dc += data_dc
918 934
919 935 self.__profIndex += 1
920 936 return
921 937
922 938 #If the buffer length is lower than n then stakcing the data value
923 939 if self.__profIndex < self.n:
924 940 self.__buffer_spc = numpy.vstack((self.__buffer_spc, data_spc))
925 941
926 942 if data_cspc != None:
927 943 self.__buffer_cspc = numpy.vstack((self.__buffer_cspc, data_cspc))
928 944
929 945 if data_dc != None:
930 946 self.__buffer_dc = numpy.vstack((self.__buffer_dc, data_dc))
931 947
932 948 self.__profIndex += 1
933 949 return
934 950
935 951 #If the buffer length is equal to n then replacing the last buffer value with the data value
936 952 self.__buffer_spc = numpy.roll(self.__buffer_spc, -1, axis=0)
937 953 self.__buffer_spc[self.n-1] = data_spc
938 954
939 955 if data_cspc != None:
940 956 self.__buffer_cspc = numpy.roll(self.__buffer_cspc, -1, axis=0)
941 957 self.__buffer_cspc[self.n-1] = data_cspc
942 958
943 959 if data_dc != None:
944 960 self.__buffer_dc = numpy.roll(self.__buffer_dc, -1, axis=0)
945 961 self.__buffer_dc[self.n-1] = data_dc
946 962
947 963 self.__profIndex = self.n
948 964 return
949 965
950 966
951 967 def pushData(self):
952 968 """
953 969 Return the sum of the last profiles and the profiles used in the sum.
954 970
955 971 Affected:
956 972
957 973 self.__profileIndex
958 974
959 975 """
960 976 data_spc = None
961 977 data_cspc = None
962 978 data_dc = None
963 979
964 980 if not self.__withOverapping:
965 981 data_spc = self.__buffer_spc
966 982 data_cspc = self.__buffer_cspc
967 983 data_dc = self.__buffer_dc
968 984
969 985 n = self.__profIndex
970 986
971 987 self.__buffer_spc = 0
972 988 self.__buffer_cspc = 0
973 989 self.__buffer_dc = 0
974 990 self.__profIndex = 0
975 991
976 992 return data_spc, data_cspc, data_dc, n
977 993
978 994 #Integration with Overlapping
979 995 data_spc = numpy.sum(self.__buffer_spc, axis=0)
980 996
981 997 if self.__buffer_cspc != None:
982 998 data_cspc = numpy.sum(self.__buffer_cspc, axis=0)
983 999
984 1000 if self.__buffer_dc != None:
985 1001 data_dc = numpy.sum(self.__buffer_dc, axis=0)
986 1002
987 1003 n = self.__profIndex
988 1004
989 1005 return data_spc, data_cspc, data_dc, n
990 1006
991 1007 def byProfiles(self, *args):
992 1008
993 1009 self.__dataReady = False
994 1010 avgdata_spc = None
995 1011 avgdata_cspc = None
996 1012 avgdata_dc = None
997 1013 n = None
998 1014
999 1015 self.putData(*args)
1000 1016
1001 1017 if self.__profIndex == self.n:
1002 1018
1003 1019 avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData()
1004 1020 self.__dataReady = True
1005 1021
1006 1022 return avgdata_spc, avgdata_cspc, avgdata_dc
1007 1023
1008 1024 def byTime(self, datatime, *args):
1009 1025
1010 1026 self.__dataReady = False
1011 1027 avgdata_spc = None
1012 1028 avgdata_cspc = None
1013 1029 avgdata_dc = None
1014 1030 n = None
1015 1031
1016 1032 self.putData(*args)
1017 1033
1018 1034 if (datatime - self.__initime) >= self.__integrationtime:
1019 1035 avgdata_spc, avgdata_cspc, avgdata_dc, n = self.pushData()
1020 1036 self.n = n
1021 1037 self.__dataReady = True
1022 1038
1023 1039 return avgdata_spc, avgdata_cspc, avgdata_dc
1024 1040
1025 1041 def integrate(self, datatime, *args):
1026 1042
1027 1043 if self.__initime == None:
1028 1044 self.__initime = datatime
1029 1045
1030 1046 if self.__byTime:
1031 1047 avgdata_spc, avgdata_cspc, avgdata_dc = self.byTime(datatime, *args)
1032 1048 else:
1033 1049 avgdata_spc, avgdata_cspc, avgdata_dc = self.byProfiles(*args)
1034 1050
1035 1051 self.__lastdatatime = datatime
1036 1052
1037 1053 if avgdata_spc == None:
1038 1054 return None, None, None, None
1039 1055
1040 1056 avgdatatime = self.__initime
1041 1057
1042 1058 deltatime = datatime -self.__lastdatatime
1043 1059
1044 1060 if not self.__withOverapping:
1045 1061 self.__initime = datatime
1046 1062 else:
1047 1063 self.__initime += deltatime
1048 1064
1049 1065 return avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc
1050 1066
1051 1067 def run(self, dataOut, n=None, timeInterval=None, overlapping=False):
1052 1068
1053 1069 if not self.__isConfig:
1054 1070 self.setup(n, timeInterval, overlapping)
1055 1071 self.__isConfig = True
1056 1072
1057 1073 avgdatatime, avgdata_spc, avgdata_cspc, avgdata_dc = self.integrate(dataOut.utctime,
1058 1074 dataOut.data_spc,
1059 1075 dataOut.data_cspc,
1060 1076 dataOut.data_dc)
1061 1077
1062 1078 # dataOut.timeInterval *= n
1063 1079 dataOut.flagNoData = True
1064 1080
1065 1081 if self.__dataReady:
1066 1082 dataOut.data_spc = avgdata_spc
1067 1083 dataOut.data_cspc = avgdata_cspc
1068 1084 dataOut.data_dc = avgdata_dc
1069 1085
1070 1086 dataOut.nIncohInt *= self.n
1071 1087 dataOut.utctime = avgdatatime
1072 1088 dataOut.timeInterval = dataOut.ippSeconds * dataOut.nCohInt * dataOut.nIncohInt * dataOut.nFFTPoints
1073 1089 dataOut.flagNoData = False
1074 No newline at end of file
1090
1091 class ProfileSelector(Operation):
1092
1093 profileIndex = None
1094 # Tamanho total de los perfiles
1095 nProfiles = None
1096
1097 def __init__(self):
1098
1099 self.profileIndex = 0
1100
1101 def incIndex(self):
1102 self.profileIndex += 1
1103
1104 if self.profileIndex >= self.nProfiles:
1105 self.profileIndex = 0
1106
1107 def isProfileInRange(self, minIndex, maxIndex):
1108
1109 if self.profileIndex < minIndex:
1110 return False
1111
1112 if self.profileIndex > maxIndex:
1113 return False
1114
1115 return True
1116
1117 def isProfileInList(self, profileList):
1118
1119 if self.profileIndex not in profileList:
1120 return False
1121
1122 return True
1123
1124 def run(self, dataOut, profileList=None, profileRangeList=None):
1125
1126 self.nProfiles = dataOut.nProfiles
1127
1128 if profileList != None:
1129 if not(self.isProfileInList(profileList)):
1130 dataOut.flagNoData = True
1131 else:
1132 dataOut.flagNoData = False
1133 self.incIndex()
1134 return 1
1135
1136
1137 elif profileRangeList != None:
1138 minIndex = profileRangeList[0]
1139 maxIndex = profileRangeList[1]
1140 if not(self.isProfileInRange(minIndex, maxIndex)):
1141 dataOut.flagNoData = True
1142 else:
1143 dataOut.flagNoData = False
1144 self.incIndex()
1145 return 1
1146 else:
1147 raise ValueError, "ProfileSelector needs profileList or profileRangeList"
1148
1149 return 0
1150
General Comments 0
You need to be logged in to leave comments. Login now