@@ -11,6 +11,9 import plplot | |||
|
11 | 11 | |
|
12 | 12 | def cmap1_init(colormap="gray"): |
|
13 | 13 | |
|
14 | if colormap == None: | |
|
15 | return | |
|
16 | ||
|
14 | 17 | ncolor = None |
|
15 | 18 | rgb_lvl = None |
|
16 | 19 | |
@@ -144,12 +147,45 def cmap1_init(colormap="gray"): | |||
|
144 | 147 | |
|
145 | 148 | return rgb_lvl |
|
146 | 149 | |
|
150 | def setColormap(colormap="br_green"): | |
|
151 | cmap1_init(colormap) | |
|
152 | ||
|
147 | 153 | class BaseGraph: |
|
148 | 154 | """ |
|
149 | 155 | |
|
150 | 156 | """ |
|
157 | hasNotRange = True | |
|
158 | ||
|
159 | xrange = None | |
|
160 | yrange = None | |
|
161 | zrange = None | |
|
151 | 162 | |
|
152 | ||
|
163 | xlabel = None | |
|
164 | ylabel = None | |
|
165 | title = None | |
|
166 | ||
|
167 | legends = None | |
|
168 | ||
|
169 | __name = None | |
|
170 | ||
|
171 | __colormap = None | |
|
172 | __colbox = None | |
|
173 | __colleg = None | |
|
174 | ||
|
175 | __xpos = None | |
|
176 | __ypos = None | |
|
177 | ||
|
178 | __xopt = None #"bcnst" | |
|
179 | __yopt = None #"bcnstv" | |
|
180 | ||
|
181 | __xlpos = None | |
|
182 | __ylpos = None | |
|
183 | ||
|
184 | __xrangeIsTime = False | |
|
185 | ||
|
186 | #Advanced | |
|
187 | __xg = None | |
|
188 | __yg = None | |
|
153 | 189 | |
|
154 | 190 | def __init__(self): |
|
155 | 191 | """ |
@@ -323,31 +359,31 class BaseGraph: | |||
|
323 | 359 | plplot.plimagefr(data, x[0], x[-1], y[0], y[-1], 0., 0., zmin, zmax, plplot.pltr2, self.__xg, self.__yg) |
|
324 | 360 | |
|
325 | 361 | |
|
326 |
class LinearPlot |
|
|
362 | class LinearPlot: | |
|
363 | ||
|
364 | linearGraphObj = BaseGraph() | |
|
327 | 365 | |
|
328 | 366 | __szchar = 1.0 |
|
367 | ||
|
329 | 368 | __xrange = None |
|
369 | ||
|
330 | 370 | __yrange = None |
|
331 | 371 | |
|
332 | m_BaseGraph = None | |
|
372 | __subpage = 0 | |
|
373 | m_BaseGraph= BaseGraph() | |
|
374 | ||
|
375 | ||
|
333 | 376 | |
|
334 | 377 | def __init__(self): |
|
335 | 378 | |
|
336 | 379 | |
|
337 | 380 | key = "linearplot" |
|
338 |
self. |
|
|
339 |
self. |
|
|
381 | self.linearGraphObj = BaseGraph() | |
|
382 | self.linearGraphObj.setName(key) | |
|
340 | 383 | |
|
341 | 384 | self.__subpage = 0 |
|
342 | 385 | |
|
343 | def setColormap(self, colormap="br_green"): | |
|
344 | ||
|
345 | if colormap == None: | |
|
346 | colormap = self.__colormap | |
|
347 | ||
|
348 | cmap1_init(colormap) | |
|
349 | ||
|
350 | def iniSubpage(self): | |
|
386 | def __iniSubpage(self): | |
|
351 | 387 | |
|
352 | 388 | if plplot.plgdev() == '': |
|
353 | 389 | raise ValueError, "Plot device has not been initialize" |
@@ -355,7 +391,7 class LinearPlot(): | |||
|
355 | 391 | plplot.pladv(self.__subpage) |
|
356 | 392 | plplot.plschr(0.0, self.__szchar) |
|
357 | 393 | |
|
358 |
|
|
|
394 | setColormap() | |
|
359 | 395 | |
|
360 | 396 | def setScreenPos(self, width='small'): |
|
361 | 397 | |
@@ -368,14 +404,14 class LinearPlot(): | |||
|
368 | 404 | xf = xi + xw |
|
369 | 405 | yf = yi + yw |
|
370 | 406 | |
|
371 |
self. |
|
|
407 | self.linearGraphObj.setScreenPos([xi, xf], [yi, yf]) | |
|
372 | 408 | |
|
373 | 409 | def setup(self, subpage, title="", xlabel="", ylabel="", XAxisAsTime=False): |
|
374 | 410 | """ |
|
375 | 411 | """ |
|
376 | 412 | |
|
377 |
self. |
|
|
378 |
self. |
|
|
413 | self.linearGraphObj.setOpt("bcnts","bcntsv") | |
|
414 | self.linearGraphObj.setup(title, | |
|
379 | 415 | xlabel, |
|
380 | 416 | ylabel |
|
381 | 417 | ) |
@@ -383,12 +419,12 class LinearPlot(): | |||
|
383 | 419 | self.setScreenPos(width='medium') |
|
384 | 420 | |
|
385 | 421 | if XAxisAsTime: |
|
386 |
self. |
|
|
422 | self.linearGraphObj.setXAxisAsTime() | |
|
387 | 423 | |
|
388 | 424 | self.__subpage = subpage |
|
389 | 425 | # def setRanges(self, xrange, yrange, zrange): |
|
390 | 426 | # |
|
391 |
# self. |
|
|
427 | # self.linearGraphObj.setRanges(xrange, yrange, zrange) | |
|
392 | 428 | |
|
393 | 429 | def plotData(self, x, y=None, xmin=None, xmax=None, ymin=None, ymax=None, colline=1): |
|
394 | 430 | """ |
@@ -411,8 +447,9 class LinearPlot(): | |||
|
411 | 447 | if ymin == None: ymin = y[0] |
|
412 | 448 | if ymax == None: ymax = y[-1] |
|
413 | 449 | |
|
414 | self.m_BaseGraph.plotBox(xmin, xmax, ymin, ymax) | |
|
415 |
self. |
|
|
450 | self.__iniSubpage() | |
|
451 | self.linearGraphObj.plotBox(xmin, xmax, ymin, ymax) | |
|
452 | self.linearGraphObj.basicLineTimePlot(x, y, xmin, xmax, ymin, ymax, colline) | |
|
416 | 453 | |
|
417 | 454 | def plotComplexData(self, x, y, xmin=None, xmax=None, ymin=None, ymax=None, colline=1, type='power'): |
|
418 | 455 | """ |
@@ -438,18 +475,40 class LinearPlot(): | |||
|
438 | 475 | if ymin == None: ymin = y[0] |
|
439 | 476 | if ymax == None: ymax = y[-1] |
|
440 | 477 | |
|
441 | self.m_BaseGraph.plotBox(xmin, xmax, ymin, ymax) | |
|
478 | self.__iniSubpage() | |
|
479 | self.linearGraphObj.plotBox(xmin, xmax, ymin, ymax) | |
|
442 | 480 | |
|
443 | 481 | if type.lower() == 'power': |
|
444 |
self. |
|
|
482 | self.linearGraphObj.basicLineTimePlot(x, abs(y), xmin, xmax, ymin, ymax, colline) | |
|
445 | 483 | |
|
446 | 484 | if type.lower() == 'iq': |
|
447 | 485 | |
|
448 |
self. |
|
|
449 |
self. |
|
|
486 | self.linearGraphObj.basicLineTimePlot(x, y.real, xmin, xmax, ymin, ymax, colline) | |
|
487 | self.linearGraphObj.basicLineTimePlot(x, y.imag, xmin, xmax, ymin, ymax, colline+1) | |
|
450 | 488 | |
|
451 |
class ColorPlot |
|
|
489 | class ColorPlot: | |
|
490 | ||
|
491 | colorGraphObj = BaseGraph() | |
|
492 | ||
|
493 | graphObjDict = {} | |
|
452 | 494 | |
|
495 | __subpage = 0 | |
|
496 | ||
|
497 | __showColorbar = False | |
|
498 | ||
|
499 | __showPowerProfile = True | |
|
500 | ||
|
501 | __szchar = 0.65 | |
|
502 | ||
|
503 | __xrange = None | |
|
504 | ||
|
505 | __yrange = None | |
|
506 | ||
|
507 | __zrange = None | |
|
508 | m_BaseGraph= BaseGraph() | |
|
509 | ||
|
510 | ||
|
511 | ||
|
453 | 512 | def __init__(self): |
|
454 | 513 | |
|
455 | 514 | self.graphObjDict = {} |
@@ -464,15 +523,15 class ColorPlot(): | |||
|
464 | 523 | self.__zrange = None |
|
465 | 524 | |
|
466 | 525 | key = "colorplot" |
|
467 |
self. |
|
|
468 |
self. |
|
|
526 | self.colorGraphObj = BaseGraph() | |
|
527 | self.colorGraphObj.setName(key) | |
|
469 | 528 | |
|
470 |
def setup(self, subpage, title="", xlabel="Frequency", ylabel="Range", colormap=" |
|
|
529 | def setup(self, subpage, title="", xlabel="Frequency", ylabel="Range", colormap="br_green", showColorbar=False, showPowerProfile=False, XAxisAsTime=False): | |
|
471 | 530 | """ |
|
472 | 531 | """ |
|
473 | 532 | |
|
474 |
self. |
|
|
475 |
self. |
|
|
533 | self.colorGraphObj.setOpt("bcnts","bcntsv") | |
|
534 | self.colorGraphObj.setup(title, | |
|
476 | 535 | xlabel, |
|
477 | 536 | ylabel |
|
478 | 537 | ) |
@@ -511,18 +570,9 class ColorPlot(): | |||
|
511 | 570 | self.setScreenPos(width='small') |
|
512 | 571 | |
|
513 | 572 | if XAxisAsTime: |
|
514 |
self. |
|
|
573 | self.colorGraphObj.setXAxisAsTime() | |
|
515 | 574 | |
|
516 | ||
|
517 | ||
|
518 | def setColormap(self, colormap="br_green"): | |
|
519 | ||
|
520 | if colormap == None: | |
|
521 | colormap = self.__colormap | |
|
522 | ||
|
523 | cmap1_init(colormap) | |
|
524 | ||
|
525 | def iniSubpage(self): | |
|
575 | def __iniSubpage(self): | |
|
526 | 576 | |
|
527 | 577 | if plplot.plgdev() == '': |
|
528 | 578 | raise ValueError, "Plot device has not been initialize" |
@@ -530,7 +580,7 class ColorPlot(): | |||
|
530 | 580 | plplot.pladv(self.__subpage) |
|
531 | 581 | plplot.plschr(0.0, self.__szchar) |
|
532 | 582 | |
|
533 |
self. |
|
|
583 | setColormap(self.__colormap) | |
|
534 | 584 | |
|
535 | 585 | def setScreenPos(self, width='small'): |
|
536 | 586 | |
@@ -550,7 +600,7 class ColorPlot(): | |||
|
550 | 600 | yf = yi + yw |
|
551 | 601 | xcmapf = xf |
|
552 | 602 | |
|
553 |
self. |
|
|
603 | self.colorGraphObj.setScreenPos([xi, xf], [yi, yf]) | |
|
554 | 604 | |
|
555 | 605 | if self.__showColorbar: |
|
556 | 606 | xcmapi = xf + deltaxcmap |
@@ -596,9 +646,9 class ColorPlot(): | |||
|
596 | 646 | if zmax == None: zmax = numpy.nanmax(data) |
|
597 | 647 | |
|
598 | 648 | plplot.plschr(0.0, self.__szchar) |
|
599 | ||
|
600 |
self. |
|
|
601 |
self. |
|
|
649 | self.__iniSubpage() | |
|
650 | self.colorGraphObj.plotBox(xmin, xmax, ymin, ymax) | |
|
651 | self.colorGraphObj.basicPcolorPlot(data, x, y, xmin, xmax, ymin, ymax, zmin, zmax) | |
|
602 | 652 | |
|
603 | 653 | if self.__showColorbar: |
|
604 | 654 | |
@@ -632,7 +682,7 class ColorPlot(): | |||
|
632 | 682 | plplot.plcol0(1) |
|
633 | 683 | |
|
634 | 684 | |
|
635 |
class ColorPlotX |
|
|
685 | class ColorPlotX: | |
|
636 | 686 | |
|
637 | 687 | |
|
638 | 688 | graphObjDict = {} |
@@ -644,25 +694,18 class ColorPlotX(): | |||
|
644 | 694 | __yrange = None |
|
645 | 695 | __zrange = None |
|
646 | 696 | |
|
647 |
|
|
|
697 | colorGraphObj = BaseGraph() | |
|
648 | 698 | |
|
649 | 699 | def __init__(self): |
|
650 | 700 | |
|
651 | 701 | key = "colorplot" |
|
652 |
self. |
|
|
702 | self.colorGraphObj.setName(key) | |
|
653 | 703 | |
|
654 | 704 | self.__subpage = 0 |
|
655 | 705 | |
|
656 |
self.graphObjDict[key] = self. |
|
|
706 | self.graphObjDict[key] = self.colorGraphObj | |
|
657 | 707 | |
|
658 | def setColormap(self, colormap="br_green"): | |
|
659 | ||
|
660 | if colormap == None: | |
|
661 | colormap = self.__colormap | |
|
662 | ||
|
663 | cmap1_init(colormap) | |
|
664 | ||
|
665 | def iniSubpage(self): | |
|
708 | def __iniSubpage(self): | |
|
666 | 709 | |
|
667 | 710 | if plplot.plgdev() == '': |
|
668 | 711 | raise ValueError, "Plot device has not been initialize" |
@@ -670,16 +713,63 class ColorPlotX(): | |||
|
670 | 713 | plplot.pladv(self.__subpage) |
|
671 | 714 | plplot.plschr(0.0, self.__szchar) |
|
672 | 715 | |
|
673 |
self. |
|
|
716 | setColormap(self.__colormap) | |
|
717 | ||
|
718 | def setScreenPos(self, xi = 0.12, yi = 0.14, xw = 0.78, yw = 0.80, xcmapw = 0.05, xpoww = 0.24, deltaxcmap = 0.02, deltaxpow = 0.06): | |
|
719 | ||
|
720 | if self.showColorbar: | |
|
721 | xw -= xcmapw + deltaxcmap | |
|
722 | ||
|
723 | if self.showPowerProfile: | |
|
724 | xw -= xpoww + deltaxpow | |
|
674 | 725 | |
|
726 | xf = xi + xw | |
|
727 | yf = yi + yw | |
|
728 | xcmapf = xf | |
|
729 | ||
|
730 | self.colorGraphObj.setScreenPos([xi, xf], [yi, yf]) | |
|
731 | ||
|
732 | if self.showColorbar: | |
|
733 | xcmapi = xf + deltaxcmap | |
|
734 | xcmapf = xcmapi + xcmapw | |
|
735 | ||
|
736 | key = "colorbar" | |
|
737 | cmapObj = self.graphObjDict[key] | |
|
738 | cmapObj.setScreenPos([xcmapi, xcmapf], [yi, yf]) | |
|
739 | ||
|
740 | if self.showPowerProfile: | |
|
741 | ||
|
742 | xpowi = xcmapf + deltaxpow | |
|
743 | xpowf = xpowi + xpoww | |
|
744 | ||
|
745 | key = "powerprof" | |
|
746 | powObj = self.graphObjDict[key] | |
|
747 | powObj.setScreenPos([xpowi, xpowf], [yi, yf]) | |
|
748 | ||
|
749 | def setRanges(self, xrange, yrange, zrange): | |
|
750 | ||
|
751 | self.colorGraphObj.setRanges(xrange, yrange, zrange) | |
|
752 | ||
|
753 | keyList = self.graphObjDict.keys() | |
|
754 | ||
|
755 | key = "colorbar" | |
|
756 | if key in keyList: | |
|
757 | cmapObj = self.graphObjDict[key] | |
|
758 | cmapObj.setRanges([0., 1.], zrange) | |
|
759 | ||
|
760 | key = "powerprof" | |
|
761 | if key in keyList: | |
|
762 | powObj = self.graphObjDict[key] | |
|
763 | powObj.setRanges(zrange, yrange) | |
|
764 | ||
|
675 | 765 | def setup(self, subpage, title="", xlabel="", ylabel="", colormap="jet", showColorbar=False, showPowerProfile=False, XAxisAsTime=False): |
|
676 | 766 | """ |
|
677 | 767 | """ |
|
678 | 768 | |
|
679 |
self. |
|
|
680 |
self. |
|
|
681 |
self. |
|
|
682 |
self. |
|
|
769 | self.colorGraphObj.setSubpage(subpage) | |
|
770 | self.colorGraphObj.setSzchar(self.__szchar) | |
|
771 | self.colorGraphObj.setOpt("bcnts","bcntsv") | |
|
772 | self.colorGraphObj.setup(title, | |
|
683 | 773 | xlabel, |
|
684 | 774 | ylabel, |
|
685 | 775 | colormap) |
@@ -721,57 +811,10 class ColorPlotX(): | |||
|
721 | 811 | self.setScreenPos() |
|
722 | 812 | |
|
723 | 813 | if XAxisAsTime: |
|
724 |
self. |
|
|
814 | self.colorGraphObj.setXAxisAsTime() | |
|
725 | 815 | #self.setScreenPos(xi = 0.05, yi = 0.18, xw = 0.92, yw = 0.74, xcmapw = 0.015, xpoww = 0.14, deltaxcmap = 0.01, deltaxpow = 0.02) |
|
726 | 816 | |
|
727 | ||
|
728 | def setScreenPos(self, xi = 0.12, yi = 0.14, xw = 0.78, yw = 0.80, xcmapw = 0.05, xpoww = 0.24, deltaxcmap = 0.02, deltaxpow = 0.06): | |
|
729 | ||
|
730 | if self.showColorbar: | |
|
731 | xw -= xcmapw + deltaxcmap | |
|
732 | ||
|
733 | if self.showPowerProfile: | |
|
734 | xw -= xpoww + deltaxpow | |
|
735 | ||
|
736 | xf = xi + xw | |
|
737 | yf = yi + yw | |
|
738 | xcmapf = xf | |
|
739 | ||
|
740 | self.m_BaseGraph.setScreenPos([xi, xf], [yi, yf]) | |
|
741 | ||
|
742 | if self.showColorbar: | |
|
743 | xcmapi = xf + deltaxcmap | |
|
744 | xcmapf = xcmapi + xcmapw | |
|
745 | ||
|
746 | key = "colorbar" | |
|
747 | cmapObj = self.graphObjDict[key] | |
|
748 | cmapObj.setScreenPos([xcmapi, xcmapf], [yi, yf]) | |
|
749 | ||
|
750 | if self.showPowerProfile: | |
|
751 | ||
|
752 | xpowi = xcmapf + deltaxpow | |
|
753 | xpowf = xpowi + xpoww | |
|
754 | ||
|
755 | key = "powerprof" | |
|
756 | powObj = self.graphObjDict[key] | |
|
757 | powObj.setScreenPos([xpowi, xpowf], [yi, yf]) | |
|
758 | ||
|
759 | def setRanges(self, xrange, yrange, zrange): | |
|
760 | ||
|
761 | self.m_BaseGraph.setRanges(xrange, yrange, zrange) | |
|
762 | 817 | |
|
763 | keyList = self.graphObjDict.keys() | |
|
764 | ||
|
765 | key = "colorbar" | |
|
766 | if key in keyList: | |
|
767 | cmapObj = self.graphObjDict[key] | |
|
768 | cmapObj.setRanges([0., 1.], zrange) | |
|
769 | ||
|
770 | key = "powerprof" | |
|
771 | if key in keyList: | |
|
772 | powObj = self.graphObjDict[key] | |
|
773 | powObj.setRanges(zrange, yrange) | |
|
774 | ||
|
775 | 818 | def plotData(self, data, x=None, y=None, xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): |
|
776 | 819 | """ |
|
777 | 820 | """ |
@@ -791,11 +834,11 class ColorPlotX(): | |||
|
791 | 834 | if zmin == None: zmin = numpy.nanmin(data) |
|
792 | 835 | if zmax == None: zmax = numpy.nanmax(data) |
|
793 | 836 | |
|
794 |
if self. |
|
|
837 | if self.colorGraphObj.hasNotRange: | |
|
795 | 838 | self.setRanges([xmin, xmax], [ymin,ymax], [zmin,zmax]) |
|
796 | 839 | |
|
797 |
self. |
|
|
798 |
self. |
|
|
840 | self.colorGraphObj.initSubpage() | |
|
841 | self.colorGraphObj.basicPcolorPlot(data, x, y, xmin, xmax, ymin, ymax, self.colorGraphObj.zrange[0], self.colorGraphObj.zrange[1]) | |
|
799 | 842 | |
|
800 | 843 | if self.showColorbar: |
|
801 | 844 | key = "colorbar" |
@@ -842,16 +885,12 if __name__ == '__main__': | |||
|
842 | 885 | data = numpy.random.uniform(-50,50,(nx,ny)) |
|
843 | 886 | |
|
844 | 887 | plplot.plbop() |
|
845 | baseObj.iniSubpage() | |
|
846 | 888 | baseObj.plotData(data) |
|
847 | 889 | |
|
848 | specObj.iniSubpage() | |
|
849 | 890 | specObj.plotData(data) |
|
850 | 891 | |
|
851 | baseObj1.iniSubpage() | |
|
852 | 892 | baseObj1.plotData(data) |
|
853 | 893 | |
|
854 | specObj1.iniSubpage() | |
|
855 | 894 | specObj1.plotData(data) |
|
856 | 895 | |
|
857 | 896 | plplot.plflush() |
@@ -16,8 +16,34 sys.path.append(path) | |||
|
16 | 16 | from Graphics.BaseGraph import * |
|
17 | 17 | from Model.Spectra import Spectra |
|
18 | 18 | |
|
19 |
class Spectrum |
|
|
19 | class Spectrum: | |
|
20 | ||
|
21 | __isPlotConfig = False | |
|
22 | ||
|
23 | __isPlotIni = False | |
|
24 | ||
|
25 | __xrange = None | |
|
26 | ||
|
27 | __yrange = None | |
|
20 | 28 | |
|
29 | nGraphs = 0 | |
|
30 | ||
|
31 | indexPlot = None | |
|
32 | ||
|
33 | graphObjList = [] | |
|
34 | ||
|
35 | spectraObj = Spectra | |
|
36 | ||
|
37 | colorGraphObj = ColorPlot() | |
|
38 | m_Spectra= Spectra() | |
|
39 | ||
|
40 | ||
|
41 | m_ColorPlot= ColorPlot() | |
|
42 | ||
|
43 | ||
|
44 | ||
|
45 | ||
|
46 | ||
|
21 | 47 | def __init__(self, Spectra, index=0): |
|
22 | 48 | |
|
23 | 49 | """ |
@@ -42,7 +68,7 class Spectrum(): | |||
|
42 | 68 | |
|
43 | 69 | self.graphObjList = [] |
|
44 | 70 | |
|
45 |
self. |
|
|
71 | self.spectraObj = Spectra | |
|
46 | 72 | |
|
47 | 73 | |
|
48 | 74 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", showColorbar=False, showPowerProfile=True, XAxisAsTime=False): |
@@ -61,7 +87,7 class Spectrum(): | |||
|
61 | 87 | |
|
62 | 88 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, showColorbar=False, showPowerProfile=True, XAxisAsTime=False): |
|
63 | 89 | |
|
64 |
nChan = int(self. |
|
|
90 | nChan = int(self.spectraObj.m_SystemHeader.numChannels) | |
|
65 | 91 | channels = range(nChan) |
|
66 | 92 | |
|
67 | 93 | myXlabel = "Radial Velocity (m/s)" |
@@ -73,8 +99,8 class Spectrum(): | |||
|
73 | 99 | myXlabel = xlabelList[i] |
|
74 | 100 | myYlabel = ylabelList[i] |
|
75 | 101 | |
|
76 |
# if self. |
|
|
77 |
# noise = '%4.2fdB' %(self. |
|
|
102 | # if self.spectraObj.m_NoiseObj != None: | |
|
103 | # noise = '%4.2fdB' %(self.spectraObj.m_NoiseObj[i]) | |
|
78 | 104 | # else: |
|
79 | 105 | noise = '--' |
|
80 | 106 | |
@@ -127,7 +153,7 class Spectrum(): | |||
|
127 | 153 | |
|
128 | 154 | plplot.plsstrm(self.indexPlot) |
|
129 | 155 | |
|
130 |
data = 10.*numpy.log10(self. |
|
|
156 | data = 10.*numpy.log10(self.spectraObj.data_spc) | |
|
131 | 157 | |
|
132 | 158 | #data.shape = Channels x Heights x Profiles |
|
133 | 159 | # data = numpy.transpose( data, (0,2,1) ) |
@@ -136,9 +162,9 class Spectrum(): | |||
|
136 | 162 | nChan, nX, nY = numpy.shape(data) |
|
137 | 163 | |
|
138 | 164 | x = numpy.arange(nX) |
|
139 |
y = self. |
|
|
165 | y = self.spectraObj.heightList | |
|
140 | 166 | |
|
141 |
thisDatetime = datetime.datetime.fromtimestamp(self. |
|
|
167 | thisDatetime = datetime.datetime.fromtimestamp(self.spectraObj.m_BasicHeader.utc) | |
|
142 | 168 | txtDate = "Self Spectra - Date: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
143 | 169 | |
|
144 | 170 | if xmin == None: xmin = x[0] |
@@ -152,7 +178,6 class Spectrum(): | |||
|
152 | 178 | |
|
153 | 179 | plplot.plssub(self.__nx, self.__ny) |
|
154 | 180 | for i in range(self.nGraphs): |
|
155 | self.graphObjList[i].iniSubpage() | |
|
156 | 181 | self.graphObjList[i].plotData(data[i,:,:], |
|
157 | 182 | x, |
|
158 | 183 | y, |
@@ -172,7 +197,7 class Spectrum(): | |||
|
172 | 197 | |
|
173 | 198 | def end(self): |
|
174 | 199 | plplot.plend() |
|
175 | ||
|
200 | ||
|
176 | 201 | |
|
177 | 202 | if __name__ == '__main__': |
|
178 | 203 | pass No newline at end of file |
@@ -1,182 +1,207 | |||
|
1 | ''' | |
|
2 | Created on Feb 7, 2012 | |
|
3 | ||
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |
|
6 | ''' | |
|
7 | import os, sys | |
|
8 | import numpy | |
|
9 | import plplot | |
|
10 | ||
|
11 | path = os.path.split(os.getcwd())[0] | |
|
12 | sys.path.append(path) | |
|
13 | ||
|
14 | from Graphics.BaseGraph import * | |
|
15 | from Model.Voltage import Voltage | |
|
16 | ||
|
17 |
class Osciloscope |
|
|
18 | ||
|
19 | def __init__(self, Voltage, index=0): | |
|
20 |
|
|
|
21 | """ | |
|
22 |
|
|
|
23 | Inputs: | |
|
24 |
|
|
|
25 | type: "power" ->> Potencia | |
|
26 | "iq" ->> Real + Imaginario | |
|
27 | """ | |
|
28 |
|
|
|
29 | self.__isPlotConfig = False | |
|
30 |
|
|
|
31 | self.__isPlotIni = False | |
|
32 |
|
|
|
33 | self.__xrange = None | |
|
34 |
|
|
|
35 | self.__yrange = None | |
|
36 |
|
|
|
37 | self.m_Voltage = None | |
|
38 | ||
|
39 | self.nGraphs = 0 | |
|
40 | ||
|
41 | self.indexPlot = index | |
|
42 | ||
|
43 | self.graphObjList = [] | |
|
44 | ||
|
45 | self.m_Voltage = Voltage | |
|
46 |
|
|
|
47 | ||
|
48 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", XAxisAsTime=False): | |
|
49 | ||
|
50 | graphObj = LinearPlot() | |
|
51 | graphObj.setup(subpage, title="", xlabel="", ylabel="", XAxisAsTime=False) | |
|
52 | #graphObj.setScreenPos() | |
|
53 | ||
|
54 | self.graphObjList.append(graphObj) | |
|
55 | ||
|
56 | del graphObj | |
|
57 | ||
|
58 | # def setXRange(self, xmin, xmax): | |
|
59 |
|
|
|
60 |
|
|
|
61 | # def setYRange(self, ymin, ymax): | |
|
62 | # self.__yrange = (ymin, ymax) | |
|
63 | ||
|
64 | ||
|
65 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False): | |
|
66 | ||
|
67 | nChan = int(self.m_Voltage.m_SystemHeader.numChannels) | |
|
68 | ||
|
69 | myTitle = "" | |
|
70 | myXlabel = "" | |
|
71 | myYlabel = "" | |
|
72 | ||
|
73 | for chan in range(nChan): | |
|
74 | if titleList != None: | |
|
75 | myTitle = titleList[chan] | |
|
76 | myXlabel = xlabelList[chan] | |
|
77 | myYlabel = ylabelList[chan] | |
|
78 | ||
|
79 | self.__addGraph(chan+1, title=myTitle, xlabel=myXlabel, ylabel=myYlabel, XAxisAsTime=XAxisAsTime) | |
|
80 | ||
|
81 | self.nGraphs = nChan | |
|
82 | self.__isPlotConfig = True | |
|
83 | ||
|
84 | def iniPlot(self, winTitle=""): | |
|
85 | ||
|
86 | plplot.plsstrm(self.indexPlot) | |
|
87 | plplot.plparseopts([winTitle], plplot.PL_PARSE_FULL) | |
|
88 | plplot.plsetopt("geometry", "%dx%d" %(700, 115*self.nGraphs)) | |
|
89 | plplot.plsdev("xwin") | |
|
90 | plplot.plscolbg(255,255,255) | |
|
91 | plplot.plscol0(1,0,0,0) | |
|
92 | plplot.plinit() | |
|
93 | plplot.plspause(False) | |
|
94 | plplot.plssub(1, self.nGraphs) | |
|
95 | ||
|
96 | self.__isPlotIni = True | |
|
97 | ||
|
98 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, idProfile=None, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False, type='iq', winTitle="Voltage"): | |
|
99 | ||
|
100 | if idProfile != None and idProfile != self.m_Voltage.idProfile: | |
|
101 | return | |
|
102 | ||
|
103 | if not(self.__isPlotConfig): | |
|
104 | self.setup(titleList, xlabelList, ylabelList, XAxisAsTime) | |
|
105 | ||
|
106 | if not(self.__isPlotIni): | |
|
107 | self.iniPlot(winTitle) | |
|
108 | ||
|
109 | plplot.plsstrm(self.indexPlot) | |
|
110 | ||
|
111 | data = self.m_Voltage.data | |
|
112 | ||
|
113 | x = self.m_Voltage.heights | |
|
114 | ||
|
115 | if xmin == None: xmin = x[0] | |
|
116 | if xmax == None: xmax = x[-1] | |
|
117 | if ymin == None: ymin = numpy.nanmin(abs(data)) | |
|
118 | if ymax == None: ymax = numpy.nanmax(abs(data)) | |
|
119 | ||
|
120 |
plplot.plb |
|
|
121 | for chan in range(self.nGraphs): | |
|
122 | y = data[chan,:] | |
|
123 | ||
|
124 | self.graphObjList[chan].iniSubpage() | |
|
125 | self.graphObjList[chan].plotComplexData(x, y, xmin, xmax, ymin, ymax, 8, type) | |
|
126 | ||
|
127 | plplot.plflush() | |
|
128 | plplot.pleop() | |
|
129 | ||
|
130 | def end(self): | |
|
131 | plplot.plend() | |
|
132 | ||
|
133 | class VoltagePlot(object): | |
|
134 | ''' | |
|
135 | classdocs | |
|
136 | ''' | |
|
137 | ||
|
138 | __m_Voltage = None | |
|
139 | ||
|
140 | def __init__(self, m_Voltage): | |
|
141 | ''' | |
|
142 | Constructor | |
|
143 | ''' | |
|
144 | self.__m_Voltage = m_Voltage | |
|
145 | ||
|
146 | def setup(self): | |
|
147 | pass | |
|
148 | ||
|
149 | def addGraph(self, type, xrange=None, yrange=None, zrange=None): | |
|
150 | pass | |
|
151 | ||
|
152 | def plotData(self): | |
|
153 | pass | |
|
154 | ||
|
155 | if __name__ == '__main__': | |
|
156 | ||
|
157 | import numpy | |
|
158 | ||
|
159 | plplot.plsetopt("geometry", "%dx%d" %(450*2, 200*2)) | |
|
160 | plplot.plsdev("xcairo") | |
|
161 | plplot.plscolbg(255,255,255) | |
|
162 | plplot.plscol0(1,0,0,0) | |
|
163 | plplot.plinit() | |
|
164 | plplot.plssub(1, 2) | |
|
165 | ||
|
166 | nx = 64 | |
|
167 | ny = 100 | |
|
168 | ||
|
169 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
|
170 | ||
|
171 | baseObj = RTI() | |
|
172 | baseObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) | |
|
173 | baseObj.plotData(data) | |
|
174 | ||
|
175 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
|
176 | ||
|
177 | base2Obj = RTI() | |
|
178 | base2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) | |
|
179 | base2Obj.plotData(data) | |
|
180 | ||
|
181 | plplot.plend() | |
|
1 | ''' | |
|
2 | Created on Feb 7, 2012 | |
|
3 | ||
|
4 | @author $Author$ | |
|
5 | @version $Id$ | |
|
6 | ''' | |
|
7 | import os, sys | |
|
8 | import numpy | |
|
9 | import plplot | |
|
10 | ||
|
11 | path = os.path.split(os.getcwd())[0] | |
|
12 | sys.path.append(path) | |
|
13 | ||
|
14 | from Graphics.BaseGraph import * | |
|
15 | from Model.Voltage import Voltage | |
|
16 | ||
|
17 | class Osciloscope: | |
|
18 | ||
|
19 | voltageObj = Voltage() | |
|
20 | ||
|
21 | linearGraphObj = LinearPlot() | |
|
22 | ||
|
23 | __isPlotConfig = False | |
|
24 | ||
|
25 | __isPlotIni = False | |
|
26 | ||
|
27 | __xrange = None | |
|
28 | ||
|
29 | __yrange = None | |
|
30 | ||
|
31 | voltageObj = Voltage() | |
|
32 | ||
|
33 | nGraphs = 0 | |
|
34 | ||
|
35 | indexPlot = None | |
|
36 | ||
|
37 | graphObjList = [] | |
|
38 | m_LinearPlot= LinearPlot() | |
|
39 | ||
|
40 | ||
|
41 | m_Voltage= Voltage() | |
|
42 | ||
|
43 | ||
|
44 | ||
|
45 | def __init__(self, Voltage, index=0): | |
|
46 | ||
|
47 | """ | |
|
48 | ||
|
49 | Inputs: | |
|
50 | ||
|
51 | type: "power" ->> Potencia | |
|
52 | "iq" ->> Real + Imaginario | |
|
53 | """ | |
|
54 | ||
|
55 | self.__isPlotConfig = False | |
|
56 | ||
|
57 | self.__isPlotIni = False | |
|
58 | ||
|
59 | self.__xrange = None | |
|
60 | ||
|
61 | self.__yrange = None | |
|
62 | ||
|
63 | self.voltageObj = None | |
|
64 | ||
|
65 | self.nGraphs = 0 | |
|
66 | ||
|
67 | self.indexPlot = index | |
|
68 | ||
|
69 | self.graphObjList = [] | |
|
70 | ||
|
71 | self.voltageObj = Voltage | |
|
72 | ||
|
73 | ||
|
74 | def __addGraph(self, subpage, title="", xlabel="", ylabel="", XAxisAsTime=False): | |
|
75 | ||
|
76 | graphObj = LinearPlot() | |
|
77 | graphObj.setup(subpage, title="", xlabel="", ylabel="", XAxisAsTime=False) | |
|
78 | #graphObj.setScreenPos() | |
|
79 | ||
|
80 | self.graphObjList.append(graphObj) | |
|
81 | ||
|
82 | del graphObj | |
|
83 | ||
|
84 | # def setXRange(self, xmin, xmax): | |
|
85 | # self.__xrange = (xmin, xmax) | |
|
86 | # | |
|
87 | # def setYRange(self, ymin, ymax): | |
|
88 | # self.__yrange = (ymin, ymax) | |
|
89 | ||
|
90 | ||
|
91 | def setup(self, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False): | |
|
92 | ||
|
93 | nChan = int(self.voltageObj.m_SystemHeader.numChannels) | |
|
94 | ||
|
95 | myTitle = "" | |
|
96 | myXlabel = "" | |
|
97 | myYlabel = "" | |
|
98 | ||
|
99 | for chan in range(nChan): | |
|
100 | if titleList != None: | |
|
101 | myTitle = titleList[chan] | |
|
102 | myXlabel = xlabelList[chan] | |
|
103 | myYlabel = ylabelList[chan] | |
|
104 | ||
|
105 | self.__addGraph(chan+1, title=myTitle, xlabel=myXlabel, ylabel=myYlabel, XAxisAsTime=XAxisAsTime) | |
|
106 | ||
|
107 | self.nGraphs = nChan | |
|
108 | self.__isPlotConfig = True | |
|
109 | ||
|
110 | def iniPlot(self, winTitle=""): | |
|
111 | ||
|
112 | plplot.plsstrm(self.indexPlot) | |
|
113 | plplot.plparseopts([winTitle], plplot.PL_PARSE_FULL) | |
|
114 | plplot.plsetopt("geometry", "%dx%d" %(700, 115*self.nGraphs)) | |
|
115 | plplot.plsdev("xwin") | |
|
116 | plplot.plscolbg(255,255,255) | |
|
117 | plplot.plscol0(1,0,0,0) | |
|
118 | plplot.plinit() | |
|
119 | plplot.plspause(False) | |
|
120 | plplot.plssub(1, self.nGraphs) | |
|
121 | ||
|
122 | self.__isPlotIni = True | |
|
123 | ||
|
124 | def plotData(self, xmin=None, xmax=None, ymin=None, ymax=None, idProfile=None, titleList=None, xlabelList=None, ylabelList=None, XAxisAsTime=False, type='iq', winTitle="Voltage"): | |
|
125 | ||
|
126 | if idProfile != None and idProfile != self.voltageObj.idProfile: | |
|
127 | return | |
|
128 | ||
|
129 | if not(self.__isPlotConfig): | |
|
130 | self.setup(titleList, xlabelList, ylabelList, XAxisAsTime) | |
|
131 | ||
|
132 | if not(self.__isPlotIni): | |
|
133 | self.iniPlot(winTitle) | |
|
134 | ||
|
135 | plplot.plsstrm(self.indexPlot) | |
|
136 | ||
|
137 | data = self.voltageObj.data | |
|
138 | ||
|
139 | x = self.voltageObj.heights | |
|
140 | ||
|
141 | if xmin == None: xmin = x[0] | |
|
142 | if xmax == None: xmax = x[-1] | |
|
143 | if ymin == None: ymin = numpy.nanmin(abs(data)) | |
|
144 | if ymax == None: ymax = numpy.nanmax(abs(data)) | |
|
145 | ||
|
146 | plplot.plbop() | |
|
147 | for chan in range(self.nGraphs): | |
|
148 | y = data[chan,:] | |
|
149 | ||
|
150 | self.graphObjList[chan].plotComplexData(x, y, xmin, xmax, ymin, ymax, 8, type) | |
|
151 | ||
|
152 | plplot.plflush() | |
|
153 | plplot.pleop() | |
|
154 | ||
|
155 | def end(self): | |
|
156 | plplot.plend() | |
|
157 | ||
|
158 | class VoltagePlot(object): | |
|
159 | ''' | |
|
160 | classdocs | |
|
161 | ''' | |
|
162 | ||
|
163 | __m_Voltage = None | |
|
164 | ||
|
165 | def __init__(self, voltageObj): | |
|
166 | ''' | |
|
167 | Constructor | |
|
168 | ''' | |
|
169 | self.__m_Voltage = voltageObj | |
|
170 | ||
|
171 | def setup(self): | |
|
172 | pass | |
|
173 | ||
|
174 | def addGraph(self, type, xrange=None, yrange=None, zrange=None): | |
|
175 | pass | |
|
176 | ||
|
177 | def plotData(self): | |
|
178 | pass | |
|
179 | ||
|
180 | if __name__ == '__main__': | |
|
181 | ||
|
182 | import numpy | |
|
183 | ||
|
184 | plplot.plsetopt("geometry", "%dx%d" %(450*2, 200*2)) | |
|
185 | plplot.plsdev("xcairo") | |
|
186 | plplot.plscolbg(255,255,255) | |
|
187 | plplot.plscol0(1,0,0,0) | |
|
188 | plplot.plinit() | |
|
189 | plplot.plssub(1, 2) | |
|
190 | ||
|
191 | nx = 64 | |
|
192 | ny = 100 | |
|
193 | ||
|
194 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
|
195 | ||
|
196 | baseObj = RTI() | |
|
197 | baseObj.setup(1, "Spectrum", "Frequency", "Range", "br_green", False, False) | |
|
198 | baseObj.plotData(data) | |
|
199 | ||
|
200 | data = numpy.random.uniform(-50,50,(nx,ny)) | |
|
201 | ||
|
202 | base2Obj = RTI() | |
|
203 | base2Obj.setup(2, "Spectrum", "Frequency", "Range", "br_green", True, True) | |
|
204 | base2Obj.plotData(data) | |
|
205 | ||
|
206 | plplot.plend() | |
|
182 | 207 | exit(0) No newline at end of file |
@@ -15,4 +15,8 class CorrelationProcessor: | |||
|
15 | 15 | ''' |
|
16 | 16 | Constructor |
|
17 | 17 | ''' |
|
18 | pass No newline at end of file | |
|
18 | pass | |
|
19 | m_Correlation= Correlation() | |
|
20 | ||
|
21 | m_Voltage= Voltage() | |
|
22 |
@@ -1,112 +1,112 | |||
|
1 | import numpy | |
|
2 | from Model.Spectra import Spectra | |
|
3 | ||
|
4 | def hildebrand_sekhon(Data, navg=1): | |
|
5 | """ | |
|
6 | This method is for the objective determination of de noise level in Doppler spectra. This | |
|
7 | implementation technique is based on the fact that the standard deviation of the spectral | |
|
8 | densities is equal to the mean spectral density for white Gaussian noise | |
|
9 | ||
|
10 | Inputs: | |
|
11 | Data : heights | |
|
12 | navg : numbers of averages | |
|
13 | ||
|
14 | Return: | |
|
15 | -1 : any error | |
|
16 | anoise : noise's level | |
|
17 | """ | |
|
18 | divisor = 8 | |
|
19 | ratio = 7 / divisor | |
|
20 | data = Data.reshape(-1) | |
|
21 | npts = data.size #numbers of points of the data | |
|
22 | ||
|
23 | if npts < 32: | |
|
24 | print "error in noise - requires at least 32 points" | |
|
25 | return -1.0 | |
|
26 | ||
|
27 | # data sorted in ascending order | |
|
28 | nmin = int(npts/divisor + ratio); | |
|
29 | s = 0.0 | |
|
30 | s2 = 0.0 | |
|
31 | data2 = data[:npts] | |
|
32 | data2.sort() | |
|
33 | ||
|
34 | for i in range(nmin): | |
|
35 | s += data2[i] | |
|
36 | s2 += data2[i]**2; | |
|
37 | ||
|
38 | icount = nmin | |
|
39 | iflag = 0 | |
|
40 | ||
|
41 | for i in range(nmin, npts): | |
|
42 | s += data2[i]; | |
|
43 | s2 += data2[i]**2 | |
|
44 | icount=icount+1; | |
|
45 | p = s / float(icount); | |
|
46 | p2 = p**2; | |
|
47 | q = s2 / float(icount) - p2; | |
|
48 | leftc = p2; | |
|
49 | rightc = q * float(navg); | |
|
50 | ||
|
51 | if leftc > rightc: | |
|
52 | iflag = 1; #No weather signal | |
|
53 | # Signal detect: R2 < 1 (R2 = leftc/rightc) | |
|
54 | if(leftc < rightc): | |
|
55 | if iflag: | |
|
56 | break | |
|
57 | ||
|
58 | anoise = 0.0; | |
|
59 | for j in range(i): | |
|
60 | anoise += data2[j]; | |
|
61 | ||
|
62 | anoise = anoise / float(i); | |
|
63 | ||
|
64 | return anoise; | |
|
65 | ||
|
66 | ||
|
67 |
class Noise |
|
|
68 | """ | |
|
69 | Clase que implementa los metodos necesarios para deternimar el nivel de ruido en un Spectro Doppler | |
|
70 | """ | |
|
71 | m_DataObj = None | |
|
72 | ||
|
73 | ||
|
74 | def __init__(self, m_Spectra=None): | |
|
75 | """ | |
|
76 | Inicializador de la clase Noise para la la determinacion del nivel de ruido en un Spectro Doppler. | |
|
77 | ||
|
78 | Affected: | |
|
79 | self.m_DataObj | |
|
80 | ||
|
81 | Return: | |
|
82 | None | |
|
83 | """ | |
|
84 | if m_Spectra == None: | |
|
85 | m_Spectra = Spectra() | |
|
86 | ||
|
87 | if not(isinstance(m_Spectra, Spectra)): | |
|
88 | raise ValueError, "in Noise class, m_Spectra must be an Spectra class object" | |
|
89 | ||
|
90 | self.m_DataObj = m_Spectra | |
|
91 | ||
|
92 | ||
|
93 | def getNoiseLevelByHildebrandSekhon(self): | |
|
94 | """ | |
|
95 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
|
96 | ||
|
97 | Return: | |
|
98 | noise level | |
|
99 | """ | |
|
100 | data = self.m_DataObj.data_spc | |
|
101 | daux = None | |
|
102 | ||
|
103 | for channel in range(self.m_DataObj.nChannels): | |
|
104 | daux = data[channel,:,:] | |
|
105 | noiselevel = hildebrand_sekhon(daux) | |
|
106 | print noiselevel | |
|
107 | ||
|
108 | ||
|
109 | for pair in range(self.m_DataObj.nPairs): | |
|
110 | daux = data[pair,:,:] | |
|
111 | noiselevel = hildebrand_sekhon(daux) | |
|
112 | print noiselevel | |
|
1 | import numpy | |
|
2 | from Model.Spectra import Spectra | |
|
3 | ||
|
4 | def hildebrand_sekhon(Data, navg=1): | |
|
5 | """ | |
|
6 | This method is for the objective determination of de noise level in Doppler spectra. This | |
|
7 | implementation technique is based on the fact that the standard deviation of the spectral | |
|
8 | densities is equal to the mean spectral density for white Gaussian noise | |
|
9 | ||
|
10 | Inputs: | |
|
11 | Data : heights | |
|
12 | navg : numbers of averages | |
|
13 | ||
|
14 | Return: | |
|
15 | -1 : any error | |
|
16 | anoise : noise's level | |
|
17 | """ | |
|
18 | divisor = 8 | |
|
19 | ratio = 7 / divisor | |
|
20 | data = Data.reshape(-1) | |
|
21 | npts = data.size #numbers of points of the data | |
|
22 | ||
|
23 | if npts < 32: | |
|
24 | print "error in noise - requires at least 32 points" | |
|
25 | return -1.0 | |
|
26 | ||
|
27 | # data sorted in ascending order | |
|
28 | nmin = int(npts/divisor + ratio); | |
|
29 | s = 0.0 | |
|
30 | s2 = 0.0 | |
|
31 | data2 = data[:npts] | |
|
32 | data2.sort() | |
|
33 | ||
|
34 | for i in range(nmin): | |
|
35 | s += data2[i] | |
|
36 | s2 += data2[i]**2; | |
|
37 | ||
|
38 | icount = nmin | |
|
39 | iflag = 0 | |
|
40 | ||
|
41 | for i in range(nmin, npts): | |
|
42 | s += data2[i]; | |
|
43 | s2 += data2[i]**2 | |
|
44 | icount=icount+1; | |
|
45 | p = s / float(icount); | |
|
46 | p2 = p**2; | |
|
47 | q = s2 / float(icount) - p2; | |
|
48 | leftc = p2; | |
|
49 | rightc = q * float(navg); | |
|
50 | ||
|
51 | if leftc > rightc: | |
|
52 | iflag = 1; #No weather signal | |
|
53 | # Signal detect: R2 < 1 (R2 = leftc/rightc) | |
|
54 | if(leftc < rightc): | |
|
55 | if iflag: | |
|
56 | break | |
|
57 | ||
|
58 | anoise = 0.0; | |
|
59 | for j in range(i): | |
|
60 | anoise += data2[j]; | |
|
61 | ||
|
62 | anoise = anoise / float(i); | |
|
63 | ||
|
64 | return anoise; | |
|
65 | ||
|
66 | ||
|
67 | class Noise: | |
|
68 | """ | |
|
69 | Clase que implementa los metodos necesarios para deternimar el nivel de ruido en un Spectro Doppler | |
|
70 | """ | |
|
71 | m_DataObj = None | |
|
72 | ||
|
73 | ||
|
74 | def __init__(self, m_Spectra=None): | |
|
75 | """ | |
|
76 | Inicializador de la clase Noise para la la determinacion del nivel de ruido en un Spectro Doppler. | |
|
77 | ||
|
78 | Affected: | |
|
79 | self.m_DataObj | |
|
80 | ||
|
81 | Return: | |
|
82 | None | |
|
83 | """ | |
|
84 | if m_Spectra == None: | |
|
85 | m_Spectra = Spectra() | |
|
86 | ||
|
87 | if not(isinstance(m_Spectra, Spectra)): | |
|
88 | raise ValueError, "in Noise class, m_Spectra must be an Spectra class object" | |
|
89 | ||
|
90 | self.m_DataObj = m_Spectra | |
|
91 | ||
|
92 | ||
|
93 | def getNoiseLevelByHildebrandSekhon(self): | |
|
94 | """ | |
|
95 | Determino el nivel de ruido usando el metodo Hildebrand-Sekhon | |
|
96 | ||
|
97 | Return: | |
|
98 | noise level | |
|
99 | """ | |
|
100 | data = self.m_DataObj.data_spc | |
|
101 | daux = None | |
|
102 | ||
|
103 | for channel in range(self.m_DataObj.nChannels): | |
|
104 | daux = data[channel,:,:] | |
|
105 | noiselevel = hildebrand_sekhon(daux) | |
|
106 | print noiselevel | |
|
107 | ||
|
108 | ||
|
109 | for pair in range(self.m_DataObj.nPairs): | |
|
110 | daux = data[pair,:,:] | |
|
111 | noiselevel = hildebrand_sekhon(daux) | |
|
112 | print noiselevel |
@@ -20,6 +20,40 class SpectraProcessor: | |||
|
20 | 20 | classdocs |
|
21 | 21 | ''' |
|
22 | 22 | |
|
23 | dataInObj = None | |
|
24 | ||
|
25 | dataOutObj = None | |
|
26 | ||
|
27 | integratorObjIndex = None | |
|
28 | ||
|
29 | decoderObjIndex = None | |
|
30 | ||
|
31 | writerObjIndex = None | |
|
32 | ||
|
33 | plotterObjIndex = None | |
|
34 | ||
|
35 | integratorObjList = [] | |
|
36 | ||
|
37 | decoderObjList = [] | |
|
38 | ||
|
39 | writerObjList = [] | |
|
40 | ||
|
41 | plotterObjList = [] | |
|
42 | ||
|
43 | buffer = None | |
|
44 | ||
|
45 | ptsId = 0 | |
|
46 | ||
|
47 | nFFTPoints = None | |
|
48 | ||
|
49 | pairList = None | |
|
50 | m_Spectra= Spectra() | |
|
51 | ||
|
52 | m_Voltage= Voltage() | |
|
53 | ||
|
54 | m_IncoherentIntegration= IncoherentIntegration() | |
|
55 | ||
|
56 | ||
|
23 | 57 | def __init__(self, dataInObj, dataOutObj=None): |
|
24 | 58 | ''' |
|
25 | 59 | Constructor |
@@ -31,25 +65,25 class SpectraProcessor: | |||
|
31 | 65 | else: |
|
32 | 66 | self.dataOutObj = dataOutObj |
|
33 | 67 | |
|
34 | self.integratorIndex = None | |
|
35 | self.decoderIndex = None | |
|
36 | self.writerIndex = None | |
|
37 | self.plotterIndex = None | |
|
68 | self.integratorObjIndex = None | |
|
69 | self.decoderObjIndex = None | |
|
70 | self.writerObjIndex = None | |
|
71 | self.plotterObjIndex = None | |
|
38 | 72 | |
|
39 | self.integratorList = [] | |
|
40 | self.decoderList = [] | |
|
41 | self.writerList = [] | |
|
42 | self.plotterList = [] | |
|
73 | self.integratorObjList = [] | |
|
74 | self.decoderObjList = [] | |
|
75 | self.writerObjList = [] | |
|
76 | self.plotterObjList = [] | |
|
43 | 77 | |
|
44 | 78 | self.buffer = None |
|
45 | 79 | self.ptsId = 0 |
|
46 | 80 | |
|
47 | 81 | def init(self, nFFTPoints, pairList=None): |
|
48 | 82 | |
|
49 | self.integratorIndex = 0 | |
|
50 | self.decoderIndex = 0 | |
|
51 | self.writerIndex = 0 | |
|
52 | self.plotterIndex = 0 | |
|
83 | self.integratorObjIndex = 0 | |
|
84 | self.decoderObjIndex = 0 | |
|
85 | self.writerObjIndex = 0 | |
|
86 | self.plotterObjIndex = 0 | |
|
53 | 87 | |
|
54 | 88 | if nFFTPoints == None: |
|
55 | 89 | nFFTPoints = self.dataOutObj.nFFTPoints |
@@ -179,54 +213,54 class SpectraProcessor: | |||
|
179 | 213 | def addWriter(self,wrpath): |
|
180 | 214 | objWriter = SpectraWriter(self.dataOutObj) |
|
181 | 215 | objWriter.setup(wrpath) |
|
182 | self.writerList.append(objWriter) | |
|
216 | self.writerObjList.append(objWriter) | |
|
183 | 217 | |
|
184 | 218 | |
|
185 | 219 | def addPlotter(self, index=None): |
|
186 | 220 | |
|
187 | 221 | if index==None: |
|
188 | index = self.plotterIndex | |
|
222 | index = self.plotterObjIndex | |
|
189 | 223 | |
|
190 | 224 | plotObj = Spectrum(self.dataOutObj, index) |
|
191 | self.plotterList.append(plotObj) | |
|
225 | self.plotterObjList.append(plotObj) | |
|
192 | 226 | |
|
193 | 227 | |
|
194 | 228 | def addIntegrator(self,N): |
|
195 | 229 | |
|
196 | 230 | objIncohInt = IncoherentIntegration(N) |
|
197 | self.integratorList.append(objIncohInt) | |
|
231 | self.integratorObjList.append(objIncohInt) | |
|
198 | 232 | |
|
199 | 233 | |
|
200 | 234 | def writeData(self, wrpath): |
|
201 | 235 | if self.dataOutObj.flagNoData: |
|
202 | 236 | return 0 |
|
203 | 237 | |
|
204 | if len(self.writerList) <= self.writerIndex: | |
|
238 | if len(self.writerObjList) <= self.writerObjIndex: | |
|
205 | 239 | self.addWriter(wrpath) |
|
206 | 240 | |
|
207 | self.writerList[self.writerIndex].putData() | |
|
241 | self.writerObjList[self.writerObjIndex].putData() | |
|
208 | 242 | |
|
209 | self.writerIndex += 1 | |
|
243 | self.writerObjIndex += 1 | |
|
210 | 244 | |
|
211 | 245 | def plotData(self,xmin=None, xmax=None, ymin=None, ymax=None, winTitle='', index=None): |
|
212 | 246 | if self.dataOutObj.flagNoData: |
|
213 | 247 | return 0 |
|
214 | 248 | |
|
215 | if len(self.plotterList) <= self.plotterIndex: | |
|
249 | if len(self.plotterObjList) <= self.plotterObjIndex: | |
|
216 | 250 | self.addPlotter(index) |
|
217 | 251 | |
|
218 | self.plotterList[self.plotterIndex].plotData(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,winTitle=winTitle) | |
|
252 | self.plotterObjList[self.plotterObjIndex].plotData(xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,winTitle=winTitle) | |
|
219 | 253 | |
|
220 | self.plotterIndex += 1 | |
|
254 | self.plotterObjIndex += 1 | |
|
221 | 255 | |
|
222 | 256 | def integrator(self, N): |
|
223 | 257 | if self.dataOutObj.flagNoData: |
|
224 | 258 | return 0 |
|
225 | 259 | |
|
226 | if len(self.integratorList) <= self.integratorIndex: | |
|
260 | if len(self.integratorObjList) <= self.integratorObjIndex: | |
|
227 | 261 | self.addIntegrator(N) |
|
228 | 262 | |
|
229 | myCohIntObj = self.integratorList[self.integratorIndex] | |
|
263 | myCohIntObj = self.integratorObjList[self.integratorObjIndex] | |
|
230 | 264 | myCohIntObj.exe(self.dataOutObj.data_spc) |
|
231 | 265 | |
|
232 | 266 | if myCohIntObj.flag: |
@@ -237,7 +271,7 class SpectraProcessor: | |||
|
237 | 271 | else: |
|
238 | 272 | self.dataOutObj.flagNoData = True |
|
239 | 273 | |
|
240 | self.integratorIndex += 1 | |
|
274 | self.integratorObjIndex += 1 | |
|
241 | 275 | |
|
242 | 276 | def removeDC(self, type): |
|
243 | 277 | |
@@ -485,7 +519,15 class SpectraProcessor: | |||
|
485 | 519 | |
|
486 | 520 | |
|
487 | 521 | class IncoherentIntegration: |
|
522 | ||
|
523 | profCounter = 1 | |
|
524 | data = None | |
|
525 | buffer = None | |
|
526 | flag = False | |
|
527 | nIncohInt = None | |
|
528 | ||
|
488 | 529 | def __init__(self, N): |
|
530 | ||
|
489 | 531 | self.profCounter = 1 |
|
490 | 532 | self.data = None |
|
491 | 533 | self.buffer = None |
@@ -19,134 +19,157 class VoltageProcessor: | |||
|
19 | 19 | ''' |
|
20 | 20 | classdocs |
|
21 | 21 | ''' |
|
22 | ||
|
23 | dataInObj = None | |
|
24 | dataOutObj = None | |
|
25 | ||
|
26 | integratorObjIndex = None | |
|
27 | decoderObjIndex = None | |
|
28 | profSelectorObjIndex = None | |
|
29 | writerObjIndex = None | |
|
30 | plotterObjIndex = None | |
|
31 | ||
|
32 | integratorObjList = [] | |
|
33 | decoderObjList = [] | |
|
34 | profileSelectorObjList = [] | |
|
35 | writerObjList = [] | |
|
36 | plotterObjList = [] | |
|
37 | m_Voltage= Voltage() | |
|
38 | ||
|
39 | m_ProfileSelector= ProfileSelector() | |
|
22 | 40 | |
|
23 | def __init__(self, voltageInObj, voltageOutObj=None): | |
|
41 | m_Decoder= Decoder() | |
|
42 | ||
|
43 | m_CoherentIntegrator= CoherentIntegrator() | |
|
44 | ||
|
45 | ||
|
46 | def __init__(self, dataInObj, dataOutObj=None): | |
|
24 | 47 | ''' |
|
25 | 48 | Constructor |
|
26 | 49 | ''' |
|
27 | 50 | |
|
28 |
self. |
|
|
51 | self.dataInObj = dataInObj | |
|
29 | 52 | |
|
30 |
if |
|
|
31 |
self. |
|
|
53 | if dataOutObj == None: | |
|
54 | self.dataOutObj = Voltage() | |
|
32 | 55 | else: |
|
33 |
self. |
|
|
56 | self.dataOutObj = dataOutObj | |
|
34 | 57 | |
|
35 | self.integratorIndex = None | |
|
36 | self.decoderIndex = None | |
|
37 | self.profSelectorIndex = None | |
|
38 | self.writerIndex = None | |
|
39 | self.plotterIndex = None | |
|
40 | ||
|
41 | self.integratorList = [] | |
|
42 | self.decoderList = [] | |
|
43 | self.profileSelectorList = [] | |
|
44 | self.writerList = [] | |
|
45 | self.plotterList = [] | |
|
58 | self.integratorObjIndex = None | |
|
59 | self.decoderObjIndex = None | |
|
60 | self.profSelectorObjIndex = None | |
|
61 | self.writerObjIndex = None | |
|
62 | self.plotterObjIndex = None | |
|
63 | ||
|
64 | self.integratorObjList = [] | |
|
65 | self.decoderObjList = [] | |
|
66 | self.profileSelectorObjList = [] | |
|
67 | self.writerObjList = [] | |
|
68 | self.plotterObjList = [] | |
|
46 | 69 | |
|
47 | 70 | def init(self): |
|
48 | 71 | |
|
49 | self.integratorIndex = 0 | |
|
50 | self.decoderIndex = 0 | |
|
51 | self.profSelectorIndex = 0 | |
|
52 | self.writerIndex = 0 | |
|
53 | self.plotterIndex = 0 | |
|
54 |
self. |
|
|
72 | self.integratorObjIndex = 0 | |
|
73 | self.decoderObjIndex = 0 | |
|
74 | self.profSelectorObjIndex = 0 | |
|
75 | self.writerObjIndex = 0 | |
|
76 | self.plotterObjIndex = 0 | |
|
77 | self.dataOutObj.copy(self.dataInObj) | |
|
55 | 78 | |
|
56 | 79 | def addWriter(self, wrpath): |
|
57 |
objWriter = VoltageWriter(self. |
|
|
80 | objWriter = VoltageWriter(self.dataOutObj) | |
|
58 | 81 | objWriter.setup(wrpath) |
|
59 | self.writerList.append(objWriter) | |
|
82 | self.writerObjList.append(objWriter) | |
|
60 | 83 | |
|
61 | 84 | def addPlotter(self): |
|
62 | 85 | |
|
63 |
plotObj = Osciloscope(self. |
|
|
64 | self.plotterList.append(plotObj) | |
|
86 | plotObj = Osciloscope(self.dataOutObj,self.plotterObjIndex) | |
|
87 | self.plotterObjList.append(plotObj) | |
|
65 | 88 | |
|
66 | 89 | def addIntegrator(self, nCohInt): |
|
67 | 90 | |
|
68 | 91 | objCohInt = CoherentIntegrator(nCohInt) |
|
69 | self.integratorList.append(objCohInt) | |
|
92 | self.integratorObjList.append(objCohInt) | |
|
70 | 93 | |
|
71 | 94 | def addDecoder(self, code, ncode, nbaud): |
|
72 | 95 | |
|
73 | 96 | objDecoder = Decoder(code,ncode,nbaud) |
|
74 | self.decoderList.append(objDecoder) | |
|
97 | self.decoderObjList.append(objDecoder) | |
|
75 | 98 | |
|
76 | 99 | def addProfileSelector(self, nProfiles): |
|
77 | 100 | |
|
78 | 101 | objProfSelector = ProfileSelector(nProfiles) |
|
79 | self.profileSelectorList.append(objProfSelector) | |
|
102 | self.profileSelectorObjList.append(objProfSelector) | |
|
80 | 103 | |
|
81 | 104 | def writeData(self,wrpath): |
|
82 | 105 | |
|
83 |
if self. |
|
|
106 | if self.dataOutObj.flagNoData: | |
|
84 | 107 | return 0 |
|
85 | 108 | |
|
86 | if len(self.writerList) <= self.writerIndex: | |
|
109 | if len(self.writerObjList) <= self.writerObjIndex: | |
|
87 | 110 | self.addWriter(wrpath) |
|
88 | 111 | |
|
89 | self.writerList[self.writerIndex].putData() | |
|
112 | self.writerObjList[self.writerObjIndex].putData() | |
|
90 | 113 | |
|
91 | # myWrObj = self.writerList[self.writerIndex] | |
|
114 | # myWrObj = self.writerObjList[self.writerObjIndex] | |
|
92 | 115 | # myWrObj.putData() |
|
93 | 116 | |
|
94 | self.writerIndex += 1 | |
|
117 | self.writerObjIndex += 1 | |
|
95 | 118 | |
|
96 | 119 | def plotData(self,idProfile, type, xmin=None, xmax=None, ymin=None, ymax=None, winTitle=''): |
|
97 |
if self. |
|
|
120 | if self.dataOutObj.flagNoData: | |
|
98 | 121 | return 0 |
|
99 | 122 | |
|
100 | if len(self.plotterList) <= self.plotterIndex: | |
|
123 | if len(self.plotterObjList) <= self.plotterObjIndex: | |
|
101 | 124 | self.addPlotter() |
|
102 | 125 | |
|
103 | self.plotterList[self.plotterIndex].plotData(type=type, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,winTitle=winTitle) | |
|
126 | self.plotterObjList[self.plotterObjIndex].plotData(type=type, xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,winTitle=winTitle) | |
|
104 | 127 | |
|
105 | self.plotterIndex += 1 | |
|
128 | self.plotterObjIndex += 1 | |
|
106 | 129 | |
|
107 | 130 | def integrator(self, N): |
|
108 | 131 | |
|
109 |
if self. |
|
|
132 | if self.dataOutObj.flagNoData: | |
|
110 | 133 | return 0 |
|
111 | 134 | |
|
112 | if len(self.integratorList) <= self.integratorIndex: | |
|
135 | if len(self.integratorObjList) <= self.integratorObjIndex: | |
|
113 | 136 | self.addIntegrator(N) |
|
114 | 137 | |
|
115 | myCohIntObj = self.integratorList[self.integratorIndex] | |
|
116 |
myCohIntObj.exe(self. |
|
|
138 | myCohIntObj = self.integratorObjList[self.integratorObjIndex] | |
|
139 | myCohIntObj.exe(self.dataOutObj.data) | |
|
117 | 140 | |
|
118 | 141 | if myCohIntObj.flag: |
|
119 |
self. |
|
|
120 |
self. |
|
|
121 |
self. |
|
|
142 | self.dataOutObj.data = myCohIntObj.data | |
|
143 | self.dataOutObj.m_ProcessingHeader.coherentInt *= N | |
|
144 | self.dataOutObj.flagNoData = False | |
|
122 | 145 | |
|
123 | 146 | else: |
|
124 |
self. |
|
|
147 | self.dataOutObj.flagNoData = True | |
|
125 | 148 | |
|
126 | self.integratorIndex += 1 | |
|
149 | self.integratorObjIndex += 1 | |
|
127 | 150 | |
|
128 | 151 | def decoder(self,code=None,type = 0): |
|
129 | 152 | |
|
130 |
if self. |
|
|
153 | if self.dataOutObj.flagNoData: | |
|
131 | 154 | return 0 |
|
132 | 155 | |
|
133 | 156 | if code == None: |
|
134 |
code = self. |
|
|
157 | code = self.dataOutObj.m_RadarControllerHeader.code | |
|
135 | 158 | ncode, nbaud = code.shape |
|
136 | 159 | |
|
137 | if len(self.decoderList) <= self.decoderIndex: | |
|
160 | if len(self.decoderObjList) <= self.decoderObjIndex: | |
|
138 | 161 | self.addDecoder(code,ncode,nbaud) |
|
139 | 162 | |
|
140 | myDecodObj = self.decoderList[self.decoderIndex] | |
|
141 |
myDecodObj.exe(data=self. |
|
|
163 | myDecodObj = self.decoderObjList[self.decoderObjIndex] | |
|
164 | myDecodObj.exe(data=self.dataOutObj.data,type=type) | |
|
142 | 165 | |
|
143 | 166 | if myDecodObj.flag: |
|
144 |
self. |
|
|
145 |
self. |
|
|
167 | self.dataOutObj.data = myDecodObj.data | |
|
168 | self.dataOutObj.flagNoData = False | |
|
146 | 169 | else: |
|
147 |
self. |
|
|
170 | self.dataOutObj.flagNoData = True | |
|
148 | 171 | |
|
149 | self.decoderIndex += 1 | |
|
172 | self.decoderObjIndex += 1 | |
|
150 | 173 | |
|
151 | 174 | |
|
152 | 175 | def filterByHei(self, window): |
@@ -162,36 +185,36 class VoltageProcessor: | |||
|
162 | 185 | |
|
163 | 186 | Affected: |
|
164 | 187 | self.dataOutObj.data |
|
165 |
self. |
|
|
188 | self.dataOutObj.channelList | |
|
166 | 189 | self.dataOutObj.nChannels |
|
167 |
self. |
|
|
190 | self.dataOutObj.m_ProcessingHeader.totalSpectra | |
|
168 | 191 | self.dataOutObj.m_SystemHeader.numChannels |
|
169 |
self. |
|
|
192 | self.dataOutObj.m_ProcessingHeader.blockSize | |
|
170 | 193 | |
|
171 | 194 | Return: |
|
172 | 195 | None |
|
173 | 196 | """ |
|
174 |
if self. |
|
|
197 | if self.dataOutObj.flagNoData: | |
|
175 | 198 | return 0 |
|
176 | 199 | |
|
177 | 200 | for channel in channelList: |
|
178 |
if channel not in self. |
|
|
201 | if channel not in self.dataOutObj.channelList: | |
|
179 | 202 | raise ValueError, "The value %d in channelList is not valid" %channel |
|
180 | 203 | |
|
181 | 204 | nchannels = len(channelList) |
|
182 |
profiles = self. |
|
|
183 |
heights = self. |
|
|
205 | profiles = self.dataOutObj.nProfiles | |
|
206 | heights = self.dataOutObj.nHeights #m_ProcessingHeader.numHeights | |
|
184 | 207 | |
|
185 | 208 | data = numpy.zeros( (nchannels,heights), dtype='complex' ) |
|
186 | 209 | for index,channel in enumerate(channelList): |
|
187 |
data[index,:] = self. |
|
|
210 | data[index,:] = self.dataOutObj.data[channel,:] | |
|
188 | 211 | |
|
189 |
self. |
|
|
190 |
self. |
|
|
191 |
self. |
|
|
192 |
self. |
|
|
193 |
self. |
|
|
194 |
self. |
|
|
212 | self.dataOutObj.data = data | |
|
213 | self.dataOutObj.channelList = channelList | |
|
214 | self.dataOutObj.nChannels = nchannels | |
|
215 | self.dataOutObj.m_ProcessingHeader.totalSpectra = nchannels | |
|
216 | self.dataOutObj.m_SystemHeader.numChannels = nchannels | |
|
217 | self.dataOutObj.m_ProcessingHeader.blockSize = data.size | |
|
195 | 218 | return 1 |
|
196 | 219 | |
|
197 | 220 | |
@@ -210,18 +233,18 class VoltageProcessor: | |||
|
210 | 233 | Return: |
|
211 | 234 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
212 | 235 | """ |
|
213 |
if self. |
|
|
236 | if self.dataOutObj.flagNoData: | |
|
214 | 237 | return 0 |
|
215 | 238 | |
|
216 |
if (minHei < self. |
|
|
239 | if (minHei < self.dataOutObj.heightList[0]) or (minHei > maxHei): | |
|
217 | 240 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
218 | 241 | |
|
219 |
if (maxHei > self. |
|
|
242 | if (maxHei > self.dataOutObj.heightList[-1]): | |
|
220 | 243 | raise ValueError, "some value in (%d,%d) is not valid" % (minHei, maxHei) |
|
221 | 244 | |
|
222 | 245 | minIndex = 0 |
|
223 | 246 | maxIndex = 0 |
|
224 |
data = self. |
|
|
247 | data = self.dataOutObj.heightList | |
|
225 | 248 | |
|
226 | 249 | for i,val in enumerate(data): |
|
227 | 250 | if val < minHei: |
@@ -250,41 +273,41 class VoltageProcessor: | |||
|
250 | 273 | maxIndex : valor de indice maximo de altura a considerar |
|
251 | 274 | |
|
252 | 275 | Affected: |
|
253 |
self. |
|
|
254 |
self. |
|
|
255 |
self. |
|
|
256 |
self. |
|
|
257 |
self. |
|
|
258 |
self. |
|
|
259 |
self. |
|
|
276 | self.dataOutObj.data | |
|
277 | self.dataOutObj.heightList | |
|
278 | self.dataOutObj.nHeights | |
|
279 | self.dataOutObj.m_ProcessingHeader.blockSize | |
|
280 | self.dataOutObj.m_ProcessingHeader.numHeights | |
|
281 | self.dataOutObj.m_ProcessingHeader.firstHeight | |
|
282 | self.dataOutObj.m_RadarControllerHeader | |
|
260 | 283 | |
|
261 | 284 | Return: |
|
262 | 285 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
263 | 286 | """ |
|
264 |
if self. |
|
|
287 | if self.dataOutObj.flagNoData: | |
|
265 | 288 | return 0 |
|
266 | 289 | |
|
267 | 290 | if (minIndex < 0) or (minIndex > maxIndex): |
|
268 | 291 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
269 | 292 | |
|
270 |
if (maxIndex >= self. |
|
|
293 | if (maxIndex >= self.dataOutObj.nHeights): | |
|
271 | 294 | raise ValueError, "some value in (%d,%d) is not valid" % (minIndex, maxIndex) |
|
272 | 295 | |
|
273 | 296 | nHeights = maxIndex - minIndex + 1 |
|
274 | 297 | firstHeight = 0 |
|
275 | 298 | |
|
276 | 299 | #voltage |
|
277 |
data = self. |
|
|
300 | data = self.dataOutObj.data[:,minIndex:maxIndex+1] | |
|
278 | 301 | |
|
279 |
firstHeight = self. |
|
|
302 | firstHeight = self.dataOutObj.heightList[minIndex] | |
|
280 | 303 | |
|
281 |
self. |
|
|
282 |
self. |
|
|
283 |
self. |
|
|
284 |
self. |
|
|
285 |
self. |
|
|
286 |
self. |
|
|
287 |
self. |
|
|
304 | self.dataOutObj.data = data | |
|
305 | self.dataOutObj.heightList = self.dataOutObj.heightList[minIndex:maxIndex+1] | |
|
306 | self.dataOutObj.nHeights = nHeights | |
|
307 | self.dataOutObj.m_ProcessingHeader.blockSize = data.size | |
|
308 | self.dataOutObj.m_ProcessingHeader.numHeights = nHeights | |
|
309 | self.dataOutObj.m_ProcessingHeader.firstHeight = firstHeight | |
|
310 | self.dataOutObj.m_RadarControllerHeader.numHeights = nHeights | |
|
288 | 311 | return 1 |
|
289 | 312 | |
|
290 | 313 | |
@@ -299,28 +322,28 class VoltageProcessor: | |||
|
299 | 322 | nProfiles : numero de profiles |
|
300 | 323 | |
|
301 | 324 | Affected: |
|
302 |
self. |
|
|
303 | self.profSelectorIndex | |
|
325 | self.dataOutObj.flagNoData | |
|
326 | self.profSelectorObjIndex | |
|
304 | 327 | |
|
305 | 328 | Return: |
|
306 | 329 | 1 si el metodo se ejecuto con exito caso contrario devuelve 0 |
|
307 | 330 | """ |
|
308 | 331 | |
|
309 |
if self. |
|
|
332 | if self.dataOutObj.flagNoData: | |
|
310 | 333 | return 0 |
|
311 | 334 | |
|
312 | if self.profSelectorIndex >= len(self.profileSelectorList): | |
|
335 | if self.profSelectorObjIndex >= len(self.profileSelectorObjList): | |
|
313 | 336 | self.addProfileSelector(nProfiles) |
|
314 | 337 | |
|
315 | profileSelectorObj = self.profileSelectorList[self.profSelectorIndex] | |
|
338 | profileSelectorObj = self.profileSelectorObjList[self.profSelectorObjIndex] | |
|
316 | 339 | |
|
317 | 340 | if profileSelectorObj.isProfileInRange(minIndex, maxIndex): |
|
318 |
self. |
|
|
319 | self.profSelectorIndex += 1 | |
|
341 | self.dataOutObj.flagNoData = False | |
|
342 | self.profSelectorObjIndex += 1 | |
|
320 | 343 | return 1 |
|
321 | 344 | |
|
322 |
self. |
|
|
323 | self.profSelectorIndex += 1 | |
|
345 | self.dataOutObj.flagNoData = True | |
|
346 | self.profSelectorObjIndex += 1 | |
|
324 | 347 | |
|
325 | 348 | return 0 |
|
326 | 349 | |
@@ -329,10 +352,20 class VoltageProcessor: | |||
|
329 | 352 | |
|
330 | 353 | |
|
331 | 354 | class Decoder: |
|
355 | ||
|
356 | data = None | |
|
357 | profCounter = 1 | |
|
358 | nCode = ncode | |
|
359 | nBaud = nbaud | |
|
360 | codeIndex = 0 | |
|
361 | code = code #this is a List | |
|
362 | fft_code = None | |
|
363 | flag = False | |
|
364 | setCodeFft = False | |
|
332 | 365 | |
|
333 | 366 | def __init__(self,code, ncode, nbaud): |
|
334 | 367 | |
|
335 |
self. |
|
|
368 | self.data = None | |
|
336 | 369 | self.profCounter = 1 |
|
337 | 370 | self.nCode = ncode |
|
338 | 371 | self.nBaud = nbaud |
@@ -400,6 +433,12 class Decoder: | |||
|
400 | 433 | |
|
401 | 434 | class CoherentIntegrator: |
|
402 | 435 | |
|
436 | profCounter = 1 | |
|
437 | data = None | |
|
438 | buffer = None | |
|
439 | flag = False | |
|
440 | nCohInt = N | |
|
441 | ||
|
403 | 442 | def __init__(self, N): |
|
404 | 443 | |
|
405 | 444 | self.profCounter = 1 |
@@ -425,7 +464,7 class CoherentIntegrator: | |||
|
425 | 464 | |
|
426 | 465 | self.profCounter += 1 |
|
427 | 466 | |
|
428 |
class ProfileSelector |
|
|
467 | class ProfileSelector: | |
|
429 | 468 | |
|
430 | 469 | indexProfile = None |
|
431 | 470 | # Tamanho total de los perfiles |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now