@@ -18,7 +18,7 from IO.SpectraIO import * | |||
|
18 | 18 | from Processing.VoltageProcessor import * |
|
19 | 19 | from Processing.SpectraProcessor import * |
|
20 | 20 | |
|
21 | from Graphics.BaseGraph_mpl import LinearPlot | |
|
21 | #from Graphics.BaseGraph_mpl import LinearPlot | |
|
22 | 22 | |
|
23 | 23 | class TestHeis(): |
|
24 | 24 | i=None |
@@ -30,14 +30,15 class TestHeis(): | |||
|
30 | 30 | |
|
31 | 31 | def setValues( self ): |
|
32 | 32 | |
|
33 |
self.path=" |
|
|
33 | self.path="/home/roj-idl71/data" | |
|
34 | ||
|
35 | #self.path = "" | |
|
34 | 36 | self.startDate = datetime.date(2012,4,1) |
|
35 | 37 | self.endDate = datetime.date(2012,6,30) |
|
36 | 38 | |
|
37 | 39 | self.startTime = datetime.time(0,0,0) |
|
38 | 40 | self.endTime = datetime.time(23,0,0) |
|
39 | #self.N = 4 | |
|
40 | #self.npts = 8 | |
|
41 | ||
|
41 | 42 | |
|
42 | 43 | def createObjects( self ): |
|
43 | 44 | |
@@ -56,103 +57,45 class TestHeis(): | |||
|
56 | 57 | if not(self.voltObj1): |
|
57 | 58 | sys.exit(0) |
|
58 | 59 | |
|
59 | print "voltaje o alturas: %03d"%(self.voltObj1.nHeights) | |
|
60 | #print "perfiles: %03d"%(self.voltObj1.nProfiles) | |
|
61 | 60 | self.specObj1 = self.specProcObj.setup(dataInObj = self.voltObj1,nFFTPoints=self.voltObj1.nHeights) |
|
62 | 61 | |
|
63 | 62 | |
|
63 | # | |
|
64 | 64 | |
|
65 | print "nChannels: %03d"%(self.specObj1.nChannels) | |
|
66 | print "nHeights: %03d"%( self.specObj1.nHeights) | |
|
67 | print "nFFTPoints: %03d"% int(self.specObj1.nFFTPoints) | |
|
68 | ||
|
65 | # | |
|
69 | 66 | |
|
70 | 67 | def testSChain( self ): |
|
71 | 68 | |
|
72 | 69 | ini = time.time() |
|
73 | ||
|
70 | counter = 0 | |
|
74 | 71 | while(True): |
|
75 | 72 | self.readerObj.getData() |
|
76 | #print self.readerObj.datablock | |
|
77 | #self.voltProcObj.init() | |
|
78 | 73 | self.specProcObj.init() |
|
79 | 74 | |
|
80 | 75 |
self.specProcObj.integrator(N=32) ## return self.dataOutObj |
|
81 | 76 | |
|
82 | self.plot() | |
|
83 | #print self.readerObj.dataOutObj.data | |
|
84 | 77 | |
|
85 | #CON TODO ESTO PLoTEO | |
|
86 | #freq = self.specProcObj.getFrecuencies() | |
|
87 |
|
|
|
88 | # print freq | |
|
89 | # print spc, spc.shape | |
|
90 | # pl.plot(freq, spc[2]) | |
|
91 | # pl.show() | |
|
78 | ||
|
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 | ||
|
92 | 88 |
|
|
93 | 89 | if self.readerObj.flagNoMoreFiles: |
|
94 | 90 |
|
|
95 | 91 |
|
|
92 | ||
|
93 | ||
|
96 | 94 | if self.readerObj.flagIsNewBlock: |
|
97 | 95 | print 'Block No %04d, Time: %s' %(self.readerObj.nTotalBlocks, |
|
98 |
datetime.datetime.fromtimestamp(self.readerObj. |
|
|
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 | ||
|
109 | # y1=spc[0] | |
|
110 | # y2=spc[1] | |
|
111 | # y3=spc[2] | |
|
112 | # y4=spc[3] | |
|
113 | ||
|
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 | ||
|
129 | linearObj = LinearPlot(indexPlot,nsubplot,winTitle) | |
|
130 | ||
|
131 | #Config SubPlots | |
|
132 | print "ConfigSubPlots" | |
|
133 | print "nsubplot: %d "%nsubplot | |
|
134 | for subplot in range(nsubplot): | |
|
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 | ||
|
145 | #Plotting | |
|
146 | type = "simple" | |
|
147 | print "Ploteando" | |
|
148 | print "nsubplot: %d "%nsubplot | |
|
149 | for subplot in range(nsubplot): | |
|
150 | indexplot = subplot + 1 | |
|
151 | y = spc[subplot,:] | |
|
152 | linearObj.plot(indexplot, x, y, type) | |
|
153 | ||
|
154 | linearObj.refresh() | |
|
155 | linearObj.show() | |
|
96 | datetime.datetime.fromtimestamp(self.readerObj.basicHeaderObj.utc),) | |
|
97 | ||
|
98 | ||
|
156 | 99 | |
|
157 | 100 | if __name__ == '__main__': |
|
158 | 101 | TestHeis() |
General Comments 0
You need to be logged in to leave comments.
Login now