@@ -62,6 +62,7 class JROData: | |||
|
62 | 62 | |
|
63 | 63 | ippSeconds = None |
|
64 | 64 | |
|
65 | timeInterval = None | |
|
65 | 66 | |
|
66 | 67 | def __init__(self): |
|
67 | 68 |
@@ -58,9 +58,6 class Figure: | |||
|
58 | 58 | |
|
59 | 59 | self.frameObjList = [] |
|
60 | 60 | |
|
61 | # self.showGraph1 = args[0] | |
|
62 | # self.showGraph2 = args[1] | |
|
63 | ||
|
64 | 61 | self.drvObj.driver.setFigure() |
|
65 | 62 | self.drvObj.driver.setColormap(colormap) |
|
66 | 63 | |
@@ -143,16 +140,12 class Figure: | |||
|
143 | 140 | self.createFrames() |
|
144 | 141 | self.__isConfig = True |
|
145 | 142 | |
|
146 | if not(self.__isOutOfXRange(x)): | |
|
147 | self.changeXRange(x) | |
|
148 | ||
|
149 | if self.__isFigureOpen: | |
|
150 | self.drvObj.driver.closePage() | |
|
151 | self.__isFigureOpen = False | |
|
143 | ||
|
152 | 144 | |
|
153 | 145 | self.selectFigure() |
|
154 | 146 | self.__newPage() |
|
155 | 147 | |
|
148 | ||
|
156 | 149 | for channel in channelList: |
|
157 | 150 | frameObj = self.frameObjList[channel] |
|
158 | 151 | frameObj.init(xmin=self.xmin, |
@@ -165,15 +158,12 class Figure: | |||
|
165 | 158 | for channel in channelList: |
|
166 | 159 | dataCh = data1D[channel,:] |
|
167 | 160 | frameObj = self.frameObjList[channel] |
|
168 | # frameObj.clearData() | |
|
169 | 161 | frameObj.plot(x, dataCh) |
|
170 | ||
|
171 | # frameObj.refresh() | |
|
162 | ||
|
172 | 163 | self.__refresh() |
|
173 | 164 | |
|
165 | ||
|
174 | 166 | if save: |
|
175 | # self.colorplotObj.setFigure(indexPlot) | |
|
176 | ||
|
177 | 167 | path = gpath |
|
178 | 168 | now = datetime.datetime.now() |
|
179 | 169 | file = "scope_img%02d_%d_%d.png"%(self.idfigure, time.mktime(now.timetuple()), now.microsecond) |
@@ -198,7 +188,7 class Figure: | |||
|
198 | 188 | deltax=None, |
|
199 | 189 | save=False, |
|
200 | 190 | gpath='./', |
|
201 |
clear |
|
|
191 | cleardata=False, | |
|
202 | 192 | *args): |
|
203 | 193 | |
|
204 | 194 | |
@@ -223,8 +213,9 class Figure: | |||
|
223 | 213 | |
|
224 | 214 | if not(self.changeXRange(x)): |
|
225 | 215 | return 0 |
|
226 | ||
|
216 | ||
|
227 | 217 | self.__closePage() |
|
218 | self.__isFigureOpen = False | |
|
228 | 219 | |
|
229 | 220 | self.selectFigure() |
|
230 | 221 | |
@@ -256,7 +247,7 class Figure: | |||
|
256 | 247 | |
|
257 | 248 | |
|
258 | 249 | self.__refresh() |
|
259 |
if clear |
|
|
250 | if cleardata == True: | |
|
260 | 251 | self.__closePage() |
|
261 | 252 | self.__isFigureOpen = False |
|
262 | 253 |
@@ -3,9 +3,143 import datetime | |||
|
3 | 3 | import time |
|
4 | 4 | from schainPlot import * |
|
5 | 5 | |
|
6 | class CrossSpc(Figure): | |
|
7 | overplot = 0 | |
|
8 | xw = 900 | |
|
9 | yw = 650 | |
|
10 | showprofile = False | |
|
11 | signalA = None | |
|
12 | signalB = None | |
|
13 | coherence = None | |
|
14 | phase = None | |
|
15 | ||
|
16 | def __init__(self, idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile): | |
|
17 | Figure.__init__(self,idfigure, nframes, wintitle, self.xw, self.yw, self.overplot, driver, colormap, colorbar) | |
|
18 | ||
|
19 | self.showprofile = showprofile | |
|
20 | self.signalA = None | |
|
21 | self.signalB = None | |
|
22 | self.coherence = None | |
|
23 | self.phase = None | |
|
24 | ||
|
25 | def getSubplots(self): | |
|
26 | nrows = self.nframes | |
|
27 | ncolumns = 1 | |
|
28 | return nrows, ncolumns | |
|
29 | ||
|
30 | def setParms(self, data, x, y, xmin, xmax, ymin, ymax, minvalue, maxvalue, *args): | |
|
31 | ||
|
32 | if xmin == None: xmin = numpy.min(x) | |
|
33 | if xmax == None: xmax = numpy.max(x) | |
|
34 | if ymin == None: ymin = numpy.min(y) | |
|
35 | if ymax == None: ymax = numpy.max(y) | |
|
36 | if minvalue == None: minvalue = 20. | |
|
37 | if maxvalue == None: maxvalue = 90. | |
|
38 | ||
|
39 | self.signalA = self.data[0] | |
|
40 | self.signalB = self.data[1] | |
|
41 | self.coherence = self.data[2] | |
|
42 | self.phase = self.data[3] | |
|
43 | ||
|
44 | self.xmin = xmin | |
|
45 | self.xmax = xmax | |
|
46 | self.minrange = ymin | |
|
47 | self.maxrange = ymax | |
|
48 | self.ymin = ymin | |
|
49 | self.ymax = ymax | |
|
50 | self.minvalue = minvalue | |
|
51 | self.maxvalue = maxvalue | |
|
52 | ||
|
53 | def changeXRange(self, *args): | |
|
54 | pass | |
|
55 | ||
|
56 | def createFrames(self): | |
|
57 | self.frameObjList = [] | |
|
58 | ||
|
59 | for frame in range(self.nframes): | |
|
60 | frameObj = CrossSpcFrame(self.drvObj,frame + 1, self.colorbar, self.showprofile) | |
|
61 | self.frameObjList.append(frameObj) | |
|
62 | ||
|
63 | ||
|
64 | class CrossSpcFrame(Frame): | |
|
65 | def __init__(self): | |
|
66 | self.drvObj = drvObj | |
|
67 | self.idframe = idframe | |
|
68 | self.nplots = 4 | |
|
69 | ||
|
70 | if showprofile: | |
|
71 | self.nplots += 4 | |
|
72 | ||
|
73 | self.colorbar = colorbar | |
|
74 | self.showprofile = showprofile | |
|
75 | self.createPlots() | |
|
76 | ||
|
77 | def createPlots(self): | |
|
78 | plotObjList = [] | |
|
79 | idplot = 0 | |
|
80 | counter_plot = 0 | |
|
81 | for i in range(self.nplots): | |
|
82 | xi, yi, xw, yw = self.getScreenPos(idplot) | |
|
83 | plotObj = SpcPlot(self.drvObj, self.idframe, idplot, xi, yi, xw, yw, self.colorbar) | |
|
84 | plotObjList.append(plotObj) | |
|
85 | ||
|
86 | if self.showprofile: | |
|
87 | xi, yi, xw, yw = self.getScreenPos(idplot) | |
|
88 | type = "pwbox" | |
|
89 | title = "" | |
|
90 | xlabel = "dB" | |
|
91 | ylabel = "" | |
|
92 | idplot += 1 | |
|
93 | plotObj = Plot1D(self.drvObj, self.idframe, idplot, xi, yi, xw, yw, type, title, xlabel, ylabel) | |
|
94 | plotObjList.append(plotObj) | |
|
95 | idplot += 1 | |
|
96 | ||
|
97 | self.plotObjList = plotObjList | |
|
98 | ||
|
99 | def getScreenPos(self,idplot): | |
|
100 | pass | |
|
101 | ||
|
102 | def getScreenPosMainPlot(self): | |
|
103 | xi = 0.15 | |
|
104 | ||
|
105 | if self.showprofile: | |
|
106 | xw = 0.55 | |
|
107 | ||
|
108 | else: | |
|
109 | xw = 0.65 | |
|
110 | ||
|
111 | if self.colorbar: | |
|
112 | xw = xw - 0.06 | |
|
113 | ||
|
114 | yi = 0.20; yw = 0.75 | |
|
115 | ||
|
116 | return xi, yi, xw, yw | |
|
117 | ||
|
118 | def getScreenPosGraph1(self): | |
|
119 | if self.colorbar: | |
|
120 | xi = 0.65 + 0.08 | |
|
121 | else: | |
|
122 | xi = 0.75 + 0.05 | |
|
123 | ||
|
124 | xw = xi + 0.2 | |
|
125 | ||
|
126 | yi = 0.2; yw = 0.75 | |
|
127 | ||
|
128 | return xi, yi, xw, yw | |
|
129 | ||
|
130 | def plot(self,x, y, data): | |
|
131 | plotObj = self.plotObjList[0] | |
|
132 | plotObj.plot(x,y,data) | |
|
133 | ||
|
134 | if self.showprofile: | |
|
135 | plotObj = self.plotObjList[1] | |
|
136 | avg_data = numpy.average(data, axis=0) | |
|
137 | plotObj.plot(avg_data,y) | |
|
138 | ||
|
139 | ||
|
6 | 140 | class SpcFigure(Figure): |
|
7 | 141 | overplot = 0 |
|
8 |
xw = |
|
|
142 | xw = 900 | |
|
9 | 143 | yw = 650 |
|
10 | 144 | showprofile = False |
|
11 | 145 | |
@@ -86,10 +220,10 class SpcFrame(Frame): | |||
|
86 | 220 | xi = 0.15 |
|
87 | 221 | |
|
88 | 222 | if self.showprofile: |
|
89 |
xw = 0. |
|
|
223 | xw = 0.55 | |
|
90 | 224 | |
|
91 | 225 | else: |
|
92 |
xw = 0. |
|
|
226 | xw = 0.65 | |
|
93 | 227 | |
|
94 | 228 | if self.colorbar: |
|
95 | 229 | xw = xw - 0.06 |
@@ -116,7 +250,8 class SpcFrame(Frame): | |||
|
116 | 250 | |
|
117 | 251 | if self.showprofile: |
|
118 | 252 | plotObj = self.plotObjList[1] |
|
119 | plotObj.plot(data,y) | |
|
253 | avg_data = numpy.average(data, axis=0) | |
|
254 | plotObj.plot(avg_data,y) | |
|
120 | 255 | |
|
121 | 256 | class SpcPlot(Plot): |
|
122 | 257 | |
@@ -147,7 +282,7 class SpcPlot(Plot): | |||
|
147 | 282 | self.xopt = "bcnst" |
|
148 | 283 | self.yopt = "bcnstv" |
|
149 | 284 | |
|
150 |
self.szchar = 0. |
|
|
285 | self.szchar = 0.7 | |
|
151 | 286 | self.strforchannel = "Channel %d"%self.idframe |
|
152 | 287 | self.xlabel = "m/s" |
|
153 | 288 | self.ylabel = "Range (Km)" |
@@ -376,7 +511,7 class RTIPlot(Plot): | |||
|
376 | 511 | self.xpos = [self.xi,self.xw] |
|
377 | 512 | self.ypos = [self.yi,self.yw] |
|
378 | 513 | self.xaxisastime = True |
|
379 | self.timefmt = "%H:%M" | |
|
514 | self.timefmt = "%H:%M:%S" | |
|
380 | 515 | self.xopt = "bcnstd" |
|
381 | 516 | self.yopt = "bcnstv" |
|
382 | 517 | |
@@ -492,7 +627,7 class Plot1D(Plot): | |||
|
492 | 627 | self.timefmt = None |
|
493 | 628 | self.xopt = "bcnst" |
|
494 | 629 | self.yopt = "bcnstv" |
|
495 |
self.szchar = |
|
|
630 | self.szchar = 0.7 | |
|
496 | 631 | self.type = type |
|
497 | 632 | self.title = title |
|
498 | 633 | self.xlabel = xlabel |
@@ -295,6 +295,10 class VoltageReader(JRODataReader): | |||
|
295 | 295 | |
|
296 | 296 | self.dataOutObj.utctime = self.basicHeaderObj.utc + self.basicHeaderObj.miliSecond/1000. + self.profileIndex * self.ippSeconds |
|
297 | 297 | |
|
298 | self.dataOutObj.ippSeconds = self.ippSeconds | |
|
299 | ||
|
300 | self.dataOutObj.timeInterval = self.ippSeconds | |
|
301 | ||
|
298 | 302 | self.dataOutObj.nCohInt = self.processingHeaderObj.nCohInt |
|
299 | 303 | |
|
300 | 304 | self.dataOutObj.flagShiftFFT = False |
@@ -313,6 +317,10 class VoltageReader(JRODataReader): | |||
|
313 | 317 | self.dataOutObj.radarControllerHeaderObj = self.radarControllerHeaderObj.copy() |
|
314 | 318 | |
|
315 | 319 | self.dataOutObj.flagNoData = False |
|
320 | ||
|
321 | # print self.profileIndex, self.dataOutObj.utctime | |
|
322 | # if self.profileIndex == 800: | |
|
323 | # a=1 | |
|
316 | 324 | |
|
317 | 325 | return self.dataOutObj.data |
|
318 | 326 |
@@ -53,7 +53,7 class SpectraProcessor: | |||
|
53 | 53 | self.buffer = None |
|
54 | 54 | self.profIndex = 0 |
|
55 | 55 | |
|
56 | def setup(self, dataInObj=None, dataOutObj=None, nFFTPoints=None, pairList=None): | |
|
56 | def setup(self, dataInObj=None, dataOutObj=None, nFFTPoints=None, pairsList=None): | |
|
57 | 57 | |
|
58 | 58 | if dataInObj == None: |
|
59 | 59 | raise ValueError, "This SpectraProcessor.setup() function needs dataInObj input variable" |
@@ -70,13 +70,13 class SpectraProcessor: | |||
|
70 | 70 | |
|
71 | 71 | nFFTPoints = dataInObj.nFFTPoints |
|
72 | 72 | |
|
73 | if pairList == None: | |
|
74 |
pairList = |
|
|
73 | if pairsList == None: | |
|
74 | pairsList = dataInObj.pairsList | |
|
75 | 75 | |
|
76 | if pairList == None: | |
|
76 | if pairsList == None: | |
|
77 | 77 | nPairs = 0 |
|
78 | 78 | else: |
|
79 | nPairs = len(pairList) | |
|
79 | nPairs = len(pairsList) | |
|
80 | 80 | |
|
81 | 81 | self.dataInObj = dataInObj |
|
82 | 82 | |
@@ -85,7 +85,7 class SpectraProcessor: | |||
|
85 | 85 | |
|
86 | 86 | self.dataOutObj = dataOutObj |
|
87 | 87 | self.dataOutObj.nFFTPoints = nFFTPoints |
|
88 | self.dataOutObj.pairList = pairList | |
|
88 | self.dataOutObj.pairsList = pairsList | |
|
89 | 89 | self.dataOutObj.nPairs = nPairs |
|
90 | 90 | |
|
91 | 91 | return self.dataOutObj |
@@ -176,10 +176,10 class SpectraProcessor: | |||
|
176 | 176 | |
|
177 | 177 | cspc = None |
|
178 | 178 | pairIndex = 0 |
|
179 | if self.dataOutObj.pairList != None: | |
|
179 | if self.dataOutObj.pairsList != None: | |
|
180 | 180 | #calculo de cross-spectra |
|
181 | 181 | cspc = numpy.zeros((self.dataOutObj.nPairs, self.dataOutObj.nFFTPoints, self.dataOutObj.nHeights), dtype='complex') |
|
182 | for pair in self.pairList: | |
|
182 | for pair in self.dataOutObj.pairsList: | |
|
183 | 183 | cspc[pairIndex,:,:] = numpy.abs(fft_volt[pair[0],:,:] * numpy.conjugate(fft_volt[pair[1],:,:])) |
|
184 | 184 | pairIndex += 1 |
|
185 | 185 | blocksize += cspc.size |
@@ -222,6 +222,47 class SpectraProcessor: | |||
|
222 | 222 | |
|
223 | 223 | objIncohInt = IncoherentIntegration(N,timeInterval) |
|
224 | 224 | self.integratorObjList.append(objIncohInt) |
|
225 | ||
|
226 | def addCrossSpc(self, idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile): | |
|
227 | crossSpcObj = CrossSpcFigure(idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile) | |
|
228 | self.plotObjList.append(crossSpcObj) | |
|
229 | ||
|
230 | def plotCrossSpc(self, idfigure=None, | |
|
231 | xmin=None, | |
|
232 | xmax=None, | |
|
233 | ymin=None, | |
|
234 | ymax=None, | |
|
235 | minvalue=None, | |
|
236 | maxvalue=None, | |
|
237 | wintitle='', | |
|
238 | driver='plplot', | |
|
239 | colormap='br_green', | |
|
240 | colorbar=True, | |
|
241 | showprofile=False, | |
|
242 | save=False, | |
|
243 | gpath=None, | |
|
244 | pairsList = None): | |
|
245 | ||
|
246 | if self.dataOutObj.flagNoData: | |
|
247 | return 0 | |
|
248 | ||
|
249 | if pairsList == None: | |
|
250 | pairsList = self.dataOutObj.pairsList | |
|
251 | ||
|
252 | nframes = len(pairsList) | |
|
253 | ||
|
254 | x = numpy.arange(self.dataOutObj.nFFTPoints) | |
|
255 | ||
|
256 | y = self.dataOutObj.heightList | |
|
257 | ||
|
258 | ||
|
259 | ||
|
260 | ||
|
261 | if len(self.plotObjList) <= self.plotObjIndex: | |
|
262 | self.addSpc(idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile) | |
|
263 | ||
|
264 | ||
|
265 | ||
|
225 | 266 | |
|
226 | 267 | def addSpc(self, idfigure, nframes, wintitle, driver, colormap, colorbar, showprofile): |
|
227 | 268 | |
@@ -276,7 +317,7 class SpectraProcessor: | |||
|
276 | 317 | |
|
277 | 318 | plotObj = self.plotObjList[self.plotObjIndex] |
|
278 | 319 | |
|
279 | plotObj.plotPcolor(data, | |
|
320 | plotObj.plotPcolor(data=data, | |
|
280 | 321 | x=x, |
|
281 | 322 | y=y, |
|
282 | 323 | channelList=channelList, |
@@ -289,9 +330,9 class SpectraProcessor: | |||
|
289 | 330 | figuretitle=figuretitle, |
|
290 | 331 | xrangestep=None, |
|
291 | 332 | deltax=None, |
|
292 |
save= |
|
|
293 |
gpath= |
|
|
294 |
clear |
|
|
333 | save=save, | |
|
334 | gpath=gpath, | |
|
335 | cleardata=cleardata | |
|
295 | 336 | ) |
|
296 | 337 | |
|
297 | 338 | self.plotObjIndex += 1 |
@@ -67,7 +67,7 class VoltageProcessor: | |||
|
67 | 67 | maxvalue=None, |
|
68 | 68 | wintitle='', |
|
69 | 69 | driver='plplot', |
|
70 | colormap='br_green', | |
|
70 | colormap='br_greeen', | |
|
71 | 71 | colorbar=True, |
|
72 | 72 | showprofile=False, |
|
73 | 73 | xrangestep=None, |
@@ -103,21 +103,25 class VoltageProcessor: | |||
|
103 | 103 | |
|
104 | 104 | cleardata = False |
|
105 | 105 | |
|
106 | plotObj.plotPcolor(data, | |
|
107 | currenttime, | |
|
108 | range, | |
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
106 | deltax = self.dataOutObj.timeInterval | |
|
107 | ||
|
108 | plotObj.plotPcolor(data=data, | |
|
109 | x=currenttime, | |
|
110 | y=range, | |
|
111 | channelList=channelList, | |
|
112 | xmin=starttime, | |
|
113 | xmax=endtime, | |
|
114 | ymin=rangemin, | |
|
115 | ymax=rangemax, | |
|
116 | minvalue=minvalue, | |
|
117 | maxvalue=maxvalue, | |
|
118 | figuretitle=figuretitle, | |
|
119 | xrangestep=xrangestep, | |
|
120 | deltax=deltax, | |
|
121 | save=save, | |
|
122 | gpath=gpath, | |
|
123 | cleardata=cleardata) | |
|
124 | ||
|
121 | 125 | |
|
122 | 126 | self.plotObjIndex += 1 |
|
123 | 127 | |
@@ -168,16 +172,17 class VoltageProcessor: | |||
|
168 | 172 | |
|
169 | 173 | plotObj = self.plotObjList[self.plotObjIndex] |
|
170 | 174 | |
|
171 | plotObj.plot1DArray(data1D, | |
|
172 | self.dataOutObj.heightList, | |
|
173 | self.dataOutObj.channelList, | |
|
174 | xmin, | |
|
175 | xmax, | |
|
176 | minvalue, | |
|
177 | maxvalue, | |
|
178 | figureTitle, | |
|
179 | save, | |
|
180 | gpath) | |
|
175 | plotObj.plot1DArray(data1D=data1D, | |
|
176 | x=self.dataOutObj.heightList, | |
|
177 | channelList=self.dataOutObj.channelList, | |
|
178 | xmin=xmin, | |
|
179 | xmax=xmax, | |
|
180 | minvalue=minvalue, | |
|
181 | maxvalue=maxvalue, | |
|
182 | figureTitle=figureTitle, | |
|
183 | save=save, | |
|
184 | gpath=gpath) | |
|
185 | ||
|
181 | 186 | |
|
182 | 187 | self.plotObjIndex += 1 |
|
183 | 188 |
General Comments 0
You need to be logged in to leave comments.
Login now