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