The requested changes are too big and content was truncated. Show full diff
@@ -1,1541 +1,1584 | |||
|
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 | import matplotlib.pyplot as plt | |
|
11 | ||
|
10 | 12 | from figure import Figure, isRealtime, isTimeInHourRange |
|
11 | 13 | from plotting_codes import * |
|
14 | from matplotlib.pyplot import savefig | |
|
12 | 15 | |
|
13 | 16 | class SpectraPlot(Figure): |
|
14 | 17 | |
|
15 | 18 | isConfig = None |
|
16 | 19 | __nsubplots = None |
|
17 | 20 | |
|
18 | 21 | WIDTHPROF = None |
|
19 | 22 | HEIGHTPROF = None |
|
20 | 23 | PREFIX = 'spc' |
|
21 | 24 | |
|
22 | 25 | def __init__(self, **kwargs): |
|
23 | 26 | Figure.__init__(self, **kwargs) |
|
24 | 27 | self.isConfig = False |
|
25 | 28 | self.__nsubplots = 1 |
|
26 | 29 | |
|
27 | 30 | self.WIDTH = 250 |
|
28 | 31 | self.HEIGHT = 250 |
|
29 | 32 | self.WIDTHPROF = 120 |
|
30 | 33 | self.HEIGHTPROF = 0 |
|
31 | 34 | self.counter_imagwr = 0 |
|
32 | 35 | |
|
33 | 36 | self.PLOT_CODE = SPEC_CODE |
|
34 | 37 | |
|
35 | 38 | self.FTP_WEI = None |
|
36 | 39 | self.EXP_CODE = None |
|
37 | 40 | self.SUB_EXP_CODE = None |
|
38 | 41 | self.PLOT_POS = None |
|
39 | 42 | |
|
40 | 43 | self.__xfilter_ena = False |
|
41 | 44 | self.__yfilter_ena = False |
|
45 | ||
|
46 | self.indice=1 | |
|
42 | 47 | |
|
43 | 48 | def getSubplots(self): |
|
44 | 49 | |
|
45 | 50 | ncol = int(numpy.sqrt(self.nplots)+0.9) |
|
46 | 51 | nrow = int(self.nplots*1./ncol + 0.9) |
|
47 | 52 | |
|
48 | 53 | return nrow, ncol |
|
49 | 54 | |
|
50 | 55 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
51 | 56 | |
|
52 | 57 | self.__showprofile = showprofile |
|
53 | 58 | self.nplots = nplots |
|
54 | 59 | |
|
55 | 60 | ncolspan = 1 |
|
56 | 61 | colspan = 1 |
|
57 | 62 | if showprofile: |
|
58 | 63 | ncolspan = 3 |
|
59 | 64 | colspan = 2 |
|
60 | 65 | self.__nsubplots = 2 |
|
61 | 66 | |
|
62 | 67 | self.createFigure(id = id, |
|
63 | 68 | wintitle = wintitle, |
|
64 | 69 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
65 | 70 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
66 | 71 | show=show) |
|
67 | 72 | |
|
68 | 73 | nrow, ncol = self.getSubplots() |
|
69 | 74 | |
|
70 | 75 | counter = 0 |
|
71 | 76 | for y in range(nrow): |
|
72 | 77 | for x in range(ncol): |
|
73 | 78 | |
|
74 | 79 | if counter >= self.nplots: |
|
75 | 80 | break |
|
76 | 81 | |
|
77 | 82 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
78 | 83 | |
|
79 | 84 | if showprofile: |
|
80 | 85 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
81 | 86 | |
|
82 | 87 | counter += 1 |
|
83 | 88 | |
|
84 | 89 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True, |
|
85 | 90 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
86 | 91 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
87 | 92 | server=None, folder=None, username=None, password=None, |
|
88 | 93 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, realtime=False, |
|
89 | 94 | xaxis="frequency", colormap='jet', normFactor=None): |
|
90 | 95 | |
|
91 | 96 | """ |
|
92 | 97 | |
|
93 | 98 | Input: |
|
94 | 99 | dataOut : |
|
95 | 100 | id : |
|
96 | 101 | wintitle : |
|
97 | 102 | channelList : |
|
98 | 103 | showProfile : |
|
99 | 104 | xmin : None, |
|
100 | 105 | xmax : None, |
|
101 | 106 | ymin : None, |
|
102 | 107 | ymax : None, |
|
103 | 108 | zmin : None, |
|
104 | 109 | zmax : None |
|
105 | 110 | """ |
|
106 | 111 | if realtime: |
|
107 | 112 | if not(isRealtime(utcdatatime = dataOut.utctime)): |
|
108 | 113 | print 'Skipping this plot function' |
|
109 | 114 | return |
|
110 | 115 | |
|
111 | 116 | if channelList == None: |
|
112 | 117 | channelIndexList = dataOut.channelIndexList |
|
113 | 118 | else: |
|
114 | 119 | channelIndexList = [] |
|
115 | 120 | for channel in channelList: |
|
116 | 121 | if channel not in dataOut.channelList: |
|
117 | 122 | raise ValueError, "Channel %d is not in dataOut.channelList" %channel |
|
118 | 123 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
119 | 124 | |
|
120 | 125 | if normFactor is None: |
|
121 | 126 | factor = dataOut.normFactor |
|
122 | 127 | else: |
|
123 | 128 | factor = normFactor |
|
124 | 129 | if xaxis == "frequency": |
|
125 | 130 | x = dataOut.getFreqRange(1)/1000. |
|
126 | 131 | xlabel = "Frequency (kHz)" |
|
127 | 132 | |
|
128 | 133 | elif xaxis == "time": |
|
129 | 134 | x = dataOut.getAcfRange(1) |
|
130 | 135 | xlabel = "Time (ms)" |
|
131 | 136 | |
|
132 | 137 | else: |
|
133 | 138 | x = dataOut.getVelRange(1) |
|
134 | 139 | xlabel = "Velocity (m/s)" |
|
135 | 140 | |
|
136 | 141 | ylabel = "Range (Km)" |
|
137 | 142 | |
|
138 | 143 | y = dataOut.getHeiRange() |
|
139 | 144 | |
|
140 | 145 | z = dataOut.data_spc/factor |
|
141 | 146 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
142 | 147 | zdB = 10*numpy.log10(z) |
|
143 | 148 | |
|
144 | 149 | avg = numpy.average(z, axis=1) |
|
145 | 150 | avgdB = 10*numpy.log10(avg) |
|
146 | 151 | |
|
147 | 152 | noise = dataOut.getNoise()/factor |
|
148 | 153 | noisedB = 10*numpy.log10(noise) |
|
149 | 154 | |
|
150 | 155 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
151 | 156 | title = wintitle + " Spectra" |
|
157 | ||
|
158 | ||
|
159 | ||
|
160 | print 'len de X',len(x), numpy.shape(x), 'len de spc line',len(dataOut.data_spc[1,:,15]), numpy.shape(dataOut.data_spc) | |
|
161 | print 'Altura:', y[0], y[1], y[13], y[14], y[10] | |
|
162 | #a=z[1,:,15] | |
|
163 | ||
|
164 | # fig = plt.figure(10+self.indice) | |
|
165 | # plt.plot( x[0:128], zdB[0,:,10] ) | |
|
166 | # plt.axis([-12, 12, 15, 50]) | |
|
167 | # plt.title(" %s" %( '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S"))) ) | |
|
168 | # plt.ylabel('Intensidad [dB]') | |
|
169 | # plt.xlabel('Velocidad [m/s]') | |
|
170 | # fig.savefig('/home/erick/Documents/Pics/to{}.png'.format(self.indice)) | |
|
171 | # | |
|
172 | # plt.show() | |
|
173 | # | |
|
174 | # self.indice=self.indice+1 | |
|
175 | ||
|
176 | ||
|
177 | ||
|
152 | 178 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
153 | 179 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
154 | 180 | |
|
155 | 181 | if not self.isConfig: |
|
156 | 182 | |
|
157 | 183 | nplots = len(channelIndexList) |
|
158 | 184 | |
|
159 | 185 | self.setup(id=id, |
|
160 | 186 | nplots=nplots, |
|
161 | 187 | wintitle=wintitle, |
|
162 | 188 | showprofile=showprofile, |
|
163 | 189 | show=show) |
|
164 | 190 | |
|
165 | 191 | if xmin == None: xmin = numpy.nanmin(x) |
|
166 | 192 | if xmax == None: xmax = numpy.nanmax(x) |
|
167 | 193 | if ymin == None: ymin = numpy.nanmin(y) |
|
168 | 194 | if ymax == None: ymax = numpy.nanmax(y) |
|
169 | 195 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
170 | 196 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
171 | 197 | |
|
172 | 198 | self.FTP_WEI = ftp_wei |
|
173 | 199 | self.EXP_CODE = exp_code |
|
174 | 200 | self.SUB_EXP_CODE = sub_exp_code |
|
175 | 201 | self.PLOT_POS = plot_pos |
|
176 | 202 | |
|
177 | 203 | self.isConfig = True |
|
178 | 204 | |
|
179 | 205 | self.setWinTitle(title) |
|
180 | 206 | |
|
181 | 207 | for i in range(self.nplots): |
|
182 | 208 | index = channelIndexList[i] |
|
183 | 209 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
184 | 210 | title = "Channel %d: %4.2fdB: %s" %(dataOut.channelList[index], noisedB[index], str_datetime) |
|
185 | 211 | if len(dataOut.beam.codeList) != 0: |
|
186 | 212 | title = "Ch%d:%4.2fdB,%2.2f,%2.2f:%s" %(dataOut.channelList[index], noisedB[index], dataOut.beam.azimuthList[index], dataOut.beam.zenithList[index], str_datetime) |
|
187 | 213 | |
|
188 | 214 | axes = self.axesList[i*self.__nsubplots] |
|
189 | 215 | axes.pcolor(x, y, zdB[index,:,:], |
|
190 | 216 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
191 | 217 | xlabel=xlabel, ylabel=ylabel, title=title, colormap=colormap, |
|
192 | 218 | ticksize=9, cblabel='') |
|
193 | 219 | |
|
194 | 220 | if self.__showprofile: |
|
195 | 221 | axes = self.axesList[i*self.__nsubplots +1] |
|
196 | 222 | axes.pline(avgdB[index,:], y, |
|
197 | 223 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
198 | 224 | xlabel='dB', ylabel='', title='', |
|
199 | 225 | ytick_visible=False, |
|
200 | 226 | grid='x') |
|
201 | 227 | |
|
202 | 228 | noiseline = numpy.repeat(noisedB[index], len(y)) |
|
203 | 229 | axes.addpline(noiseline, y, idline=1, color="black", linestyle="dashed", lw=2) |
|
204 | 230 | |
|
205 | 231 | self.draw() |
|
206 | 232 | |
|
207 | 233 | if figfile == None: |
|
208 | 234 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
209 | 235 | name = str_datetime |
|
210 | 236 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
211 | 237 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) |
|
212 | 238 | figfile = self.getFilename(name) |
|
213 | 239 | |
|
214 | 240 | self.save(figpath=figpath, |
|
215 | 241 | figfile=figfile, |
|
216 | 242 | save=save, |
|
217 | 243 | ftp=ftp, |
|
218 | 244 | wr_period=wr_period, |
|
219 | 245 | thisDatetime=thisDatetime) |
|
246 | ||
|
220 | 247 | |
|
221 | 248 | class CrossSpectraPlot(Figure): |
|
222 | 249 | |
|
223 | 250 | isConfig = None |
|
224 | 251 | __nsubplots = None |
|
225 | 252 | |
|
226 | 253 | WIDTH = None |
|
227 | 254 | HEIGHT = None |
|
228 | 255 | WIDTHPROF = None |
|
229 | 256 | HEIGHTPROF = None |
|
230 | 257 | PREFIX = 'cspc' |
|
231 | 258 | |
|
232 | 259 | def __init__(self, **kwargs): |
|
233 | 260 | Figure.__init__(self, **kwargs) |
|
234 | 261 | self.isConfig = False |
|
235 | 262 | self.__nsubplots = 4 |
|
236 | 263 | self.counter_imagwr = 0 |
|
237 | 264 | self.WIDTH = 250 |
|
238 | 265 | self.HEIGHT = 250 |
|
239 | 266 | self.WIDTHPROF = 0 |
|
240 | 267 | self.HEIGHTPROF = 0 |
|
241 | 268 | |
|
242 | 269 | self.PLOT_CODE = CROSS_CODE |
|
243 | 270 | self.FTP_WEI = None |
|
244 | 271 | self.EXP_CODE = None |
|
245 | 272 | self.SUB_EXP_CODE = None |
|
246 | 273 | self.PLOT_POS = None |
|
274 | ||
|
275 | self.indice=0 | |
|
247 | 276 | |
|
248 | 277 | def getSubplots(self): |
|
249 | 278 | |
|
250 | 279 | ncol = 4 |
|
251 | 280 | nrow = self.nplots |
|
252 | 281 | |
|
253 | 282 | return nrow, ncol |
|
254 | 283 | |
|
255 | 284 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
256 | 285 | |
|
257 | 286 | self.__showprofile = showprofile |
|
258 | 287 | self.nplots = nplots |
|
259 | 288 | |
|
260 | 289 | ncolspan = 1 |
|
261 | 290 | colspan = 1 |
|
262 | 291 | |
|
263 | 292 | self.createFigure(id = id, |
|
264 | 293 | wintitle = wintitle, |
|
265 | 294 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
266 | 295 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
267 | 296 | show=True) |
|
268 | 297 | |
|
269 | 298 | nrow, ncol = self.getSubplots() |
|
270 | 299 | |
|
271 | 300 | counter = 0 |
|
272 | 301 | for y in range(nrow): |
|
273 | 302 | for x in range(ncol): |
|
274 | 303 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
275 | 304 | |
|
276 | 305 | counter += 1 |
|
277 | 306 | |
|
278 | 307 | def run(self, dataOut, id, wintitle="", pairsList=None, |
|
279 | 308 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
280 | 309 | coh_min=None, coh_max=None, phase_min=None, phase_max=None, |
|
281 | 310 | save=False, figpath='./', figfile=None, ftp=False, wr_period=1, |
|
282 | 311 | power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True, |
|
283 | 312 | server=None, folder=None, username=None, password=None, |
|
284 | 313 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, normFactor=None, |
|
285 | 314 | xaxis='frequency'): |
|
286 | 315 | |
|
287 | 316 | """ |
|
288 | 317 | |
|
289 | 318 | Input: |
|
290 | 319 | dataOut : |
|
291 | 320 | id : |
|
292 | 321 | wintitle : |
|
293 | 322 | channelList : |
|
294 | 323 | showProfile : |
|
295 | 324 | xmin : None, |
|
296 | 325 | xmax : None, |
|
297 | 326 | ymin : None, |
|
298 | 327 | ymax : None, |
|
299 | 328 | zmin : None, |
|
300 | 329 | zmax : None |
|
301 | 330 | """ |
|
302 | 331 | |
|
303 | 332 | if pairsList == None: |
|
304 | 333 | pairsIndexList = dataOut.pairsIndexList |
|
305 | 334 | else: |
|
306 | 335 | pairsIndexList = [] |
|
307 | 336 | for pair in pairsList: |
|
308 | 337 | if pair not in dataOut.pairsList: |
|
309 | 338 | raise ValueError, "Pair %s is not in dataOut.pairsList" %str(pair) |
|
310 | 339 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
311 | 340 | |
|
312 | 341 | if not pairsIndexList: |
|
313 | 342 | return |
|
314 | 343 | |
|
315 | 344 | if len(pairsIndexList) > 4: |
|
316 | 345 | pairsIndexList = pairsIndexList[0:4] |
|
317 | 346 | |
|
318 | 347 | if normFactor is None: |
|
319 | 348 | factor = dataOut.normFactor |
|
320 | 349 | else: |
|
321 | 350 | factor = normFactor |
|
322 | 351 | x = dataOut.getVelRange(1) |
|
323 | 352 | y = dataOut.getHeiRange() |
|
324 | 353 | z = dataOut.data_spc[:,:,:]/factor |
|
325 | 354 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
326 | 355 | |
|
327 | 356 | noise = dataOut.noise/factor |
|
328 | 357 | |
|
329 | 358 | zdB = 10*numpy.log10(z) |
|
330 | 359 | noisedB = 10*numpy.log10(noise) |
|
331 | 360 | |
|
332 | 361 | if coh_min == None: |
|
333 | 362 | coh_min = 0.0 |
|
334 | 363 | if coh_max == None: |
|
335 | 364 | coh_max = 1.0 |
|
336 | 365 | |
|
337 | 366 | if phase_min == None: |
|
338 | 367 | phase_min = -180 |
|
339 | 368 | if phase_max == None: |
|
340 | 369 | phase_max = 180 |
|
341 | 370 | |
|
342 | 371 | #thisDatetime = dataOut.datatime |
|
343 | 372 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
344 | 373 | title = wintitle + " Cross-Spectra: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
345 | 374 | # xlabel = "Velocity (m/s)" |
|
346 | 375 | ylabel = "Range (Km)" |
|
347 | 376 | |
|
348 | 377 | if xaxis == "frequency": |
|
349 | 378 | x = dataOut.getFreqRange(1)/1000. |
|
350 | 379 | xlabel = "Frequency (kHz)" |
|
351 | 380 | |
|
352 | 381 | elif xaxis == "time": |
|
353 | 382 | x = dataOut.getAcfRange(1) |
|
354 | 383 | xlabel = "Time (ms)" |
|
355 | 384 | |
|
356 | 385 | else: |
|
357 | 386 | x = dataOut.getVelRange(1) |
|
358 | 387 | xlabel = "Velocity (m/s)" |
|
359 | 388 | |
|
360 | 389 | if not self.isConfig: |
|
361 | 390 | |
|
362 | 391 | nplots = len(pairsIndexList) |
|
363 | 392 | |
|
364 | 393 | self.setup(id=id, |
|
365 | 394 | nplots=nplots, |
|
366 | 395 | wintitle=wintitle, |
|
367 | 396 | showprofile=False, |
|
368 | 397 | show=show) |
|
369 | 398 | |
|
370 | 399 | avg = numpy.abs(numpy.average(z, axis=1)) |
|
371 | 400 | avgdB = 10*numpy.log10(avg) |
|
372 | 401 | |
|
373 | 402 | if xmin == None: xmin = numpy.nanmin(x) |
|
374 | 403 | if xmax == None: xmax = numpy.nanmax(x) |
|
375 | 404 | if ymin == None: ymin = numpy.nanmin(y) |
|
376 | 405 | if ymax == None: ymax = numpy.nanmax(y) |
|
377 | 406 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
378 | 407 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
379 | 408 | |
|
380 | 409 | self.FTP_WEI = ftp_wei |
|
381 | 410 | self.EXP_CODE = exp_code |
|
382 | 411 | self.SUB_EXP_CODE = sub_exp_code |
|
383 | 412 | self.PLOT_POS = plot_pos |
|
384 | 413 | |
|
385 | 414 | self.isConfig = True |
|
386 | 415 | |
|
387 | 416 | self.setWinTitle(title) |
|
417 | ||
|
388 | 418 | |
|
389 | 419 | for i in range(self.nplots): |
|
390 | 420 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
391 | 421 | |
|
392 | 422 | chan_index0 = dataOut.channelList.index(pair[0]) |
|
393 | 423 | chan_index1 = dataOut.channelList.index(pair[1]) |
|
394 | 424 | |
|
395 | 425 | str_datetime = '%s %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S")) |
|
396 | 426 | title = "Ch%d: %4.2fdB: %s" %(pair[0], noisedB[chan_index0], str_datetime) |
|
397 | 427 | zdB = 10.*numpy.log10(dataOut.data_spc[chan_index0,:,:]/factor) |
|
398 | 428 | axes0 = self.axesList[i*self.__nsubplots] |
|
399 | 429 | axes0.pcolor(x, y, zdB, |
|
400 | 430 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
401 | 431 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
402 | 432 | ticksize=9, colormap=power_cmap, cblabel='') |
|
403 | 433 | |
|
404 | 434 | title = "Ch%d: %4.2fdB: %s" %(pair[1], noisedB[chan_index1], str_datetime) |
|
405 | 435 | zdB = 10.*numpy.log10(dataOut.data_spc[chan_index1,:,:]/factor) |
|
406 | 436 | axes0 = self.axesList[i*self.__nsubplots+1] |
|
407 | 437 | axes0.pcolor(x, y, zdB, |
|
408 | 438 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
409 | 439 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
410 | 440 | ticksize=9, colormap=power_cmap, cblabel='') |
|
411 | 441 | |
|
412 | 442 | coherenceComplex = dataOut.data_cspc[pairsIndexList[i],:,:]/numpy.sqrt(dataOut.data_spc[chan_index0,:,:]*dataOut.data_spc[chan_index1,:,:]) |
|
413 | 443 | coherence = numpy.abs(coherenceComplex) |
|
414 | 444 | # phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi |
|
415 | 445 | phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi |
|
446 | ||
|
447 | ||
|
448 | # print 'FASE', numpy.shape(phase), y[10] | |
|
449 | # fig = plt.figure(10+self.indice) | |
|
450 | # plt.plot( x[0:128],phase[:,10] ) | |
|
451 | # #plt.axis([-12, 12, 15, 50]) | |
|
452 | # plt.title("%s" %( '%s %s, Channel %s'%(thisDatetime.strftime("%Y/%m/%d"),thisDatetime.strftime("%H:%M:%S") , i))) | |
|
453 | # plt.ylabel('Desfase [grados]') | |
|
454 | # plt.xlabel('Velocidad [m/s]') | |
|
455 | # fig.savefig('/home/erick/Documents/Pics/to{}.png'.format(self.indice)) | |
|
456 | # | |
|
457 | # plt.show() | |
|
458 | # self.indice=self.indice+1 | |
|
416 | 459 | |
|
417 | 460 | title = "Coherence Ch%d * Ch%d" %(pair[0], pair[1]) |
|
418 | 461 | axes0 = self.axesList[i*self.__nsubplots+2] |
|
419 | 462 | axes0.pcolor(x, y, coherence, |
|
420 | 463 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=coh_min, zmax=coh_max, |
|
421 | 464 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
422 | 465 | ticksize=9, colormap=coherence_cmap, cblabel='') |
|
423 | 466 | |
|
424 | 467 | title = "Phase Ch%d * Ch%d" %(pair[0], pair[1]) |
|
425 | 468 | axes0 = self.axesList[i*self.__nsubplots+3] |
|
426 | 469 | axes0.pcolor(x, y, phase, |
|
427 | 470 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max, |
|
428 | 471 | xlabel=xlabel, ylabel=ylabel, title=title, |
|
429 | 472 | ticksize=9, colormap=phase_cmap, cblabel='') |
|
430 | 473 | |
|
431 | 474 | |
|
432 | 475 | |
|
433 | 476 | self.draw() |
|
434 | 477 | |
|
435 | 478 | self.save(figpath=figpath, |
|
436 | 479 | figfile=figfile, |
|
437 | 480 | save=save, |
|
438 | 481 | ftp=ftp, |
|
439 | 482 | wr_period=wr_period, |
|
440 | 483 | thisDatetime=thisDatetime) |
|
441 | 484 | |
|
442 | 485 | |
|
443 | 486 | class RTIPlot(Figure): |
|
444 | 487 | |
|
445 | 488 | __isConfig = None |
|
446 | 489 | __nsubplots = None |
|
447 | 490 | |
|
448 | 491 | WIDTHPROF = None |
|
449 | 492 | HEIGHTPROF = None |
|
450 | 493 | PREFIX = 'rti' |
|
451 | 494 | |
|
452 | 495 | def __init__(self, **kwargs): |
|
453 | 496 | |
|
454 | 497 | Figure.__init__(self, **kwargs) |
|
455 | 498 | self.timerange = None |
|
456 | 499 | self.isConfig = False |
|
457 | 500 | self.__nsubplots = 1 |
|
458 | 501 | |
|
459 | 502 | self.WIDTH = 800 |
|
460 | 503 | self.HEIGHT = 180 |
|
461 | 504 | self.WIDTHPROF = 120 |
|
462 | 505 | self.HEIGHTPROF = 0 |
|
463 | 506 | self.counter_imagwr = 0 |
|
464 | 507 | |
|
465 | 508 | self.PLOT_CODE = RTI_CODE |
|
466 | 509 | |
|
467 | 510 | self.FTP_WEI = None |
|
468 | 511 | self.EXP_CODE = None |
|
469 | 512 | self.SUB_EXP_CODE = None |
|
470 | 513 | self.PLOT_POS = None |
|
471 | 514 | self.tmin = None |
|
472 | 515 | self.tmax = None |
|
473 | 516 | |
|
474 | 517 | self.xmin = None |
|
475 | 518 | self.xmax = None |
|
476 | 519 | |
|
477 | 520 | self.figfile = None |
|
478 | 521 | |
|
479 | 522 | def getSubplots(self): |
|
480 | 523 | |
|
481 | 524 | ncol = 1 |
|
482 | 525 | nrow = self.nplots |
|
483 | 526 | |
|
484 | 527 | return nrow, ncol |
|
485 | 528 | |
|
486 | 529 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
487 | 530 | |
|
488 | 531 | self.__showprofile = showprofile |
|
489 | 532 | self.nplots = nplots |
|
490 | 533 | |
|
491 | 534 | ncolspan = 1 |
|
492 | 535 | colspan = 1 |
|
493 | 536 | if showprofile: |
|
494 | 537 | ncolspan = 7 |
|
495 | 538 | colspan = 6 |
|
496 | 539 | self.__nsubplots = 2 |
|
497 | 540 | |
|
498 | 541 | self.createFigure(id = id, |
|
499 | 542 | wintitle = wintitle, |
|
500 | 543 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
501 | 544 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
502 | 545 | show=show) |
|
503 | 546 | |
|
504 | 547 | nrow, ncol = self.getSubplots() |
|
505 | 548 | |
|
506 | 549 | counter = 0 |
|
507 | 550 | for y in range(nrow): |
|
508 | 551 | for x in range(ncol): |
|
509 | 552 | |
|
510 | 553 | if counter >= self.nplots: |
|
511 | 554 | break |
|
512 | 555 | |
|
513 | 556 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
514 | 557 | |
|
515 | 558 | if showprofile: |
|
516 | 559 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
517 | 560 | |
|
518 | 561 | counter += 1 |
|
519 | 562 | |
|
520 | 563 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
521 | 564 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
522 | 565 | timerange=None, colormap='jet', |
|
523 | 566 | save=False, figpath='./', lastone=0,figfile=None, ftp=False, wr_period=1, show=True, |
|
524 | 567 | server=None, folder=None, username=None, password=None, |
|
525 | 568 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0, normFactor=None, HEIGHT=None): |
|
526 | 569 | |
|
527 | 570 | """ |
|
528 | 571 | |
|
529 | 572 | Input: |
|
530 | 573 | dataOut : |
|
531 | 574 | id : |
|
532 | 575 | wintitle : |
|
533 | 576 | channelList : |
|
534 | 577 | showProfile : |
|
535 | 578 | xmin : None, |
|
536 | 579 | xmax : None, |
|
537 | 580 | ymin : None, |
|
538 | 581 | ymax : None, |
|
539 | 582 | zmin : None, |
|
540 | 583 | zmax : None |
|
541 | 584 | """ |
|
542 | 585 | |
|
543 | 586 | #colormap = kwargs.get('colormap', 'jet') |
|
544 | 587 | if HEIGHT is not None: |
|
545 | 588 | self.HEIGHT = HEIGHT |
|
546 | 589 | |
|
547 | 590 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
548 | 591 | return |
|
549 | 592 | |
|
550 | 593 | if channelList == None: |
|
551 | 594 | channelIndexList = dataOut.channelIndexList |
|
552 | 595 | else: |
|
553 | 596 | channelIndexList = [] |
|
554 | 597 | for channel in channelList: |
|
555 | 598 | if channel not in dataOut.channelList: |
|
556 | 599 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
557 | 600 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
558 | 601 | |
|
559 | 602 | if normFactor is None: |
|
560 | 603 | factor = dataOut.normFactor |
|
561 | 604 | else: |
|
562 | 605 | factor = normFactor |
|
563 | 606 | |
|
564 | 607 | # factor = dataOut.normFactor |
|
565 | 608 | x = dataOut.getTimeRange() |
|
566 | 609 | y = dataOut.getHeiRange() |
|
567 | 610 | |
|
568 | 611 | z = dataOut.data_spc/factor |
|
569 | 612 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
570 | 613 | avg = numpy.average(z, axis=1) |
|
571 | 614 | avgdB = 10.*numpy.log10(avg) |
|
572 | 615 | # avgdB = dataOut.getPower() |
|
573 | 616 | |
|
574 | 617 | |
|
575 | 618 | thisDatetime = dataOut.datatime |
|
576 | 619 | # thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
577 | 620 | title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
578 | 621 | xlabel = "" |
|
579 | 622 | ylabel = "Range (Km)" |
|
580 | 623 | |
|
581 | 624 | update_figfile = False |
|
582 | 625 | |
|
583 | 626 | if dataOut.ltctime >= self.xmax: |
|
584 | 627 | self.counter_imagwr = wr_period |
|
585 | 628 | self.isConfig = False |
|
586 | 629 | update_figfile = True |
|
587 | 630 | |
|
588 | 631 | if not self.isConfig: |
|
589 | 632 | |
|
590 | 633 | nplots = len(channelIndexList) |
|
591 | 634 | |
|
592 | 635 | self.setup(id=id, |
|
593 | 636 | nplots=nplots, |
|
594 | 637 | wintitle=wintitle, |
|
595 | 638 | showprofile=showprofile, |
|
596 | 639 | show=show) |
|
597 | 640 | |
|
598 | 641 | if timerange != None: |
|
599 | 642 | self.timerange = timerange |
|
600 | 643 | |
|
601 | 644 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
602 | 645 | |
|
603 | 646 | noise = dataOut.noise/factor |
|
604 | 647 | noisedB = 10*numpy.log10(noise) |
|
605 | 648 | |
|
606 | 649 | if ymin == None: ymin = numpy.nanmin(y) |
|
607 | 650 | if ymax == None: ymax = numpy.nanmax(y) |
|
608 | 651 | if zmin == None: zmin = numpy.floor(numpy.nanmin(noisedB)) - 3 |
|
609 | 652 | if zmax == None: zmax = numpy.ceil(numpy.nanmax(avgdB)) + 3 |
|
610 | 653 | |
|
611 | 654 | self.FTP_WEI = ftp_wei |
|
612 | 655 | self.EXP_CODE = exp_code |
|
613 | 656 | self.SUB_EXP_CODE = sub_exp_code |
|
614 | 657 | self.PLOT_POS = plot_pos |
|
615 | 658 | |
|
616 | 659 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
617 | 660 | self.isConfig = True |
|
618 | 661 | self.figfile = figfile |
|
619 | 662 | update_figfile = True |
|
620 | 663 | |
|
621 | 664 | self.setWinTitle(title) |
|
622 | 665 | |
|
623 | 666 | for i in range(self.nplots): |
|
624 | 667 | index = channelIndexList[i] |
|
625 | 668 | title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
626 | 669 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): |
|
627 | 670 | title = title + '_' + 'azimuth,zenith=%2.2f,%2.2f'%(dataOut.azimuth, dataOut.zenith) |
|
628 | 671 | axes = self.axesList[i*self.__nsubplots] |
|
629 | 672 | zdB = avgdB[index].reshape((1,-1)) |
|
630 | 673 | axes.pcolorbuffer(x, y, zdB, |
|
631 | 674 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
632 | 675 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
633 | 676 | ticksize=9, cblabel='', cbsize="1%", colormap=colormap) |
|
634 | 677 | |
|
635 | 678 | if self.__showprofile: |
|
636 | 679 | axes = self.axesList[i*self.__nsubplots +1] |
|
637 | 680 | axes.pline(avgdB[index], y, |
|
638 | 681 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
639 | 682 | xlabel='dB', ylabel='', title='', |
|
640 | 683 | ytick_visible=False, |
|
641 | 684 | grid='x') |
|
642 | 685 | |
|
643 | 686 | self.draw() |
|
644 | 687 | |
|
645 | 688 | self.save(figpath=figpath, |
|
646 | 689 | figfile=figfile, |
|
647 | 690 | save=save, |
|
648 | 691 | ftp=ftp, |
|
649 | 692 | wr_period=wr_period, |
|
650 | 693 | thisDatetime=thisDatetime, |
|
651 | 694 | update_figfile=update_figfile) |
|
652 | 695 | |
|
653 | 696 | class CoherenceMap(Figure): |
|
654 | 697 | isConfig = None |
|
655 | 698 | __nsubplots = None |
|
656 | 699 | |
|
657 | 700 | WIDTHPROF = None |
|
658 | 701 | HEIGHTPROF = None |
|
659 | 702 | PREFIX = 'cmap' |
|
660 | 703 | |
|
661 | 704 | def __init__(self, **kwargs): |
|
662 | 705 | Figure.__init__(self, **kwargs) |
|
663 | 706 | self.timerange = 2*60*60 |
|
664 | 707 | self.isConfig = False |
|
665 | 708 | self.__nsubplots = 1 |
|
666 | 709 | |
|
667 | 710 | self.WIDTH = 800 |
|
668 | 711 | self.HEIGHT = 180 |
|
669 | 712 | self.WIDTHPROF = 120 |
|
670 | 713 | self.HEIGHTPROF = 0 |
|
671 | 714 | self.counter_imagwr = 0 |
|
672 | 715 | |
|
673 | 716 | self.PLOT_CODE = COH_CODE |
|
674 | 717 | |
|
675 | 718 | self.FTP_WEI = None |
|
676 | 719 | self.EXP_CODE = None |
|
677 | 720 | self.SUB_EXP_CODE = None |
|
678 | 721 | self.PLOT_POS = None |
|
679 | 722 | self.counter_imagwr = 0 |
|
680 | 723 | |
|
681 | 724 | self.xmin = None |
|
682 | 725 | self.xmax = None |
|
683 | 726 | |
|
684 | 727 | def getSubplots(self): |
|
685 | 728 | ncol = 1 |
|
686 | 729 | nrow = self.nplots*2 |
|
687 | 730 | |
|
688 | 731 | return nrow, ncol |
|
689 | 732 | |
|
690 | 733 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
691 | 734 | self.__showprofile = showprofile |
|
692 | 735 | self.nplots = nplots |
|
693 | 736 | |
|
694 | 737 | ncolspan = 1 |
|
695 | 738 | colspan = 1 |
|
696 | 739 | if showprofile: |
|
697 | 740 | ncolspan = 7 |
|
698 | 741 | colspan = 6 |
|
699 | 742 | self.__nsubplots = 2 |
|
700 | 743 | |
|
701 | 744 | self.createFigure(id = id, |
|
702 | 745 | wintitle = wintitle, |
|
703 | 746 | widthplot = self.WIDTH + self.WIDTHPROF, |
|
704 | 747 | heightplot = self.HEIGHT + self.HEIGHTPROF, |
|
705 | 748 | show=True) |
|
706 | 749 | |
|
707 | 750 | nrow, ncol = self.getSubplots() |
|
708 | 751 | |
|
709 | 752 | for y in range(nrow): |
|
710 | 753 | for x in range(ncol): |
|
711 | 754 | |
|
712 | 755 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
713 | 756 | |
|
714 | 757 | if showprofile: |
|
715 | 758 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan+colspan, 1, 1) |
|
716 | 759 | |
|
717 | 760 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
718 | 761 | xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None, |
|
719 | 762 | timerange=None, phase_min=None, phase_max=None, |
|
720 | 763 | save=False, figpath='./', figfile=None, ftp=False, wr_period=1, |
|
721 | 764 | coherence_cmap='jet', phase_cmap='RdBu_r', show=True, |
|
722 | 765 | server=None, folder=None, username=None, password=None, |
|
723 | 766 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
724 | 767 | |
|
725 | 768 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
726 | 769 | return |
|
727 | 770 | |
|
728 | 771 | if pairsList == None: |
|
729 | 772 | pairsIndexList = dataOut.pairsIndexList |
|
730 | 773 | else: |
|
731 | 774 | pairsIndexList = [] |
|
732 | 775 | for pair in pairsList: |
|
733 | 776 | if pair not in dataOut.pairsList: |
|
734 | 777 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
735 | 778 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
736 | 779 | |
|
737 | 780 | if pairsIndexList == []: |
|
738 | 781 | return |
|
739 | 782 | |
|
740 | 783 | if len(pairsIndexList) > 4: |
|
741 | 784 | pairsIndexList = pairsIndexList[0:4] |
|
742 | 785 | |
|
743 | 786 | if phase_min == None: |
|
744 | 787 | phase_min = -180 |
|
745 | 788 | if phase_max == None: |
|
746 | 789 | phase_max = 180 |
|
747 | 790 | |
|
748 | 791 | x = dataOut.getTimeRange() |
|
749 | 792 | y = dataOut.getHeiRange() |
|
750 | 793 | |
|
751 | 794 | thisDatetime = dataOut.datatime |
|
752 | 795 | |
|
753 | 796 | title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
754 | 797 | xlabel = "" |
|
755 | 798 | ylabel = "Range (Km)" |
|
756 | 799 | update_figfile = False |
|
757 | 800 | |
|
758 | 801 | if not self.isConfig: |
|
759 | 802 | nplots = len(pairsIndexList) |
|
760 | 803 | self.setup(id=id, |
|
761 | 804 | nplots=nplots, |
|
762 | 805 | wintitle=wintitle, |
|
763 | 806 | showprofile=showprofile, |
|
764 | 807 | show=show) |
|
765 | 808 | |
|
766 | 809 | if timerange != None: |
|
767 | 810 | self.timerange = timerange |
|
768 | 811 | |
|
769 | 812 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
770 | 813 | |
|
771 | 814 | if ymin == None: ymin = numpy.nanmin(y) |
|
772 | 815 | if ymax == None: ymax = numpy.nanmax(y) |
|
773 | 816 | if zmin == None: zmin = 0. |
|
774 | 817 | if zmax == None: zmax = 1. |
|
775 | 818 | |
|
776 | 819 | self.FTP_WEI = ftp_wei |
|
777 | 820 | self.EXP_CODE = exp_code |
|
778 | 821 | self.SUB_EXP_CODE = sub_exp_code |
|
779 | 822 | self.PLOT_POS = plot_pos |
|
780 | 823 | |
|
781 | 824 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
782 | 825 | |
|
783 | 826 | self.isConfig = True |
|
784 | 827 | update_figfile = True |
|
785 | 828 | |
|
786 | 829 | self.setWinTitle(title) |
|
787 | 830 | |
|
788 | 831 | for i in range(self.nplots): |
|
789 | 832 | |
|
790 | 833 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
791 | 834 | |
|
792 | 835 | ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0) |
|
793 | 836 | powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0) |
|
794 | 837 | powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0) |
|
795 | 838 | |
|
796 | 839 | |
|
797 | 840 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
798 | 841 | coherence = numpy.abs(avgcoherenceComplex) |
|
799 | 842 | |
|
800 | 843 | z = coherence.reshape((1,-1)) |
|
801 | 844 | |
|
802 | 845 | counter = 0 |
|
803 | 846 | |
|
804 | 847 | title = "Coherence Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
805 | 848 | axes = self.axesList[i*self.__nsubplots*2] |
|
806 | 849 | axes.pcolorbuffer(x, y, z, |
|
807 | 850 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax, |
|
808 | 851 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
809 | 852 | ticksize=9, cblabel='', colormap=coherence_cmap, cbsize="1%") |
|
810 | 853 | |
|
811 | 854 | if self.__showprofile: |
|
812 | 855 | counter += 1 |
|
813 | 856 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
814 | 857 | axes.pline(coherence, y, |
|
815 | 858 | xmin=zmin, xmax=zmax, ymin=ymin, ymax=ymax, |
|
816 | 859 | xlabel='', ylabel='', title='', ticksize=7, |
|
817 | 860 | ytick_visible=False, nxticks=5, |
|
818 | 861 | grid='x') |
|
819 | 862 | |
|
820 | 863 | counter += 1 |
|
821 | 864 | |
|
822 | 865 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
823 | 866 | |
|
824 | 867 | z = phase.reshape((1,-1)) |
|
825 | 868 | |
|
826 | 869 | title = "Phase Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
827 | 870 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
828 | 871 | axes.pcolorbuffer(x, y, z, |
|
829 | 872 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max, |
|
830 | 873 | xlabel=xlabel, ylabel=ylabel, title=title, rti=True, XAxisAsTime=True, |
|
831 | 874 | ticksize=9, cblabel='', colormap=phase_cmap, cbsize="1%") |
|
832 | 875 | |
|
833 | 876 | if self.__showprofile: |
|
834 | 877 | counter += 1 |
|
835 | 878 | axes = self.axesList[i*self.__nsubplots*2 + counter] |
|
836 | 879 | axes.pline(phase, y, |
|
837 | 880 | xmin=phase_min, xmax=phase_max, ymin=ymin, ymax=ymax, |
|
838 | 881 | xlabel='', ylabel='', title='', ticksize=7, |
|
839 | 882 | ytick_visible=False, nxticks=4, |
|
840 | 883 | grid='x') |
|
841 | 884 | |
|
842 | 885 | self.draw() |
|
843 | 886 | |
|
844 | 887 | if dataOut.ltctime >= self.xmax: |
|
845 | 888 | self.counter_imagwr = wr_period |
|
846 | 889 | self.isConfig = False |
|
847 | 890 | update_figfile = True |
|
848 | 891 | |
|
849 | 892 | self.save(figpath=figpath, |
|
850 | 893 | figfile=figfile, |
|
851 | 894 | save=save, |
|
852 | 895 | ftp=ftp, |
|
853 | 896 | wr_period=wr_period, |
|
854 | 897 | thisDatetime=thisDatetime, |
|
855 | 898 | update_figfile=update_figfile) |
|
856 | 899 | |
|
857 | 900 | class PowerProfilePlot(Figure): |
|
858 | 901 | |
|
859 | 902 | isConfig = None |
|
860 | 903 | __nsubplots = None |
|
861 | 904 | |
|
862 | 905 | WIDTHPROF = None |
|
863 | 906 | HEIGHTPROF = None |
|
864 | 907 | PREFIX = 'spcprofile' |
|
865 | 908 | |
|
866 | 909 | def __init__(self, **kwargs): |
|
867 | 910 | Figure.__init__(self, **kwargs) |
|
868 | 911 | self.isConfig = False |
|
869 | 912 | self.__nsubplots = 1 |
|
870 | 913 | |
|
871 | 914 | self.PLOT_CODE = POWER_CODE |
|
872 | 915 | |
|
873 | 916 | self.WIDTH = 300 |
|
874 | 917 | self.HEIGHT = 500 |
|
875 | 918 | self.counter_imagwr = 0 |
|
876 | 919 | |
|
877 | 920 | def getSubplots(self): |
|
878 | 921 | ncol = 1 |
|
879 | 922 | nrow = 1 |
|
880 | 923 | |
|
881 | 924 | return nrow, ncol |
|
882 | 925 | |
|
883 | 926 | def setup(self, id, nplots, wintitle, show): |
|
884 | 927 | |
|
885 | 928 | self.nplots = nplots |
|
886 | 929 | |
|
887 | 930 | ncolspan = 1 |
|
888 | 931 | colspan = 1 |
|
889 | 932 | |
|
890 | 933 | self.createFigure(id = id, |
|
891 | 934 | wintitle = wintitle, |
|
892 | 935 | widthplot = self.WIDTH, |
|
893 | 936 | heightplot = self.HEIGHT, |
|
894 | 937 | show=show) |
|
895 | 938 | |
|
896 | 939 | nrow, ncol = self.getSubplots() |
|
897 | 940 | |
|
898 | 941 | counter = 0 |
|
899 | 942 | for y in range(nrow): |
|
900 | 943 | for x in range(ncol): |
|
901 | 944 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
902 | 945 | |
|
903 | 946 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
904 | 947 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
905 | 948 | save=False, figpath='./', figfile=None, show=True, |
|
906 | 949 | ftp=False, wr_period=1, server=None, |
|
907 | 950 | folder=None, username=None, password=None): |
|
908 | 951 | |
|
909 | 952 | |
|
910 | 953 | if channelList == None: |
|
911 | 954 | channelIndexList = dataOut.channelIndexList |
|
912 | 955 | channelList = dataOut.channelList |
|
913 | 956 | else: |
|
914 | 957 | channelIndexList = [] |
|
915 | 958 | for channel in channelList: |
|
916 | 959 | if channel not in dataOut.channelList: |
|
917 | 960 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
918 | 961 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
919 | 962 | |
|
920 | 963 | factor = dataOut.normFactor |
|
921 | 964 | |
|
922 | 965 | y = dataOut.getHeiRange() |
|
923 | 966 | |
|
924 | 967 | #for voltage |
|
925 | 968 | if dataOut.type == 'Voltage': |
|
926 | 969 | x = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) |
|
927 | 970 | x = x.real |
|
928 | 971 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
929 | 972 | |
|
930 | 973 | #for spectra |
|
931 | 974 | if dataOut.type == 'Spectra': |
|
932 | 975 | x = dataOut.data_spc[channelIndexList,:,:]/factor |
|
933 | 976 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
934 | 977 | x = numpy.average(x, axis=1) |
|
935 | 978 | |
|
936 | 979 | |
|
937 | 980 | xdB = 10*numpy.log10(x) |
|
938 | 981 | |
|
939 | 982 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
940 | 983 | title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
941 | 984 | xlabel = "dB" |
|
942 | 985 | ylabel = "Range (Km)" |
|
943 | 986 | |
|
944 | 987 | if not self.isConfig: |
|
945 | 988 | |
|
946 | 989 | nplots = 1 |
|
947 | 990 | |
|
948 | 991 | self.setup(id=id, |
|
949 | 992 | nplots=nplots, |
|
950 | 993 | wintitle=wintitle, |
|
951 | 994 | show=show) |
|
952 | 995 | |
|
953 | 996 | if ymin == None: ymin = numpy.nanmin(y) |
|
954 | 997 | if ymax == None: ymax = numpy.nanmax(y) |
|
955 | 998 | if xmin == None: xmin = numpy.nanmin(xdB)*0.9 |
|
956 | 999 | if xmax == None: xmax = numpy.nanmax(xdB)*1.1 |
|
957 | 1000 | |
|
958 | 1001 | self.isConfig = True |
|
959 | 1002 | |
|
960 | 1003 | self.setWinTitle(title) |
|
961 | 1004 | |
|
962 | 1005 | title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
963 | 1006 | axes = self.axesList[0] |
|
964 | 1007 | |
|
965 | 1008 | legendlabels = ["channel %d"%x for x in channelList] |
|
966 | 1009 | axes.pmultiline(xdB, y, |
|
967 | 1010 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
968 | 1011 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
969 | 1012 | ytick_visible=True, nxticks=5, |
|
970 | 1013 | grid='x') |
|
971 | 1014 | |
|
972 | 1015 | self.draw() |
|
973 | 1016 | |
|
974 | 1017 | self.save(figpath=figpath, |
|
975 | 1018 | figfile=figfile, |
|
976 | 1019 | save=save, |
|
977 | 1020 | ftp=ftp, |
|
978 | 1021 | wr_period=wr_period, |
|
979 | 1022 | thisDatetime=thisDatetime) |
|
980 | 1023 | |
|
981 | 1024 | class SpectraCutPlot(Figure): |
|
982 | 1025 | |
|
983 | 1026 | isConfig = None |
|
984 | 1027 | __nsubplots = None |
|
985 | 1028 | |
|
986 | 1029 | WIDTHPROF = None |
|
987 | 1030 | HEIGHTPROF = None |
|
988 | 1031 | PREFIX = 'spc_cut' |
|
989 | 1032 | |
|
990 | 1033 | def __init__(self, **kwargs): |
|
991 | 1034 | Figure.__init__(self, **kwargs) |
|
992 | 1035 | self.isConfig = False |
|
993 | 1036 | self.__nsubplots = 1 |
|
994 | 1037 | |
|
995 | 1038 | self.PLOT_CODE = POWER_CODE |
|
996 | 1039 | |
|
997 | 1040 | self.WIDTH = 700 |
|
998 | 1041 | self.HEIGHT = 500 |
|
999 | 1042 | self.counter_imagwr = 0 |
|
1000 | 1043 | |
|
1001 | 1044 | def getSubplots(self): |
|
1002 | 1045 | ncol = 1 |
|
1003 | 1046 | nrow = 1 |
|
1004 | 1047 | |
|
1005 | 1048 | return nrow, ncol |
|
1006 | 1049 | |
|
1007 | 1050 | def setup(self, id, nplots, wintitle, show): |
|
1008 | 1051 | |
|
1009 | 1052 | self.nplots = nplots |
|
1010 | 1053 | |
|
1011 | 1054 | ncolspan = 1 |
|
1012 | 1055 | colspan = 1 |
|
1013 | 1056 | |
|
1014 | 1057 | self.createFigure(id = id, |
|
1015 | 1058 | wintitle = wintitle, |
|
1016 | 1059 | widthplot = self.WIDTH, |
|
1017 | 1060 | heightplot = self.HEIGHT, |
|
1018 | 1061 | show=show) |
|
1019 | 1062 | |
|
1020 | 1063 | nrow, ncol = self.getSubplots() |
|
1021 | 1064 | |
|
1022 | 1065 | counter = 0 |
|
1023 | 1066 | for y in range(nrow): |
|
1024 | 1067 | for x in range(ncol): |
|
1025 | 1068 | self.addAxes(nrow, ncol*ncolspan, y, x*ncolspan, colspan, 1) |
|
1026 | 1069 | |
|
1027 | 1070 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
1028 | 1071 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1029 | 1072 | save=False, figpath='./', figfile=None, show=True, |
|
1030 | 1073 | ftp=False, wr_period=1, server=None, |
|
1031 | 1074 | folder=None, username=None, password=None, |
|
1032 | 1075 | xaxis="frequency"): |
|
1033 | 1076 | |
|
1034 | 1077 | |
|
1035 | 1078 | if channelList == None: |
|
1036 | 1079 | channelIndexList = dataOut.channelIndexList |
|
1037 | 1080 | channelList = dataOut.channelList |
|
1038 | 1081 | else: |
|
1039 | 1082 | channelIndexList = [] |
|
1040 | 1083 | for channel in channelList: |
|
1041 | 1084 | if channel not in dataOut.channelList: |
|
1042 | 1085 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
1043 | 1086 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
1044 | 1087 | |
|
1045 | 1088 | factor = dataOut.normFactor |
|
1046 | 1089 | |
|
1047 | 1090 | y = dataOut.getHeiRange() |
|
1048 | 1091 | |
|
1049 | 1092 | z = dataOut.data_spc/factor |
|
1050 | 1093 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
1051 | 1094 | |
|
1052 | 1095 | hei_index = numpy.arange(25)*3 + 20 |
|
1053 | 1096 | |
|
1054 | 1097 | if xaxis == "frequency": |
|
1055 | 1098 | x = dataOut.getFreqRange()/1000. |
|
1056 | 1099 | zdB = 10*numpy.log10(z[0,:,hei_index]) |
|
1057 | 1100 | xlabel = "Frequency (kHz)" |
|
1058 | 1101 | ylabel = "Power (dB)" |
|
1059 | 1102 | |
|
1060 | 1103 | elif xaxis == "time": |
|
1061 | 1104 | x = dataOut.getAcfRange() |
|
1062 | 1105 | zdB = z[0,:,hei_index] |
|
1063 | 1106 | xlabel = "Time (ms)" |
|
1064 | 1107 | ylabel = "ACF" |
|
1065 | 1108 | |
|
1066 | 1109 | else: |
|
1067 | 1110 | x = dataOut.getVelRange() |
|
1068 | 1111 | zdB = 10*numpy.log10(z[0,:,hei_index]) |
|
1069 | 1112 | xlabel = "Velocity (m/s)" |
|
1070 | 1113 | ylabel = "Power (dB)" |
|
1071 | 1114 | |
|
1072 | 1115 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) |
|
1073 | 1116 | title = wintitle + " Range Cuts %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1074 | 1117 | |
|
1075 | 1118 | if not self.isConfig: |
|
1076 | 1119 | |
|
1077 | 1120 | nplots = 1 |
|
1078 | 1121 | |
|
1079 | 1122 | self.setup(id=id, |
|
1080 | 1123 | nplots=nplots, |
|
1081 | 1124 | wintitle=wintitle, |
|
1082 | 1125 | show=show) |
|
1083 | 1126 | |
|
1084 | 1127 | if xmin == None: xmin = numpy.nanmin(x)*0.9 |
|
1085 | 1128 | if xmax == None: xmax = numpy.nanmax(x)*1.1 |
|
1086 | 1129 | if ymin == None: ymin = numpy.nanmin(zdB) |
|
1087 | 1130 | if ymax == None: ymax = numpy.nanmax(zdB) |
|
1088 | 1131 | |
|
1089 | 1132 | self.isConfig = True |
|
1090 | 1133 | |
|
1091 | 1134 | self.setWinTitle(title) |
|
1092 | 1135 | |
|
1093 | 1136 | title = "Spectra Cuts: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
1094 | 1137 | axes = self.axesList[0] |
|
1095 | 1138 | |
|
1096 | 1139 | legendlabels = ["Range = %dKm" %y[i] for i in hei_index] |
|
1097 | 1140 | |
|
1098 | 1141 | axes.pmultilineyaxis( x, zdB, |
|
1099 | 1142 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
1100 | 1143 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
1101 | 1144 | ytick_visible=True, nxticks=5, |
|
1102 | 1145 | grid='x') |
|
1103 | 1146 | |
|
1104 | 1147 | self.draw() |
|
1105 | 1148 | |
|
1106 | 1149 | self.save(figpath=figpath, |
|
1107 | 1150 | figfile=figfile, |
|
1108 | 1151 | save=save, |
|
1109 | 1152 | ftp=ftp, |
|
1110 | 1153 | wr_period=wr_period, |
|
1111 | 1154 | thisDatetime=thisDatetime) |
|
1112 | 1155 | |
|
1113 | 1156 | class Noise(Figure): |
|
1114 | 1157 | |
|
1115 | 1158 | isConfig = None |
|
1116 | 1159 | __nsubplots = None |
|
1117 | 1160 | |
|
1118 | 1161 | PREFIX = 'noise' |
|
1119 | 1162 | |
|
1120 | 1163 | |
|
1121 | 1164 | def __init__(self, **kwargs): |
|
1122 | 1165 | Figure.__init__(self, **kwargs) |
|
1123 | 1166 | self.timerange = 24*60*60 |
|
1124 | 1167 | self.isConfig = False |
|
1125 | 1168 | self.__nsubplots = 1 |
|
1126 | 1169 | self.counter_imagwr = 0 |
|
1127 | 1170 | self.WIDTH = 800 |
|
1128 | 1171 | self.HEIGHT = 400 |
|
1129 | 1172 | self.WIDTHPROF = 120 |
|
1130 | 1173 | self.HEIGHTPROF = 0 |
|
1131 | 1174 | self.xdata = None |
|
1132 | 1175 | self.ydata = None |
|
1133 | 1176 | |
|
1134 | 1177 | self.PLOT_CODE = NOISE_CODE |
|
1135 | 1178 | |
|
1136 | 1179 | self.FTP_WEI = None |
|
1137 | 1180 | self.EXP_CODE = None |
|
1138 | 1181 | self.SUB_EXP_CODE = None |
|
1139 | 1182 | self.PLOT_POS = None |
|
1140 | 1183 | self.figfile = None |
|
1141 | 1184 | |
|
1142 | 1185 | self.xmin = None |
|
1143 | 1186 | self.xmax = None |
|
1144 | 1187 | |
|
1145 | 1188 | def getSubplots(self): |
|
1146 | 1189 | |
|
1147 | 1190 | ncol = 1 |
|
1148 | 1191 | nrow = 1 |
|
1149 | 1192 | |
|
1150 | 1193 | return nrow, ncol |
|
1151 | 1194 | |
|
1152 | 1195 | def openfile(self, filename): |
|
1153 | 1196 | dirname = os.path.dirname(filename) |
|
1154 | 1197 | |
|
1155 | 1198 | if not os.path.exists(dirname): |
|
1156 | 1199 | os.mkdir(dirname) |
|
1157 | 1200 | |
|
1158 | 1201 | f = open(filename,'w+') |
|
1159 | 1202 | f.write('\n\n') |
|
1160 | 1203 | f.write('JICAMARCA RADIO OBSERVATORY - Noise \n') |
|
1161 | 1204 | f.write('DD MM YYYY HH MM SS Channel0 Channel1 Channel2 Channel3\n\n' ) |
|
1162 | 1205 | f.close() |
|
1163 | 1206 | |
|
1164 | 1207 | def save_data(self, filename_phase, data, data_datetime): |
|
1165 | 1208 | |
|
1166 | 1209 | f=open(filename_phase,'a') |
|
1167 | 1210 | |
|
1168 | 1211 | timetuple_data = data_datetime.timetuple() |
|
1169 | 1212 | day = str(timetuple_data.tm_mday) |
|
1170 | 1213 | month = str(timetuple_data.tm_mon) |
|
1171 | 1214 | year = str(timetuple_data.tm_year) |
|
1172 | 1215 | hour = str(timetuple_data.tm_hour) |
|
1173 | 1216 | minute = str(timetuple_data.tm_min) |
|
1174 | 1217 | second = str(timetuple_data.tm_sec) |
|
1175 | 1218 | |
|
1176 | 1219 | data_msg = '' |
|
1177 | 1220 | for i in range(len(data)): |
|
1178 | 1221 | data_msg += str(data[i]) + ' ' |
|
1179 | 1222 | |
|
1180 | 1223 | f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' ' + data_msg + '\n') |
|
1181 | 1224 | f.close() |
|
1182 | 1225 | |
|
1183 | 1226 | |
|
1184 | 1227 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1185 | 1228 | |
|
1186 | 1229 | self.__showprofile = showprofile |
|
1187 | 1230 | self.nplots = nplots |
|
1188 | 1231 | |
|
1189 | 1232 | ncolspan = 7 |
|
1190 | 1233 | colspan = 6 |
|
1191 | 1234 | self.__nsubplots = 2 |
|
1192 | 1235 | |
|
1193 | 1236 | self.createFigure(id = id, |
|
1194 | 1237 | wintitle = wintitle, |
|
1195 | 1238 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1196 | 1239 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1197 | 1240 | show=show) |
|
1198 | 1241 | |
|
1199 | 1242 | nrow, ncol = self.getSubplots() |
|
1200 | 1243 | |
|
1201 | 1244 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1202 | 1245 | |
|
1203 | 1246 | |
|
1204 | 1247 | def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True', |
|
1205 | 1248 | xmin=None, xmax=None, ymin=None, ymax=None, |
|
1206 | 1249 | timerange=None, |
|
1207 | 1250 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1208 | 1251 | server=None, folder=None, username=None, password=None, |
|
1209 | 1252 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1210 | 1253 | |
|
1211 | 1254 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
1212 | 1255 | return |
|
1213 | 1256 | |
|
1214 | 1257 | if channelList == None: |
|
1215 | 1258 | channelIndexList = dataOut.channelIndexList |
|
1216 | 1259 | channelList = dataOut.channelList |
|
1217 | 1260 | else: |
|
1218 | 1261 | channelIndexList = [] |
|
1219 | 1262 | for channel in channelList: |
|
1220 | 1263 | if channel not in dataOut.channelList: |
|
1221 | 1264 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
1222 | 1265 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
1223 | 1266 | |
|
1224 | 1267 | x = dataOut.getTimeRange() |
|
1225 | 1268 | #y = dataOut.getHeiRange() |
|
1226 | 1269 | factor = dataOut.normFactor |
|
1227 | 1270 | noise = dataOut.noise[channelIndexList]/factor |
|
1228 | 1271 | noisedB = 10*numpy.log10(noise) |
|
1229 | 1272 | |
|
1230 | 1273 | thisDatetime = dataOut.datatime |
|
1231 | 1274 | |
|
1232 | 1275 | title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1233 | 1276 | xlabel = "" |
|
1234 | 1277 | ylabel = "Intensity (dB)" |
|
1235 | 1278 | update_figfile = False |
|
1236 | 1279 | |
|
1237 | 1280 | if not self.isConfig: |
|
1238 | 1281 | |
|
1239 | 1282 | nplots = 1 |
|
1240 | 1283 | |
|
1241 | 1284 | self.setup(id=id, |
|
1242 | 1285 | nplots=nplots, |
|
1243 | 1286 | wintitle=wintitle, |
|
1244 | 1287 | showprofile=showprofile, |
|
1245 | 1288 | show=show) |
|
1246 | 1289 | |
|
1247 | 1290 | if timerange != None: |
|
1248 | 1291 | self.timerange = timerange |
|
1249 | 1292 | |
|
1250 | 1293 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1251 | 1294 | |
|
1252 | 1295 | if ymin == None: ymin = numpy.floor(numpy.nanmin(noisedB)) - 10.0 |
|
1253 | 1296 | if ymax == None: ymax = numpy.nanmax(noisedB) + 10.0 |
|
1254 | 1297 | |
|
1255 | 1298 | self.FTP_WEI = ftp_wei |
|
1256 | 1299 | self.EXP_CODE = exp_code |
|
1257 | 1300 | self.SUB_EXP_CODE = sub_exp_code |
|
1258 | 1301 | self.PLOT_POS = plot_pos |
|
1259 | 1302 | |
|
1260 | 1303 | |
|
1261 | 1304 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1262 | 1305 | self.isConfig = True |
|
1263 | 1306 | self.figfile = figfile |
|
1264 | 1307 | self.xdata = numpy.array([]) |
|
1265 | 1308 | self.ydata = numpy.array([]) |
|
1266 | 1309 | |
|
1267 | 1310 | update_figfile = True |
|
1268 | 1311 | |
|
1269 | 1312 | #open file beacon phase |
|
1270 | 1313 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1271 | 1314 | noise_file = os.path.join(path,'%s.txt'%self.name) |
|
1272 | 1315 | self.filename_noise = os.path.join(figpath,noise_file) |
|
1273 | 1316 | |
|
1274 | 1317 | self.setWinTitle(title) |
|
1275 | 1318 | |
|
1276 | 1319 | title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1277 | 1320 | |
|
1278 | 1321 | legendlabels = ["channel %d"%(idchannel) for idchannel in channelList] |
|
1279 | 1322 | axes = self.axesList[0] |
|
1280 | 1323 | |
|
1281 | 1324 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1282 | 1325 | |
|
1283 | 1326 | if len(self.ydata)==0: |
|
1284 | 1327 | self.ydata = noisedB.reshape(-1,1) |
|
1285 | 1328 | else: |
|
1286 | 1329 | self.ydata = numpy.hstack((self.ydata, noisedB.reshape(-1,1))) |
|
1287 | 1330 | |
|
1288 | 1331 | |
|
1289 | 1332 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1290 | 1333 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1291 | 1334 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1292 | 1335 | XAxisAsTime=True, grid='both' |
|
1293 | 1336 | ) |
|
1294 | 1337 | |
|
1295 | 1338 | self.draw() |
|
1296 | 1339 | |
|
1297 | 1340 | if dataOut.ltctime >= self.xmax: |
|
1298 | 1341 | self.counter_imagwr = wr_period |
|
1299 | 1342 | self.isConfig = False |
|
1300 | 1343 | update_figfile = True |
|
1301 | 1344 | |
|
1302 | 1345 | self.save(figpath=figpath, |
|
1303 | 1346 | figfile=figfile, |
|
1304 | 1347 | save=save, |
|
1305 | 1348 | ftp=ftp, |
|
1306 | 1349 | wr_period=wr_period, |
|
1307 | 1350 | thisDatetime=thisDatetime, |
|
1308 | 1351 | update_figfile=update_figfile) |
|
1309 | 1352 | |
|
1310 | 1353 | #store data beacon phase |
|
1311 | 1354 | if save: |
|
1312 | 1355 | self.save_data(self.filename_noise, noisedB, thisDatetime) |
|
1313 | 1356 | |
|
1314 | 1357 | class BeaconPhase(Figure): |
|
1315 | 1358 | |
|
1316 | 1359 | __isConfig = None |
|
1317 | 1360 | __nsubplots = None |
|
1318 | 1361 | |
|
1319 | 1362 | PREFIX = 'beacon_phase' |
|
1320 | 1363 | |
|
1321 | 1364 | def __init__(self, **kwargs): |
|
1322 | 1365 | Figure.__init__(self, **kwargs) |
|
1323 | 1366 | self.timerange = 24*60*60 |
|
1324 | 1367 | self.isConfig = False |
|
1325 | 1368 | self.__nsubplots = 1 |
|
1326 | 1369 | self.counter_imagwr = 0 |
|
1327 | 1370 | self.WIDTH = 800 |
|
1328 | 1371 | self.HEIGHT = 400 |
|
1329 | 1372 | self.WIDTHPROF = 120 |
|
1330 | 1373 | self.HEIGHTPROF = 0 |
|
1331 | 1374 | self.xdata = None |
|
1332 | 1375 | self.ydata = None |
|
1333 | 1376 | |
|
1334 | 1377 | self.PLOT_CODE = BEACON_CODE |
|
1335 | 1378 | |
|
1336 | 1379 | self.FTP_WEI = None |
|
1337 | 1380 | self.EXP_CODE = None |
|
1338 | 1381 | self.SUB_EXP_CODE = None |
|
1339 | 1382 | self.PLOT_POS = None |
|
1340 | 1383 | |
|
1341 | 1384 | self.filename_phase = None |
|
1342 | 1385 | |
|
1343 | 1386 | self.figfile = None |
|
1344 | 1387 | |
|
1345 | 1388 | self.xmin = None |
|
1346 | 1389 | self.xmax = None |
|
1347 | 1390 | |
|
1348 | 1391 | def getSubplots(self): |
|
1349 | 1392 | |
|
1350 | 1393 | ncol = 1 |
|
1351 | 1394 | nrow = 1 |
|
1352 | 1395 | |
|
1353 | 1396 | return nrow, ncol |
|
1354 | 1397 | |
|
1355 | 1398 | def setup(self, id, nplots, wintitle, showprofile=True, show=True): |
|
1356 | 1399 | |
|
1357 | 1400 | self.__showprofile = showprofile |
|
1358 | 1401 | self.nplots = nplots |
|
1359 | 1402 | |
|
1360 | 1403 | ncolspan = 7 |
|
1361 | 1404 | colspan = 6 |
|
1362 | 1405 | self.__nsubplots = 2 |
|
1363 | 1406 | |
|
1364 | 1407 | self.createFigure(id = id, |
|
1365 | 1408 | wintitle = wintitle, |
|
1366 | 1409 | widthplot = self.WIDTH+self.WIDTHPROF, |
|
1367 | 1410 | heightplot = self.HEIGHT+self.HEIGHTPROF, |
|
1368 | 1411 | show=show) |
|
1369 | 1412 | |
|
1370 | 1413 | nrow, ncol = self.getSubplots() |
|
1371 | 1414 | |
|
1372 | 1415 | self.addAxes(nrow, ncol*ncolspan, 0, 0, colspan, 1) |
|
1373 | 1416 | |
|
1374 | 1417 | def save_phase(self, filename_phase): |
|
1375 | 1418 | f = open(filename_phase,'w+') |
|
1376 | 1419 | f.write('\n\n') |
|
1377 | 1420 | f.write('JICAMARCA RADIO OBSERVATORY - Beacon Phase \n') |
|
1378 | 1421 | f.write('DD MM YYYY HH MM SS pair(2,0) pair(2,1) pair(2,3) pair(2,4)\n\n' ) |
|
1379 | 1422 | f.close() |
|
1380 | 1423 | |
|
1381 | 1424 | def save_data(self, filename_phase, data, data_datetime): |
|
1382 | 1425 | f=open(filename_phase,'a') |
|
1383 | 1426 | timetuple_data = data_datetime.timetuple() |
|
1384 | 1427 | day = str(timetuple_data.tm_mday) |
|
1385 | 1428 | month = str(timetuple_data.tm_mon) |
|
1386 | 1429 | year = str(timetuple_data.tm_year) |
|
1387 | 1430 | hour = str(timetuple_data.tm_hour) |
|
1388 | 1431 | minute = str(timetuple_data.tm_min) |
|
1389 | 1432 | second = str(timetuple_data.tm_sec) |
|
1390 | 1433 | f.write(day+' '+month+' '+year+' '+hour+' '+minute+' '+second+' '+str(data[0])+' '+str(data[1])+' '+str(data[2])+' '+str(data[3])+'\n') |
|
1391 | 1434 | f.close() |
|
1392 | 1435 | |
|
1393 | 1436 | |
|
1394 | 1437 | def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True', |
|
1395 | 1438 | xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None, |
|
1396 | 1439 | timerange=None, |
|
1397 | 1440 | save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1, |
|
1398 | 1441 | server=None, folder=None, username=None, password=None, |
|
1399 | 1442 | ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0): |
|
1400 | 1443 | |
|
1401 | 1444 | if not isTimeInHourRange(dataOut.datatime, xmin, xmax): |
|
1402 | 1445 | return |
|
1403 | 1446 | |
|
1404 | 1447 | if pairsList == None: |
|
1405 | 1448 | pairsIndexList = dataOut.pairsIndexList[:10] |
|
1406 | 1449 | else: |
|
1407 | 1450 | pairsIndexList = [] |
|
1408 | 1451 | for pair in pairsList: |
|
1409 | 1452 | if pair not in dataOut.pairsList: |
|
1410 | 1453 | raise ValueError, "Pair %s is not in dataOut.pairsList" %(pair) |
|
1411 | 1454 | pairsIndexList.append(dataOut.pairsList.index(pair)) |
|
1412 | 1455 | |
|
1413 | 1456 | if pairsIndexList == []: |
|
1414 | 1457 | return |
|
1415 | 1458 | |
|
1416 | 1459 | # if len(pairsIndexList) > 4: |
|
1417 | 1460 | # pairsIndexList = pairsIndexList[0:4] |
|
1418 | 1461 | |
|
1419 | 1462 | hmin_index = None |
|
1420 | 1463 | hmax_index = None |
|
1421 | 1464 | |
|
1422 | 1465 | if hmin != None and hmax != None: |
|
1423 | 1466 | indexes = numpy.arange(dataOut.nHeights) |
|
1424 | 1467 | hmin_list = indexes[dataOut.heightList >= hmin] |
|
1425 | 1468 | hmax_list = indexes[dataOut.heightList <= hmax] |
|
1426 | 1469 | |
|
1427 | 1470 | if hmin_list.any(): |
|
1428 | 1471 | hmin_index = hmin_list[0] |
|
1429 | 1472 | |
|
1430 | 1473 | if hmax_list.any(): |
|
1431 | 1474 | hmax_index = hmax_list[-1]+1 |
|
1432 | 1475 | |
|
1433 | 1476 | x = dataOut.getTimeRange() |
|
1434 | 1477 | #y = dataOut.getHeiRange() |
|
1435 | 1478 | |
|
1436 | 1479 | |
|
1437 | 1480 | thisDatetime = dataOut.datatime |
|
1438 | 1481 | |
|
1439 | 1482 | title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1440 | 1483 | xlabel = "Local Time" |
|
1441 | 1484 | ylabel = "Phase (degrees)" |
|
1442 | 1485 | |
|
1443 | 1486 | update_figfile = False |
|
1444 | 1487 | |
|
1445 | 1488 | nplots = len(pairsIndexList) |
|
1446 | 1489 | #phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList))) |
|
1447 | 1490 | phase_beacon = numpy.zeros(len(pairsIndexList)) |
|
1448 | 1491 | for i in range(nplots): |
|
1449 | 1492 | pair = dataOut.pairsList[pairsIndexList[i]] |
|
1450 | 1493 | ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0) |
|
1451 | 1494 | powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0) |
|
1452 | 1495 | powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0) |
|
1453 | 1496 | avgcoherenceComplex = ccf/numpy.sqrt(powa*powb) |
|
1454 | 1497 | phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi |
|
1455 | 1498 | |
|
1456 | 1499 | #print "Phase %d%d" %(pair[0], pair[1]) |
|
1457 | 1500 | #print phase[dataOut.beacon_heiIndexList] |
|
1458 | 1501 | |
|
1459 | 1502 | if dataOut.beacon_heiIndexList: |
|
1460 | 1503 | phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList]) |
|
1461 | 1504 | else: |
|
1462 | 1505 | phase_beacon[i] = numpy.average(phase) |
|
1463 | 1506 | |
|
1464 | 1507 | if not self.isConfig: |
|
1465 | 1508 | |
|
1466 | 1509 | nplots = len(pairsIndexList) |
|
1467 | 1510 | |
|
1468 | 1511 | self.setup(id=id, |
|
1469 | 1512 | nplots=nplots, |
|
1470 | 1513 | wintitle=wintitle, |
|
1471 | 1514 | showprofile=showprofile, |
|
1472 | 1515 | show=show) |
|
1473 | 1516 | |
|
1474 | 1517 | if timerange != None: |
|
1475 | 1518 | self.timerange = timerange |
|
1476 | 1519 | |
|
1477 | 1520 | self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange) |
|
1478 | 1521 | |
|
1479 | 1522 | if ymin == None: ymin = 0 |
|
1480 | 1523 | if ymax == None: ymax = 360 |
|
1481 | 1524 | |
|
1482 | 1525 | self.FTP_WEI = ftp_wei |
|
1483 | 1526 | self.EXP_CODE = exp_code |
|
1484 | 1527 | self.SUB_EXP_CODE = sub_exp_code |
|
1485 | 1528 | self.PLOT_POS = plot_pos |
|
1486 | 1529 | |
|
1487 | 1530 | self.name = thisDatetime.strftime("%Y%m%d_%H%M%S") |
|
1488 | 1531 | self.isConfig = True |
|
1489 | 1532 | self.figfile = figfile |
|
1490 | 1533 | self.xdata = numpy.array([]) |
|
1491 | 1534 | self.ydata = numpy.array([]) |
|
1492 | 1535 | |
|
1493 | 1536 | update_figfile = True |
|
1494 | 1537 | |
|
1495 | 1538 | #open file beacon phase |
|
1496 | 1539 | path = '%s%03d' %(self.PREFIX, self.id) |
|
1497 | 1540 | beacon_file = os.path.join(path,'%s.txt'%self.name) |
|
1498 | 1541 | self.filename_phase = os.path.join(figpath,beacon_file) |
|
1499 | 1542 | #self.save_phase(self.filename_phase) |
|
1500 | 1543 | |
|
1501 | 1544 | |
|
1502 | 1545 | #store data beacon phase |
|
1503 | 1546 | #self.save_data(self.filename_phase, phase_beacon, thisDatetime) |
|
1504 | 1547 | |
|
1505 | 1548 | self.setWinTitle(title) |
|
1506 | 1549 | |
|
1507 | 1550 | |
|
1508 | 1551 | title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S")) |
|
1509 | 1552 | |
|
1510 | 1553 | legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList] |
|
1511 | 1554 | |
|
1512 | 1555 | axes = self.axesList[0] |
|
1513 | 1556 | |
|
1514 | 1557 | self.xdata = numpy.hstack((self.xdata, x[0:1])) |
|
1515 | 1558 | |
|
1516 | 1559 | if len(self.ydata)==0: |
|
1517 | 1560 | self.ydata = phase_beacon.reshape(-1,1) |
|
1518 | 1561 | else: |
|
1519 | 1562 | self.ydata = numpy.hstack((self.ydata, phase_beacon.reshape(-1,1))) |
|
1520 | 1563 | |
|
1521 | 1564 | |
|
1522 | 1565 | axes.pmultilineyaxis(x=self.xdata, y=self.ydata, |
|
1523 | 1566 | xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, |
|
1524 | 1567 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, marker='x', markersize=8, linestyle="solid", |
|
1525 | 1568 | XAxisAsTime=True, grid='both' |
|
1526 | 1569 | ) |
|
1527 | 1570 | |
|
1528 | 1571 | self.draw() |
|
1529 | 1572 | |
|
1530 | 1573 | if dataOut.ltctime >= self.xmax: |
|
1531 | 1574 | self.counter_imagwr = wr_period |
|
1532 | 1575 | self.isConfig = False |
|
1533 | 1576 | update_figfile = True |
|
1534 | 1577 | |
|
1535 | 1578 | self.save(figpath=figpath, |
|
1536 | 1579 | figfile=figfile, |
|
1537 | 1580 | save=save, |
|
1538 | 1581 | ftp=ftp, |
|
1539 | 1582 | wr_period=wr_period, |
|
1540 | 1583 | thisDatetime=thisDatetime, |
|
1541 | 1584 | update_figfile=update_figfile) |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,1193 +1,1194 | |||
|
1 | 1 | import os, sys |
|
2 | 2 | import glob |
|
3 | 3 | import fnmatch |
|
4 | 4 | import datetime |
|
5 | 5 | import time |
|
6 | 6 | import re |
|
7 | 7 | import h5py |
|
8 | 8 | import numpy |
|
9 | 9 | import matplotlib.pyplot as plt |
|
10 | 10 | |
|
11 | 11 | import pylab as plb |
|
12 | 12 | from scipy.optimize import curve_fit |
|
13 | 13 | from scipy import asarray as ar,exp |
|
14 | 14 | from scipy import stats |
|
15 | 15 | |
|
16 | 16 | from duplicity.path import Path |
|
17 | 17 | from numpy.ma.core import getdata |
|
18 | 18 | |
|
19 | 19 | SPEED_OF_LIGHT = 299792458 |
|
20 | 20 | SPEED_OF_LIGHT = 3e8 |
|
21 | 21 | |
|
22 | 22 | try: |
|
23 | 23 | from gevent import sleep |
|
24 | 24 | except: |
|
25 | 25 | from time import sleep |
|
26 | 26 | |
|
27 | 27 | from schainpy.model.data.jrodata import Spectra |
|
28 | 28 | #from schainpy.model.data.BLTRheaderIO import FileHeader, RecordHeader |
|
29 | 29 | from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation |
|
30 | 30 | #from schainpy.model.io.jroIO_bltr import BLTRReader |
|
31 | 31 | from numpy import imag, shape, NaN |
|
32 | 32 | |
|
33 | 33 | from jroIO_base import JRODataReader |
|
34 | 34 | |
|
35 | 35 | |
|
36 | 36 | class Header(object): |
|
37 | 37 | |
|
38 | 38 | def __init__(self): |
|
39 | 39 | raise NotImplementedError |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | def read(self): |
|
43 | 43 | |
|
44 | 44 | raise NotImplementedError |
|
45 | 45 | |
|
46 | 46 | def write(self): |
|
47 | 47 | |
|
48 | 48 | raise NotImplementedError |
|
49 | 49 | |
|
50 | 50 | def printInfo(self): |
|
51 | 51 | |
|
52 | 52 | message = "#"*50 + "\n" |
|
53 | 53 | message += self.__class__.__name__.upper() + "\n" |
|
54 | 54 | message += "#"*50 + "\n" |
|
55 | 55 | |
|
56 | 56 | keyList = self.__dict__.keys() |
|
57 | 57 | keyList.sort() |
|
58 | 58 | |
|
59 | 59 | for key in keyList: |
|
60 | 60 | message += "%s = %s" %(key, self.__dict__[key]) + "\n" |
|
61 | 61 | |
|
62 | 62 | if "size" not in keyList: |
|
63 | 63 | attr = getattr(self, "size") |
|
64 | 64 | |
|
65 | 65 | if attr: |
|
66 | 66 | message += "%s = %s" %("size", attr) + "\n" |
|
67 | 67 | |
|
68 | 68 | #print message |
|
69 | 69 | |
|
70 | 70 | |
|
71 | 71 | |
|
72 | 72 | |
|
73 | 73 | |
|
74 | 74 | FILE_STRUCTURE = numpy.dtype([ #HEADER 48bytes |
|
75 | 75 | ('FileMgcNumber','<u4'), #0x23020100 |
|
76 | 76 | ('nFDTdataRecors','<u4'), #No Of FDT data records in this file (0 or more) |
|
77 | 77 | ('OffsetStartHeader','<u4'), |
|
78 | 78 | ('RadarUnitId','<u4'), |
|
79 | 79 | ('SiteName',numpy.str_,32), #Null terminated |
|
80 | 80 | ]) |
|
81 | 81 | |
|
82 | 82 | class FileHeaderBLTR(Header): |
|
83 | 83 | |
|
84 | 84 | def __init__(self): |
|
85 | 85 | |
|
86 | 86 | self.FileMgcNumber= 0 #0x23020100 |
|
87 | 87 | self.nFDTdataRecors=0 #No Of FDT data records in this file (0 or more) |
|
88 | 88 | self.RadarUnitId= 0 |
|
89 | 89 | self.OffsetStartHeader=0 |
|
90 | 90 | self.SiteName= "" |
|
91 | 91 | self.size = 48 |
|
92 | 92 | |
|
93 | 93 | def FHread(self, fp): |
|
94 | 94 | #try: |
|
95 | 95 | startFp = open(fp,"rb") |
|
96 | 96 | |
|
97 | 97 | header = numpy.fromfile(startFp, FILE_STRUCTURE,1) |
|
98 | 98 | |
|
99 | 99 | print ' ' |
|
100 | 100 | print 'puntero file header', startFp.tell() |
|
101 | 101 | print ' ' |
|
102 | 102 | |
|
103 | 103 | |
|
104 | 104 | ''' numpy.fromfile(file, dtype, count, sep='') |
|
105 | 105 | file : file or str |
|
106 | 106 | Open file object or filename. |
|
107 | 107 | |
|
108 | 108 | dtype : data-type |
|
109 | 109 | Data type of the returned array. For binary files, it is used to determine |
|
110 | 110 | the size and byte-order of the items in the file. |
|
111 | 111 | |
|
112 | 112 | count : int |
|
113 | 113 | Number of items to read. -1 means all items (i.e., the complete file). |
|
114 | 114 | |
|
115 | 115 | sep : str |
|
116 | 116 | Separator between items if file is a text file. Empty ("") separator means |
|
117 | 117 | the file should be treated as binary. Spaces (" ") in the separator match zero |
|
118 | 118 | or more whitespace characters. A separator consisting only of spaces must match |
|
119 | 119 | at least one whitespace. |
|
120 | 120 | |
|
121 | 121 | ''' |
|
122 | 122 | |
|
123 | 123 | |
|
124 | 124 | |
|
125 | 125 | self.FileMgcNumber= hex(header['FileMgcNumber'][0]) |
|
126 | 126 | self.nFDTdataRecors=int(header['nFDTdataRecors'][0]) #No Of FDT data records in this file (0 or more) |
|
127 | 127 | self.RadarUnitId= int(header['RadarUnitId'][0]) |
|
128 | 128 | self.OffsetStartHeader= int(header['OffsetStartHeader'][0]) |
|
129 | 129 | self.SiteName= str(header['SiteName'][0]) |
|
130 | 130 | |
|
131 | 131 | #print 'Numero de bloques', self.nFDTdataRecors |
|
132 | 132 | |
|
133 | 133 | |
|
134 | 134 | if self.size <48: |
|
135 | 135 | return 0 |
|
136 | 136 | |
|
137 | 137 | return 1 |
|
138 | 138 | |
|
139 | 139 | |
|
140 | 140 | def write(self, fp): |
|
141 | 141 | |
|
142 | 142 | headerTuple = (self.FileMgcNumber, |
|
143 | 143 | self.nFDTdataRecors, |
|
144 | 144 | self.RadarUnitId, |
|
145 | 145 | self.SiteName, |
|
146 | 146 | self.size) |
|
147 | 147 | |
|
148 | 148 | |
|
149 | 149 | header = numpy.array(headerTuple, FILE_STRUCTURE) |
|
150 | 150 | # numpy.array(object, dtype=None, copy=True, order=None, subok=False, ndmin=0) |
|
151 | 151 | header.tofile(fp) |
|
152 | 152 | ''' ndarray.tofile(fid, sep, format) Write array to a file as text or binary (default). |
|
153 | 153 | |
|
154 | 154 | fid : file or str |
|
155 | 155 | An open file object, or a string containing a filename. |
|
156 | 156 | |
|
157 | 157 | sep : str |
|
158 | 158 | Separator between array items for text output. If "" (empty), a binary file is written, |
|
159 | 159 | equivalent to file.write(a.tobytes()). |
|
160 | 160 | |
|
161 | 161 | format : str |
|
162 | 162 | Format string for text file output. Each entry in the array is formatted to text by |
|
163 | 163 | first converting it to the closest Python type, and then using "format" % item. |
|
164 | 164 | |
|
165 | 165 | ''' |
|
166 | 166 | |
|
167 | 167 | return 1 |
|
168 | 168 | |
|
169 | 169 | |
|
170 | 170 | |
|
171 | 171 | |
|
172 | 172 | |
|
173 | 173 | RECORD_STRUCTURE = numpy.dtype([ #RECORD HEADER 180+20N bytes |
|
174 | 174 | ('RecMgcNumber','<u4'), #0x23030001 |
|
175 | 175 | ('RecCounter','<u4'), #Record counter(0,1, ...) |
|
176 | 176 | ('Off2StartNxtRec','<u4'), #Offset to start of next record form start of this record |
|
177 | 177 | ('Off2StartData','<u4'), #Offset to start of data from start of this record |
|
178 | 178 | ('nUtime','<i4'), #Epoch time stamp of start of acquisition (seconds) |
|
179 | 179 | ('nMilisec','<u4'), #Millisecond component of time stamp (0,...,999) |
|
180 | 180 | ('ExpTagName',numpy.str_,32), #Experiment tag name (null terminated) |
|
181 | 181 | ('ExpComment',numpy.str_,32), #Experiment comment (null terminated) |
|
182 | 182 | ('SiteLatDegrees','<f4'), #Site latitude (from GPS) in degrees (positive implies North) |
|
183 | 183 | ('SiteLongDegrees','<f4'), #Site longitude (from GPS) in degrees (positive implies East) |
|
184 | 184 | ('RTCgpsStatus','<u4'), #RTC GPS engine status (0=SEEK, 1=LOCK, 2=NOT FITTED, 3=UNAVAILABLE) |
|
185 | 185 | ('TransmitFrec','<u4'), #Transmit frequency (Hz) |
|
186 | 186 | ('ReceiveFrec','<u4'), #Receive frequency |
|
187 | 187 | ('FirstOsciFrec','<u4'), #First local oscillator frequency (Hz) |
|
188 | 188 | ('Polarisation','<u4'), #(0="O", 1="E", 2="linear 1", 3="linear2") |
|
189 | 189 | ('ReceiverFiltSett','<u4'), #Receiver filter settings (0,1,2,3) |
|
190 | 190 | ('nModesInUse','<u4'), #Number of modes in use (1 or 2) |
|
191 | 191 | ('DualModeIndex','<u4'), #Dual Mode index number for these data (0 or 1) |
|
192 | 192 | ('DualModeRange','<u4'), #Dual Mode range correction for these data (m) |
|
193 | 193 | ('nDigChannels','<u4'), #Number of digital channels acquired (2*N) |
|
194 | 194 | ('SampResolution','<u4'), #Sampling resolution (meters) |
|
195 | 195 | ('nHeights','<u4'), #Number of range gates sampled |
|
196 | 196 | ('StartRangeSamp','<u4'), #Start range of sampling (meters) |
|
197 | 197 | ('PRFhz','<u4'), #PRF (Hz) |
|
198 | 198 | ('nCohInt','<u4'), #Integrations |
|
199 | 199 | ('nProfiles','<u4'), #Number of data points transformed |
|
200 | 200 | ('nChannels','<u4'), #Number of receive beams stored in file (1 or N) |
|
201 | 201 | ('nIncohInt','<u4'), #Number of spectral averages |
|
202 | 202 | ('FFTwindowingInd','<u4'), #FFT windowing index (0 = no window) |
|
203 | 203 | ('BeamAngleAzim','<f4'), #Beam steer angle (azimuth) in degrees (clockwise from true North) |
|
204 | 204 | ('BeamAngleZen','<f4'), #Beam steer angle (zenith) in degrees (0=> vertical) |
|
205 | 205 | ('AntennaCoord0','<f4'), #Antenna coordinates (Range(meters), Bearing(degrees)) - N pairs |
|
206 | 206 | ('AntennaAngl0','<f4'), #Antenna coordinates (Range(meters), Bearing(degrees)) - N pairs |
|
207 | 207 | ('AntennaCoord1','<f4'), #Antenna coordinates (Range(meters), Bearing(degrees)) - N pairs |
|
208 | 208 | ('AntennaAngl1','<f4'), #Antenna coordinates (Range(meters), Bearing(degrees)) - N pairs |
|
209 | 209 | ('AntennaCoord2','<f4'), #Antenna coordinates (Range(meters), Bearing(degrees)) - N pairs |
|
210 | 210 | ('AntennaAngl2','<f4'), #Antenna coordinates (Range(meters), Bearing(degrees)) - N pairs |
|
211 | 211 | ('RecPhaseCalibr0','<f4'), #Receiver phase calibration (degrees) - N values |
|
212 | 212 | ('RecPhaseCalibr1','<f4'), #Receiver phase calibration (degrees) - N values |
|
213 | 213 | ('RecPhaseCalibr2','<f4'), #Receiver phase calibration (degrees) - N values |
|
214 | 214 | ('RecAmpCalibr0','<f4'), #Receiver amplitude calibration (ratio relative to receiver one) - N values |
|
215 | 215 | ('RecAmpCalibr1','<f4'), #Receiver amplitude calibration (ratio relative to receiver one) - N values |
|
216 | 216 | ('RecAmpCalibr2','<f4'), #Receiver amplitude calibration (ratio relative to receiver one) - N values |
|
217 | 217 | ('ReceiverGaindB0','<i4'), #Receiver gains in dB - N values |
|
218 | 218 | ('ReceiverGaindB1','<i4'), #Receiver gains in dB - N values |
|
219 | 219 | ('ReceiverGaindB2','<i4'), #Receiver gains in dB - N values |
|
220 | 220 | ]) |
|
221 | 221 | |
|
222 | 222 | |
|
223 | 223 | class RecordHeaderBLTR(Header): |
|
224 | 224 | |
|
225 | 225 | def __init__(self, RecMgcNumber=None, RecCounter= 0, Off2StartNxtRec= 811248, |
|
226 | 226 | nUtime= 0, nMilisec= 0, ExpTagName= None, |
|
227 | 227 | ExpComment=None, SiteLatDegrees=0, SiteLongDegrees= 0, |
|
228 | 228 | RTCgpsStatus= 0, TransmitFrec= 0, ReceiveFrec= 0, |
|
229 | 229 | FirstOsciFrec= 0, Polarisation= 0, ReceiverFiltSett= 0, |
|
230 | 230 | nModesInUse= 0, DualModeIndex= 0, DualModeRange= 0, |
|
231 | 231 | nDigChannels= 0, SampResolution= 0, nHeights= 0, |
|
232 | 232 | StartRangeSamp= 0, PRFhz= 0, nCohInt= 0, |
|
233 | 233 | nProfiles= 0, nChannels= 0, nIncohInt= 0, |
|
234 | 234 | FFTwindowingInd= 0, BeamAngleAzim= 0, BeamAngleZen= 0, |
|
235 | 235 | AntennaCoord0= 0, AntennaCoord1= 0, AntennaCoord2= 0, |
|
236 | 236 | RecPhaseCalibr0= 0, RecPhaseCalibr1= 0, RecPhaseCalibr2= 0, |
|
237 | 237 | RecAmpCalibr0= 0, RecAmpCalibr1= 0, RecAmpCalibr2= 0, |
|
238 | 238 | AntennaAngl0=0, AntennaAngl1=0, AntennaAngl2=0, |
|
239 | 239 | ReceiverGaindB0= 0, ReceiverGaindB1= 0, ReceiverGaindB2= 0, Off2StartData=0, OffsetStartHeader=0): |
|
240 | 240 | |
|
241 | 241 | self.RecMgcNumber = RecMgcNumber #0x23030001 |
|
242 | 242 | self.RecCounter = RecCounter |
|
243 | 243 | self.Off2StartNxtRec = Off2StartNxtRec |
|
244 | 244 | self.Off2StartData = Off2StartData |
|
245 | 245 | self.nUtime = nUtime |
|
246 | 246 | self.nMilisec = nMilisec |
|
247 | 247 | self.ExpTagName = ExpTagName |
|
248 | 248 | self.ExpComment = ExpComment |
|
249 | 249 | self.SiteLatDegrees = SiteLatDegrees |
|
250 | 250 | self.SiteLongDegrees = SiteLongDegrees |
|
251 | 251 | self.RTCgpsStatus = RTCgpsStatus |
|
252 | 252 | self.TransmitFrec = TransmitFrec |
|
253 | 253 | self.ReceiveFrec = ReceiveFrec |
|
254 | 254 | self.FirstOsciFrec = FirstOsciFrec |
|
255 | 255 | self.Polarisation = Polarisation |
|
256 | 256 | self.ReceiverFiltSett = ReceiverFiltSett |
|
257 | 257 | self.nModesInUse = nModesInUse |
|
258 | 258 | self.DualModeIndex = DualModeIndex |
|
259 | 259 | self.DualModeRange = DualModeRange |
|
260 | 260 | self.nDigChannels = nDigChannels |
|
261 | 261 | self.SampResolution = SampResolution |
|
262 | 262 | self.nHeights = nHeights |
|
263 | 263 | self.StartRangeSamp = StartRangeSamp |
|
264 | 264 | self.PRFhz = PRFhz |
|
265 | 265 | self.nCohInt = nCohInt |
|
266 | 266 | self.nProfiles = nProfiles |
|
267 | 267 | self.nChannels = nChannels |
|
268 | 268 | self.nIncohInt = nIncohInt |
|
269 | 269 | self.FFTwindowingInd = FFTwindowingInd |
|
270 | 270 | self.BeamAngleAzim = BeamAngleAzim |
|
271 | 271 | self.BeamAngleZen = BeamAngleZen |
|
272 | 272 | self.AntennaCoord0 = AntennaCoord0 |
|
273 | 273 | self.AntennaAngl0 = AntennaAngl0 |
|
274 | 274 | self.AntennaAngl1 = AntennaAngl1 |
|
275 | 275 | self.AntennaAngl2 = AntennaAngl2 |
|
276 | 276 | self.AntennaCoord1 = AntennaCoord1 |
|
277 | 277 | self.AntennaCoord2 = AntennaCoord2 |
|
278 | 278 | self.RecPhaseCalibr0 = RecPhaseCalibr0 |
|
279 | 279 | self.RecPhaseCalibr1 = RecPhaseCalibr1 |
|
280 | 280 | self.RecPhaseCalibr2 = RecPhaseCalibr2 |
|
281 | 281 | self.RecAmpCalibr0 = RecAmpCalibr0 |
|
282 | 282 | self.RecAmpCalibr1 = RecAmpCalibr1 |
|
283 | 283 | self.RecAmpCalibr2 = RecAmpCalibr2 |
|
284 | 284 | self.ReceiverGaindB0 = ReceiverGaindB0 |
|
285 | 285 | self.ReceiverGaindB1 = ReceiverGaindB1 |
|
286 | 286 | self.ReceiverGaindB2 = ReceiverGaindB2 |
|
287 | 287 | self.OffsetStartHeader = 48 |
|
288 | 288 | |
|
289 | 289 | |
|
290 | 290 | |
|
291 | 291 | def RHread(self, fp): |
|
292 | 292 | #print fp |
|
293 | 293 | #startFp = open('/home/erick/Documents/Data/huancayo.20161019.22.fdt',"rb") #The method tell() returns the current position of the file read/write pointer within the file. |
|
294 | 294 | startFp = open(fp,"rb") #The method tell() returns the current position of the file read/write pointer within the file. |
|
295 | 295 | #RecCounter=0 |
|
296 | 296 | #Off2StartNxtRec=811248 |
|
297 | 297 | OffRHeader= self.OffsetStartHeader + self.RecCounter*self.Off2StartNxtRec |
|
298 | 298 | print ' ' |
|
299 | 299 | print 'puntero Record Header', startFp.tell() |
|
300 | 300 | print ' ' |
|
301 | 301 | |
|
302 | 302 | |
|
303 | 303 | startFp.seek(OffRHeader, os.SEEK_SET) |
|
304 | 304 | |
|
305 | 305 | print ' ' |
|
306 | 306 | print 'puntero Record Header con seek', startFp.tell() |
|
307 | 307 | print ' ' |
|
308 | 308 | |
|
309 | 309 | #print 'Posicion del bloque: ',OffRHeader |
|
310 | 310 | |
|
311 | 311 | header = numpy.fromfile(startFp,RECORD_STRUCTURE,1) |
|
312 | 312 | |
|
313 | 313 | print ' ' |
|
314 | 314 | print 'puntero Record Header con seek', startFp.tell() |
|
315 | 315 | print ' ' |
|
316 | 316 | |
|
317 | 317 | print ' ' |
|
318 | 318 | # |
|
319 | 319 | #print 'puntero Record Header despues de seek', header.tell() |
|
320 | 320 | print ' ' |
|
321 | 321 | |
|
322 | 322 | self.RecMgcNumber = hex(header['RecMgcNumber'][0]) #0x23030001 |
|
323 | 323 | self.RecCounter = int(header['RecCounter'][0]) |
|
324 | 324 | self.Off2StartNxtRec = int(header['Off2StartNxtRec'][0]) |
|
325 | 325 | self.Off2StartData = int(header['Off2StartData'][0]) |
|
326 | 326 | self.nUtime = header['nUtime'][0] |
|
327 | 327 | self.nMilisec = header['nMilisec'][0] |
|
328 | 328 | self.ExpTagName = str(header['ExpTagName'][0]) |
|
329 | 329 | self.ExpComment = str(header['ExpComment'][0]) |
|
330 | 330 | self.SiteLatDegrees = header['SiteLatDegrees'][0] |
|
331 | 331 | self.SiteLongDegrees = header['SiteLongDegrees'][0] |
|
332 | 332 | self.RTCgpsStatus = header['RTCgpsStatus'][0] |
|
333 | 333 | self.TransmitFrec = header['TransmitFrec'][0] |
|
334 | 334 | self.ReceiveFrec = header['ReceiveFrec'][0] |
|
335 | 335 | self.FirstOsciFrec = header['FirstOsciFrec'][0] |
|
336 | 336 | self.Polarisation = header['Polarisation'][0] |
|
337 | 337 | self.ReceiverFiltSett = header['ReceiverFiltSett'][0] |
|
338 | 338 | self.nModesInUse = header['nModesInUse'][0] |
|
339 | 339 | self.DualModeIndex = header['DualModeIndex'][0] |
|
340 | 340 | self.DualModeRange = header['DualModeRange'][0] |
|
341 | 341 | self.nDigChannels = header['nDigChannels'][0] |
|
342 | 342 | self.SampResolution = header['SampResolution'][0] |
|
343 | 343 | self.nHeights = header['nHeights'][0] |
|
344 | 344 | self.StartRangeSamp = header['StartRangeSamp'][0] |
|
345 | 345 | self.PRFhz = header['PRFhz'][0] |
|
346 | 346 | self.nCohInt = header['nCohInt'][0] |
|
347 | 347 | self.nProfiles = header['nProfiles'][0] |
|
348 | 348 | self.nChannels = header['nChannels'][0] |
|
349 | 349 | self.nIncohInt = header['nIncohInt'][0] |
|
350 | 350 | self.FFTwindowingInd = header['FFTwindowingInd'][0] |
|
351 | 351 | self.BeamAngleAzim = header['BeamAngleAzim'][0] |
|
352 | 352 | self.BeamAngleZen = header['BeamAngleZen'][0] |
|
353 | 353 | self.AntennaCoord0 = header['AntennaCoord0'][0] |
|
354 | 354 | self.AntennaAngl0 = header['AntennaAngl0'][0] |
|
355 | 355 | self.AntennaCoord1 = header['AntennaCoord1'][0] |
|
356 | 356 | self.AntennaAngl1 = header['AntennaAngl1'][0] |
|
357 | 357 | self.AntennaCoord2 = header['AntennaCoord2'][0] |
|
358 | 358 | self.AntennaAngl2 = header['AntennaAngl2'][0] |
|
359 | 359 | self.RecPhaseCalibr0 = header['RecPhaseCalibr0'][0] |
|
360 | 360 | self.RecPhaseCalibr1 = header['RecPhaseCalibr1'][0] |
|
361 | 361 | self.RecPhaseCalibr2 = header['RecPhaseCalibr2'][0] |
|
362 | 362 | self.RecAmpCalibr0 = header['RecAmpCalibr0'][0] |
|
363 | 363 | self.RecAmpCalibr1 = header['RecAmpCalibr1'][0] |
|
364 | 364 | self.RecAmpCalibr2 = header['RecAmpCalibr2'][0] |
|
365 | 365 | self.ReceiverGaindB0 = header['ReceiverGaindB0'][0] |
|
366 | 366 | self.ReceiverGaindB1 = header['ReceiverGaindB1'][0] |
|
367 | 367 | self.ReceiverGaindB2 = header['ReceiverGaindB2'][0] |
|
368 | 368 | |
|
369 | 369 | self.ipp= 0.5*(SPEED_OF_LIGHT/self.PRFhz) |
|
370 | 370 | |
|
371 | 371 | self.RHsize = 180+20*self.nChannels |
|
372 | 372 | self.Datasize= self.nProfiles*self.nChannels*self.nHeights*2*4 |
|
373 | 373 | #print 'Datasize',self.Datasize |
|
374 | 374 | endFp = self.OffsetStartHeader + self.RecCounter*self.Off2StartNxtRec |
|
375 | 375 | |
|
376 | 376 | print '==============================================' |
|
377 | 377 | print 'RecMgcNumber ',self.RecMgcNumber |
|
378 | 378 | print 'RecCounter ',self.RecCounter |
|
379 | 379 | print 'Off2StartNxtRec ',self.Off2StartNxtRec |
|
380 | 380 | print 'Off2StartData ',self.Off2StartData |
|
381 | 381 | print 'Range Resolution ',self.SampResolution |
|
382 | 382 | print 'First Height ',self.StartRangeSamp |
|
383 | 383 | print 'PRF (Hz) ',self.PRFhz |
|
384 | 384 | print 'Heights (K) ',self.nHeights |
|
385 | 385 | print 'Channels (N) ',self.nChannels |
|
386 | 386 | print 'Profiles (J) ',self.nProfiles |
|
387 | 387 | print 'iCoh ',self.nCohInt |
|
388 | 388 | print 'iInCoh ',self.nIncohInt |
|
389 | 389 | print 'BeamAngleAzim ',self.BeamAngleAzim |
|
390 | 390 | print 'BeamAngleZen ',self.BeamAngleZen |
|
391 | 391 | |
|
392 | 392 | #print 'ModoEnUso ',self.DualModeIndex |
|
393 | 393 | #print 'UtcTime ',self.nUtime |
|
394 | 394 | #print 'MiliSec ',self.nMilisec |
|
395 | 395 | #print 'Exp TagName ',self.ExpTagName |
|
396 | 396 | #print 'Exp Comment ',self.ExpComment |
|
397 | 397 | #print 'FFT Window Index ',self.FFTwindowingInd |
|
398 | 398 | #print 'N Dig. Channels ',self.nDigChannels |
|
399 | 399 | print 'Size de bloque ',self.RHsize |
|
400 | 400 | print 'DataSize ',self.Datasize |
|
401 | 401 | print 'BeamAngleAzim ',self.BeamAngleAzim |
|
402 | 402 | #print 'AntennaCoord0 ',self.AntennaCoord0 |
|
403 | 403 | #print 'AntennaAngl0 ',self.AntennaAngl0 |
|
404 | 404 | #print 'AntennaCoord1 ',self.AntennaCoord1 |
|
405 | 405 | #print 'AntennaAngl1 ',self.AntennaAngl1 |
|
406 | 406 | #print 'AntennaCoord2 ',self.AntennaCoord2 |
|
407 | 407 | #print 'AntennaAngl2 ',self.AntennaAngl2 |
|
408 | 408 | print 'RecPhaseCalibr0 ',self.RecPhaseCalibr0 |
|
409 | 409 | print 'RecPhaseCalibr1 ',self.RecPhaseCalibr1 |
|
410 | 410 | print 'RecPhaseCalibr2 ',self.RecPhaseCalibr2 |
|
411 | 411 | print 'RecAmpCalibr0 ',self.RecAmpCalibr0 |
|
412 | 412 | print 'RecAmpCalibr1 ',self.RecAmpCalibr1 |
|
413 | 413 | print 'RecAmpCalibr2 ',self.RecAmpCalibr2 |
|
414 | 414 | print 'ReceiverGaindB0 ',self.ReceiverGaindB0 |
|
415 | 415 | print 'ReceiverGaindB1 ',self.ReceiverGaindB1 |
|
416 | 416 | print 'ReceiverGaindB2 ',self.ReceiverGaindB2 |
|
417 | 417 | print '==============================================' |
|
418 | 418 | |
|
419 | 419 | if OffRHeader > endFp: |
|
420 | 420 | sys.stderr.write("Warning %s: Size value read from System Header is lower than it has to be\n" %fp) |
|
421 | 421 | return 0 |
|
422 | 422 | |
|
423 | 423 | if OffRHeader < endFp: |
|
424 | 424 | sys.stderr.write("Warning %s: Size value read from System Header size is greater than it has to be\n" %fp) |
|
425 | 425 | return 0 |
|
426 | 426 | |
|
427 | 427 | return 1 |
|
428 | 428 | |
|
429 | 429 | |
|
430 | 430 | class BLTRReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODataReader): |
|
431 | 431 | |
|
432 | 432 | path = None |
|
433 | 433 | startDate = None |
|
434 | 434 | endDate = None |
|
435 | 435 | startTime = None |
|
436 | 436 | endTime = None |
|
437 | 437 | walk = None |
|
438 | 438 | isConfig = False |
|
439 | 439 | |
|
440 | 440 | |
|
441 | 441 | fileList= None |
|
442 | 442 | |
|
443 | 443 | #metadata |
|
444 | 444 | TimeZone= None |
|
445 | 445 | Interval= None |
|
446 | 446 | heightList= None |
|
447 | 447 | |
|
448 | 448 | #data |
|
449 | 449 | data= None |
|
450 | 450 | utctime= None |
|
451 | 451 | |
|
452 | 452 | |
|
453 | 453 | |
|
454 | 454 | def __init__(self, **kwargs): |
|
455 | 455 | |
|
456 | 456 | #Eliminar de la base la herencia |
|
457 | 457 | ProcessingUnit.__init__(self, **kwargs) |
|
458 | 458 | |
|
459 | 459 | # self.isConfig = False |
|
460 | 460 | |
|
461 | 461 | #self.pts2read_SelfSpectra = 0 |
|
462 | 462 | #self.pts2read_CrossSpectra = 0 |
|
463 | 463 | #self.pts2read_DCchannels = 0 |
|
464 | 464 | #self.datablock = None |
|
465 | 465 | self.utc = None |
|
466 | 466 | self.ext = ".fdt" |
|
467 | 467 | self.optchar = "P" |
|
468 | 468 | self.fpFile=None |
|
469 | 469 | self.fp = None |
|
470 | 470 | self.BlockCounter=0 |
|
471 | 471 | self.dtype = None |
|
472 | 472 | self.fileSizeByHeader = None |
|
473 | 473 | self.filenameList = [] |
|
474 | 474 | self.fileSelector = 0 |
|
475 | 475 | self.Off2StartNxtRec=0 |
|
476 | 476 | self.RecCounter=0 |
|
477 | 477 | self.flagNoMoreFiles = 0 |
|
478 | 478 | self.data_spc=None |
|
479 | 479 | self.data_cspc=None |
|
480 | 480 | self.data_output=None |
|
481 | 481 | self.path = None |
|
482 | 482 | self.OffsetStartHeader=0 |
|
483 | 483 | self.Off2StartData=0 |
|
484 | 484 | self.ipp = 0 |
|
485 | 485 | self.nFDTdataRecors=0 |
|
486 | 486 | self.blocksize = 0 |
|
487 | 487 | self.dataOut = Spectra() |
|
488 | 488 | self.profileIndex = 1 #Always |
|
489 | 489 | self.dataOut.flagNoData=False |
|
490 | 490 | self.dataOut.nRdPairs = 0 |
|
491 | 491 | self.dataOut.pairsList = [] |
|
492 | 492 | self.dataOut.data_spc=None |
|
493 | 493 | self.dataOut.noise=[] |
|
494 | 494 | self.dataOut.velocityX=[] |
|
495 | 495 | self.dataOut.velocityY=[] |
|
496 | 496 | self.dataOut.velocityV=[] |
|
497 | 497 | |
|
498 | 498 | |
|
499 | 499 | |
|
500 | 500 | def Files2Read(self, fp): |
|
501 | 501 | ''' |
|
502 | 502 | Function that indicates the number of .fdt files that exist in the folder to be read. |
|
503 | 503 | It also creates an organized list with the names of the files to read. |
|
504 | 504 | ''' |
|
505 | 505 | #self.__checkPath() |
|
506 | 506 | |
|
507 | 507 | ListaData=os.listdir(fp) #Gets the list of files within the fp address |
|
508 | 508 | ListaData=sorted(ListaData) #Sort the list of files from least to largest by names |
|
509 | 509 | nFiles=0 #File Counter |
|
510 | 510 | FileList=[] #A list is created that will contain the .fdt files |
|
511 | 511 | for IndexFile in ListaData : |
|
512 | 512 | if '.fdt' in IndexFile: |
|
513 | 513 | FileList.append(IndexFile) |
|
514 | 514 | nFiles+=1 |
|
515 | 515 | |
|
516 | 516 | #print 'Files2Read' |
|
517 | 517 | #print 'Existen '+str(nFiles)+' archivos .fdt' |
|
518 | 518 | |
|
519 | 519 | self.filenameList=FileList #List of files from least to largest by names |
|
520 | 520 | |
|
521 | 521 | |
|
522 | 522 | def run(self, **kwargs): |
|
523 | 523 | ''' |
|
524 | 524 | This method will be the one that will initiate the data entry, will be called constantly. |
|
525 | 525 | You should first verify that your Setup () is set up and then continue to acquire |
|
526 | 526 | the data to be processed with getData (). |
|
527 | 527 | ''' |
|
528 | 528 | if not self.isConfig: |
|
529 | 529 | self.setup(**kwargs) |
|
530 | 530 | self.isConfig = True |
|
531 | 531 | |
|
532 | 532 | self.getData() |
|
533 | 533 | #print 'running' |
|
534 | 534 | |
|
535 | 535 | |
|
536 | 536 | def setup(self, path=None, |
|
537 | 537 | startDate=None, |
|
538 | 538 | endDate=None, |
|
539 | 539 | startTime=None, |
|
540 | 540 | endTime=None, |
|
541 | 541 | walk=True, |
|
542 | 542 | timezone='utc', |
|
543 | 543 | code = None, |
|
544 | 544 | online=False, |
|
545 | 545 | ReadMode=None, |
|
546 | 546 | **kwargs): |
|
547 | 547 | |
|
548 | 548 | self.isConfig = True |
|
549 | 549 | |
|
550 | 550 | self.path=path |
|
551 | 551 | self.startDate=startDate |
|
552 | 552 | self.endDate=endDate |
|
553 | 553 | self.startTime=startTime |
|
554 | 554 | self.endTime=endTime |
|
555 | 555 | self.walk=walk |
|
556 | 556 | self.ReadMode=int(ReadMode) |
|
557 | 557 | |
|
558 | 558 | pass |
|
559 | 559 | |
|
560 | 560 | |
|
561 | 561 | def getData(self): |
|
562 | 562 | ''' |
|
563 | 563 | Before starting this function, you should check that there is still an unread file, |
|
564 | 564 | If there are still blocks to read or if the data block is empty. |
|
565 | 565 | |
|
566 | 566 | You should call the file "read". |
|
567 | 567 | |
|
568 | 568 | ''' |
|
569 | 569 | |
|
570 | 570 | if self.flagNoMoreFiles: |
|
571 | 571 | self.dataOut.flagNoData = True |
|
572 | 572 | print 'NoData se vuelve true' |
|
573 | 573 | return 0 |
|
574 | 574 | |
|
575 | 575 | self.fp=self.path |
|
576 | 576 | self.Files2Read(self.fp) |
|
577 | 577 | self.readFile(self.fp) |
|
578 | 578 | self.dataOut.data_spc = self.data_spc |
|
579 | 579 | self.dataOut.data_cspc =self.data_cspc |
|
580 | 580 | self.dataOut.data_output=self.data_output |
|
581 | 581 | |
|
582 | 582 | print 'self.dataOut.data_output', shape(self.dataOut.data_output) |
|
583 | 583 | |
|
584 | 584 | #self.removeDC() |
|
585 | 585 | return self.dataOut.data_spc |
|
586 | 586 | |
|
587 | 587 | |
|
588 | 588 | def readFile(self,fp): |
|
589 | 589 | ''' |
|
590 | 590 | You must indicate if you are reading in Online or Offline mode and load the |
|
591 | 591 | The parameters for this file reading mode. |
|
592 | 592 | |
|
593 | 593 | Then you must do 2 actions: |
|
594 | 594 | |
|
595 | 595 | 1. Get the BLTR FileHeader. |
|
596 | 596 | 2. Start reading the first block. |
|
597 | 597 | ''' |
|
598 | 598 | |
|
599 | 599 | #The address of the folder is generated the name of the .fdt file that will be read |
|
600 | 600 | print "File: ",self.fileSelector+1 |
|
601 | 601 | |
|
602 | 602 | if self.fileSelector < len(self.filenameList): |
|
603 | 603 | |
|
604 | 604 | self.fpFile=str(fp)+'/'+str(self.filenameList[self.fileSelector]) |
|
605 | 605 | #print self.fpFile |
|
606 | 606 | fheader = FileHeaderBLTR() |
|
607 | 607 | fheader.FHread(self.fpFile) #Bltr FileHeader Reading |
|
608 | 608 | self.nFDTdataRecors=fheader.nFDTdataRecors |
|
609 | 609 | |
|
610 | 610 | self.readBlock() #Block reading |
|
611 | 611 | else: |
|
612 | 612 | print 'readFile FlagNoData becomes true' |
|
613 | 613 | self.flagNoMoreFiles=True |
|
614 | 614 | self.dataOut.flagNoData = True |
|
615 | 615 | return 0 |
|
616 | 616 | |
|
617 | 617 | def getVelRange(self, extrapoints=0): |
|
618 | 618 | Lambda= SPEED_OF_LIGHT/50000000 |
|
619 | 619 | PRF = self.dataOut.PRF#1./(self.dataOut.ippSeconds * self.dataOut.nCohInt) |
|
620 | 620 | Vmax=-Lambda/(4.*(1./PRF)*self.dataOut.nCohInt*2.) |
|
621 | 621 | deltafreq = PRF / (self.nProfiles) |
|
622 | 622 | deltavel = (Vmax*2) / (self.nProfiles) |
|
623 | 623 | freqrange = deltafreq*(numpy.arange(self.nProfiles)-self.nProfiles/2.) - deltafreq/2 |
|
624 | 624 | velrange = deltavel*(numpy.arange(self.nProfiles)-self.nProfiles/2.) |
|
625 | 625 | return velrange |
|
626 | 626 | |
|
627 | 627 | def readBlock(self): |
|
628 | 628 | ''' |
|
629 | 629 | It should be checked if the block has data, if it is not passed to the next file. |
|
630 | 630 | |
|
631 | 631 | Then the following is done: |
|
632 | 632 | |
|
633 | 633 | 1. Read the RecordHeader |
|
634 | 634 | 2. Fill the buffer with the current block number. |
|
635 | 635 | |
|
636 | 636 | ''' |
|
637 | 637 | |
|
638 | 638 | if self.BlockCounter < self.nFDTdataRecors-2: |
|
639 | 639 | print self.nFDTdataRecors, 'CONDICION!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' |
|
640 | 640 | if self.ReadMode==1: |
|
641 | 641 | rheader = RecordHeaderBLTR(RecCounter=self.BlockCounter+1) |
|
642 | 642 | elif self.ReadMode==0: |
|
643 | 643 | rheader = RecordHeaderBLTR(RecCounter=self.BlockCounter) |
|
644 | 644 | |
|
645 | 645 | rheader.RHread(self.fpFile) #Bltr FileHeader Reading |
|
646 | 646 | |
|
647 | 647 | self.OffsetStartHeader=rheader.OffsetStartHeader |
|
648 | 648 | self.RecCounter=rheader.RecCounter |
|
649 | 649 | self.Off2StartNxtRec=rheader.Off2StartNxtRec |
|
650 | 650 | self.Off2StartData=rheader.Off2StartData |
|
651 | 651 | self.nProfiles=rheader.nProfiles |
|
652 | 652 | self.nChannels=rheader.nChannels |
|
653 | 653 | self.nHeights=rheader.nHeights |
|
654 | 654 | self.frequency=rheader.TransmitFrec |
|
655 | 655 | self.DualModeIndex=rheader.DualModeIndex |
|
656 | 656 | |
|
657 | 657 | self.pairsList =[(0,1),(0,2),(1,2)] |
|
658 | 658 | self.dataOut.pairsList = self.pairsList |
|
659 | 659 | |
|
660 | 660 | self.nRdPairs=len(self.dataOut.pairsList) |
|
661 | 661 | self.dataOut.nRdPairs = self.nRdPairs |
|
662 | 662 | |
|
663 | 663 | self.__firstHeigth=rheader.StartRangeSamp |
|
664 | 664 | self.__deltaHeigth=rheader.SampResolution |
|
665 | 665 | self.dataOut.heightList= self.__firstHeigth + numpy.array(range(self.nHeights))*self.__deltaHeigth |
|
666 | 666 | self.dataOut.channelList = range(self.nChannels) |
|
667 | 667 | self.dataOut.nProfiles=rheader.nProfiles |
|
668 | 668 | self.dataOut.nIncohInt=rheader.nIncohInt |
|
669 | 669 | self.dataOut.nCohInt=rheader.nCohInt |
|
670 | 670 | self.dataOut.ippSeconds= 1/float(rheader.PRFhz) |
|
671 | 671 | self.dataOut.PRF=rheader.PRFhz |
|
672 | 672 | self.dataOut.nFFTPoints=rheader.nProfiles |
|
673 | 673 | self.dataOut.utctime=rheader.nUtime |
|
674 | 674 | self.dataOut.timeZone=0 |
|
675 | 675 | self.dataOut.normFactor= self.dataOut.nProfiles*self.dataOut.nIncohInt*self.dataOut.nCohInt |
|
676 | 676 | self.dataOut.outputInterval= self.dataOut.ippSeconds * self.dataOut.nCohInt * self.dataOut.nIncohInt * self.nProfiles |
|
677 | 677 | |
|
678 | 678 | self.data_output=numpy.ones([3,rheader.nHeights])*numpy.NaN |
|
679 | 679 | print 'self.data_output', shape(self.data_output) |
|
680 | 680 | self.dataOut.velocityX=[] |
|
681 | 681 | self.dataOut.velocityY=[] |
|
682 | 682 | self.dataOut.velocityV=[] |
|
683 | 683 | |
|
684 | 684 | '''Block Reading, the Block Data is received and Reshape is used to give it |
|
685 | 685 | shape. |
|
686 | 686 | ''' |
|
687 | 687 | |
|
688 | 688 | #Procedure to take the pointer to where the date block starts |
|
689 | 689 | startDATA = open(self.fpFile,"rb") |
|
690 | 690 | OffDATA= self.OffsetStartHeader + self.RecCounter*self.Off2StartNxtRec+self.Off2StartData |
|
691 | 691 | startDATA.seek(OffDATA, os.SEEK_SET) |
|
692 | 692 | |
|
693 | 693 | def moving_average(x, N=2): |
|
694 | 694 | return numpy.convolve(x, numpy.ones((N,))/N)[(N-1):] |
|
695 | 695 | |
|
696 | 696 | def gaus(xSamples,a,x0,sigma): |
|
697 | 697 | return a*exp(-(xSamples-x0)**2/(2*sigma**2)) |
|
698 | 698 | |
|
699 | 699 | def Find(x,value): |
|
700 | 700 | for index in range(len(x)): |
|
701 | 701 | if x[index]==value: |
|
702 | 702 | return index |
|
703 | 703 | |
|
704 | 704 | def pol2cart(rho, phi): |
|
705 | 705 | x = rho * numpy.cos(phi) |
|
706 | 706 | y = rho * numpy.sin(phi) |
|
707 | 707 | return(x, y) |
|
708 | 708 | |
|
709 | 709 | |
|
710 | 710 | |
|
711 | 711 | |
|
712 | 712 | if self.DualModeIndex==self.ReadMode: |
|
713 | 713 | |
|
714 | 714 | self.data_fft = numpy.fromfile( startDATA, [('complex','<c8')],self.nProfiles*self.nChannels*self.nHeights ) |
|
715 | 715 | |
|
716 | 716 | self.data_fft=self.data_fft.astype(numpy.dtype('complex')) |
|
717 | 717 | |
|
718 | 718 | self.data_block=numpy.reshape(self.data_fft,(self.nHeights, self.nChannels, self.nProfiles )) |
|
719 | 719 | |
|
720 | 720 | self.data_block = numpy.transpose(self.data_block, (1,2,0)) |
|
721 | 721 | |
|
722 | 722 | copy = self.data_block.copy() |
|
723 | 723 | spc = copy * numpy.conjugate(copy) |
|
724 | 724 | |
|
725 | 725 | self.data_spc = numpy.absolute(spc) # valor absoluto o magnitud |
|
726 | 726 | |
|
727 | 727 | factor = self.dataOut.normFactor |
|
728 | 728 | |
|
729 | 729 | |
|
730 | 730 | z = self.data_spc.copy()#/factor |
|
731 | 731 | z = numpy.where(numpy.isfinite(z), z, numpy.NAN) |
|
732 | 732 | #zdB = 10*numpy.log10(z) |
|
733 | 733 | print ' ' |
|
734 | 734 | print 'Z: ' |
|
735 | 735 | print shape(z) |
|
736 | 736 | print ' ' |
|
737 | 737 | print ' ' |
|
738 | 738 | |
|
739 | 739 | self.dataOut.data_spc=self.data_spc |
|
740 | 740 | |
|
741 | 741 | self.noise = self.dataOut.getNoise(ymin_index=80, ymax_index=132)#/factor |
|
742 | 742 | #noisedB = 10*numpy.log10(self.noise) |
|
743 | 743 | |
|
744 | 744 | |
|
745 | 745 | ySamples=numpy.ones([3,self.nProfiles]) |
|
746 | 746 | phase=numpy.ones([3,self.nProfiles]) |
|
747 | 747 | CSPCSamples=numpy.ones([3,self.nProfiles],dtype=numpy.complex_) |
|
748 | 748 | coherence=numpy.ones([3,self.nProfiles]) |
|
749 | 749 | PhaseSlope=numpy.ones(3) |
|
750 | 750 | PhaseInter=numpy.ones(3) |
|
751 | 751 | |
|
752 | 752 | '''****** Getting CrossSpectra ******''' |
|
753 | 753 | cspc=self.data_block.copy() |
|
754 | 754 | self.data_cspc=self.data_block.copy() |
|
755 | 755 | |
|
756 | 756 | xFrec=self.getVelRange(1) |
|
757 | 757 | VelRange=self.getVelRange(1) |
|
758 | 758 | self.dataOut.VelRange=VelRange |
|
759 | 759 | #print ' ' |
|
760 | 760 | #print ' ' |
|
761 | 761 | #print 'xFrec',xFrec |
|
762 | 762 | #print ' ' |
|
763 | 763 | #print ' ' |
|
764 | 764 | #Height=35 |
|
765 | ||
|
765 | 766 | for i in range(self.nRdPairs): |
|
766 | 767 | |
|
767 | 768 | chan_index0 = self.dataOut.pairsList[i][0] |
|
768 | 769 | chan_index1 = self.dataOut.pairsList[i][1] |
|
769 | 770 | |
|
770 | 771 | self.data_cspc[i,:,:]=cspc[chan_index0,:,:] * numpy.conjugate(cspc[chan_index1,:,:]) |
|
771 | 772 | |
|
772 | 773 | |
|
773 | 774 | '''Getting Eij and Nij''' |
|
774 | 775 | (AntennaX0,AntennaY0)=pol2cart(rheader.AntennaCoord0, rheader.AntennaAngl0*numpy.pi/180) |
|
775 | 776 | (AntennaX1,AntennaY1)=pol2cart(rheader.AntennaCoord1, rheader.AntennaAngl1*numpy.pi/180) |
|
776 | 777 | (AntennaX2,AntennaY2)=pol2cart(rheader.AntennaCoord2, rheader.AntennaAngl2*numpy.pi/180) |
|
777 | 778 | |
|
778 | 779 | E01=AntennaX0-AntennaX1 |
|
779 | 780 | N01=AntennaY0-AntennaY1 |
|
780 | 781 | |
|
781 | 782 | E02=AntennaX0-AntennaX2 |
|
782 | 783 | N02=AntennaY0-AntennaY2 |
|
783 | 784 | |
|
784 | 785 | E12=AntennaX1-AntennaX2 |
|
785 | 786 | N12=AntennaY1-AntennaY2 |
|
786 | 787 | |
|
787 | 788 | self.ChanDist= numpy.array([[E01, N01],[E02,N02],[E12,N12]]) |
|
788 | 789 | |
|
789 | 790 | self.dataOut.ChanDist = self.ChanDist |
|
790 | 791 | |
|
791 | 792 | |
|
792 | 793 | # for Height in range(self.nHeights): |
|
793 | 794 | # |
|
794 | 795 | # for i in range(self.nRdPairs): |
|
795 | 796 | # |
|
796 | 797 | # '''****** Line of Data SPC ******''' |
|
797 | 798 | # zline=z[i,:,Height] |
|
798 | 799 | # |
|
799 | 800 | # '''****** DC is removed ******''' |
|
800 | 801 | # DC=Find(zline,numpy.amax(zline)) |
|
801 | 802 | # zline[DC]=(zline[DC-1]+zline[DC+1])/2 |
|
802 | 803 | # |
|
803 | 804 | # |
|
804 | 805 | # '''****** SPC is normalized ******''' |
|
805 | 806 | # FactNorm= zline.copy() / numpy.sum(zline.copy()) |
|
806 | 807 | # FactNorm= FactNorm/numpy.sum(FactNorm) |
|
807 | 808 | # |
|
808 | 809 | # SmoothSPC=moving_average(FactNorm,N=3) |
|
809 | 810 | # |
|
810 | 811 | # xSamples = ar(range(len(SmoothSPC))) |
|
811 | 812 | # ySamples[i] = SmoothSPC-self.noise[i] |
|
812 | 813 | # |
|
813 | 814 | # for i in range(self.nRdPairs): |
|
814 | 815 | # |
|
815 | 816 | # '''****** Line of Data CSPC ******''' |
|
816 | 817 | # cspcLine=self.data_cspc[i,:,Height].copy() |
|
817 | 818 | # |
|
818 | 819 | # |
|
819 | 820 | # |
|
820 | 821 | # '''****** CSPC is normalized ******''' |
|
821 | 822 | # chan_index0 = self.dataOut.pairsList[i][0] |
|
822 | 823 | # chan_index1 = self.dataOut.pairsList[i][1] |
|
823 | 824 | # CSPCFactor= numpy.sum(ySamples[chan_index0]) * numpy.sum(ySamples[chan_index1]) |
|
824 | 825 | # |
|
825 | 826 | # |
|
826 | 827 | # CSPCNorm= cspcLine.copy() / numpy.sqrt(CSPCFactor) |
|
827 | 828 | # |
|
828 | 829 | # |
|
829 | 830 | # CSPCSamples[i] = CSPCNorm-self.noise[i] |
|
830 | 831 | # coherence[i] = numpy.abs(CSPCSamples[i]) / numpy.sqrt(CSPCFactor) |
|
831 | 832 | # |
|
832 | 833 | # '''****** DC is removed ******''' |
|
833 | 834 | # DC=Find(coherence[i],numpy.amax(coherence[i])) |
|
834 | 835 | # coherence[i][DC]=(coherence[i][DC-1]+coherence[i][DC+1])/2 |
|
835 | 836 | # coherence[i]= moving_average(coherence[i],N=2) |
|
836 | 837 | # |
|
837 | 838 | # phase[i] = moving_average( numpy.arctan2(CSPCSamples[i].imag, CSPCSamples[i].real),N=1)#*180/numpy.pi |
|
838 | 839 | # |
|
839 | 840 | # |
|
840 | 841 | # '''****** Getting fij width ******''' |
|
841 | 842 | # |
|
842 | 843 | # yMean=[] |
|
843 | 844 | # yMean2=[] |
|
844 | 845 | # |
|
845 | 846 | # for j in range(len(ySamples[1])): |
|
846 | 847 | # yMean=numpy.append(yMean,numpy.average([ySamples[0,j],ySamples[1,j],ySamples[2,j]])) |
|
847 | 848 | # |
|
848 | 849 | # '''******* Getting fitting Gaussian ******''' |
|
849 | 850 | # meanGauss=sum(xSamples*yMean) / len(xSamples) |
|
850 | 851 | # sigma=sum(yMean*(xSamples-meanGauss)**2) / len(xSamples) |
|
851 | 852 | # #print 'Height',Height,'SNR', meanGauss/sigma**2 |
|
852 | 853 | # |
|
853 | 854 | # if (abs(meanGauss/sigma**2) > 0.0001) : |
|
854 | 855 | # |
|
855 | 856 | # try: |
|
856 | 857 | # popt,pcov = curve_fit(gaus,xSamples,yMean,p0=[1,meanGauss,sigma]) |
|
857 | 858 | # |
|
858 | 859 | # if numpy.amax(popt)>numpy.amax(yMean)*0.3: |
|
859 | 860 | # FitGauss=gaus(xSamples,*popt) |
|
860 | 861 | # |
|
861 | 862 | # else: |
|
862 | 863 | # FitGauss=numpy.ones(len(xSamples))*numpy.mean(yMean) |
|
863 | 864 | # print 'Verificador: Dentro', Height |
|
864 | 865 | # except RuntimeError: |
|
865 | 866 | # |
|
866 | 867 | # try: |
|
867 | 868 | # for j in range(len(ySamples[1])): |
|
868 | 869 | # yMean2=numpy.append(yMean2,numpy.average([ySamples[1,j],ySamples[2,j]])) |
|
869 | 870 | # popt,pcov = curve_fit(gaus,xSamples,yMean2,p0=[1,meanGauss,sigma]) |
|
870 | 871 | # FitGauss=gaus(xSamples,*popt) |
|
871 | 872 | # print 'Verificador: Exepcion1', Height |
|
872 | 873 | # except RuntimeError: |
|
873 | 874 | # |
|
874 | 875 | # try: |
|
875 | 876 | # popt,pcov = curve_fit(gaus,xSamples,ySamples[1],p0=[1,meanGauss,sigma]) |
|
876 | 877 | # FitGauss=gaus(xSamples,*popt) |
|
877 | 878 | # print 'Verificador: Exepcion2', Height |
|
878 | 879 | # except RuntimeError: |
|
879 | 880 | # FitGauss=numpy.ones(len(xSamples))*numpy.mean(yMean) |
|
880 | 881 | # print 'Verificador: Exepcion3', Height |
|
881 | 882 | # else: |
|
882 | 883 | # FitGauss=numpy.ones(len(xSamples))*numpy.mean(yMean) |
|
883 | 884 | # #print 'Verificador: Fuera', Height |
|
884 | 885 | # |
|
885 | 886 | # |
|
886 | 887 | # |
|
887 | 888 | # Maximun=numpy.amax(yMean) |
|
888 | 889 | # eMinus1=Maximun*numpy.exp(-1) |
|
889 | 890 | # |
|
890 | 891 | # HWpos=Find(FitGauss,min(FitGauss, key=lambda value:abs(value-eMinus1))) |
|
891 | 892 | # HalfWidth= xFrec[HWpos] |
|
892 | 893 | # GCpos=Find(FitGauss, numpy.amax(FitGauss)) |
|
893 | 894 | # Vpos=Find(FactNorm, numpy.amax(FactNorm)) |
|
894 | 895 | # #Vpos=numpy.sum(FactNorm)/len(FactNorm) |
|
895 | 896 | # #Vpos=Find(FactNorm, min(FactNorm, key=lambda value:abs(value- numpy.mean(FactNorm) ))) |
|
896 | 897 | # #print 'GCpos',GCpos, numpy.amax(FitGauss), 'HWpos',HWpos |
|
897 | 898 | # '''****** Getting Fij ******''' |
|
898 | 899 | # |
|
899 | 900 | # GaussCenter=xFrec[GCpos] |
|
900 | 901 | # if (GaussCenter<0 and HalfWidth>0) or (GaussCenter>0 and HalfWidth<0): |
|
901 | 902 | # Fij=abs(GaussCenter)+abs(HalfWidth)+0.0000001 |
|
902 | 903 | # else: |
|
903 | 904 | # Fij=abs(GaussCenter-HalfWidth)+0.0000001 |
|
904 | 905 | # |
|
905 | 906 | # '''****** Getting Frecuency range of significant data ******''' |
|
906 | 907 | # |
|
907 | 908 | # Rangpos=Find(FitGauss,min(FitGauss, key=lambda value:abs(value-Maximun*0.10))) |
|
908 | 909 | # |
|
909 | 910 | # if Rangpos<GCpos: |
|
910 | 911 | # Range=numpy.array([Rangpos,2*GCpos-Rangpos]) |
|
911 | 912 | # else: |
|
912 | 913 | # Range=numpy.array([2*GCpos-Rangpos,Rangpos]) |
|
913 | 914 | # |
|
914 | 915 | # FrecRange=xFrec[Range[0]:Range[1]] |
|
915 | 916 | # |
|
916 | 917 | # #print 'FrecRange', FrecRange |
|
917 | 918 | # '''****** Getting SCPC Slope ******''' |
|
918 | 919 | # |
|
919 | 920 | # for i in range(self.nRdPairs): |
|
920 | 921 | # |
|
921 | 922 | # if len(FrecRange)>5 and len(FrecRange)<self.nProfiles*0.5: |
|
922 | 923 | # PhaseRange=moving_average(phase[i,Range[0]:Range[1]],N=3) |
|
923 | 924 | # |
|
924 | 925 | # slope, intercept, r_value, p_value, std_err = stats.linregress(FrecRange,PhaseRange) |
|
925 | 926 | # PhaseSlope[i]=slope |
|
926 | 927 | # PhaseInter[i]=intercept |
|
927 | 928 | # else: |
|
928 | 929 | # PhaseSlope[i]=0 |
|
929 | 930 | # PhaseInter[i]=0 |
|
930 | 931 | # |
|
931 | 932 | # # plt.figure(i+15) |
|
932 | 933 | # # plt.title('FASE ( CH%s*CH%s )' %(self.dataOut.pairsList[i][0],self.dataOut.pairsList[i][1])) |
|
933 | 934 | # # plt.xlabel('Frecuencia (KHz)') |
|
934 | 935 | # # plt.ylabel('Magnitud') |
|
935 | 936 | # # #plt.subplot(311+i) |
|
936 | 937 | # # plt.plot(FrecRange,PhaseRange,'b') |
|
937 | 938 | # # plt.plot(FrecRange,FrecRange*PhaseSlope[i]+PhaseInter[i],'r') |
|
938 | 939 | # |
|
939 | 940 | # #plt.axis([-0.6, 0.2, -3.2, 3.2]) |
|
940 | 941 | # |
|
941 | 942 | # |
|
942 | 943 | # '''Getting constant C''' |
|
943 | 944 | # cC=(Fij*numpy.pi)**2 |
|
944 | 945 | # |
|
945 | 946 | # # '''Getting Eij and Nij''' |
|
946 | 947 | # # (AntennaX0,AntennaY0)=pol2cart(rheader.AntennaCoord0, rheader.AntennaAngl0*numpy.pi/180) |
|
947 | 948 | # # (AntennaX1,AntennaY1)=pol2cart(rheader.AntennaCoord1, rheader.AntennaAngl1*numpy.pi/180) |
|
948 | 949 | # # (AntennaX2,AntennaY2)=pol2cart(rheader.AntennaCoord2, rheader.AntennaAngl2*numpy.pi/180) |
|
949 | 950 | # # |
|
950 | 951 | # # E01=AntennaX0-AntennaX1 |
|
951 | 952 | # # N01=AntennaY0-AntennaY1 |
|
952 | 953 | # # |
|
953 | 954 | # # E02=AntennaX0-AntennaX2 |
|
954 | 955 | # # N02=AntennaY0-AntennaY2 |
|
955 | 956 | # # |
|
956 | 957 | # # E12=AntennaX1-AntennaX2 |
|
957 | 958 | # # N12=AntennaY1-AntennaY2 |
|
958 | 959 | # |
|
959 | 960 | # '''****** Getting constants F and G ******''' |
|
960 | 961 | # MijEijNij=numpy.array([[E02,N02], [E12,N12]]) |
|
961 | 962 | # MijResult0=(-PhaseSlope[1]*cC) / (2*numpy.pi) |
|
962 | 963 | # MijResult1=(-PhaseSlope[2]*cC) / (2*numpy.pi) |
|
963 | 964 | # MijResults=numpy.array([MijResult0,MijResult1]) |
|
964 | 965 | # (cF,cG) = numpy.linalg.solve(MijEijNij, MijResults) |
|
965 | 966 | # |
|
966 | 967 | # '''****** Getting constants A, B and H ******''' |
|
967 | 968 | # W01=numpy.amax(coherence[0]) |
|
968 | 969 | # W02=numpy.amax(coherence[1]) |
|
969 | 970 | # W12=numpy.amax(coherence[2]) |
|
970 | 971 | # |
|
971 | 972 | # WijResult0=((cF*E01+cG*N01)**2)/cC - numpy.log(W01 / numpy.sqrt(numpy.pi/cC)) |
|
972 | 973 | # WijResult1=((cF*E02+cG*N02)**2)/cC - numpy.log(W02 / numpy.sqrt(numpy.pi/cC)) |
|
973 | 974 | # WijResult2=((cF*E12+cG*N12)**2)/cC - numpy.log(W12 / numpy.sqrt(numpy.pi/cC)) |
|
974 | 975 | # |
|
975 | 976 | # WijResults=numpy.array([WijResult0, WijResult1, WijResult2]) |
|
976 | 977 | # |
|
977 | 978 | # WijEijNij=numpy.array([ [E01**2, N01**2, 2*E01*N01] , [E02**2, N02**2, 2*E02*N02] , [E12**2, N12**2, 2*E12*N12] ]) |
|
978 | 979 | # (cA,cB,cH) = numpy.linalg.solve(WijEijNij, WijResults) |
|
979 | 980 | # |
|
980 | 981 | # VxVy=numpy.array([[cA,cH],[cH,cB]]) |
|
981 | 982 | # |
|
982 | 983 | # VxVyResults=numpy.array([-cF,-cG]) |
|
983 | 984 | # (Vx,Vy) = numpy.linalg.solve(VxVy, VxVyResults) |
|
984 | 985 | # Vzon = Vy |
|
985 | 986 | # Vmer = Vx |
|
986 | 987 | # Vmag=numpy.sqrt(Vzon**2+Vmer**2) |
|
987 | 988 | # Vang=numpy.arctan2(Vmer,Vzon) |
|
988 | 989 | # |
|
989 | 990 | # if abs(Vy)<100 and abs(Vy)> 0.: |
|
990 | 991 | # self.dataOut.velocityX=numpy.append(self.dataOut.velocityX, Vzon) #Vmag |
|
991 | 992 | # #print 'Vmag',Vmag |
|
992 | 993 | # else: |
|
993 | 994 | # self.dataOut.velocityX=numpy.append(self.dataOut.velocityX, NaN) |
|
994 | 995 | # |
|
995 | 996 | # if abs(Vx)<100 and abs(Vx) > 0.: |
|
996 | 997 | # self.dataOut.velocityY=numpy.append(self.dataOut.velocityY, Vmer) #Vang |
|
997 | 998 | # #print 'Vang',Vang |
|
998 | 999 | # else: |
|
999 | 1000 | # self.dataOut.velocityY=numpy.append(self.dataOut.velocityY, NaN) |
|
1000 | 1001 | # |
|
1001 | 1002 | # if abs(GaussCenter)<2: |
|
1002 | 1003 | # self.dataOut.velocityV=numpy.append(self.dataOut.velocityV, xFrec[Vpos]) |
|
1003 | 1004 | # |
|
1004 | 1005 | # else: |
|
1005 | 1006 | # self.dataOut.velocityV=numpy.append(self.dataOut.velocityV, NaN) |
|
1006 | 1007 | # |
|
1007 | 1008 | # |
|
1008 | 1009 | # # print '********************************************' |
|
1009 | 1010 | # # print 'HalfWidth ', HalfWidth |
|
1010 | 1011 | # # print 'Maximun ', Maximun |
|
1011 | 1012 | # # print 'eMinus1 ', eMinus1 |
|
1012 | 1013 | # # print 'Rangpos ', Rangpos |
|
1013 | 1014 | # # print 'GaussCenter ',GaussCenter |
|
1014 | 1015 | # # print 'E01 ',E01 |
|
1015 | 1016 | # # print 'N01 ',N01 |
|
1016 | 1017 | # # print 'E02 ',E02 |
|
1017 | 1018 | # # print 'N02 ',N02 |
|
1018 | 1019 | # # print 'E12 ',E12 |
|
1019 | 1020 | # # print 'N12 ',N12 |
|
1020 | 1021 | # #print 'self.dataOut.velocityX ', self.dataOut.velocityX |
|
1021 | 1022 | # # print 'Fij ', Fij |
|
1022 | 1023 | # # print 'cC ', cC |
|
1023 | 1024 | # # print 'cF ', cF |
|
1024 | 1025 | # # print 'cG ', cG |
|
1025 | 1026 | # # print 'cA ', cA |
|
1026 | 1027 | # # print 'cB ', cB |
|
1027 | 1028 | # # print 'cH ', cH |
|
1028 | 1029 | # # print 'Vx ', Vx |
|
1029 | 1030 | # # print 'Vy ', Vy |
|
1030 | 1031 | # # print 'Vmag ', Vmag |
|
1031 | 1032 | # # print 'Vang ', Vang*180/numpy.pi |
|
1032 | 1033 | # # print 'PhaseSlope ',PhaseSlope[0] |
|
1033 | 1034 | # # print 'PhaseSlope ',PhaseSlope[1] |
|
1034 | 1035 | # # print 'PhaseSlope ',PhaseSlope[2] |
|
1035 | 1036 | # # print '********************************************' |
|
1036 | 1037 | # #print 'data_output',shape(self.dataOut.velocityX), shape(self.dataOut.velocityY) |
|
1037 | 1038 | # |
|
1038 | 1039 | # #print 'self.dataOut.velocityX', len(self.dataOut.velocityX) |
|
1039 | 1040 | # #print 'self.dataOut.velocityY', len(self.dataOut.velocityY) |
|
1040 | 1041 | # #print 'self.dataOut.velocityV', self.dataOut.velocityV |
|
1041 | 1042 | # |
|
1042 | 1043 | # self.data_output[0]=numpy.array(self.dataOut.velocityX) |
|
1043 | 1044 | # self.data_output[1]=numpy.array(self.dataOut.velocityY) |
|
1044 | 1045 | # self.data_output[2]=numpy.array(self.dataOut.velocityV) |
|
1045 | 1046 | # |
|
1046 | 1047 | # prin= self.data_output[0][~numpy.isnan(self.data_output[0])] |
|
1047 | 1048 | # print ' ' |
|
1048 | 1049 | # print 'VmagAverage',numpy.mean(prin) |
|
1049 | 1050 | # print ' ' |
|
1050 | 1051 | # # plt.figure(5) |
|
1051 | 1052 | # # plt.subplot(211) |
|
1052 | 1053 | # # plt.plot(self.dataOut.velocityX,'yo:') |
|
1053 | 1054 | # # plt.subplot(212) |
|
1054 | 1055 | # # plt.plot(self.dataOut.velocityY,'yo:') |
|
1055 | 1056 | # |
|
1056 | 1057 | # # plt.figure(1) |
|
1057 | 1058 | # # # plt.subplot(121) |
|
1058 | 1059 | # # # plt.plot(xFrec,ySamples[0],'k',label='Ch0') |
|
1059 | 1060 | # # # plt.plot(xFrec,ySamples[1],'g',label='Ch1') |
|
1060 | 1061 | # # # plt.plot(xFrec,ySamples[2],'r',label='Ch2') |
|
1061 | 1062 | # # # plt.plot(xFrec,FitGauss,'yo:',label='fit') |
|
1062 | 1063 | # # # plt.legend() |
|
1063 | 1064 | # # plt.title('DATOS A ALTURA DE 2850 METROS') |
|
1064 | 1065 | # # |
|
1065 | 1066 | # # plt.xlabel('Frecuencia (KHz)') |
|
1066 | 1067 | # # plt.ylabel('Magnitud') |
|
1067 | 1068 | # # # plt.subplot(122) |
|
1068 | 1069 | # # # plt.title('Fit for Time Constant') |
|
1069 | 1070 | # # #plt.plot(xFrec,zline) |
|
1070 | 1071 | # # #plt.plot(xFrec,SmoothSPC,'g') |
|
1071 | 1072 | # # plt.plot(xFrec,FactNorm) |
|
1072 | 1073 | # # plt.axis([-4, 4, 0, 0.15]) |
|
1073 | 1074 | # # # plt.xlabel('SelfSpectra KHz') |
|
1074 | 1075 | # # |
|
1075 | 1076 | # # plt.figure(10) |
|
1076 | 1077 | # # # plt.subplot(121) |
|
1077 | 1078 | # # plt.plot(xFrec,ySamples[0],'b',label='Ch0') |
|
1078 | 1079 | # # plt.plot(xFrec,ySamples[1],'y',label='Ch1') |
|
1079 | 1080 | # # plt.plot(xFrec,ySamples[2],'r',label='Ch2') |
|
1080 | 1081 | # # # plt.plot(xFrec,FitGauss,'yo:',label='fit') |
|
1081 | 1082 | # # plt.legend() |
|
1082 | 1083 | # # plt.title('SELFSPECTRA EN CANALES') |
|
1083 | 1084 | # # |
|
1084 | 1085 | # # plt.xlabel('Frecuencia (KHz)') |
|
1085 | 1086 | # # plt.ylabel('Magnitud') |
|
1086 | 1087 | # # # plt.subplot(122) |
|
1087 | 1088 | # # # plt.title('Fit for Time Constant') |
|
1088 | 1089 | # # #plt.plot(xFrec,zline) |
|
1089 | 1090 | # # #plt.plot(xFrec,SmoothSPC,'g') |
|
1090 | 1091 | # # # plt.plot(xFrec,FactNorm) |
|
1091 | 1092 | # # # plt.axis([-4, 4, 0, 0.15]) |
|
1092 | 1093 | # # # plt.xlabel('SelfSpectra KHz') |
|
1093 | 1094 | # # |
|
1094 | 1095 | # # plt.figure(9) |
|
1095 | 1096 | # # |
|
1096 | 1097 | # # |
|
1097 | 1098 | # # plt.title('DATOS SUAVIZADOS') |
|
1098 | 1099 | # # plt.xlabel('Frecuencia (KHz)') |
|
1099 | 1100 | # # plt.ylabel('Magnitud') |
|
1100 | 1101 | # # plt.plot(xFrec,SmoothSPC,'g') |
|
1101 | 1102 | # # |
|
1102 | 1103 | # # #plt.plot(xFrec,FactNorm) |
|
1103 | 1104 | # # plt.axis([-4, 4, 0, 0.15]) |
|
1104 | 1105 | # # # plt.xlabel('SelfSpectra KHz') |
|
1105 | 1106 | # # # |
|
1106 | 1107 | # # plt.figure(2) |
|
1107 | 1108 | # # # #plt.subplot(121) |
|
1108 | 1109 | # # plt.plot(xFrec,yMean,'r',label='Mean SelfSpectra') |
|
1109 | 1110 | # # plt.plot(xFrec,FitGauss,'yo:',label='Ajuste Gaussiano') |
|
1110 | 1111 | # # # plt.plot(xFrec[Rangpos],FitGauss[Find(FitGauss,min(FitGauss, key=lambda value:abs(value-Maximun*0.1)))],'bo') |
|
1111 | 1112 | # # # #plt.plot(xFrec,phase) |
|
1112 | 1113 | # # # plt.xlabel('Suavizado, promediado KHz') |
|
1113 | 1114 | # # plt.title('SELFSPECTRA PROMEDIADO') |
|
1114 | 1115 | # # # #plt.subplot(122) |
|
1115 | 1116 | # # # #plt.plot(xSamples,zline) |
|
1116 | 1117 | # # plt.xlabel('Frecuencia (KHz)') |
|
1117 | 1118 | # # plt.ylabel('Magnitud') |
|
1118 | 1119 | # # plt.legend() |
|
1119 | 1120 | # # # |
|
1120 | 1121 | # # # plt.figure(3) |
|
1121 | 1122 | # # # plt.subplot(311) |
|
1122 | 1123 | # # # #plt.plot(xFrec,phase[0]) |
|
1123 | 1124 | # # # plt.plot(xFrec,phase[0],'g') |
|
1124 | 1125 | # # # plt.subplot(312) |
|
1125 | 1126 | # # # plt.plot(xFrec,phase[1],'g') |
|
1126 | 1127 | # # # plt.subplot(313) |
|
1127 | 1128 | # # # plt.plot(xFrec,phase[2],'g') |
|
1128 | 1129 | # # # #plt.plot(xFrec,phase[2]) |
|
1129 | 1130 | # # # |
|
1130 | 1131 | # # # plt.figure(4) |
|
1131 | 1132 | # # # |
|
1132 | 1133 | # # # plt.plot(xSamples,coherence[0],'b') |
|
1133 | 1134 | # # # plt.plot(xSamples,coherence[1],'r') |
|
1134 | 1135 | # # # plt.plot(xSamples,coherence[2],'g') |
|
1135 | 1136 | # # plt.show() |
|
1136 | 1137 | # # # |
|
1137 | 1138 | # # # plt.clf() |
|
1138 | 1139 | # # # plt.cla() |
|
1139 | 1140 | # # # plt.close() |
|
1140 | 1141 | # |
|
1141 | 1142 | # print ' ' |
|
1142 | 1143 | |
|
1143 | 1144 | |
|
1144 | 1145 | |
|
1145 | 1146 | self.BlockCounter+=2 |
|
1146 | 1147 | |
|
1147 | 1148 | else: |
|
1148 | 1149 | self.fileSelector+=1 |
|
1149 | 1150 | self.BlockCounter=0 |
|
1150 | 1151 | print "Next File" |
|
1151 | 1152 | |
|
1152 | 1153 | |
|
1153 | 1154 | |
|
1154 | 1155 | class BLTRWriter(ProcessingUnit): |
|
1155 | 1156 | ''' |
|
1156 | 1157 | classdocs |
|
1157 | 1158 | ''' |
|
1158 | 1159 | |
|
1159 | 1160 | def __init__(self): |
|
1160 | 1161 | ''' |
|
1161 | 1162 | Constructor |
|
1162 | 1163 | ''' |
|
1163 | 1164 | self.dataOut = None |
|
1164 | 1165 | |
|
1165 | 1166 | self.isConfig = False |
|
1166 | 1167 | |
|
1167 | 1168 | def setup(self, dataIn, path, blocksPerFile, set=0, ext=None): |
|
1168 | 1169 | ''' |
|
1169 | 1170 | In this method we should set all initial parameters. |
|
1170 | 1171 | |
|
1171 | 1172 | Input: |
|
1172 | 1173 | dataIn : Input data will also be outputa data |
|
1173 | 1174 | |
|
1174 | 1175 | ''' |
|
1175 | 1176 | self.dataOut = dataIn |
|
1176 | 1177 | |
|
1177 | 1178 | self.isConfig = True |
|
1178 | 1179 | |
|
1179 | 1180 | return |
|
1180 | 1181 | |
|
1181 | 1182 | def run(self, dataIn, **kwargs): |
|
1182 | 1183 | ''' |
|
1183 | 1184 | This method will be called many times so here you should put all your code |
|
1184 | 1185 | |
|
1185 | 1186 | Inputs: |
|
1186 | 1187 | |
|
1187 | 1188 | dataIn : object with the data |
|
1188 | 1189 | |
|
1189 | 1190 | ''' |
|
1190 | 1191 | |
|
1191 | 1192 | if not self.isConfig: |
|
1192 | 1193 | self.setup(dataIn, **kwargs) |
|
1193 | 1194 |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file, binary diff hidden |
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -1,1 +1,1 | |||
|
1 | <Project description="read bltr data sswma file" id="191" name="test1"><ReadUnit datatype="testBLTRReader" id="1911" inputId="0" name="testBLTRReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="testBLTRReader" /><Parameter format="str" id="191112" name="path" value="/media/erick/6F60F7113095A154/BLTR" /><Parameter format="date" id="191113" name="startDate" value="2017/01/17" /><Parameter format="date" id="191114" name="endDate" value="2018/01/01" /><Parameter format="time" id="191115" name="startTime" value="00:00:00" /><Parameter format="time" id="191116" name="endTime" value="23:59:59" /><Parameter format="str" id="191118" name="ext" value="sswma" /></Operation></ReadUnit><ProcUnit datatype="BLTRProcess" id="1912" inputId="1911" name="BLTRProcess"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="SnrFilter" priority="2" type="self"><Parameter format="float" id="191221" name="snr_val" value="-20" /><Parameter format="int" id="191222" name="modetofilter" value="2" /></Operation><Operation id="19123" name="OutliersFilter" priority="3" type="self"><Parameter format="str" id="191231" name="svalue" value="meridional" /><Parameter format="str" id="191232" name="svalue2" value="inTime" /><Parameter format="float" id="191233" name="method" value="0" /><Parameter format="float" id="191234" name="factor" value="2" /><Parameter format="float" id="191235" name="filter" value="0" /><Parameter format="float" id="191236" name="npoints" value="9" /><Parameter format="int" id="191237" name="modetofilter" value="2" /></Operation><Operation id="19124" name="OutliersFilter" priority="4" type="self"><Parameter format="str" id="191241" name="svalue" value="zonal" /><Parameter format="str" id="191242" name="svalue2" value="inTime" /><Parameter format="float" id="191243" name="method" value="0" /><Parameter format="float" id="191244" name="factor" value="2" /><Parameter format="float" id="191245" name="filter" value="0" /><Parameter format="float" id="191246" name="npoints" value="9" /><Parameter format="int" id="191247" name="modetofilter" value="2" /></Operation><Operation id="19125" name="OutliersFilter" priority="5" type="self"><Parameter format="str" id="191251" name="svalue" value="vertical" /><Parameter format="str" id="191252" name="svalue2" value="inHeight" /><Parameter format="float" id="191253" name="method" value="0" /><Parameter format="float" id="191254" name="factor" value="2" /><Parameter format="float" id="191255" name="filter" value="0" /><Parameter format="float" id="191256" name="npoints" value="9" /><Parameter format="int" id="191257" name="modetofilter" value="2" /></Operation><Operation id="19126" name="prePlot" priority="6" type="self"><Parameter format="int" id="191261" name="modeselect" value="1" /></Operation><Operation id="19127" name="WindProfilerPlot" priority="7" type="other"><Parameter format="int" id="191271" name="id" value="1" /><Parameter format="str" id="191272" name="wintitle" value="" /><Parameter format="intlist" id="191273" name="channelList" value="0" /><Parameter format="int" id="191274" name="SNRmin" value="-10" /><Parameter format="int" id="191275" name="SNRmax" value="50" /><Parameter format="float" id="191276" name="SNRthresh" value="0" /><Parameter format="float" id="191277" name="xmin" value="0" /><Parameter format="float" id="191278" name="xmax" value="24" /><Parameter format="float" id="191279" name="ymax" value="3" /><Parameter format="float" id="191280" name="zmin" value="-20" /><Parameter format="float" id="191281" name="zmax" value="20" /><Parameter format="float" id="191282" name="zmin_ver" value="-200" /><Parameter format="float" id="191283" name="zmax_ver" value="200" /></Operation><Operation id="19128" name="prePlot" priority="8" type="self"><Parameter format="int" id="191281" name="modeselect" value="2" /></Operation><Operation id="19129" name="WindProfilerPlot" priority="9" type="other"><Parameter format="int" id="191291" name="id" value="2" /><Parameter format="str" id="191292" name="wintitle" value="" /><Parameter format="bool" id="191293" name="save" value="1" /><Parameter format="str" id="191294" name="figpath" value="/media/erick/6F60F7113095A154/BLTR/" /><Parameter format="int" id="191295" name="SNRmin" value="-20" /><Parameter format="int" id="191296" name="SNRmax" value="40" /><Parameter format="float" id="191297" name="SNRthresh" value="0" /><Parameter format="float" id="191298" name="xmin" value="0" /><Parameter format="float" id="191299" name="xmax" value="24" /><Parameter format="float" id="191300" name="ymin" value="0" /><Parameter format="float" id="191301" name="ymax" value="10" /><Parameter format="float" id="191302" name="zmin" value="-4" /><Parameter format="float" id="191303" name="zmax" value="4" /><Parameter format="float" id="191304" name="zmin_ver" value="-200" /><Parameter format="float" id="191305" name="zmax_ver" value="200" /></Operation></ProcUnit></Project> No newline at end of file | |
|
1 | <Project description="Segundo Test" id="191" name="test01"><ReadUnit datatype="VoltageReader" id="1911" inputId="0" name="VoltageReader"><Operation id="19111" name="run" priority="1" type="self"><Parameter format="str" id="191111" name="datatype" value="VoltageReader" /><Parameter format="str" id="191112" name="path" value="/home/erick/Documents/Data/Claire_Data/raw" /><Parameter format="date" id="191113" name="startDate" value="2017/07/26" /><Parameter format="date" id="191114" name="endDate" value="2017/07/26" /><Parameter format="time" id="191115" name="startTime" value="10:02:00" /><Parameter format="time" id="191116" name="endTime" value="10:11:00" /><Parameter format="int" id="191118" name="online" value="0" /><Parameter format="int" id="191119" name="walk" value="1" /></Operation><Operation id="19112" name="printNumberOfBlock" priority="2" type="self" /></ReadUnit><ProcUnit datatype="SpectraProc" id="1913" inputId="1912" name="SpectraProc"><Operation id="19131" name="run" priority="1" type="self"><Parameter format="int" id="191311" name="nFFTPoints" value="128" /><Parameter format="pairslist" id="191312" name="pairsList" value="(0,1),(0,2),(1,2)" /></Operation><Operation id="19132" name="removeDC" priority="2" type="self" /><Operation id="19133" name="IncohInt" priority="3" type="external"><Parameter format="float" id="191331" name="n" value="30" /></Operation><Operation id="19134" name="CrossSpectraPlot" priority="4" type="other"><Parameter format="str" id="191341" name="phase_cmap" value="bwr" /><Parameter format="int" id="191342" name="id" value="2005" /><Parameter format="str" id="191343" name="wintitle" value="CrossSpectraPlot_ShortPulse" /><Parameter format="str" id="191344" name="xaxis" value="Velocity" /><Parameter format="float" id="191345" name="ymin" value="1" /><Parameter format="int" id="191346" name="ymax" value="7" /><Parameter format="int" id="191347" name="zmin" value="15" /><Parameter format="int" id="191348" name="zmax" value="60" /><Parameter format="int" id="191349" name="save" value="2" /><Parameter format="str" id="191350" name="figpath" value="/media/erick/6F60F7113095A154/CLAIRE/CLAIRE_WINDS_2MHZ/Images" /></Operation></ProcUnit><ProcUnit datatype="VoltageProc" id="1912" inputId="1911" name="VoltageProc"><Operation id="19121" name="run" priority="1" type="self" /><Operation id="19122" name="setRadarFrequency" priority="2" type="self"><Parameter format="float" id="191221" name="frequency" value="445.09e6" /></Operation><Operation id="19123" name="selectHeights" priority="3" type="self"><Parameter format="float" id="191231" name="minHei" value="0" /><Parameter format="float" id="191232" name="maxHei" value="64" /></Operation></ProcUnit><ProcUnit datatype="Parameters" id="1914" inputId="1913" name="ParametersProc"><Operation id="19141" name="run" priority="1" type="self" /><Operation id="19142" name="GaussianFit" priority="2" type="other" /></ProcUnit></Project> No newline at end of file |
@@ -1,171 +1,171 | |||
|
1 | 1 | ''' |
|
2 | 2 | Created on Nov 09, 2016 |
|
3 | 3 | |
|
4 | 4 | @author: roj- LouVD |
|
5 | 5 | ''' |
|
6 | 6 | import os, sys |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | path = os.path.split(os.getcwd())[0] |
|
10 | 10 | path = os.path.split(path)[0] |
|
11 | 11 | |
|
12 | 12 | sys.path.insert(0, path) |
|
13 | 13 | |
|
14 | 14 | from schainpy.controller import Project |
|
15 | 15 | |
|
16 | 16 | filename = 'test1.xml' |
|
17 | 17 | # path = '/home/jespinoza/workspace/data/bltr/' |
|
18 | 18 | path = '/media/erick/6F60F7113095A154/BLTR/' |
|
19 | 19 | desc = "read bltr data sswma file" |
|
20 | 20 | figpath = '/media/erick/6F60F7113095A154/BLTR/' |
|
21 | 21 | pathhdf5 = '/tmp/' |
|
22 | 22 | |
|
23 | 23 | controllerObj = Project() |
|
24 | 24 | |
|
25 | 25 | controllerObj.setup(id = '191', name='test1', description=desc) |
|
26 | 26 | readUnitConfObj = controllerObj.addReadUnit(datatype='testBLTRReader', |
|
27 | 27 | path=path, |
|
28 | 28 | startDate='2017/01/17', |
|
29 | 29 | endDate='2018/01/01', |
|
30 | 30 | startTime='00:00:00', |
|
31 | 31 | endTime='23:59:59', |
|
32 | 32 | ext='sswma') |
|
33 | 33 | |
|
34 | 34 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='BLTRProcess', |
|
35 | 35 | inputId=readUnitConfObj.getId()) |
|
36 | 36 | |
|
37 | 37 | '''-------------------------------------------Processing--------------------------------------------''' |
|
38 | 38 | |
|
39 | 39 | '''MODE 1: LOW ATMOSPHERE: 0- 3 km''' |
|
40 | 40 | # opObj10 = procUnitConfObj1.addOperation(name='SnrFilter') |
|
41 | 41 | # opObj10.addParameter(name='snr_val', value='-10', format='float') |
|
42 | 42 | # opObj10.addParameter(name='modetofilter', value='1', format='int') |
|
43 | 43 | # |
|
44 | 44 | # opObj10 = procUnitConfObj1.addOperation(name='OutliersFilter') |
|
45 | 45 | # opObj10.addParameter(name='svalue', value='meridional', format='str') |
|
46 | 46 | # opObj10.addParameter(name='svalue2', value='inTime', format='str') |
|
47 | 47 | # opObj10.addParameter(name='method', value='0', format='float') |
|
48 | 48 | # opObj10.addParameter(name='factor', value='1', format='float') |
|
49 | 49 | # opObj10.addParameter(name='filter', value='0', format='float') |
|
50 | 50 | # opObj10.addParameter(name='npoints', value='5', format='float') |
|
51 | 51 | # opObj10.addParameter(name='modetofilter', value='1', format='int') |
|
52 | 52 | # # |
|
53 | 53 | # opObj10 = procUnitConfObj1.addOperation(name='OutliersFilter') |
|
54 | 54 | # opObj10.addParameter(name='svalue', value='zonal', format='str') |
|
55 | 55 | # opObj10.addParameter(name='svalue2', value='inTime', format='str') |
|
56 | 56 | # opObj10.addParameter(name='method', value='0', format='float') |
|
57 | 57 | # opObj10.addParameter(name='factor', value='1', format='float') |
|
58 | 58 | # opObj10.addParameter(name='filter', value='0', format='float') |
|
59 | 59 | # opObj10.addParameter(name='npoints', value='5', format='float') |
|
60 | 60 | # opObj10.addParameter(name='modetofilter', value='1', format='int') |
|
61 | 61 | # # |
|
62 | 62 | # opObj10 = procUnitConfObj1.addOperation(name='OutliersFilter') |
|
63 | 63 | # opObj10.addParameter(name='svalue', value='vertical', format='str') |
|
64 | 64 | # opObj10.addParameter(name='svalue2', value='inHeight', format='str') |
|
65 | 65 | # opObj10.addParameter(name='method', value='0', format='float') |
|
66 | 66 | # opObj10.addParameter(name='factor', value='2', format='float') |
|
67 | 67 | # opObj10.addParameter(name='filter', value='0', format='float') |
|
68 | 68 | # opObj10.addParameter(name='npoints', value='9', format='float') |
|
69 | 69 | # opObj10.addParameter(name='modetofilter', value='1', format='int') |
|
70 | 70 | # |
|
71 | 71 | |
|
72 | 72 | ''' MODE 2: 0 - 10 km ''' |
|
73 | 73 | |
|
74 | 74 | opObj10 = procUnitConfObj1.addOperation(name='SnrFilter') |
|
75 | 75 | opObj10.addParameter(name='snr_val', value='-20', format='float') |
|
76 | 76 | opObj10.addParameter(name='modetofilter', value='2', format='int') |
|
77 | 77 | |
|
78 | 78 | opObj10 = procUnitConfObj1.addOperation(name='OutliersFilter') |
|
79 | 79 | opObj10.addParameter(name='svalue', value='meridional', format='str') |
|
80 | 80 | opObj10.addParameter(name='svalue2', value='inTime', format='str') |
|
81 | 81 | opObj10.addParameter(name='method', value='0', format='float') |
|
82 | 82 | opObj10.addParameter(name='factor', value='2', format='float') |
|
83 | 83 | opObj10.addParameter(name='filter', value='0', format='float') |
|
84 | 84 | opObj10.addParameter(name='npoints', value='9', format='float') |
|
85 | 85 | opObj10.addParameter(name='modetofilter', value='2', format='int') |
|
86 | 86 | # # |
|
87 | 87 | opObj10 = procUnitConfObj1.addOperation(name='OutliersFilter') |
|
88 | 88 | opObj10.addParameter(name='svalue', value='zonal', format='str') |
|
89 | 89 | opObj10.addParameter(name='svalue2', value='inTime', format='str') |
|
90 | 90 | opObj10.addParameter(name='method', value='0', format='float') |
|
91 | 91 | opObj10.addParameter(name='factor', value='2', format='float') |
|
92 | 92 | opObj10.addParameter(name='filter', value='0', format='float') |
|
93 | 93 | opObj10.addParameter(name='npoints', value='9', format='float') |
|
94 | 94 | opObj10.addParameter(name='modetofilter', value='2', format='int') |
|
95 | 95 | # # |
|
96 | 96 | opObj10 = procUnitConfObj1.addOperation(name='OutliersFilter') |
|
97 | 97 | opObj10.addParameter(name='svalue', value='vertical', format='str') |
|
98 | 98 | opObj10.addParameter(name='svalue2', value='inHeight', format='str') |
|
99 | 99 | opObj10.addParameter(name='method', value='0', format='float') |
|
100 | 100 | opObj10.addParameter(name='factor', value='2', format='float') |
|
101 | 101 | opObj10.addParameter(name='filter', value='0', format='float') |
|
102 | 102 | opObj10.addParameter(name='npoints', value='9', format='float') |
|
103 | 103 | opObj10.addParameter(name='modetofilter', value='2', format='int') |
|
104 | 104 | |
|
105 | 105 | # '''-----------------------------------------Writing-------------------------------------------''' |
|
106 | 106 | # |
|
107 | 107 | # # opObj10 = procUnitConfObj1.addOperation(name='testBLTRWriter',optype='other') |
|
108 | 108 | # # opObj10.addParameter(name='path', value = pathhdf5) |
|
109 | 109 | # # opObj10.addParameter(name='modetowrite', value = '2',format='int') |
|
110 | 110 | # # |
|
111 | 111 | # # opObj10 = procUnitConfObj1.addOperation(name='testBLTRWriter',optype='other') |
|
112 | 112 | # # opObj10.addParameter(name='path', value = pathhdf5) |
|
113 | 113 | # # opObj10.addParameter(name='modetowrite', value = '1',format='int') |
|
114 | 114 | # |
|
115 | 115 | # '''----------------------------------------Plotting--------------------------------------------''' |
|
116 | 116 | # |
|
117 | 117 | opObj10 = procUnitConfObj1.addOperation(name='prePlot') |
|
118 | 118 | opObj10.addParameter(name='modeselect',value='1',format='int') |
|
119 | 119 | # # |
|
120 | 120 | opObj10 = procUnitConfObj1.addOperation(name='WindProfilerPlot', optype='other') |
|
121 | 121 | opObj10.addParameter(name='id', value='1', format='int') |
|
122 | 122 | opObj10.addParameter(name='wintitle', value='', format='str') |
|
123 | 123 | opObj10.addParameter(name='channelList', value='0', format='intlist') |
|
124 | 124 | #opObj10.addParameter(name='save', value='1', format='bool') |
|
125 | 125 | #opObj10.addParameter(name='figpath', value=figpath, format='str') |
|
126 | 126 | opObj10.addParameter(name='SNRmin', value='-10', format='int') |
|
127 | 127 | opObj10.addParameter(name='SNRmax', value='50', format='int') |
|
128 | 128 | opObj10.addParameter(name='SNRthresh', value='0', format='float') |
|
129 | 129 | opObj10.addParameter(name='xmin', value='0', format='float') |
|
130 | 130 | opObj10.addParameter(name='xmax', value='24', format='float') |
|
131 | 131 | opObj10.addParameter(name='ymax', value='3', format='float') |
|
132 | 132 | opObj10.addParameter(name='zmin', value='-20', format='float') |
|
133 | 133 | opObj10.addParameter(name='zmax', value='20', format='float') |
|
134 | 134 | opObj10.addParameter(name='zmin_ver', value='-200', format='float') |
|
135 | 135 | opObj10.addParameter(name='zmax_ver', value='200', format='float') |
|
136 | 136 | #opObj10.addParameter(name='showprofile', value='1', format='bool') |
|
137 | 137 | #opObj10.addParameter(name='show', value='1', format='bool') |
|
138 | 138 | |
|
139 | 139 | opObj10 = procUnitConfObj1.addOperation(name='prePlot') |
|
140 | 140 | opObj10.addParameter(name='modeselect',value='2',format='int') |
|
141 | 141 | # |
|
142 | 142 | opObj10 = procUnitConfObj1.addOperation(name='WindProfilerPlot', optype='other') |
|
143 | 143 | opObj10.addParameter(name='id', value='2', format='int') |
|
144 | 144 | opObj10.addParameter(name='wintitle', value='', format='str') |
|
145 | 145 | #opObj10.addParameter(name='channelList', value='0', format='intlist') |
|
146 | 146 | opObj10.addParameter(name='save', value='1', format='bool') |
|
147 | 147 | opObj10.addParameter(name='figpath', value=figpath, format='str') |
|
148 | 148 | opObj10.addParameter(name='SNRmin', value='-20', format='int') |
|
149 | 149 | opObj10.addParameter(name='SNRmax', value='40', format='int') |
|
150 | 150 | opObj10.addParameter(name='SNRthresh', value='0', format='float') |
|
151 | 151 | opObj10.addParameter(name='xmin', value='0', format='float') |
|
152 | 152 | opObj10.addParameter(name='xmax', value='24', format='float') |
|
153 | 153 | opObj10.addParameter(name='ymin', value='0', format='float') |
|
154 |
opObj10.addParameter(name='ymax', value=' |
|
|
154 | opObj10.addParameter(name='ymax', value='7', format='float') | |
|
155 | 155 | opObj10.addParameter(name='zmin', value='-4', format='float') |
|
156 | 156 | opObj10.addParameter(name='zmax', value='4', format='float') |
|
157 | 157 | opObj10.addParameter(name='zmin_ver', value='-200', format='float') |
|
158 | 158 | opObj10.addParameter(name='zmax_ver', value='200', format='float') |
|
159 | 159 | #opObj10.addParameter(name='showprofile', value='1', format='bool') |
|
160 | 160 | #opObj10.addParameter(name='show', value='1', format='bool') |
|
161 | 161 | |
|
162 | 162 | # # print "Escribiendo el archivo XML" |
|
163 | 163 | # controllerObj.writeXml(filename) |
|
164 | 164 | # # print "Leyendo el archivo XML" |
|
165 | 165 | # controllerObj.readXml(filename) |
|
166 | 166 | |
|
167 | 167 | # controllerObj.createObjects() |
|
168 | 168 | # controllerObj.connectObjects() |
|
169 | 169 | # controllerObj.run() |
|
170 | 170 | controllerObj.start() |
|
171 | 171 |
@@ -1,150 +1,151 | |||
|
1 | 1 | #!/usr/bin/env python |
|
2 | 2 | import os, sys |
|
3 | 3 | |
|
4 | 4 | # path = os.path.dirname(os.getcwd()) |
|
5 | 5 | # path = os.path.join(path, 'source') |
|
6 | 6 | # sys.path.insert(0, '../') |
|
7 | 7 | |
|
8 | 8 | from schainpy.controller import Project |
|
9 | 9 | |
|
10 | 10 | xmin = '15.5' |
|
11 | 11 | xmax = '24' |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | desc = "ProcBLTR Test" |
|
15 | 15 | filename = "ProcBLTR.xml" |
|
16 | 16 | figpath = '/media/erick/6F60F7113095A154/BLTR' |
|
17 | 17 | |
|
18 | 18 | controllerObj = Project() |
|
19 | 19 | |
|
20 | 20 | |
|
21 | 21 | controllerObj.setup(id='191', name='test01', description=desc) |
|
22 | 22 | |
|
23 | 23 | readUnitConfObj = controllerObj.addReadUnit(datatype='BLTRReader', |
|
24 | 24 | path='/media/erick/6F60F7113095A154/BLTR/', |
|
25 | 25 | |
|
26 | 26 | endDate='2017/10/19', |
|
27 | 27 | startTime='13:00:00', |
|
28 | 28 | startDate='2016/11/8', |
|
29 | 29 | endTime='23:59:59', |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | online=0, |
|
33 | 33 | walk=0, |
|
34 | 34 | ReadMode='1') |
|
35 | 35 | # expLabel='') |
|
36 | 36 | |
|
37 | 37 | # opObj11 = readUnitConfObj.addOperation(name='printNumberOfBlock') |
|
38 | 38 | |
|
39 | 39 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=readUnitConfObj.getId()) |
|
40 | 40 | |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | opObj11 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') |
|
44 | 44 | opObj11.addParameter(name='n', value='3', format='float') |
|
45 | 45 | |
|
46 | 46 | opObj10 = procUnitConfObj1.addOperation(name='removeDC') |
|
47 | 47 | |
|
48 | 48 | # opObj10 = procUnitConfObj1.addOperation(name='calcMag') |
|
49 | 49 | |
|
50 | 50 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
51 | 51 | # opObj11.addParameter(name='id', value='21', format='int') |
|
52 | 52 | # opObj11.addParameter(name='wintitle', value='SpectraCutPlot', format='str') |
|
53 | 53 | # opObj11.addParameter(name='xaxis', value='frequency', format='str') |
|
54 | 54 | # opObj11.addParameter(name='colormap', value='winter', format='str') |
|
55 | 55 | # opObj11.addParameter(name='xmin', value='-0.005', format='float') |
|
56 | 56 | # opObj11.addParameter(name='xmax', value='0.005', format='float') |
|
57 | 57 | # #opObj10 = procUnitConfObj1.addOperation(name='selectChannels') |
|
58 | 58 | # #opObj10.addParameter(name='channelList', value='0,1', format='intlist') |
|
59 | 59 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
60 | 60 | # opObj11.addParameter(name='id', value='21', format='int') |
|
61 | 61 | # opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') |
|
62 | 62 | # #opObj11.addParameter(name='xaxis', value='Velocity', format='str') |
|
63 | 63 | |
|
64 | 64 | # opObj11.addParameter(name='xaxis', value='velocity', format='str') |
|
65 | 65 | # opObj11.addParameter(name='xmin', value='-0.005', format='float') |
|
66 | 66 | # opObj11.addParameter(name='xmax', value='0.005', format='float') |
|
67 | 67 | |
|
68 | 68 | # opObj11.addParameter(name='ymin', value='225', format='float') |
|
69 | 69 | # opObj11.addParameter(name='ymax', value='3000', format='float') |
|
70 | 70 | # opObj11.addParameter(name='zmin', value='-100', format='int') |
|
71 | 71 | # opObj11.addParameter(name='zmax', value='-65', format='int') |
|
72 | 72 | |
|
73 | 73 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') |
|
74 | 74 | # opObj11.addParameter(name='id', value='10', format='int') |
|
75 | 75 | # opObj11.addParameter(name='wintitle', value='RTI', format='str') |
|
76 | 76 | # opObj11.addParameter(name='ymin', value='0', format='float') |
|
77 | 77 | # opObj11.addParameter(name='ymax', value='4000', format='float') |
|
78 | 78 | # #opObj11.addParameter(name='zmin', value='-100', format='int') |
|
79 | 79 | # #opObj11.addParameter(name='zmax', value='-70', format='int') |
|
80 | 80 | # opObj11.addParameter(name='zmin', value='-90', format='int') |
|
81 | 81 | # opObj11.addParameter(name='zmax', value='-40', format='int') |
|
82 | 82 | # opObj11.addParameter(name='showprofile', value='1', format='int') |
|
83 | 83 | # opObj11.addParameter(name='timerange', value=str(2*60*60), format='int') |
|
84 | 84 | |
|
85 | 85 | opObj11 = procUnitConfObj1.addOperation(name='CrossSpectraPlot', optype='other') |
|
86 | 86 | procUnitConfObj1.addParameter(name='pairsList', value='(0,1),(0,2),(1,2)', format='pairsList') |
|
87 | 87 | opObj11.addParameter(name='id', value='2005', format='int') |
|
88 | 88 | opObj11.addParameter(name='wintitle', value='CrossSpectraPlot_ShortPulse', format='str') |
|
89 | 89 | # opObj11.addParameter(name='exp_code', value='13', format='int') |
|
90 | 90 | opObj11.addParameter(name='xaxis', value='Velocity', format='str') |
|
91 | 91 | #opObj11.addParameter(name='xmin', value='-10', format='float') |
|
92 | 92 | #opObj11.addParameter(name='xmax', value='10', format='float') |
|
93 | 93 | #opObj11.addParameter(name='ymin', value='225', format='float') |
|
94 | 94 | #opObj11.addParameter(name='ymax', value='3000', format='float') |
|
95 | 95 | #opObj11.addParameter(name='phase_min', value='-4', format='int') |
|
96 | 96 | #opObj11.addParameter(name='phase_max', value='4', format='int') |
|
97 | 97 | |
|
98 | 98 | # procUnitConfObj2 = controllerObj.addProcUnit(datatype='CorrelationProc', inputId=procUnitConfObj1.getId()) |
|
99 | 99 | # procUnitConfObj2.addParameter(name='pairsList', value='(0,1),(0,2),(1,2)', format='pairsList') |
|
100 | 100 | |
|
101 | 101 | procUnitConfObj2 = controllerObj.addProcUnit(datatype='Parameters', inputId=procUnitConfObj1.getId()) |
|
102 | 102 | opObj11 = procUnitConfObj2.addOperation(name='SpectralMoments', optype='other') |
|
103 | 103 | opObj22 = procUnitConfObj2.addOperation(name='FullSpectralAnalysis', optype='other') |
|
104 | opObj22.addParameter(name='SNRlimit', value='-4', format='float') | |
|
104 | 105 | # |
|
105 | 106 | opObj22 = procUnitConfObj2.addOperation(name='WindProfilerPlot', optype='other') |
|
106 | 107 | opObj22.addParameter(name='id', value='4', format='int') |
|
107 | 108 | opObj22.addParameter(name='wintitle', value='Wind Profiler', format='str') |
|
108 | 109 | opObj22.addParameter(name='save', value='1', format='bool') |
|
109 | 110 | # opObj22.addParameter(name='figpath', value = '/home/erick/Pictures', format='str') |
|
110 | 111 | |
|
111 | 112 | opObj22.addParameter(name='zmin', value='-20', format='int') |
|
112 | 113 | opObj22.addParameter(name='zmax', value='20', format='int') |
|
113 | 114 | opObj22.addParameter(name='zmin_ver', value='-250', format='float') |
|
114 | 115 | opObj22.addParameter(name='zmax_ver', value='250', format='float') |
|
115 | 116 | opObj22.addParameter(name='SNRmin', value='-5', format='int') |
|
116 | 117 | opObj22.addParameter(name='SNRmax', value='30', format='int') |
|
117 | 118 | # opObj22.addParameter(name='SNRthresh', value='-3.5', format='float') |
|
118 | opObj22.addParameter(name='xmin', value=0, format='float') | |
|
119 | opObj22.addParameter(name='xmax', value=24, format='float') | |
|
119 | opObj22.addParameter(name='xmin', value='0', format='float') | |
|
120 | opObj22.addParameter(name='xmax', value='24', format='float') | |
|
120 | 121 | opObj22.addParameter(name='ymin', value='225', format='float') |
|
121 | 122 | #opObj22.addParameter(name='ymax', value='2000', format='float') |
|
122 | 123 | opObj22.addParameter(name='save', value='1', format='int') |
|
123 | 124 | opObj22.addParameter(name='figpath', value=figpath, format='str') |
|
124 | 125 | |
|
125 | 126 | |
|
126 | 127 | # opObj11.addParameter(name='pairlist', value='(1,0),(0,2),(1,2)', format='pairsList') |
|
127 | 128 | #opObj10 = procUnitConfObj1.addOperation(name='selectHeights') |
|
128 | 129 | #opObj10.addParameter(name='minHei', value='225', format='float') |
|
129 | 130 | #opObj10.addParameter(name='maxHei', value='1000', format='float') |
|
130 | 131 | |
|
131 | 132 | # opObj11 = procUnitConfObj1.addOperation(name='CoherenceMap', optype='other') |
|
132 | 133 | # opObj11.addParameter(name='id', value='102', format='int') |
|
133 | 134 | # opObj11.addParameter(name='wintitle', value='Coherence', format='str') |
|
134 | 135 | # opObj11.addParameter(name='ymin', value='225', format='float') |
|
135 | 136 | # opObj11.addParameter(name='ymax', value='4000', format='float') |
|
136 | 137 | |
|
137 | 138 | # opObj11.addParameter(name='phase_cmap', value='jet', format='str') |
|
138 | 139 | # opObj11.addParameter(name='xmin', value='8.5', format='float') |
|
139 | 140 | # opObj11.addParameter(name='xmax', value='9.5', format='float') |
|
140 | 141 | # opObj11.addParameter(name='figpath', value=figpath, format='str') |
|
141 | 142 | # opObj11.addParameter(name='save', value=1, format='bool') |
|
142 | 143 | # opObj11.addParameter(name='pairsList', value='(1,0),(3,2)', format='pairsList') |
|
143 | 144 | |
|
144 | 145 | # opObj12 = procUnitConfObj1.addOperation(name='PublishData', optype='other') |
|
145 | 146 | # opObj12.addParameter(name='zeromq', value=1, format='int') |
|
146 | 147 | # opObj12.addParameter(name='verbose', value=0, format='bool') |
|
147 | 148 | # opObj12.addParameter(name='server', value='erick2', format='str') |
|
148 | 149 | controllerObj.start() |
|
149 | 150 | |
|
150 | 151 |
General Comments 0
You need to be logged in to leave comments.
Login now