##// END OF EJS Templates
El metodo getTimeLim se ha generalizado y se coloco en a clase base Figure
Miguel Valdez -
r230:ac995a7d4bc5
parent child
Show More
@@ -1,323 +1,351
1 import os
1 import os
2 import numpy
2 import numpy
3 import mpldriver
3 import mpldriver
4
4
5
5
6 class Figure:
6 class Figure:
7
7
8 __driver = mpldriver
8 __driver = mpldriver
9 fig = None
9 fig = None
10
10
11 idfigure = None
11 idfigure = None
12 wintitle = None
12 wintitle = None
13 width = None
13 width = None
14 height = None
14 height = None
15 nplots = None
15 nplots = None
16
16
17 axesObjList = []
17 axesObjList = []
18
18
19 WIDTH = None
19 WIDTH = None
20 HEIGHT = None
20 HEIGHT = None
21 PREFIX = 'fig'
21 PREFIX = 'fig'
22
22
23 def __init__(self):
23 def __init__(self):
24
24
25 raise ValueError, "This method is not implemented"
25 raise ValueError, "This method is not implemented"
26
26
27 def __del__(self):
27 def __del__(self):
28
28
29 self.__driver.closeFigure()
29 self.__driver.closeFigure()
30
30
31 def getFilename(self, name, ext='.png'):
31 def getFilename(self, name, ext='.png'):
32
32
33 filename = '%s_%s%s' %(self.PREFIX, name, ext)
33 filename = '%s_%s%s' %(self.PREFIX, name, ext)
34
34
35 return filename
35 return filename
36
36
37 def getAxesObjList(self):
37 def getAxesObjList(self):
38
38
39 return self.axesObjList
39 return self.axesObjList
40
40
41 def getSubplots(self):
41 def getSubplots(self):
42
42
43 raise ValueError, "Abstract method: This method should be defined"
43 raise ValueError, "Abstract method: This method should be defined"
44
44
45 def getScreenDim(self, widthplot, heightplot):
45 def getScreenDim(self, widthplot, heightplot):
46
46
47 nrow, ncol = self.getSubplots()
47 nrow, ncol = self.getSubplots()
48
48
49 widthscreen = widthplot*ncol
49 widthscreen = widthplot*ncol
50 heightscreen = heightplot*nrow
50 heightscreen = heightplot*nrow
51
51
52 return widthscreen, heightscreen
52 return widthscreen, heightscreen
53
54 def getTimeLim(self, x, xmin, xmax):
55
56 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
57 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
58
59 ####################################################
60 #If the x is out of xrange
61 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
62 xmin = None
63 xmax = None
64
65 if xmin == None:
66 td = thisdatetime - thisdate
67 xmin = td.seconds/(60*60.)
68
69 if xmax == None:
70 xmax = xmin + self.__timerange/(60*60.)
53
71
72 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
73 tmin = time.mktime(mindt.timetuple())
74
75 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
76 tmax = time.mktime(maxdt.timetuple())
77
78 self.__timerange = tmax - tmin
79
80 return tmin, tmax
81
54 def init(self, idfigure, nplots, wintitle):
82 def init(self, idfigure, nplots, wintitle):
55
83
56 raise ValueError, "This method has been replaced with createFigure"
84 raise ValueError, "This method has been replaced with createFigure"
57
85
58 def createFigure(self, idfigure, wintitle, widthplot=None, heightplot=None):
86 def createFigure(self, idfigure, wintitle, widthplot=None, heightplot=None):
59
87
60 """
88 """
61 Crea la figura de acuerdo al driver y parametros seleccionados seleccionados.
89 Crea la figura de acuerdo al driver y parametros seleccionados seleccionados.
62 Las dimensiones de la pantalla es calculada a partir de los atributos self.WIDTH
90 Las dimensiones de la pantalla es calculada a partir de los atributos self.WIDTH
63 y self.HEIGHT y el numero de subplots (nrow, ncol)
91 y self.HEIGHT y el numero de subplots (nrow, ncol)
64
92
65 Input:
93 Input:
66 idfigure : Los parametros necesarios son
94 idfigure : Los parametros necesarios son
67 wintitle :
95 wintitle :
68
96
69 """
97 """
70
98
71 if widthplot == None:
99 if widthplot == None:
72 widthplot = self.WIDTH
100 widthplot = self.WIDTH
73
101
74 if heightplot == None:
102 if heightplot == None:
75 heightplot = self.HEIGHT
103 heightplot = self.HEIGHT
76
104
77 self.idfigure = idfigure
105 self.idfigure = idfigure
78
106
79 self.wintitle = wintitle
107 self.wintitle = wintitle
80
108
81 self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot)
109 self.widthscreen, self.heightscreen = self.getScreenDim(widthplot, heightplot)
82
110
83 self.fig = self.__driver.createFigure(self.idfigure,
111 self.fig = self.__driver.createFigure(self.idfigure,
84 self.wintitle,
112 self.wintitle,
85 self.widthscreen,
113 self.widthscreen,
86 self.heightscreen)
114 self.heightscreen)
87
115
88 self.axesObjList = []
116 self.axesObjList = []
89
117
90 def setDriver(self, driver=mpldriver):
118 def setDriver(self, driver=mpldriver):
91
119
92 self.__driver = driver
120 self.__driver = driver
93
121
94 def setTitle(self, title):
122 def setTitle(self, title):
95
123
96 self.__driver.setTitle(self.fig, title)
124 self.__driver.setTitle(self.fig, title)
97
125
98 def setWinTitle(self, title):
126 def setWinTitle(self, title):
99
127
100 self.__driver.setWinTitle(self.fig, title=title)
128 self.__driver.setWinTitle(self.fig, title=title)
101
129
102 def setTextFromAxes(self, text):
130 def setTextFromAxes(self, text):
103
131
104 raise ValueError, "Este metodo ha sido reemplazaado con el metodo setText de la clase Axes"
132 raise ValueError, "Este metodo ha sido reemplazaado con el metodo setText de la clase Axes"
105
133
106 def makeAxes(self, nrow, ncol, xpos, ypos, colspan, rowspan):
134 def makeAxes(self, nrow, ncol, xpos, ypos, colspan, rowspan):
107
135
108 raise ValueError, "Este metodo ha sido reemplazaado con el metodo addAxes"
136 raise ValueError, "Este metodo ha sido reemplazaado con el metodo addAxes"
109
137
110 def addAxes(self, *args):
138 def addAxes(self, *args):
111 """
139 """
112
140
113 Input:
141 Input:
114 *args : Los parametros necesarios son
142 *args : Los parametros necesarios son
115 nrow, ncol, xpos, ypos, colspan, rowspan
143 nrow, ncol, xpos, ypos, colspan, rowspan
116 """
144 """
117
145
118 axesObj = Axes(self.fig, *args)
146 axesObj = Axes(self.fig, *args)
119 self.axesObjList.append(axesObj)
147 self.axesObjList.append(axesObj)
120
148
121 def saveFigure(self, figpath, figfile, *args):
149 def saveFigure(self, figpath, figfile, *args):
122
150
123 filename = os.path.join(figpath, figfile)
151 filename = os.path.join(figpath, figfile)
124 self.__driver.saveFigure(self.fig, filename, *args)
152 self.__driver.saveFigure(self.fig, filename, *args)
125
153
126 def draw(self):
154 def draw(self):
127
155
128 self.__driver.draw(self.fig)
156 self.__driver.draw(self.fig)
129
157
130 def run(self):
158 def run(self):
131
159
132 raise ValueError, "This method is not implemented"
160 raise ValueError, "This method is not implemented"
133
161
134 axesList = property(getAxesObjList)
162 axesList = property(getAxesObjList)
135
163
136
164
137 class Axes:
165 class Axes:
138
166
139 __driver = mpldriver
167 __driver = mpldriver
140 fig = None
168 fig = None
141 ax = None
169 ax = None
142 plot = None
170 plot = None
143
171
144 __firsttime = None
172 __firsttime = None
145
173
146 __showprofile = False
174 __showprofile = False
147
175
148 xmin = None
176 xmin = None
149 xmax = None
177 xmax = None
150 ymin = None
178 ymin = None
151 ymax = None
179 ymax = None
152 zmin = None
180 zmin = None
153 zmax = None
181 zmax = None
154
182
155 def __init__(self, *args):
183 def __init__(self, *args):
156
184
157 """
185 """
158
186
159 Input:
187 Input:
160 *args : Los parametros necesarios son
188 *args : Los parametros necesarios son
161 fig, nrow, ncol, xpos, ypos, colspan, rowspan
189 fig, nrow, ncol, xpos, ypos, colspan, rowspan
162 """
190 """
163
191
164 ax = self.__driver.createAxes(*args)
192 ax = self.__driver.createAxes(*args)
165 self.fig = args[0]
193 self.fig = args[0]
166 self.ax = ax
194 self.ax = ax
167 self.plot = None
195 self.plot = None
168
196
169 self.__firsttime = True
197 self.__firsttime = True
170
198
171 def setText(self, text):
199 def setText(self, text):
172
200
173 self.__driver.setAxesText(self.ax, text)
201 self.__driver.setAxesText(self.ax, text)
174
202
175 def setXAxisAsTime(self):
203 def setXAxisAsTime(self):
176 pass
204 pass
177
205
178 def pline(self, x, y,
206 def pline(self, x, y,
179 xmin=None, xmax=None,
207 xmin=None, xmax=None,
180 ymin=None, ymax=None,
208 ymin=None, ymax=None,
181 xlabel='', ylabel='',
209 xlabel='', ylabel='',
182 title='',
210 title='',
183 **kwargs):
211 **kwargs):
184
212
185 """
213 """
186
214
187 Input:
215 Input:
188 x :
216 x :
189 y :
217 y :
190 xmin :
218 xmin :
191 xmax :
219 xmax :
192 ymin :
220 ymin :
193 ymax :
221 ymax :
194 xlabel :
222 xlabel :
195 ylabel :
223 ylabel :
196 title :
224 title :
197 **kwargs : Los parametros aceptados son
225 **kwargs : Los parametros aceptados son
198
226
199 ticksize
227 ticksize
200 ytick_visible
228 ytick_visible
201 """
229 """
202
230
203 if self.__firsttime:
231 if self.__firsttime:
204
232
205 if xmin == None: xmin = numpy.nanmin(x)
233 if xmin == None: xmin = numpy.nanmin(x)
206 if xmax == None: xmax = numpy.nanmax(x)
234 if xmax == None: xmax = numpy.nanmax(x)
207 if ymin == None: ymin = numpy.nanmin(y)
235 if ymin == None: ymin = numpy.nanmin(y)
208 if ymax == None: ymax = numpy.nanmax(y)
236 if ymax == None: ymax = numpy.nanmax(y)
209
237
210 self.plot = self.__driver.createPline(self.ax, x, y,
238 self.plot = self.__driver.createPline(self.ax, x, y,
211 xmin, xmax,
239 xmin, xmax,
212 ymin, ymax,
240 ymin, ymax,
213 xlabel=xlabel,
241 xlabel=xlabel,
214 ylabel=ylabel,
242 ylabel=ylabel,
215 title=title,
243 title=title,
216 **kwargs)
244 **kwargs)
217 self.__firsttime = False
245 self.__firsttime = False
218 return
246 return
219
247
220 self.__driver.pline(self.plot, x, y, xlabel=xlabel,
248 self.__driver.pline(self.plot, x, y, xlabel=xlabel,
221 ylabel=ylabel,
249 ylabel=ylabel,
222 title=title)
250 title=title)
223
251
224 def pmultiline(self, x, y,
252 def pmultiline(self, x, y,
225 xmin=None, xmax=None,
253 xmin=None, xmax=None,
226 ymin=None, ymax=None,
254 ymin=None, ymax=None,
227 xlabel='', ylabel='',
255 xlabel='', ylabel='',
228 title='',
256 title='',
229 **kwargs):
257 **kwargs):
230
258
231 if self.__firsttime:
259 if self.__firsttime:
232
260
233 if xmin == None: xmin = numpy.nanmin(x)
261 if xmin == None: xmin = numpy.nanmin(x)
234 if xmax == None: xmax = numpy.nanmax(x)
262 if xmax == None: xmax = numpy.nanmax(x)
235 if ymin == None: ymin = numpy.nanmin(y)
263 if ymin == None: ymin = numpy.nanmin(y)
236 if ymax == None: ymax = numpy.nanmax(y)
264 if ymax == None: ymax = numpy.nanmax(y)
237
265
238 self.plot = self.__driver.createPmultiline(self.ax, x, y,
266 self.plot = self.__driver.createPmultiline(self.ax, x, y,
239 xmin, xmax,
267 xmin, xmax,
240 ymin, ymax,
268 ymin, ymax,
241 xlabel=xlabel,
269 xlabel=xlabel,
242 ylabel=ylabel,
270 ylabel=ylabel,
243 title=title,
271 title=title,
244 **kwargs)
272 **kwargs)
245 self.__firsttime = False
273 self.__firsttime = False
246 return
274 return
247
275
248 self.__driver.pmultiline(self.plot, x, y, xlabel=xlabel,
276 self.__driver.pmultiline(self.plot, x, y, xlabel=xlabel,
249 ylabel=ylabel,
277 ylabel=ylabel,
250 title=title)
278 title=title)
251
279
252 def pcolor(self, x, y, z,
280 def pcolor(self, x, y, z,
253 xmin=None, xmax=None,
281 xmin=None, xmax=None,
254 ymin=None, ymax=None,
282 ymin=None, ymax=None,
255 zmin=None, zmax=None,
283 zmin=None, zmax=None,
256 xlabel='', ylabel='',
284 xlabel='', ylabel='',
257 title='', rti = False, colormap='jet',
285 title='', rti = False, colormap='jet',
258 **kwargs):
286 **kwargs):
259
287
260 """
288 """
261 Input:
289 Input:
262 x :
290 x :
263 y :
291 y :
264 x :
292 x :
265 xmin :
293 xmin :
266 xmax :
294 xmax :
267 ymin :
295 ymin :
268 ymax :
296 ymax :
269 zmin :
297 zmin :
270 zmax :
298 zmax :
271 xlabel :
299 xlabel :
272 ylabel :
300 ylabel :
273 title :
301 title :
274 **kwargs : Los parametros aceptados son
302 **kwargs : Los parametros aceptados son
275 ticksize=9,
303 ticksize=9,
276 cblabel=''
304 cblabel=''
277 rti = True or False
305 rti = True or False
278 """
306 """
279
307
280 if self.__firsttime:
308 if self.__firsttime:
281
309
282 if xmin == None: xmin = numpy.nanmin(x)
310 if xmin == None: xmin = numpy.nanmin(x)
283 if xmax == None: xmax = numpy.nanmax(x)
311 if xmax == None: xmax = numpy.nanmax(x)
284 if ymin == None: ymin = numpy.nanmin(y)
312 if ymin == None: ymin = numpy.nanmin(y)
285 if ymax == None: ymax = numpy.nanmax(y)
313 if ymax == None: ymax = numpy.nanmax(y)
286 if zmin == None: zmin = numpy.nanmin(z)
314 if zmin == None: zmin = numpy.nanmin(z)
287 if zmax == None: zmax = numpy.nanmax(z)
315 if zmax == None: zmax = numpy.nanmax(z)
288
316
289
317
290 self.plot = self.__driver.createPcolor(self.ax, x, y, z,
318 self.plot = self.__driver.createPcolor(self.ax, x, y, z,
291 xmin, xmax,
319 xmin, xmax,
292 ymin, ymax,
320 ymin, ymax,
293 zmin, zmax,
321 zmin, zmax,
294 xlabel=xlabel,
322 xlabel=xlabel,
295 ylabel=ylabel,
323 ylabel=ylabel,
296 title=title,
324 title=title,
297 colormap=colormap,
325 colormap=colormap,
298 **kwargs)
326 **kwargs)
299
327
300 if self.xmin == None: self.xmin = xmin
328 if self.xmin == None: self.xmin = xmin
301 if self.xmax == None: self.xmax = xmax
329 if self.xmax == None: self.xmax = xmax
302 if self.ymin == None: self.ymin = ymin
330 if self.ymin == None: self.ymin = ymin
303 if self.ymax == None: self.ymax = ymax
331 if self.ymax == None: self.ymax = ymax
304 if self.zmin == None: self.zmin = zmin
332 if self.zmin == None: self.zmin = zmin
305 if self.zmax == None: self.zmax = zmax
333 if self.zmax == None: self.zmax = zmax
306
334
307 self.__firsttime = False
335 self.__firsttime = False
308 return
336 return
309
337
310 if rti:
338 if rti:
311 self.__driver.addpcolor(self.ax, x, y, z, self.zmin, self.zmax,
339 self.__driver.addpcolor(self.ax, x, y, z, self.zmin, self.zmax,
312 xlabel=xlabel,
340 xlabel=xlabel,
313 ylabel=ylabel,
341 ylabel=ylabel,
314 title=title,
342 title=title,
315 colormap=colormap)
343 colormap=colormap)
316 return
344 return
317
345
318 self.__driver.pcolor(self.plot, z,
346 self.__driver.pcolor(self.plot, z,
319 xlabel=xlabel,
347 xlabel=xlabel,
320 ylabel=ylabel,
348 ylabel=ylabel,
321 title=title)
349 title=title)
322
350
323 No newline at end of file
351
@@ -1,874 +1,818
1 import numpy
1 import numpy
2 import time, datetime
2 import time, datetime
3 from graphics.figure import *
3 from graphics.figure import *
4
4
5 class CrossSpectraPlot(Figure):
5 class CrossSpectraPlot(Figure):
6
6
7 __isConfig = None
7 __isConfig = None
8 __nsubplots = None
8 __nsubplots = None
9
9
10 WIDTHPROF = None
10 WIDTHPROF = None
11 HEIGHTPROF = None
11 HEIGHTPROF = None
12 PREFIX = 'cspc'
12 PREFIX = 'cspc'
13
13
14 def __init__(self):
14 def __init__(self):
15
15
16 self.__isConfig = False
16 self.__isConfig = False
17 self.__nsubplots = 4
17 self.__nsubplots = 4
18
18
19 self.WIDTH = 300
19 self.WIDTH = 300
20 self.HEIGHT = 400
20 self.HEIGHT = 400
21 self.WIDTHPROF = 0
21 self.WIDTHPROF = 0
22 self.HEIGHTPROF = 0
22 self.HEIGHTPROF = 0
23
23
24 def getSubplots(self):
24 def getSubplots(self):
25
25
26 ncol = 4
26 ncol = 4
27 nrow = self.nplots
27 nrow = self.nplots
28
28
29 return nrow, ncol
29 return nrow, ncol
30
30
31 def setup(self, idfigure, nplots, wintitle, showprofile=True):
31 def setup(self, idfigure, nplots, wintitle, showprofile=True):
32
32
33 self.__showprofile = showprofile
33 self.__showprofile = showprofile
34 self.nplots = nplots
34 self.nplots = nplots
35
35
36 ncolspan = 1
36 ncolspan = 1
37 colspan = 1
37 colspan = 1
38
38
39 self.createFigure(idfigure = idfigure,
39 self.createFigure(idfigure = idfigure,
40 wintitle = wintitle,
40 wintitle = wintitle,
41 widthplot = self.WIDTH + self.WIDTHPROF,
41 widthplot = self.WIDTH + self.WIDTHPROF,
42 heightplot = self.HEIGHT + self.HEIGHTPROF)
42 heightplot = self.HEIGHT + self.HEIGHTPROF)
43
43
44 nrow, ncol = self.getSubplots()
44 nrow, ncol = self.getSubplots()
45
45
46 counter = 0
46 counter = 0
47 for y in range(nrow):
47 for y in range(nrow):
48 for x in range(ncol):
48 for x in range(ncol):
49 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
49 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
50
50
51 counter += 1
51 counter += 1
52
52
53 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
53 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
54 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
54 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
55 save=False, figpath='./', figfile=None):
55 save=False, figpath='./', figfile=None):
56
56
57 """
57 """
58
58
59 Input:
59 Input:
60 dataOut :
60 dataOut :
61 idfigure :
61 idfigure :
62 wintitle :
62 wintitle :
63 channelList :
63 channelList :
64 showProfile :
64 showProfile :
65 xmin : None,
65 xmin : None,
66 xmax : None,
66 xmax : None,
67 ymin : None,
67 ymin : None,
68 ymax : None,
68 ymax : None,
69 zmin : None,
69 zmin : None,
70 zmax : None
70 zmax : None
71 """
71 """
72
72
73 if pairsList == None:
73 if pairsList == None:
74 pairsIndexList = dataOut.pairsIndexList
74 pairsIndexList = dataOut.pairsIndexList
75 else:
75 else:
76 pairsIndexList = []
76 pairsIndexList = []
77 for pair in pairsList:
77 for pair in pairsList:
78 if pair not in dataOut.pairsList:
78 if pair not in dataOut.pairsList:
79 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
79 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
80 pairsIndexList.append(dataOut.pairsList.index(pair))
80 pairsIndexList.append(dataOut.pairsList.index(pair))
81
81
82 if pairsIndexList == []:
82 if pairsIndexList == []:
83 return
83 return
84
84
85 if len(pairsIndexList) > 4:
85 if len(pairsIndexList) > 4:
86 pairsIndexList = pairsIndexList[0:4]
86 pairsIndexList = pairsIndexList[0:4]
87
87
88 x = dataOut.getFreqRange(1)
88 x = dataOut.getFreqRange(1)
89 y = dataOut.getHeiRange()
89 y = dataOut.getHeiRange()
90 z = 10.*numpy.log10(dataOut.data_spc[:,:,:])
90 z = 10.*numpy.log10(dataOut.data_spc[:,:,:])
91 avg = numpy.average(numpy.abs(z), axis=1)
91 avg = numpy.average(numpy.abs(z), axis=1)
92
92
93 noise = dataOut.getNoise()
93 noise = dataOut.getNoise()
94
94
95 if not self.__isConfig:
95 if not self.__isConfig:
96
96
97 nplots = len(pairsIndexList)
97 nplots = len(pairsIndexList)
98
98
99 self.setup(idfigure=idfigure,
99 self.setup(idfigure=idfigure,
100 nplots=nplots,
100 nplots=nplots,
101 wintitle=wintitle,
101 wintitle=wintitle,
102 showprofile=showprofile)
102 showprofile=showprofile)
103
103
104 if xmin == None: xmin = numpy.nanmin(x)
104 if xmin == None: xmin = numpy.nanmin(x)
105 if xmax == None: xmax = numpy.nanmax(x)
105 if xmax == None: xmax = numpy.nanmax(x)
106 if ymin == None: ymin = numpy.nanmin(y)
106 if ymin == None: ymin = numpy.nanmin(y)
107 if ymax == None: ymax = numpy.nanmax(y)
107 if ymax == None: ymax = numpy.nanmax(y)
108 if zmin == None: zmin = numpy.nanmin(avg)*0.9
108 if zmin == None: zmin = numpy.nanmin(avg)*0.9
109 if zmax == None: zmax = numpy.nanmax(avg)*0.9
109 if zmax == None: zmax = numpy.nanmax(avg)*0.9
110
110
111 self.__isConfig = True
111 self.__isConfig = True
112
112
113 thisDatetime = dataOut.datatime
113 thisDatetime = dataOut.datatime
114 title = "Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
114 title = "Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
115 xlabel = "Velocity (m/s)"
115 xlabel = "Velocity (m/s)"
116 ylabel = "Range (Km)"
116 ylabel = "Range (Km)"
117
117
118 self.setWinTitle(title)
118 self.setWinTitle(title)
119
119
120 for i in range(self.nplots):
120 for i in range(self.nplots):
121 pair = dataOut.pairsList[pairsIndexList[i]]
121 pair = dataOut.pairsList[pairsIndexList[i]]
122
122
123 title = "Channel %d: %4.2fdB" %(pair[0], noise[pair[0]])
123 title = "Channel %d: %4.2fdB" %(pair[0], noise[pair[0]])
124 z = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:])
124 z = 10.*numpy.log10(dataOut.data_spc[pair[0],:,:])
125 axes0 = self.axesList[i*self.__nsubplots]
125 axes0 = self.axesList[i*self.__nsubplots]
126 axes0.pcolor(x, y, z,
126 axes0.pcolor(x, y, z,
127 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
127 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
128 xlabel=xlabel, ylabel=ylabel, title=title,
128 xlabel=xlabel, ylabel=ylabel, title=title,
129 ticksize=9, cblabel='')
129 ticksize=9, cblabel='')
130
130
131 title = "Channel %d: %4.2fdB" %(pair[1], noise[pair[1]])
131 title = "Channel %d: %4.2fdB" %(pair[1], noise[pair[1]])
132 z = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:])
132 z = 10.*numpy.log10(dataOut.data_spc[pair[1],:,:])
133 axes0 = self.axesList[i*self.__nsubplots+1]
133 axes0 = self.axesList[i*self.__nsubplots+1]
134 axes0.pcolor(x, y, z,
134 axes0.pcolor(x, y, z,
135 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
135 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
136 xlabel=xlabel, ylabel=ylabel, title=title,
136 xlabel=xlabel, ylabel=ylabel, title=title,
137 ticksize=9, cblabel='')
137 ticksize=9, cblabel='')
138
138
139 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
139 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
140 coherence = numpy.abs(coherenceComplex)
140 coherence = numpy.abs(coherenceComplex)
141 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
141 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
142
142
143
143
144 title = "Coherence %d%d" %(pair[0], pair[1])
144 title = "Coherence %d%d" %(pair[0], pair[1])
145 axes0 = self.axesList[i*self.__nsubplots+2]
145 axes0 = self.axesList[i*self.__nsubplots+2]
146 axes0.pcolor(x, y, coherence,
146 axes0.pcolor(x, y, coherence,
147 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
147 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
148 xlabel=xlabel, ylabel=ylabel, title=title,
148 xlabel=xlabel, ylabel=ylabel, title=title,
149 ticksize=9, cblabel='')
149 ticksize=9, cblabel='')
150
150
151 title = "Phase %d%d" %(pair[0], pair[1])
151 title = "Phase %d%d" %(pair[0], pair[1])
152 axes0 = self.axesList[i*self.__nsubplots+3]
152 axes0 = self.axesList[i*self.__nsubplots+3]
153 axes0.pcolor(x, y, phase,
153 axes0.pcolor(x, y, phase,
154 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
154 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
155 xlabel=xlabel, ylabel=ylabel, title=title,
155 xlabel=xlabel, ylabel=ylabel, title=title,
156 ticksize=9, cblabel='', colormap='RdBu')
156 ticksize=9, cblabel='', colormap='RdBu')
157
157
158
158
159
159
160 self.draw()
160 self.draw()
161
161
162 if save:
162 if save:
163 date = thisDatetime.strftime("%Y%m%d")
163 date = thisDatetime.strftime("%Y%m%d")
164 if figfile == None:
164 if figfile == None:
165 figfile = self.getFilename(name = date)
165 figfile = self.getFilename(name = date)
166
166
167 self.saveFigure(figpath, figfile)
167 self.saveFigure(figpath, figfile)
168
168
169
169
170 class RTIPlot(Figure):
170 class RTIPlot(Figure):
171
171
172 __isConfig = None
172 __isConfig = None
173 __nsubplots = None
173 __nsubplots = None
174
174
175 WIDTHPROF = None
175 WIDTHPROF = None
176 HEIGHTPROF = None
176 HEIGHTPROF = None
177 PREFIX = 'rti'
177 PREFIX = 'rti'
178
178
179 def __init__(self):
179 def __init__(self):
180
180
181 self.__timerange = 24*60*60
181 self.__timerange = 24*60*60
182 self.__isConfig = False
182 self.__isConfig = False
183 self.__nsubplots = 1
183 self.__nsubplots = 1
184
184
185 self.WIDTH = 800
185 self.WIDTH = 800
186 self.HEIGHT = 200
186 self.HEIGHT = 200
187 self.WIDTHPROF = 120
187 self.WIDTHPROF = 120
188 self.HEIGHTPROF = 0
188 self.HEIGHTPROF = 0
189
189
190 def getSubplots(self):
190 def getSubplots(self):
191
191
192 ncol = 1
192 ncol = 1
193 nrow = self.nplots
193 nrow = self.nplots
194
194
195 return nrow, ncol
195 return nrow, ncol
196
196
197 def setup(self, idfigure, nplots, wintitle, showprofile=True):
197 def setup(self, idfigure, nplots, wintitle, showprofile=True):
198
198
199 self.__showprofile = showprofile
199 self.__showprofile = showprofile
200 self.nplots = nplots
200 self.nplots = nplots
201
201
202 ncolspan = 1
202 ncolspan = 1
203 colspan = 1
203 colspan = 1
204 if showprofile:
204 if showprofile:
205 ncolspan = 7
205 ncolspan = 7
206 colspan = 6
206 colspan = 6
207 self.__nsubplots = 2
207 self.__nsubplots = 2
208
208
209 self.createFigure(idfigure = idfigure,
209 self.createFigure(idfigure = idfigure,
210 wintitle = wintitle,
210 wintitle = wintitle,
211 widthplot = self.WIDTH + self.WIDTHPROF,
211 widthplot = self.WIDTH + self.WIDTHPROF,
212 heightplot = self.HEIGHT + self.HEIGHTPROF)
212 heightplot = self.HEIGHT + self.HEIGHTPROF)
213
213
214 nrow, ncol = self.getSubplots()
214 nrow, ncol = self.getSubplots()
215
215
216 counter = 0
216 counter = 0
217 for y in range(nrow):
217 for y in range(nrow):
218 for x in range(ncol):
218 for x in range(ncol):
219
219
220 if counter >= self.nplots:
220 if counter >= self.nplots:
221 break
221 break
222
222
223 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
223 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
224
224
225 if showprofile:
225 if showprofile:
226 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
226 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
227
227
228 counter += 1
228 counter += 1
229
229
230 def __getTimeLim(self, x, xmin, xmax):
231
232 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
233 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
234
235 ####################################################
236 #If the x is out of xrange
237 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
238 xmin = None
239 xmax = None
240
241 if xmin == None:
242 td = thisdatetime - thisdate
243 xmin = td.seconds/(60*60.)
244
245 if xmax == None:
246 xmax = xmin + self.__timerange/(60*60.)
247
248 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
249 tmin = time.mktime(mindt.timetuple())
250
251 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
252 tmax = time.mktime(maxdt.timetuple())
253
254 self.__timerange = tmax - tmin
255
256 return tmin, tmax
257
258 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
230 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
259 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
231 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
260 timerange=None,
232 timerange=None,
261 save=False, figpath='./', figfile=None):
233 save=False, figpath='./', figfile=None):
262
234
263 """
235 """
264
236
265 Input:
237 Input:
266 dataOut :
238 dataOut :
267 idfigure :
239 idfigure :
268 wintitle :
240 wintitle :
269 channelList :
241 channelList :
270 showProfile :
242 showProfile :
271 xmin : None,
243 xmin : None,
272 xmax : None,
244 xmax : None,
273 ymin : None,
245 ymin : None,
274 ymax : None,
246 ymax : None,
275 zmin : None,
247 zmin : None,
276 zmax : None
248 zmax : None
277 """
249 """
278
250
279 if channelList == None:
251 if channelList == None:
280 channelIndexList = dataOut.channelIndexList
252 channelIndexList = dataOut.channelIndexList
281 else:
253 else:
282 channelIndexList = []
254 channelIndexList = []
283 for channel in channelList:
255 for channel in channelList:
284 if channel not in dataOut.channelList:
256 if channel not in dataOut.channelList:
285 raise ValueError, "Channel %d is not in dataOut.channelList"
257 raise ValueError, "Channel %d is not in dataOut.channelList"
286 channelIndexList.append(dataOut.channelList.index(channel))
258 channelIndexList.append(dataOut.channelList.index(channel))
287
259
288 if timerange != None:
260 if timerange != None:
289 self.__timerange = timerange
261 self.__timerange = timerange
290
262
291 tmin = None
263 tmin = None
292 tmax = None
264 tmax = None
293 x = dataOut.getTimeRange()
265 x = dataOut.getTimeRange()
294 y = dataOut.getHeiRange()
266 y = dataOut.getHeiRange()
295 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
267 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
296 avg = numpy.average(z, axis=1)
268 avg = numpy.average(z, axis=1)
297
269
298 noise = dataOut.getNoise()
270 noise = dataOut.getNoise()
299
271
300 if not self.__isConfig:
272 if not self.__isConfig:
301
273
302 nplots = len(channelIndexList)
274 nplots = len(channelIndexList)
303
275
304 self.setup(idfigure=idfigure,
276 self.setup(idfigure=idfigure,
305 nplots=nplots,
277 nplots=nplots,
306 wintitle=wintitle,
278 wintitle=wintitle,
307 showprofile=showprofile)
279 showprofile=showprofile)
308
280
309 tmin, tmax = self.__getTimeLim(x, xmin, xmax)
281 tmin, tmax = self.getTimeLim(x, xmin, xmax)
310 if ymin == None: ymin = numpy.nanmin(y)
282 if ymin == None: ymin = numpy.nanmin(y)
311 if ymax == None: ymax = numpy.nanmax(y)
283 if ymax == None: ymax = numpy.nanmax(y)
312 if zmin == None: zmin = numpy.nanmin(avg)*0.9
284 if zmin == None: zmin = numpy.nanmin(avg)*0.9
313 if zmax == None: zmax = numpy.nanmax(avg)*0.9
285 if zmax == None: zmax = numpy.nanmax(avg)*0.9
314
286
315 self.__isConfig = True
287 self.__isConfig = True
316
288
317 thisDatetime = dataOut.datatime
289 thisDatetime = dataOut.datatime
318 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
290 title = "RTI: %s" %(thisDatetime.strftime("%d-%b-%Y"))
319 xlabel = "Velocity (m/s)"
291 xlabel = "Velocity (m/s)"
320 ylabel = "Range (Km)"
292 ylabel = "Range (Km)"
321
293
322 self.setWinTitle(title)
294 self.setWinTitle(title)
323
295
324 for i in range(self.nplots):
296 for i in range(self.nplots):
325 title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
297 title = "Channel %d: %s" %(dataOut.channelList[i], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
326 axes = self.axesList[i*self.__nsubplots]
298 axes = self.axesList[i*self.__nsubplots]
327 z = avg[i].reshape((1,-1))
299 z = avg[i].reshape((1,-1))
328 axes.pcolor(x, y, z,
300 axes.pcolor(x, y, z,
329 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
301 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
330 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
302 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
331 ticksize=9, cblabel='', cbsize="1%")
303 ticksize=9, cblabel='', cbsize="1%")
332
304
333 if self.__showprofile:
305 if self.__showprofile:
334 axes = self.axesList[i*self.__nsubplots +1]
306 axes = self.axesList[i*self.__nsubplots +1]
335 axes.pline(avg[i], y,
307 axes.pline(avg[i], y,
336 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
308 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
337 xlabel='dB', ylabel='', title='',
309 xlabel='dB', ylabel='', title='',
338 ytick_visible=False,
310 ytick_visible=False,
339 grid='x')
311 grid='x')
340
312
341 self.draw()
313 self.draw()
342
314
343 if save:
315 if save:
344 date = thisDatetime.strftime("%Y%m%d")
316 date = thisDatetime.strftime("%Y%m%d")
345 if figfile == None:
317 if figfile == None:
346 figfile = self.getFilename(name = date)
318 figfile = self.getFilename(name = date)
347
319
348 self.saveFigure(figpath, figfile)
320 self.saveFigure(figpath, figfile)
349
321
350 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
322 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
351 self.__isConfig = False
323 self.__isConfig = False
352
324
353 class SpectraPlot(Figure):
325 class SpectraPlot(Figure):
354
326
355 __isConfig = None
327 __isConfig = None
356 __nsubplots = None
328 __nsubplots = None
357
329
358 WIDTHPROF = None
330 WIDTHPROF = None
359 HEIGHTPROF = None
331 HEIGHTPROF = None
360 PREFIX = 'spc'
332 PREFIX = 'spc'
361
333
362 def __init__(self):
334 def __init__(self):
363
335
364 self.__isConfig = False
336 self.__isConfig = False
365 self.__nsubplots = 1
337 self.__nsubplots = 1
366
338
367 self.WIDTH = 300
339 self.WIDTH = 300
368 self.HEIGHT = 400
340 self.HEIGHT = 400
369 self.WIDTHPROF = 120
341 self.WIDTHPROF = 120
370 self.HEIGHTPROF = 0
342 self.HEIGHTPROF = 0
371
343
372 def getSubplots(self):
344 def getSubplots(self):
373
345
374 ncol = int(numpy.sqrt(self.nplots)+0.9)
346 ncol = int(numpy.sqrt(self.nplots)+0.9)
375 nrow = int(self.nplots*1./ncol + 0.9)
347 nrow = int(self.nplots*1./ncol + 0.9)
376
348
377 return nrow, ncol
349 return nrow, ncol
378
350
379 def setup(self, idfigure, nplots, wintitle, showprofile=True):
351 def setup(self, idfigure, nplots, wintitle, showprofile=True):
380
352
381 self.__showprofile = showprofile
353 self.__showprofile = showprofile
382 self.nplots = nplots
354 self.nplots = nplots
383
355
384 ncolspan = 1
356 ncolspan = 1
385 colspan = 1
357 colspan = 1
386 if showprofile:
358 if showprofile:
387 ncolspan = 3
359 ncolspan = 3
388 colspan = 2
360 colspan = 2
389 self.__nsubplots = 2
361 self.__nsubplots = 2
390
362
391 self.createFigure(idfigure = idfigure,
363 self.createFigure(idfigure = idfigure,
392 wintitle = wintitle,
364 wintitle = wintitle,
393 widthplot = self.WIDTH + self.WIDTHPROF,
365 widthplot = self.WIDTH + self.WIDTHPROF,
394 heightplot = self.HEIGHT + self.HEIGHTPROF)
366 heightplot = self.HEIGHT + self.HEIGHTPROF)
395
367
396 nrow, ncol = self.getSubplots()
368 nrow, ncol = self.getSubplots()
397
369
398 counter = 0
370 counter = 0
399 for y in range(nrow):
371 for y in range(nrow):
400 for x in range(ncol):
372 for x in range(ncol):
401
373
402 if counter >= self.nplots:
374 if counter >= self.nplots:
403 break
375 break
404
376
405 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
377 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
406
378
407 if showprofile:
379 if showprofile:
408 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
380 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
409
381
410 counter += 1
382 counter += 1
411
383
412 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
384 def run(self, dataOut, idfigure, wintitle="", channelList=None, showprofile='True',
413 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
385 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
414 save=False, figpath='./', figfile=None):
386 save=False, figpath='./', figfile=None):
415
387
416 """
388 """
417
389
418 Input:
390 Input:
419 dataOut :
391 dataOut :
420 idfigure :
392 idfigure :
421 wintitle :
393 wintitle :
422 channelList :
394 channelList :
423 showProfile :
395 showProfile :
424 xmin : None,
396 xmin : None,
425 xmax : None,
397 xmax : None,
426 ymin : None,
398 ymin : None,
427 ymax : None,
399 ymax : None,
428 zmin : None,
400 zmin : None,
429 zmax : None
401 zmax : None
430 """
402 """
431
403
432 if channelList == None:
404 if channelList == None:
433 channelIndexList = dataOut.channelIndexList
405 channelIndexList = dataOut.channelIndexList
434 else:
406 else:
435 channelIndexList = []
407 channelIndexList = []
436 for channel in channelList:
408 for channel in channelList:
437 if channel not in dataOut.channelList:
409 if channel not in dataOut.channelList:
438 raise ValueError, "Channel %d is not in dataOut.channelList"
410 raise ValueError, "Channel %d is not in dataOut.channelList"
439 channelIndexList.append(dataOut.channelList.index(channel))
411 channelIndexList.append(dataOut.channelList.index(channel))
440
412
441 x = dataOut.getVelRange(1)
413 x = dataOut.getVelRange(1)
442 y = dataOut.getHeiRange()
414 y = dataOut.getHeiRange()
443 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
415 z = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
444 avg = numpy.average(z, axis=1)
416 avg = numpy.average(z, axis=1)
445
417
446 noise = dataOut.getNoise()
418 noise = dataOut.getNoise()
447
419
448 if not self.__isConfig:
420 if not self.__isConfig:
449
421
450 nplots = len(channelIndexList)
422 nplots = len(channelIndexList)
451
423
452 self.setup(idfigure=idfigure,
424 self.setup(idfigure=idfigure,
453 nplots=nplots,
425 nplots=nplots,
454 wintitle=wintitle,
426 wintitle=wintitle,
455 showprofile=showprofile)
427 showprofile=showprofile)
456
428
457 if xmin == None: xmin = numpy.nanmin(x)
429 if xmin == None: xmin = numpy.nanmin(x)
458 if xmax == None: xmax = numpy.nanmax(x)
430 if xmax == None: xmax = numpy.nanmax(x)
459 if ymin == None: ymin = numpy.nanmin(y)
431 if ymin == None: ymin = numpy.nanmin(y)
460 if ymax == None: ymax = numpy.nanmax(y)
432 if ymax == None: ymax = numpy.nanmax(y)
461 if zmin == None: zmin = numpy.nanmin(avg)*0.9
433 if zmin == None: zmin = numpy.nanmin(avg)*0.9
462 if zmax == None: zmax = numpy.nanmax(avg)*0.9
434 if zmax == None: zmax = numpy.nanmax(avg)*0.9
463
435
464 self.__isConfig = True
436 self.__isConfig = True
465
437
466 thisDatetime = dataOut.datatime
438 thisDatetime = dataOut.datatime
467 title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
439 title = "Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
468 xlabel = "Velocity (m/s)"
440 xlabel = "Velocity (m/s)"
469 ylabel = "Range (Km)"
441 ylabel = "Range (Km)"
470
442
471 self.setWinTitle(title)
443 self.setWinTitle(title)
472
444
473 for i in range(self.nplots):
445 for i in range(self.nplots):
474 title = "Channel %d: %4.2fdB" %(dataOut.channelList[i], noise[i])
446 title = "Channel %d: %4.2fdB" %(dataOut.channelList[i], noise[i])
475 axes = self.axesList[i*self.__nsubplots]
447 axes = self.axesList[i*self.__nsubplots]
476 axes.pcolor(x, y, z[i,:,:],
448 axes.pcolor(x, y, z[i,:,:],
477 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
449 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
478 xlabel=xlabel, ylabel=ylabel, title=title,
450 xlabel=xlabel, ylabel=ylabel, title=title,
479 ticksize=9, cblabel='')
451 ticksize=9, cblabel='')
480
452
481 if self.__showprofile:
453 if self.__showprofile:
482 axes = self.axesList[i*self.__nsubplots +1]
454 axes = self.axesList[i*self.__nsubplots +1]
483 axes.pline(avg[i], y,
455 axes.pline(avg[i], y,
484 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
456 xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax,
485 xlabel='dB', ylabel='', title='',
457 xlabel='dB', ylabel='', title='',
486 ytick_visible=False,
458 ytick_visible=False,
487 grid='x')
459 grid='x')
488
460
489 self.draw()
461 self.draw()
490
462
491 if save:
463 if save:
492 date = thisDatetime.strftime("%Y%m%d")
464 date = thisDatetime.strftime("%Y%m%d")
493 if figfile == None:
465 if figfile == None:
494 figfile = self.getFilename(name = date)
466 figfile = self.getFilename(name = date)
495
467
496 self.saveFigure(figpath, figfile)
468 self.saveFigure(figpath, figfile)
497
469
498 class Scope(Figure):
470 class Scope(Figure):
499
471
500 __isConfig = None
472 __isConfig = None
501
473
502 def __init__(self):
474 def __init__(self):
503
475
504 self.__isConfig = False
476 self.__isConfig = False
505 self.WIDTH = 600
477 self.WIDTH = 600
506 self.HEIGHT = 200
478 self.HEIGHT = 200
507
479
508 def getSubplots(self):
480 def getSubplots(self):
509
481
510 nrow = self.nplots
482 nrow = self.nplots
511 ncol = 3
483 ncol = 3
512 return nrow, ncol
484 return nrow, ncol
513
485
514 def setup(self, idfigure, nplots, wintitle):
486 def setup(self, idfigure, nplots, wintitle):
515
487
516 self.createFigure(idfigure, wintitle)
488 self.createFigure(idfigure, wintitle)
517
489
518 nrow,ncol = self.getSubplots()
490 nrow,ncol = self.getSubplots()
519 colspan = 3
491 colspan = 3
520 rowspan = 1
492 rowspan = 1
521
493
522 for i in range(nplots):
494 for i in range(nplots):
523 self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
495 self.addAxes(nrow, ncol, i, 0, colspan, rowspan)
524
496
525 self.nplots = nplots
497 self.nplots = nplots
526
498
527 def run(self, dataOut, idfigure, wintitle="", channelList=None,
499 def run(self, dataOut, idfigure, wintitle="", channelList=None,
528 xmin=None, xmax=None, ymin=None, ymax=None, save=False, filename=None):
500 xmin=None, xmax=None, ymin=None, ymax=None, save=False, filename=None):
529
501
530 """
502 """
531
503
532 Input:
504 Input:
533 dataOut :
505 dataOut :
534 idfigure :
506 idfigure :
535 wintitle :
507 wintitle :
536 channelList :
508 channelList :
537 xmin : None,
509 xmin : None,
538 xmax : None,
510 xmax : None,
539 ymin : None,
511 ymin : None,
540 ymax : None,
512 ymax : None,
541 """
513 """
542
514
543 if channelList == None:
515 if channelList == None:
544 channelIndexList = dataOut.channelIndexList
516 channelIndexList = dataOut.channelIndexList
545 else:
517 else:
546 channelIndexList = []
518 channelIndexList = []
547 for channel in channelList:
519 for channel in channelList:
548 if channel not in dataOut.channelList:
520 if channel not in dataOut.channelList:
549 raise ValueError, "Channel %d is not in dataOut.channelList"
521 raise ValueError, "Channel %d is not in dataOut.channelList"
550 channelIndexList.append(dataOut.channelList.index(channel))
522 channelIndexList.append(dataOut.channelList.index(channel))
551
523
552 x = dataOut.heightList
524 x = dataOut.heightList
553 y = dataOut.data[channelList,:] * numpy.conjugate(dataOut.data[channelList,:])
525 y = dataOut.data[channelList,:] * numpy.conjugate(dataOut.data[channelList,:])
554 y = y.real
526 y = y.real
555
527
556 noise = dataOut.getNoise()
528 noise = dataOut.getNoise()
557
529
558 if not self.__isConfig:
530 if not self.__isConfig:
559 nplots = len(channelList)
531 nplots = len(channelList)
560
532
561 self.setup(idfigure=idfigure,
533 self.setup(idfigure=idfigure,
562 nplots=nplots,
534 nplots=nplots,
563 wintitle=wintitle)
535 wintitle=wintitle)
564
536
565 if xmin == None: xmin = numpy.nanmin(x)
537 if xmin == None: xmin = numpy.nanmin(x)
566 if xmax == None: xmax = numpy.nanmax(x)
538 if xmax == None: xmax = numpy.nanmax(x)
567 if ymin == None: ymin = numpy.nanmin(y)
539 if ymin == None: ymin = numpy.nanmin(y)
568 if ymax == None: ymax = numpy.nanmax(y)
540 if ymax == None: ymax = numpy.nanmax(y)
569
541
570 self.__isConfig = True
542 self.__isConfig = True
571
543
572
544
573 thisDatetime = dataOut.datatime
545 thisDatetime = dataOut.datatime
574 title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
546 title = "Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
575 xlabel = "Range (Km)"
547 xlabel = "Range (Km)"
576 ylabel = "Intensity"
548 ylabel = "Intensity"
577
549
578 self.setWinTitle(title)
550 self.setWinTitle(title)
579
551
580 for i in range(len(self.axesList)):
552 for i in range(len(self.axesList)):
581 title = "Channel %d: %4.2fdB" %(i, noise[i])
553 title = "Channel %d: %4.2fdB" %(i, noise[i])
582 axes = self.axesList[i]
554 axes = self.axesList[i]
583 ychannel = y[i,:]
555 ychannel = y[i,:]
584 axes.pline(x, ychannel,
556 axes.pline(x, ychannel,
585 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
557 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
586 xlabel=xlabel, ylabel=ylabel, title=title)
558 xlabel=xlabel, ylabel=ylabel, title=title)
587
559
588 self.draw()
560 self.draw()
589
561
590 if save:
562 if save:
591 self.saveFigure(filename)
563 self.saveFigure(filename)
592
564
593 class ProfilePlot(Figure):
565 class ProfilePlot(Figure):
594 __isConfig = None
566 __isConfig = None
595 __nsubplots = None
567 __nsubplots = None
596
568
597 WIDTHPROF = None
569 WIDTHPROF = None
598 HEIGHTPROF = None
570 HEIGHTPROF = None
599 PREFIX = 'spcprofile'
571 PREFIX = 'spcprofile'
600
572
601 def __init__(self):
573 def __init__(self):
602 self.__isConfig = False
574 self.__isConfig = False
603 self.__nsubplots = 1
575 self.__nsubplots = 1
604
576
605 self.WIDTH = 300
577 self.WIDTH = 300
606 self.HEIGHT = 500
578 self.HEIGHT = 500
607
579
608 def getSubplots(self):
580 def getSubplots(self):
609 ncol = 1
581 ncol = 1
610 nrow = 1
582 nrow = 1
611
583
612 return nrow, ncol
584 return nrow, ncol
613
585
614 def setup(self, idfigure, nplots, wintitle):
586 def setup(self, idfigure, nplots, wintitle):
615
587
616 self.nplots = nplots
588 self.nplots = nplots
617
589
618 ncolspan = 1
590 ncolspan = 1
619 colspan = 1
591 colspan = 1
620
592
621 self.createFigure(idfigure = idfigure,
593 self.createFigure(idfigure = idfigure,
622 wintitle = wintitle,
594 wintitle = wintitle,
623 widthplot = self.WIDTH,
595 widthplot = self.WIDTH,
624 heightplot = self.HEIGHT)
596 heightplot = self.HEIGHT)
625
597
626 nrow, ncol = self.getSubplots()
598 nrow, ncol = self.getSubplots()
627
599
628 counter = 0
600 counter = 0
629 for y in range(nrow):
601 for y in range(nrow):
630 for x in range(ncol):
602 for x in range(ncol):
631 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
603 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
632
604
633 def run(self, dataOut, idfigure, wintitle="", channelList=None,
605 def run(self, dataOut, idfigure, wintitle="", channelList=None,
634 xmin=None, xmax=None, ymin=None, ymax=None,
606 xmin=None, xmax=None, ymin=None, ymax=None,
635 save=False, figpath='./', figfile=None):
607 save=False, figpath='./', figfile=None):
636
608
637 if channelList == None:
609 if channelList == None:
638 channelIndexList = dataOut.channelIndexList
610 channelIndexList = dataOut.channelIndexList
639 channelList = dataOut.channelList
611 channelList = dataOut.channelList
640 else:
612 else:
641 channelIndexList = []
613 channelIndexList = []
642 for channel in channelList:
614 for channel in channelList:
643 if channel not in dataOut.channelList:
615 if channel not in dataOut.channelList:
644 raise ValueError, "Channel %d is not in dataOut.channelList"
616 raise ValueError, "Channel %d is not in dataOut.channelList"
645 channelIndexList.append(dataOut.channelList.index(channel))
617 channelIndexList.append(dataOut.channelList.index(channel))
646
618
647
619
648 y = dataOut.getHeiRange()
620 y = dataOut.getHeiRange()
649 x = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
621 x = 10.*numpy.log10(dataOut.data_spc[channelIndexList,:,:])
650 avg = numpy.average(x, axis=1)
622 avg = numpy.average(x, axis=1)
651
623
652
624
653 if not self.__isConfig:
625 if not self.__isConfig:
654
626
655 nplots = 1
627 nplots = 1
656
628
657 self.setup(idfigure=idfigure,
629 self.setup(idfigure=idfigure,
658 nplots=nplots,
630 nplots=nplots,
659 wintitle=wintitle)
631 wintitle=wintitle)
660
632
661 if ymin == None: ymin = numpy.nanmin(y)
633 if ymin == None: ymin = numpy.nanmin(y)
662 if ymax == None: ymax = numpy.nanmax(y)
634 if ymax == None: ymax = numpy.nanmax(y)
663 if xmin == None: xmin = numpy.nanmin(avg)*0.9
635 if xmin == None: xmin = numpy.nanmin(avg)*0.9
664 if xmax == None: xmax = numpy.nanmax(avg)*0.9
636 if xmax == None: xmax = numpy.nanmax(avg)*0.9
665
637
666 self.__isConfig = True
638 self.__isConfig = True
667
639
668 thisDatetime = dataOut.datatime
640 thisDatetime = dataOut.datatime
669 title = "Power Profile"
641 title = "Power Profile"
670 xlabel = "dB"
642 xlabel = "dB"
671 ylabel = "Range (Km)"
643 ylabel = "Range (Km)"
672
644
673 self.setWinTitle(title)
645 self.setWinTitle(title)
674
646
675
647
676 title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
648 title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
677 axes = self.axesList[0]
649 axes = self.axesList[0]
678
650
679 legendlabels = ["channel %d"%x for x in channelList]
651 legendlabels = ["channel %d"%x for x in channelList]
680 axes.pmultiline(avg, y,
652 axes.pmultiline(avg, y,
681 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
653 xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax,
682 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
654 xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels,
683 ytick_visible=True, nxticks=5,
655 ytick_visible=True, nxticks=5,
684 grid='x')
656 grid='x')
685
657
686 self.draw()
658 self.draw()
687
659
688 if save:
660 if save:
689 date = thisDatetime.strftime("%Y%m%d")
661 date = thisDatetime.strftime("%Y%m%d")
690 if figfile == None:
662 if figfile == None:
691 figfile = self.getFilename(name = date)
663 figfile = self.getFilename(name = date)
692
664
693 self.saveFigure(figpath, figfile)
665 self.saveFigure(figpath, figfile)
694
666
695 class CoherencePlot(Figure):
667 class CoherencePlot(Figure):
696 __isConfig = None
668 __isConfig = None
697 __nsubplots = None
669 __nsubplots = None
698
670
699 WIDTHPROF = None
671 WIDTHPROF = None
700 HEIGHTPROF = None
672 HEIGHTPROF = None
701 PREFIX = 'coherencemap'
673 PREFIX = 'coherencemap'
702
674
703 def __init__(self):
675 def __init__(self):
704 self.__timerange = 24*60*60
676 self.__timerange = 24*60*60
705 self.__isConfig = False
677 self.__isConfig = False
706 self.__nsubplots = 1
678 self.__nsubplots = 1
707
679
708 self.WIDTH = 800
680 self.WIDTH = 800
709 self.HEIGHT = 200
681 self.HEIGHT = 200
710 self.WIDTHPROF = 120
682 self.WIDTHPROF = 120
711 self.HEIGHTPROF = 0
683 self.HEIGHTPROF = 0
712
684
713 def getSubplots(self):
685 def getSubplots(self):
714 ncol = 1
686 ncol = 1
715 nrow = self.nplots*2
687 nrow = self.nplots*2
716
688
717 return nrow, ncol
689 return nrow, ncol
718
690
719 def setup(self, idfigure, nplots, wintitle, showprofile=True):
691 def setup(self, idfigure, nplots, wintitle, showprofile=True):
720 self.__showprofile = showprofile
692 self.__showprofile = showprofile
721 self.nplots = nplots
693 self.nplots = nplots
722
694
723 ncolspan = 1
695 ncolspan = 1
724 colspan = 1
696 colspan = 1
725 if showprofile:
697 if showprofile:
726 ncolspan = 7
698 ncolspan = 7
727 colspan = 6
699 colspan = 6
728 self.__nsubplots = 2
700 self.__nsubplots = 2
729
701
730 self.createFigure(idfigure = idfigure,
702 self.createFigure(idfigure = idfigure,
731 wintitle = wintitle,
703 wintitle = wintitle,
732 widthplot = self.WIDTH + self.WIDTHPROF,
704 widthplot = self.WIDTH + self.WIDTHPROF,
733 heightplot = self.HEIGHT + self.HEIGHTPROF)
705 heightplot = self.HEIGHT + self.HEIGHTPROF)
734
706
735 nrow, ncol = self.getSubplots()
707 nrow, ncol = self.getSubplots()
736
708
737 for y in range(nrow):
709 for y in range(nrow):
738 for x in range(ncol):
710 for x in range(ncol):
739
711
740 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
712 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1)
741
713
742 if showprofile:
714 if showprofile:
743 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
715 self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1)
744
745 def __getTimeLim(self, x, xmin, xmax):
746
747 thisdatetime = datetime.datetime.fromtimestamp(numpy.min(x))
748 thisdate = datetime.datetime.combine(thisdatetime.date(), datetime.time(0,0,0))
749
750 ####################################################
751 #If the x is out of xrange
752 if xmax < (thisdatetime - thisdate).seconds/(60*60.):
753 xmin = None
754 xmax = None
755
756 if xmin == None:
757 td = thisdatetime - thisdate
758 xmin = td.seconds/(60*60.)
759
760 if xmax == None:
761 xmax = xmin + self.__timerange/(60*60.)
762
763 mindt = thisdate + datetime.timedelta(0,0,0,0,0, xmin)
764 tmin = time.mktime(mindt.timetuple())
765
766 maxdt = thisdate + datetime.timedelta(0,0,0,0,0, xmax)
767 tmax = time.mktime(maxdt.timetuple())
768
769 self.__timerange = tmax - tmin
770
771 return tmin, tmax
772
716
773 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
717 def run(self, dataOut, idfigure, wintitle="", pairsList=None, showprofile='True',
774 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
718 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
775 timerange=None,
719 timerange=None,
776 save=False, figpath='./', figfile=None):
720 save=False, figpath='./', figfile=None):
777
721
778 if pairsList == None:
722 if pairsList == None:
779 pairsIndexList = dataOut.pairsIndexList
723 pairsIndexList = dataOut.pairsIndexList
780 else:
724 else:
781 pairsIndexList = []
725 pairsIndexList = []
782 for pair in pairsList:
726 for pair in pairsList:
783 if pair not in dataOut.pairsList:
727 if pair not in dataOut.pairsList:
784 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
728 raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair)
785 pairsIndexList.append(dataOut.pairsList.index(pair))
729 pairsIndexList.append(dataOut.pairsList.index(pair))
786
730
787 if timerange != None:
731 if timerange != None:
788 self.__timerange = timerange
732 self.__timerange = timerange
789
733
790 tmin = None
734 tmin = None
791 tmax = None
735 tmax = None
792 x = dataOut.getTimeRange()
736 x = dataOut.getTimeRange()
793 y = dataOut.getHeiRange()
737 y = dataOut.getHeiRange()
794
738
795 if not self.__isConfig:
739 if not self.__isConfig:
796 nplots = len(pairsIndexList)
740 nplots = len(pairsIndexList)
797 self.setup(idfigure=idfigure,
741 self.setup(idfigure=idfigure,
798 nplots=nplots,
742 nplots=nplots,
799 wintitle=wintitle,
743 wintitle=wintitle,
800 showprofile=showprofile)
744 showprofile=showprofile)
801
745
802 tmin, tmax = self.__getTimeLim(x, xmin, xmax)
746 tmin, tmax = self.getTimeLim(x, xmin, xmax)
803 if ymin == None: ymin = numpy.nanmin(y)
747 if ymin == None: ymin = numpy.nanmin(y)
804 if ymax == None: ymax = numpy.nanmax(y)
748 if ymax == None: ymax = numpy.nanmax(y)
805
749
806 self.__isConfig = True
750 self.__isConfig = True
807
751
808 thisDatetime = dataOut.datatime
752 thisDatetime = dataOut.datatime
809 title = "CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y"))
753 title = "CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y"))
810 xlabel = ""
754 xlabel = ""
811 ylabel = "Range (Km)"
755 ylabel = "Range (Km)"
812
756
813 self.setWinTitle(title)
757 self.setWinTitle(title)
814
758
815 for i in range(self.nplots):
759 for i in range(self.nplots):
816
760
817 pair = dataOut.pairsList[pairsIndexList[i]]
761 pair = dataOut.pairsList[pairsIndexList[i]]
818 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
762 coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[pair[0],:,:]*dataOut.data_spc[pair[1],:,:])
819 coherence = numpy.abs(coherenceComplex)
763 coherence = numpy.abs(coherenceComplex)
820 avg = numpy.average(coherence, axis=0)
764 avg = numpy.average(coherence, axis=0)
821 z = avg.reshape((1,-1))
765 z = avg.reshape((1,-1))
822
766
823 counter = 0
767 counter = 0
824
768
825 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
769 title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
826 axes = self.axesList[i*self.__nsubplots*2]
770 axes = self.axesList[i*self.__nsubplots*2]
827 axes.pcolor(x, y, z,
771 axes.pcolor(x, y, z,
828 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
772 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=0, zmax=1,
829 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
773 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
830 ticksize=9, cblabel='', cbsize="1%")
774 ticksize=9, cblabel='', cbsize="1%")
831
775
832 if self.__showprofile:
776 if self.__showprofile:
833 counter += 1
777 counter += 1
834 axes = self.axesList[i*self.__nsubplots*2 + counter]
778 axes = self.axesList[i*self.__nsubplots*2 + counter]
835 axes.pline(avg, y,
779 axes.pline(avg, y,
836 xmin=0, xmax=1, ymin=ymin, ymax=ymax,
780 xmin=0, xmax=1, ymin=ymin, ymax=ymax,
837 xlabel='', ylabel='', title='', ticksize=7,
781 xlabel='', ylabel='', title='', ticksize=7,
838 ytick_visible=False, nxticks=5,
782 ytick_visible=False, nxticks=5,
839 grid='x')
783 grid='x')
840
784
841 counter += 1
785 counter += 1
842 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
786 phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
843 avg = numpy.average(phase, axis=0)
787 avg = numpy.average(phase, axis=0)
844 z = avg.reshape((1,-1))
788 z = avg.reshape((1,-1))
845
789
846 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
790 title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
847 axes = self.axesList[i*self.__nsubplots*2 + counter]
791 axes = self.axesList[i*self.__nsubplots*2 + counter]
848 axes.pcolor(x, y, z,
792 axes.pcolor(x, y, z,
849 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
793 xmin=tmin, xmax=tmax, ymin=ymin, ymax=ymax, zmin=-180, zmax=180,
850 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
794 xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True,
851 ticksize=9, cblabel='', colormap='RdBu', cbsize="1%")
795 ticksize=9, cblabel='', colormap='RdBu', cbsize="1%")
852
796
853 if self.__showprofile:
797 if self.__showprofile:
854 counter += 1
798 counter += 1
855 axes = self.axesList[i*self.__nsubplots*2 + counter]
799 axes = self.axesList[i*self.__nsubplots*2 + counter]
856 axes.pline(avg, y,
800 axes.pline(avg, y,
857 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
801 xmin=-180, xmax=180, ymin=ymin, ymax=ymax,
858 xlabel='', ylabel='', title='', ticksize=7,
802 xlabel='', ylabel='', title='', ticksize=7,
859 ytick_visible=False, nxticks=4,
803 ytick_visible=False, nxticks=4,
860 grid='x')
804 grid='x')
861
805
862 self.draw()
806 self.draw()
863
807
864 if save:
808 if save:
865 date = thisDatetime.strftime("%Y%m%d")
809 date = thisDatetime.strftime("%Y%m%d")
866 if figfile == None:
810 if figfile == None:
867 figfile = self.getFilename(name = date)
811 figfile = self.getFilename(name = date)
868
812
869 self.saveFigure(figpath, figfile)
813 self.saveFigure(figpath, figfile)
870
814
871 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
815 if x[1] + (x[1]-x[0]) >= self.axesList[0].xmax:
872 self.__isConfig = False
816 self.__isConfig = False
873
817
874 No newline at end of file
818
General Comments 0
You need to be logged in to leave comments. Login now