##// END OF EJS Templates
UPDATE del jroplot_voltage.py
avaldez -
r1312:f4fa6c62c9fb
parent child
Show More
@@ -1,276 +1,302
1 1 '''
2 2 Created on Jul 9, 2014
3 3
4 4 @author: roj-idl71
5 5 '''
6 6 import os
7 7 import datetime
8 8 import numpy
9 9
10 10 from schainpy.model.graphics.jroplot_base import Plot, plt
11 11
12 12
13 13 class ScopePlot(Plot):
14 14
15 15 '''
16 16 Plot for Scope
17 17 '''
18 18
19 19 CODE = 'scope'
20 20 plot_name = 'Scope'
21 21 plot_type = 'scatter'
22 22
23 23 def setup(self):
24 24
25 25 self.xaxis = 'Range (Km)'
26 26 self.ncols = 1
27 27 self.nrows = 1
28 28 self.nplots = 1
29 29 self.ylabel = 'Intensity [dB]'
30 30 self.titles = ['Scope']
31 31 self.colorbar = False
32 32 self.width = 6
33 33 self.height = 4
34 34
35 35 def plot_iq(self, x, y, channelIndexList, thisDatetime, wintitle):
36 36
37 37 yreal = y[channelIndexList,:].real
38 38 yimag = y[channelIndexList,:].imag
39 39 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y"))
40 40 self.xlabel = "Range (Km)"
41 41 self.ylabel = "Intensity - IQ"
42 42
43 43 self.y = yreal
44 44 self.x = x
45 45 self.xmin = min(x)
46 46 self.xmax = max(x)
47 47
48 48
49 49 self.titles[0] = title
50 50
51 51 for i,ax in enumerate(self.axes):
52 52 title = "Channel %d" %(i)
53 53 if ax.firsttime:
54 54 ax.plt_r = ax.plot(x, yreal[i,:], color='b')[0]
55 55 ax.plt_i = ax.plot(x, yimag[i,:], color='r')[0]
56 56 else:
57 57 ax.plt_r.set_data(x, yreal[i,:])
58 58 ax.plt_i.set_data(x, yimag[i,:])
59 59
60 60 def plot_power(self, x, y, channelIndexList, thisDatetime, wintitle):
61 61 y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:])
62 62 yreal = y.real
63 63 yreal = 10*numpy.log10(yreal)
64 64 self.y = yreal
65 65 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y"))
66 66 self.xlabel = "Range (Km)"
67 67 self.ylabel = "Intensity"
68 68 self.xmin = min(x)
69 69 self.xmax = max(x)
70 70
71 71
72 72 self.titles[0] = title
73 73
74 74 for i,ax in enumerate(self.axes):
75 75 title = "Channel %d" %(i)
76 76
77 77 ychannel = yreal[i,:]
78 78
79 79 if ax.firsttime:
80 80 ax.plt_r = ax.plot(x, ychannel)[0]
81 81 else:
82 82 #pass
83 83 ax.plt_r.set_data(x, ychannel)
84 84
85 85 def plot_weatherpower(self, x, y, channelIndexList, thisDatetime, wintitle):
86 86
87 87
88 88 y = y[channelIndexList,:]
89 89 yreal = y.real
90 90 yreal = 10*numpy.log10(yreal)
91 91 self.y = yreal
92 92 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
93 93 self.xlabel = "Range (Km)"
94 94 self.ylabel = "Intensity"
95 95 self.xmin = min(x)
96 96 self.xmax = max(x)
97 97
98 98 self.titles[0] =title
99 99 for i,ax in enumerate(self.axes):
100 100 title = "Channel %d" %(i)
101 101
102 102 ychannel = yreal[i,:]
103 103
104 104 if ax.firsttime:
105 105 ax.plt_r = ax.plot(x, ychannel)[0]
106 106 else:
107 107 #pass
108 108 ax.plt_r.set_data(x, ychannel)
109 109
110 110 def plot_weathervelocity(self, x, y, channelIndexList, thisDatetime, wintitle):
111 111
112 112 x = x[channelIndexList,:]
113 113 yreal = y
114 114 self.y = yreal
115 115 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
116 116 self.xlabel = "Velocity (m/s)"
117 117 self.ylabel = "Range (Km)"
118 118 self.xmin = numpy.min(x)
119 119 self.xmax = numpy.max(x)
120 120 self.titles[0] =title
121 121 for i,ax in enumerate(self.axes):
122 122 title = "Channel %d" %(i)
123 123 xchannel = x[i,:]
124 124 if ax.firsttime:
125 125 ax.plt_r = ax.plot(xchannel, yreal)[0]
126 126 else:
127 127 #pass
128 128 ax.plt_r.set_data(xchannel, yreal)
129 129
130 130 def plot_weatherspecwidth(self, x, y, channelIndexList, thisDatetime, wintitle):
131 131
132 132 x = x[channelIndexList,:]
133 133 yreal = y
134 134 self.y = yreal
135 135 title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
136 136 self.xlabel = "width "
137 137 self.ylabel = "Range (Km)"
138 138 self.xmin = numpy.min(x)
139 139 self.xmax = numpy.max(x)
140 140 self.titles[0] =title
141 141 for i,ax in enumerate(self.axes):
142 142 title = "Channel %d" %(i)
143 143 xchannel = x[i,:]
144 144 if ax.firsttime:
145 145 ax.plt_r = ax.plot(xchannel, yreal)[0]
146 146 else:
147 147 #pass
148 148 ax.plt_r.set_data(xchannel, yreal)
149 149
150 150 def plot(self):
151 151 if self.channels:
152 152 channels = self.channels
153 153 else:
154 154 channels = self.data.channels
155 155
156 156 thisDatetime = datetime.datetime.utcfromtimestamp(self.data.times[-1])
157 157 if self.CODE == "pp_power":
158 158 scope = self.data['pp_power']
159 elif self.CODE == "pp_signal":
160 scope = self.data["pp_signal"]
159 161 elif self.CODE == "pp_velocity":
160 162 scope = self.data["pp_velocity"]
161 163 elif self.CODE == "pp_specwidth":
162 164 scope = self.data["pp_specwidth"]
163 165 else:
164 166 scope =self.data["scope"]
165 167
166 168 if self.data.flagDataAsBlock:
167 169
168 170 for i in range(self.data.nProfiles):
169 171
170 172 wintitle1 = " [Profile = %d] " %i
171 173 if self.CODE =="scope":
172 174 if self.type == "power":
173 175 self.plot_power(self.data.heights,
174 176 scope[:,i,:],
175 177 channels,
176 178 thisDatetime,
177 179 wintitle1
178 180 )
179 181
180 182 if self.type == "iq":
181 183 self.plot_iq(self.data.heights,
182 184 scope[:,i,:],
183 185 channels,
184 186 thisDatetime,
185 187 wintitle1
186 188 )
187 189 if self.CODE=="pp_power":
188 190 self.plot_weatherpower(self.data.heights,
189 191 scope[:,i,:],
190 192 channels,
191 193 thisDatetime,
192 194 wintitle
193 195 )
196 if self.CODE=="pp_signal":
197 self.plot_weatherpower(self.data.heights,
198 scope[:,i,:],
199 channels,
200 thisDatetime,
201 wintitle
202 )
194 203 if self.CODE=="pp_velocity":
195 204 self.plot_weathervelocity(scope[:,i,:],
196 205 self.data.heights,
197 206 channels,
198 207 thisDatetime,
199 208 wintitle
200 209 )
201 210 if self.CODE=="pp_spcwidth":
202 211 self.plot_weatherspecwidth(scope[:,i,:],
203 212 self.data.heights,
204 213 channels,
205 214 thisDatetime,
206 215 wintitle
207 216 )
208 217 else:
209 218 wintitle = " [Profile = %d] " %self.data.profileIndex
210 219 if self.CODE== "scope":
211 220 if self.type == "power":
212 221 self.plot_power(self.data.heights,
213 222 scope,
214 223 channels,
215 224 thisDatetime,
216 225 wintitle
217 226 )
218 227
219 228 if self.type == "iq":
220 229 self.plot_iq(self.data.heights,
221 230 scope,
222 231 channels,
223 232 thisDatetime,
224 233 wintitle
225 234 )
226 235 if self.CODE=="pp_power":
227 236 self.plot_weatherpower(self.data.heights,
228 237 scope,
229 238 channels,
230 239 thisDatetime,
231 240 wintitle
232 241 )
242 if self.CODE=="pp_signal":
243 self.plot_weatherpower(self.data.heights,
244 scope,
245 channels,
246 thisDatetime,
247 wintitle
248 )
233 249 if self.CODE=="pp_velocity":
234 250 self.plot_weathervelocity(scope,
235 251 self.data.heights,
236 252 channels,
237 253 thisDatetime,
238 254 wintitle
239 255 )
240 256 if self.CODE=="pp_specwidth":
241 257 self.plot_weatherspecwidth(scope,
242 258 self.data.heights,
243 259 channels,
244 260 thisDatetime,
245 261 wintitle
246 262 )
247 263
248 264
249 265
250 266 class PulsepairPowerPlot(ScopePlot):
251 267 '''
252 Plot for
268 Plot for P= S+N
253 269 '''
254 270
255 271 CODE = 'pp_power'
256 272 plot_name = 'PulsepairPower'
257 273 plot_type = 'scatter'
258 274 buffering = False
259 275
260 276 class PulsepairVelocityPlot(ScopePlot):
261 277 '''
262 Plot for
278 Plot for VELOCITY
263 279 '''
264 280 CODE = 'pp_velocity'
265 281 plot_name = 'PulsepairVelocity'
266 282 plot_type = 'scatter'
267 283 buffering = False
268 284
269 285 class PulsepairSpecwidthPlot(ScopePlot):
270 286 '''
271 Plot for
287 Plot for WIDTH
272 288 '''
273 289 CODE = 'pp_specwidth'
274 290 plot_name = 'PulsepairSpecwidth'
275 291 plot_type = 'scatter'
276 292 buffering = False
293
294 class PulsepairSignalPlot(ScopePlot):
295 '''
296 Plot for S
297 '''
298
299 CODE = 'pp_signal'
300 plot_name = 'PulsepairSignal'
301 plot_type = 'scatter'
302 buffering = False
General Comments 0
You need to be logged in to leave comments. Login now