##// END OF EJS Templates
Test de los espectros de Altura usando la librería plplot
Alexander Valdez -
r152:605f1f11c642
parent child
Show More
@@ -18,7 +18,7 from IO.SpectraIO import *
18 from Processing.VoltageProcessor import *
18 from Processing.VoltageProcessor import *
19 from Processing.SpectraProcessor import *
19 from Processing.SpectraProcessor import *
20
20
21 from Graphics.BaseGraph_mpl import LinearPlot
21 #from Graphics.BaseGraph_mpl import LinearPlot
22
22
23 class TestHeis():
23 class TestHeis():
24 i=None
24 i=None
@@ -30,14 +30,15 class TestHeis():
30
30
31 def setValues( self ):
31 def setValues( self ):
32
32
33 self.path="C:\data2"
33 self.path="/home/roj-idl71/data"
34
35 #self.path = ""
34 self.startDate = datetime.date(2012,4,1)
36 self.startDate = datetime.date(2012,4,1)
35 self.endDate = datetime.date(2012,6,30)
37 self.endDate = datetime.date(2012,6,30)
36
38
37 self.startTime = datetime.time(0,0,0)
39 self.startTime = datetime.time(0,0,0)
38 self.endTime = datetime.time(23,0,0)
40 self.endTime = datetime.time(23,0,0)
39 #self.N = 4
41
40 #self.npts = 8
41
42
42 def createObjects( self ):
43 def createObjects( self ):
43
44
@@ -55,104 +56,46 class TestHeis():
55
56
56 if not(self.voltObj1):
57 if not(self.voltObj1):
57 sys.exit(0)
58 sys.exit(0)
58
59
59 print "voltaje o alturas: %03d"%(self.voltObj1.nHeights)
60 #print "perfiles: %03d"%(self.voltObj1.nProfiles)
61 self.specObj1 = self.specProcObj.setup(dataInObj = self.voltObj1,nFFTPoints=self.voltObj1.nHeights)
60 self.specObj1 = self.specProcObj.setup(dataInObj = self.voltObj1,nFFTPoints=self.voltObj1.nHeights)
62
61
63
62
64
63 #
65 print "nChannels: %03d"%(self.specObj1.nChannels)
64
66 print "nHeights: %03d"%( self.specObj1.nHeights)
65 #
67 print "nFFTPoints: %03d"% int(self.specObj1.nFFTPoints)
68
69
66
70 def testSChain( self ):
67 def testSChain( self ):
71
68
72 ini = time.time()
69 ini = time.time()
73
70 counter = 0
74 while(True):
71 while(True):
75 self.readerObj.getData()
72 self.readerObj.getData()
76 #print self.readerObj.datablock
77 #self.voltProcObj.init()
78 self.specProcObj.init()
73 self.specProcObj.init()
79
74
80 self.specProcObj.integrator(N=32) ## return self.dataOutObj
75 self.specProcObj.integrator(N=32) ## return self.dataOutObj
81
82 self.plot()
83 #print self.readerObj.dataOutObj.data
84
85 #CON TODO ESTO PLoTEO
86 #freq = self.specProcObj.getFrecuencies()
87 #spc = self.specProcObj.getSpectra()
88 # print freq
89 # print spc, spc.shape
90 # pl.plot(freq, spc[2])
91 # pl.show()
92
93 if self.readerObj.flagNoMoreFiles:
94 break
95
96 if self.readerObj.flagIsNewBlock:
97 print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks,
98 datetime.datetime.fromtimestamp(self.readerObj.m_BasicHeader.utc),)
99
100
101 def plot(self):
102
103 # x = self.specProcObj.getFrecuencies()
104 x = numpy.arange(self.specObj1.nFFTPoints)
105 spc = self.specObj1.data_spc
106 # spc = self.specProcObj.getSpectra()
107 nchannels = self.specObj1.nChannels
108
76
109 # y1=spc[0]
110 # y2=spc[1]
111 # y3=spc[2]
112 # y4=spc[3]
113
77
114 # signalList=[y1,y2,y3,y4]
115 # xmin = numpy.min(x)
116 # xmax = numpy.max(x)
117
118 #Creating Object
119 indexPlot = 1
120 nsubplot = nchannels
121 #nsubplot = 1
122 print "nsubplot:%d"%(nsubplot)
123 winTitle = "mi grafico de Espectrov1"
124
125 subplotTitle = "subplot-Espectro - No Channel."
126 xlabel = ""
127 ylabel = ""
128
78
129 linearObj = LinearPlot(indexPlot,nsubplot,winTitle)
79
80 self.specProcObj.plotScope(idfigure=1,
81 wintitle='test plot library',
82 driver='plplot',
83 minvalue = 30000.0,
84 maxvalue = 5000000.0,
85 save=True,
86 gpath="/home/roj-idl71/PlotImage")
87
130
88
131 #Config SubPlots
89 if self.readerObj.flagNoMoreFiles:
132 print "ConfigSubPlots"
90 break
133 print "nsubplot: %d "%nsubplot
91
134 for subplot in range(nsubplot):
92
135 indexplot = subplot + 1
136 name=subplot+1
137 print "Channel: %d"%(name)
138 title = subplotTitle + '%d'%name
139 xmin = numpy.min(x)
140 xmax = numpy.max(x)
141 ymin = numpy.min(spc[subplot])
142 ymax = numpy.max(spc[subplot])
143 linearObj.setup(indexplot, xmin, xmax, ymin, ymax, title, xlabel, ylabel)
144
93
145 #Plotting
94 if self.readerObj.flagIsNewBlock:
146 type = "simple"
95 print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks,
147 print "Ploteando"
96 datetime.datetime.fromtimestamp(self.readerObj.basicHeaderObj.utc),)
148 print "nsubplot: %d "%nsubplot
97
149 for subplot in range(nsubplot):
98
150 indexplot = subplot + 1
151 y = spc[subplot,:]
152 linearObj.plot(indexplot, x, y, type)
153
154 linearObj.refresh()
155 linearObj.show()
156
99
157 if __name__ == '__main__':
100 if __name__ == '__main__':
158 TestHeis()
101 TestHeis()
General Comments 0
You need to be logged in to leave comments. Login now