@@ -586,10 +586,10 if __name__ == '__main__': | |||
|
586 | 586 | controllerObj.setup(id = '191', name='test01', description=desc) |
|
587 | 587 | |
|
588 | 588 | readUnitConfObj = controllerObj.addReadUnit(datatype='Spectra', |
|
589 |
path=' |
|
|
590 |
startDate='2011/0 |
|
|
589 | path='/Users/dsuarez/Remote/IMAGING', | |
|
590 | startDate='2011/03/20', | |
|
591 | 591 | endDate='2012/12/31', |
|
592 |
startTime='0 |
|
|
592 | startTime='06:10:00', | |
|
593 | 593 | endTime='23:59:59', |
|
594 | 594 | online=0) |
|
595 | 595 | |
@@ -605,31 +605,38 if __name__ == '__main__': | |||
|
605 | 605 | opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') |
|
606 | 606 | # opObj11.addParameter(name='zmin', value='70', format='int') |
|
607 | 607 | # opObj11.addParameter(name='zmax', value='90', format='int') |
|
608 |
opObj11.addParameter(name='showprofile', value=' |
|
|
608 | opObj11.addParameter(name='showprofile', value='0', format='int') | |
|
609 | 609 | |
|
610 |
opObj1 |
|
|
611 |
opObj1 |
|
|
612 | ||
|
613 | opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |
|
614 |
opObj1 |
|
|
615 | ||
|
616 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
|
617 | opObj11.addParameter(name='idfigure', value='2', format='int') | |
|
618 |
opObj1 |
|
|
619 | opObj11.addParameter(name='zmin', value='70', format='int') | |
|
620 | opObj11.addParameter(name='zmax', value='90', format='int') | |
|
621 | ||
|
622 | opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
|
623 | opObj10.addParameter(name='channelList', value='2,6', format='intlist') | |
|
624 | ||
|
625 | opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |
|
626 |
opObj1 |
|
|
627 | ||
|
628 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
|
629 | opObj11.addParameter(name='idfigure', value='3', format='int') | |
|
630 |
opObj1 |
|
|
631 | opObj11.addParameter(name='zmin', value='70', format='int') | |
|
632 | opObj11.addParameter(name='zmax', value='90', format='int') | |
|
610 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
|
611 | opObj11.addParameter(name='idfigure', value='10', format='int') | |
|
612 | opObj11.addParameter(name='wintitle', value='RTI', format='str') | |
|
613 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
|
614 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
|
615 | opObj11.addParameter(name='showprofile', value='0', format='int') | |
|
616 | ||
|
617 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
|
618 | # opObj10.addParameter(name='channelList', value='0,2,4,6', format='intlist') | |
|
619 | # | |
|
620 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |
|
621 | # opObj12.addParameter(name='n', value='2', format='int') | |
|
622 | # | |
|
623 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
|
624 | # opObj11.addParameter(name='idfigure', value='2', format='int') | |
|
625 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') | |
|
626 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
|
627 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
|
628 | # | |
|
629 | # opObj10 = procUnitConfObj1.addOperation(name='selectChannels') | |
|
630 | # opObj10.addParameter(name='channelList', value='2,6', format='intlist') | |
|
631 | # | |
|
632 | # opObj12 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |
|
633 | # opObj12.addParameter(name='n', value='2', format='int') | |
|
634 | # | |
|
635 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |
|
636 | # opObj11.addParameter(name='idfigure', value='3', format='int') | |
|
637 | # opObj11.addParameter(name='wintitle', value='SpectraPlot10', format='str') | |
|
638 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
|
639 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
|
633 | 640 | |
|
634 | 641 | |
|
635 | 642 | # opObj12 = procUnitConfObj1.addOperation(name='decoder') |
@@ -640,16 +647,16 if __name__ == '__main__': | |||
|
640 | 647 | |
|
641 | 648 | |
|
642 | 649 | |
|
643 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj1.getId()) | |
|
644 | ||
|
645 | opObj21 = procUnitConfObj2.addOperation(name='IncohInt', optype='other') | |
|
646 | opObj21.addParameter(name='n', value='2', format='int') | |
|
647 | ||
|
648 | opObj11 = procUnitConfObj2.addOperation(name='SpectraPlot', optype='other') | |
|
649 | opObj11.addParameter(name='idfigure', value='4', format='int') | |
|
650 | opObj11.addParameter(name='wintitle', value='SpectraPlot OBJ 2', format='str') | |
|
651 | opObj11.addParameter(name='zmin', value='70', format='int') | |
|
652 | opObj11.addParameter(name='zmax', value='90', format='int') | |
|
650 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj1.getId()) | |
|
651 | # | |
|
652 | # opObj21 = procUnitConfObj2.addOperation(name='IncohInt', optype='other') | |
|
653 | # opObj21.addParameter(name='n', value='2', format='int') | |
|
654 | # | |
|
655 | # opObj11 = procUnitConfObj2.addOperation(name='SpectraPlot', optype='other') | |
|
656 | # opObj11.addParameter(name='idfigure', value='4', format='int') | |
|
657 | # opObj11.addParameter(name='wintitle', value='SpectraPlot OBJ 2', format='str') | |
|
658 | # opObj11.addParameter(name='zmin', value='70', format='int') | |
|
659 | # opObj11.addParameter(name='zmax', value='90', format='int') | |
|
653 | 660 | |
|
654 | 661 | print "Escribiendo el archivo XML" |
|
655 | 662 |
@@ -126,6 +126,9 class Axes: | |||
|
126 | 126 | |
|
127 | 127 | __showprofile = False |
|
128 | 128 | |
|
129 | __zmin = None | |
|
130 | __zmax = None | |
|
131 | ||
|
129 | 132 | def __init__(self, *args): |
|
130 | 133 | |
|
131 | 134 | """ |
@@ -198,7 +201,7 class Axes: | |||
|
198 | 201 | ymin=None, ymax=None, |
|
199 | 202 | zmin=None, zmax=None, |
|
200 | 203 | xlabel='', ylabel='', |
|
201 | title='', | |
|
204 | title='', rti = False, | |
|
202 | 205 | **kwargs): |
|
203 | 206 | |
|
204 | 207 | """ |
@@ -218,6 +221,7 class Axes: | |||
|
218 | 221 | **kwargs : Los parametros aceptados son |
|
219 | 222 | ticksize=9, |
|
220 | 223 | cblabel='' |
|
224 | rti = True or False | |
|
221 | 225 | """ |
|
222 | 226 | |
|
223 | 227 | if self.firsttime: |
@@ -228,7 +232,8 class Axes: | |||
|
228 | 232 | if ymax == None: ymax = numpy.nanmax(y) |
|
229 | 233 | if zmin == None: zmin = numpy.nanmin(z) |
|
230 | 234 | if zmax == None: zmax = numpy.nanmax(z) |
|
231 | ||
|
235 | ||
|
236 | ||
|
232 | 237 | self.plot = self.__driver.createPcolor(self.ax, x, y, z, |
|
233 | 238 | xmin, xmax, |
|
234 | 239 | ymin, ymax, |
@@ -238,8 +243,14 class Axes: | |||
|
238 | 243 | title=title, |
|
239 | 244 | **kwargs) |
|
240 | 245 | self.firsttime = False |
|
246 | if self.__zmin == None: self.__zmin = zmin | |
|
247 | if self.__zmax == None: self.__zmax = zmax | |
|
241 | 248 | return |
|
242 |
|
|
|
243 | mesh = self.__driver.pcolor(self.plot, z, xlabel=xlabel, | |
|
244 | ylabel=ylabel, | |
|
245 | title=title) | |
|
249 | ||
|
250 | if rti: | |
|
251 | self.__driver.addpcolor(self.ax, x, y, z, self.__zmin, self.__zmax) | |
|
252 | return | |
|
253 | ||
|
254 | self.__driver.pcolor(self.plot, z, xlabel=xlabel, ylabel=ylabel, title=title) | |
|
255 | ||
|
256 | No newline at end of file |
@@ -107,7 +107,7 def closeFigure(): | |||
|
107 | 107 | matplotlib.pyplot.ioff() |
|
108 | 108 | matplotlib.pyplot.show() |
|
109 | 109 | |
|
110 | retur | |
|
110 | return | |
|
111 | 111 | |
|
112 | 112 | def setWinTitle(fig, title): |
|
113 | 113 | |
@@ -238,6 +238,10 def pcolor(imesh, z, xlabel='', ylabel='', title=''): | |||
|
238 | 238 | |
|
239 | 239 | imesh.set_array(z.ravel()) |
|
240 | 240 | |
|
241 | def addpcolor(ax, x, y, z, zmin, zmax): | |
|
242 | ||
|
243 | imesh = ax.pcolormesh(x,y,z.T,vmin=zmin,vmax=zmax) | |
|
244 | ||
|
241 | 245 | def draw(fig): |
|
242 | 246 | |
|
243 | 247 | if type(fig) == 'int': |
@@ -123,7 +123,7 class JROData: | |||
|
123 | 123 | |
|
124 | 124 | # nChannels = None |
|
125 | 125 | |
|
126 | nHeights = None | |
|
126 | # nHeights = None | |
|
127 | 127 | |
|
128 | 128 | nProfiles = None |
|
129 | 129 | |
@@ -184,6 +184,10 class JROData: | |||
|
184 | 184 | |
|
185 | 185 | return self.flagNoData |
|
186 | 186 | |
|
187 | def getNoise(self): | |
|
188 | ||
|
189 | raise ValueError, "Not implemented" | |
|
190 | ||
|
187 | 191 | def getNChannels(self): |
|
188 | 192 | |
|
189 | 193 | return len(self.channelList) |
@@ -192,9 +196,53 class JROData: | |||
|
192 | 196 | |
|
193 | 197 | return range(self.nChannels) |
|
194 | 198 | |
|
199 | def getNHeights(self): | |
|
200 | ||
|
201 | return len(self.heightList) | |
|
202 | ||
|
203 | def getHeiRange(self, extrapoints=0): | |
|
204 | ||
|
205 | heis = self.heightList | |
|
206 | # deltah = self.heightList[1] - self.heightList[0] | |
|
207 | # | |
|
208 | # heis.append(self.heightList[-1]) | |
|
209 | ||
|
210 | return heis | |
|
211 | ||
|
212 | def getDatatime(self): | |
|
213 | ||
|
214 | datatime = [] | |
|
215 | ||
|
216 | datatime.append(self.utctime) | |
|
217 | datatime.append(self.utctime + 2*self.timeInterval) | |
|
218 | ||
|
219 | datatime = numpy.array(datatime) | |
|
220 | ||
|
221 | return datatime | |
|
222 | ||
|
223 | def getFmax(self): | |
|
224 | ||
|
225 | PRF = 1./(self.ippSeconds * self.nCohInt) | |
|
226 | ||
|
227 | fmax = PRF/2. | |
|
228 | ||
|
229 | return fmax | |
|
230 | ||
|
231 | def getVmax(self): | |
|
232 | ||
|
233 | _lambda = self.C/self.frequency | |
|
234 | ||
|
235 | vmax = self.getFmax() * _lambda / 2. | |
|
236 | ||
|
237 | return vmax | |
|
238 | ||
|
195 | 239 | nChannels = property(getNChannels, "I'm the 'nChannel' property.") |
|
196 | 240 | channelIndexList = property(getChannelIndexList, "I'm the 'channelIndexList' property.") |
|
197 | 241 | |
|
242 | nHeights = property(getNHeights, "I'm the 'nHeights' property.") | |
|
243 | ||
|
244 | noise = property(getNoise, "I'm the 'nHeights' property.") | |
|
245 | ||
|
198 | 246 | class Voltage(JROData): |
|
199 | 247 | |
|
200 | 248 | #data es un numpy array de 2 dmensiones (canales, alturas) |
@@ -217,7 +265,7 class Voltage(JROData): | |||
|
217 | 265 | |
|
218 | 266 | # self.nChannels = 0 |
|
219 | 267 | |
|
220 | self.nHeights = 0 | |
|
268 | # self.nHeights = 0 | |
|
221 | 269 | |
|
222 | 270 | self.nProfiles = None |
|
223 | 271 | |
@@ -300,7 +348,7 class Spectra(JROData): | |||
|
300 | 348 | |
|
301 | 349 | # self.nChannels = 0 |
|
302 | 350 | |
|
303 | self.nHeights = 0 | |
|
351 | # self.nHeights = 0 | |
|
304 | 352 | |
|
305 | 353 | self.nProfiles = None |
|
306 | 354 | |
@@ -325,22 +373,6 class Spectra(JROData): | |||
|
325 | 373 | self.nFFTPoints = None |
|
326 | 374 | |
|
327 | 375 | self.wavelength = None |
|
328 | ||
|
329 | def getFmax(self): | |
|
330 | ||
|
331 | PRF = 1./(self.ippSeconds * self.nCohInt) | |
|
332 | ||
|
333 | fmax = PRF/2. | |
|
334 | ||
|
335 | return fmax | |
|
336 | ||
|
337 | def getVmax(self): | |
|
338 | ||
|
339 | _lambda = self.C/self.frequency | |
|
340 | ||
|
341 | vmax = self.getFmax() * _lambda / 2. | |
|
342 | ||
|
343 | return vmax | |
|
344 | 376 | |
|
345 | 377 | def getFreqRange(self, extrapoints=0): |
|
346 | 378 | |
@@ -441,7 +473,7 class SpectraHeis(JROData): | |||
|
441 | 473 | |
|
442 | 474 | # self.nChannels = 0 |
|
443 | 475 | |
|
444 | self.nHeights = 0 | |
|
476 | # self.nHeights = 0 | |
|
445 | 477 | |
|
446 | 478 | self.nProfiles = None |
|
447 | 479 |
@@ -1319,7 +1319,7 class VoltageReader(JRODataReader): | |||
|
1319 | 1319 | |
|
1320 | 1320 | # self.dataOut.nChannels = self.systemHeaderObj.nChannels |
|
1321 | 1321 | |
|
1322 | self.dataOut.nHeights = self.processingHeaderObj.nHeights | |
|
1322 | # self.dataOut.nHeights = self.processingHeaderObj.nHeights | |
|
1323 | 1323 | |
|
1324 | 1324 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock |
|
1325 | 1325 | |
@@ -1967,7 +1967,7 class SpectraReader(JRODataReader): | |||
|
1967 | 1967 | |
|
1968 | 1968 | self.dataOut.pairsList = self.rdPairList |
|
1969 | 1969 | |
|
1970 | self.dataOut.nHeights = self.processingHeaderObj.nHeights | |
|
1970 | # self.dataOut.nHeights = self.processingHeaderObj.nHeights | |
|
1971 | 1971 | |
|
1972 | 1972 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock |
|
1973 | 1973 |
@@ -2,6 +2,143 import numpy | |||
|
2 | 2 | import datetime |
|
3 | 3 | from graphics.figure import * |
|
4 | 4 | |
|
5 | class RTIPlot(Figure): | |
|
6 | ||
|
7 | __isConfig = None | |
|
8 | __nsubplots = None | |
|
9 | ||
|
10 | WIDTHPROF = None | |
|
11 | HEIGHTPROF = None | |
|
12 | ||
|
13 | def __init__(self): | |
|
14 | ||
|
15 | self.__timerange = 30*60 | |
|
16 | self.__isConfig = False | |
|
17 | self.__nsubplots = 1 | |
|
18 | ||
|
19 | self.WIDTH = 800 | |
|
20 | self.HEIGHT = 400 | |
|
21 | self.WIDTHPROF = 120 | |
|
22 | self.HEIGHTPROF = 0 | |
|
23 | ||
|
24 | def getSubplots(self): | |
|
25 | ||
|
26 | ncol = 1 | |
|
27 | nrow = self.nplots | |
|
28 | ||
|
29 | return nrow, ncol | |
|
30 | ||
|
31 | def setup(self, idfigure, nplots, wintitle, showprofile=True): | |
|
32 | ||
|
33 | self.__showprofile = showprofile | |
|
34 | self.nplots = nplots | |
|
35 | ||
|
36 | ncolspan = 1 | |
|
37 | colspan = 1 | |
|
38 | if showprofile: | |
|
39 | ncolspan = 7 | |
|
40 | colspan = 6 | |
|
41 | self.__nsubplots = 2 | |
|
42 | self.WIDTH += self.WIDTHPROF | |
|
43 | self.HEIGHT += self.HEIGHTPROF | |
|
44 | ||
|
45 | self.createFigure(idfigure, wintitle) | |
|
46 | ||
|
47 | nrow, ncol = self.getSubplots() | |
|
48 | ||
|
49 | counter = 0 | |
|
50 | for y in range(nrow): | |
|
51 | for x in range(ncol): | |
|
52 | ||
|
53 | if counter >= self.nplots: | |
|
54 | break | |
|
55 | ||
|
56 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) | |
|
57 | ||
|
58 | if showprofile: | |
|
59 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) | |
|
60 | ||
|
61 | counter += 1 | |
|
62 | ||
|
63 | def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True', | |
|
64 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None): | |
|
65 | ||
|
66 | """ | |
|
67 | ||
|
68 | Input: | |
|
69 | dataOut : | |
|
70 | idfigure : | |
|
71 | wintitle : | |
|
72 | channelList : | |
|
73 | showProfile : | |
|
74 | xmin : None, | |
|
75 | xmax : None, | |
|
76 | ymin : None, | |
|
77 | ymax : None, | |
|
78 | zmin : None, | |
|
79 | zmax : None | |
|
80 | """ | |
|
81 | ||
|
82 | if channelList == None: | |
|
83 | channelIndexList = dataOut.channelIndexList | |
|
84 | else: | |
|
85 | channelIndexList = [] | |
|
86 | for channel in channelList: | |
|
87 | if channel not in dataOut.channelList: | |
|
88 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
|
89 | channelIndexList.append(channel) | |
|
90 | ||
|
91 | x = dataOut.getDatatime() | |
|
92 | y = dataOut.getHeiRange() | |
|
93 | z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:]) | |
|
94 | avg = numpy.average(z, axis=1) | |
|
95 | ||
|
96 | noise = dataOut.getNoise() | |
|
97 | ||
|
98 | if not self.__isConfig: | |
|
99 | ||
|
100 | nplots = len(channelIndexList) | |
|
101 | ||
|
102 | self.setup(idfigure=idfigure, | |
|
103 | nplots=nplots, | |
|
104 | wintitle=wintitle, | |
|
105 | showprofile=showprofile) | |
|
106 | ||
|
107 | if xmin == None: xmin = numpy.min(x) | |
|
108 | if xmax == None: xmax = xmin + self.__timerange | |
|
109 | if ymin == None: ymin = numpy.nanmin(y) | |
|
110 | if ymax == None: ymax = numpy.nanmax(y) | |
|
111 | if zmin == None: zmin = numpy.nanmin(avg)*0.9 | |
|
112 | if zmax == None: zmax = numpy.nanmax(avg)*0.9 | |
|
113 | ||
|
114 | self.__isConfig = True | |
|
115 | ||
|
116 | thisDatetime = datetime.datetime.fromtimestamp(dataOut.utctime) | |
|
117 | title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
|
118 | xlabel = "Velocity (m/s)" | |
|
119 | ylabel = "Range (Km)" | |
|
120 | ||
|
121 | self.setWinTitle(title) | |
|
122 | ||
|
123 | for i in range(self.nplots): | |
|
124 | title = "Channel %d: %4.2fdB" %(dataOut.channelList[i], noise[i]) | |
|
125 | axes = self.axesList[i*self.__nsubplots] | |
|
126 | z = avg[i].reshape((1,-1)) | |
|
127 | axes.pcolor(x, y, z, | |
|
128 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, | |
|
129 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, | |
|
130 | ticksize=9, cblabel='') | |
|
131 | ||
|
132 | if self.__showprofile: | |
|
133 | axes = self.axesList[i*self.__nsubplots +1] | |
|
134 | axes.pline(avg[i], y, | |
|
135 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, | |
|
136 | xlabel='dB', ylabel='', title='', | |
|
137 | ytick_visible=False, | |
|
138 | grid='x') | |
|
139 | ||
|
140 | self.draw() | |
|
141 | ||
|
5 | 142 | class SpectraPlot(Figure): |
|
6 | 143 | |
|
7 | 144 | __isConfig = None |
@@ -55,7 +192,7 class SpectraPlot(Figure): | |||
|
55 | 192 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
56 | 193 | |
|
57 | 194 | if showprofile: |
|
58 |
self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+ |
|
|
195 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) | |
|
59 | 196 | |
|
60 | 197 | counter += 1 |
|
61 | 198 | |
@@ -88,7 +225,7 class SpectraPlot(Figure): | |||
|
88 | 225 | channelIndexList.append(channel) |
|
89 | 226 | |
|
90 | 227 | x = dataOut.getVelRange(1) |
|
91 |
y = dataOut. |
|
|
228 | y = dataOut.getHeiRange() | |
|
92 | 229 | z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:]) |
|
93 | 230 | avg = numpy.average(z, axis=1) |
|
94 | 231 |
@@ -479,7 +479,7 class SpectraProc(ProcessingUnit): | |||
|
479 | 479 | self.dataOut.channelList = self.dataIn.channelList |
|
480 | 480 | self.dataOut.heightList = self.dataIn.heightList |
|
481 | 481 | self.dataOut.dtype = self.dataIn.dtype |
|
482 | self.dataOut.nHeights = self.dataIn.nHeights | |
|
482 | # self.dataOut.nHeights = self.dataIn.nHeights | |
|
483 | 483 | # self.dataOut.nChannels = self.dataIn.nChannels |
|
484 | 484 | self.dataOut.nBaud = self.dataIn.nBaud |
|
485 | 485 | self.dataOut.nCode = self.dataIn.nCode |
General Comments 0
You need to be logged in to leave comments.
Login now