@@ -446,6 +446,8 class Voltage(JROData): | |||
|
446 | 446 | |
|
447 | 447 | self.flagDataAsBlock = False # Asumo que la data es leida perfil a perfil |
|
448 | 448 | |
|
449 | self.ippFactor = 1 | |
|
450 | ||
|
449 | 451 | self.profileIndex = 0 |
|
450 | 452 | |
|
451 | 453 | def getNoisebyHildebrand(self, channel=None): |
@@ -501,6 +503,21 class Voltage(JROData): | |||
|
501 | 503 | |
|
502 | 504 | return timeInterval |
|
503 | 505 | |
|
506 | def getAcfRange(self, extrapoints=0): | |
|
507 | #print "GET ACF RANGE" | |
|
508 | #print "NFFTPoints",self.nFFTPoints | |
|
509 | #print "IPPFactor", self.ippFactor | |
|
510 | #deltafreq = 10. / ( self.getFmax() / (self.nFFTPoints * self.ippFactor) ) | |
|
511 | deltatime = 1./(self.getFmax()/ self.ippFactor) | |
|
512 | #print "getFmax",self.getFmax() | |
|
513 | #import time | |
|
514 | #time.sleep(30) | |
|
515 | timerange = deltatime * \ | |
|
516 | (numpy.arange(self.nProfiles + extrapoints))#- self.nProfiles / 2.) | |
|
517 | #- deltafreq / 2 | |
|
518 | #print "timerange",timerange | |
|
519 | return timerange | |
|
520 | ||
|
504 | 521 | noise = property(getNoise, "I'm the 'nHeights' property.") |
|
505 | 522 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
506 | 523 |
@@ -8,6 +8,7 import datetime | |||
|
8 | 8 | import numpy |
|
9 | 9 | |
|
10 | 10 | from figure import Figure |
|
11 | from plotting_codes import * | |
|
11 | 12 | |
|
12 | 13 | class Scope(Figure): |
|
13 | 14 | |
@@ -223,3 +224,203 class Scope(Figure): | |||
|
223 | 224 | ftp=ftp, |
|
224 | 225 | wr_period=wr_period, |
|
225 | 226 | thisDatetime=thisDatetime) |
|
227 | ||
|
228 | ||
|
229 | class VoltACFPLot(Figure): | |
|
230 | ||
|
231 | isConfig = None | |
|
232 | __nsubplots = None | |
|
233 | PREFIX = 'voltacf' | |
|
234 | ||
|
235 | def __init__(self, **kwargs): | |
|
236 | Figure.__init__(self,**kwargs) | |
|
237 | self.isConfig = False | |
|
238 | self.__nsubplots = 1 | |
|
239 | self.PLOT_CODE = VOLT_ACF_CODE | |
|
240 | self.WIDTH = 900 | |
|
241 | self.HEIGHT = 700 | |
|
242 | self.counter_imagwr= 0 | |
|
243 | self.FTP_WEI = None | |
|
244 | self.EXP_CODE = None | |
|
245 | self.SUB_EXP_CODE = None | |
|
246 | self.PLOT_POS = None | |
|
247 | ||
|
248 | def getSubplots(self) : | |
|
249 | ncol = 1 | |
|
250 | nrow = 1 | |
|
251 | return nrow, ncol | |
|
252 | ||
|
253 | def setup(self,id, nplots,wintitle,show): | |
|
254 | self.nplots = nplots | |
|
255 | ncolspan = 1 | |
|
256 | colspan = 1 | |
|
257 | self.createFigure(id=id, | |
|
258 | wintitle = wintitle, | |
|
259 | widthplot = self.WIDTH, | |
|
260 | heightplot = self.HEIGHT, | |
|
261 | show = show) | |
|
262 | nrow, ncol = self.getSubplots() | |
|
263 | counter = 0 | |
|
264 | for y in range(nrow): | |
|
265 | for x in range(ncol): | |
|
266 | self.addAxes(nrow, ncol*ncolspan,y, x*ncolspan, colspan, 1) | |
|
267 | ||
|
268 | def run(self,dataOut, id, wintitle="",channelList = None , channel =None, nSamples = None, | |
|
269 | nSampleList= None, resolutionFactor=None, xmin= None, xmax = None, ymin=None, ymax=None, | |
|
270 | save= False, figpath='./', figfile= None,show= True, ftp= False, wr_period=1, server= None, | |
|
271 | folder= None, username =None, password= None, ftp_wei=0 , exp_code=0,sub_exp_code=0,plot_pos=0, | |
|
272 | xaxis="time"): | |
|
273 | ||
|
274 | channel0 = channel | |
|
275 | nSamples = nSamples | |
|
276 | resFactor = resolutionFactor | |
|
277 | ||
|
278 | if nSamples == None: | |
|
279 | nSamples = 20 | |
|
280 | ||
|
281 | if resFactor == None: | |
|
282 | resFactor = 5 | |
|
283 | ||
|
284 | if channel0 == None: | |
|
285 | channel0 = 0 | |
|
286 | else: | |
|
287 | if channel0 not in dataOut.channelList: | |
|
288 | raise ValueError, "Channel %d is not in %s dataOut.channelList"%(channel0, dataOut.channelList) | |
|
289 | ||
|
290 | if channelList == None: | |
|
291 | channelIndexList = dataOut.channelIndexList | |
|
292 | channelList = dataOut.channelList | |
|
293 | ||
|
294 | else: | |
|
295 | channelIndexList = [] | |
|
296 | for channel in channelList: | |
|
297 | if channel not in dataOut.channelList: | |
|
298 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
|
299 | channelIndexList.append(dataOut.channelList.index(channel)) | |
|
300 | ||
|
301 | ||
|
302 | #factor = dataOut.normFactor | |
|
303 | y = dataOut.getHeiRange() | |
|
304 | #print y, dataOut.heightList[0] | |
|
305 | #print "pause" | |
|
306 | #import time | |
|
307 | #time.sleep(10) | |
|
308 | deltaHeight = dataOut.heightList[1]-dataOut.heightList[0] | |
|
309 | z = dataOut.data | |
|
310 | ||
|
311 | shape = dataOut.data.shape | |
|
312 | hei_index = numpy.arange(shape[2]) | |
|
313 | hei_plot = numpy.arange(nSamples)*resFactor | |
|
314 | ||
|
315 | if nSampleList is not None: | |
|
316 | for nsample in nSampleList: | |
|
317 | if nsample not in dataOut.heightList/deltaHeight: | |
|
318 | print "Lista available : %s "%(dataOut.heightList/deltaHeight) | |
|
319 | raise ValueError, "nsample %d is not in %s dataOut.heightList"%(nsample,dataOut.heightList) | |
|
320 | ||
|
321 | if nSampleList is not None: | |
|
322 | hei_plot = numpy.array(nSampleList)*resFactor | |
|
323 | ||
|
324 | if hei_plot[-1] >= hei_index[-1]: | |
|
325 | print ("La cantidad de puntos en altura es %d y la resolucion es %f Km"%(hei_plot.shape[0],deltaHeight*resFactor )) | |
|
326 | raise ValueError, "resFactor %d multiplicado por el valor de %d nSamples es mayor a %d cantidad total de puntos"%(resFactor,nSamples,hei_index[-1]) | |
|
327 | ||
|
328 | #escalamiento -1 a 1 a resolucion (factor de resolucion en altura)* deltaHeight | |
|
329 | #min = numpy.min(z[0,:,0]) | |
|
330 | #max =numpy.max(z[0,:,0]) | |
|
331 | for i in range(shape[0]): | |
|
332 | for j in range(shape[2]): | |
|
333 | min = numpy.min(z[i,:,j]) | |
|
334 | max = numpy.max(z[i,:,j]) | |
|
335 | z[i,:,j]= (((z[i,:,j]-min)/(max-min))*deltaHeight*resFactor + j*deltaHeight+dataOut.heightList[0]) | |
|
336 | ||
|
337 | ||
|
338 | if xaxis == "time": | |
|
339 | x = dataOut.getAcfRange()*1000 | |
|
340 | zdB = z[channel0,:,hei_plot] | |
|
341 | xlabel = "Time (ms)" | |
|
342 | ylabel = "VOLT_ACF" | |
|
343 | ||
|
344 | ||
|
345 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0]) | |
|
346 | title = wintitle + "VOLT ACF Plot Ch %s %s" %(channel0,thisDatetime.strftime("%d-%b-%Y")) | |
|
347 | ||
|
348 | if not self.isConfig: | |
|
349 | ||
|
350 | nplots = 1 | |
|
351 | ||
|
352 | self.setup(id=id, | |
|
353 | nplots=nplots, | |
|
354 | wintitle=wintitle, | |
|
355 | show=show) | |
|
356 | ||
|
357 | if xmin == None: xmin = numpy.nanmin(x)#*0.9 | |
|
358 | if xmax == None: xmax = numpy.nanmax(x)#*1.1 | |
|
359 | if ymin == None: ymin = numpy.nanmin(zdB) | |
|
360 | if ymax == None: ymax = numpy.nanmax(zdB) | |
|
361 | ||
|
362 | print ("El parametro resFactor es %d y la resolucion en altura es %f"%(resFactor,deltaHeight )) | |
|
363 | print ("La cantidad de puntos en altura es %d y la nueva resolucion es %f Km"%(hei_plot.shape[0],deltaHeight*resFactor )) | |
|
364 | print ("La altura maxima es %d Km"%(hei_plot[-1]*deltaHeight )) | |
|
365 | ||
|
366 | self.FTP_WEI = ftp_wei | |
|
367 | self.EXP_CODE = exp_code | |
|
368 | self.SUB_EXP_CODE = sub_exp_code | |
|
369 | self.PLOT_POS = plot_pos | |
|
370 | ||
|
371 | self.isConfig = True | |
|
372 | ||
|
373 | self.setWinTitle(title) | |
|
374 | ||
|
375 | title = "VOLT ACF Plot: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
|
376 | axes = self.axesList[0] | |
|
377 | ||
|
378 | legendlabels = ["Range = %dKm" %y[i] for i in hei_plot] | |
|
379 | ||
|
380 | axes.pmultilineyaxis( x, zdB, | |
|
381 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, | |
|
382 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, | |
|
383 | ytick_visible=True, nxticks=5, | |
|
384 | grid='x') | |
|
385 | ||
|
386 | self.draw() | |
|
387 | ||
|
388 | if figfile == None: | |
|
389 | str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S") | |
|
390 | name = str_datetime | |
|
391 | if ((dataOut.azimuth!=None) and (dataOut.zenith!=None)): | |
|
392 | name = name + '_az' + '_%2.2f'%(dataOut.azimuth) + '_zn' + '_%2.2f'%(dataOut.zenith) | |
|
393 | figfile = self.getFilename(name) | |
|
394 | ||
|
395 | self.save(figpath=figpath, | |
|
396 | figfile=figfile, | |
|
397 | save=save, | |
|
398 | ftp=ftp, | |
|
399 | wr_period=wr_period, | |
|
400 | thisDatetime=thisDatetime) | |
|
401 | ||
|
402 | ||
|
403 | ||
|
404 | ||
|
405 | ||
|
406 | ||
|
407 | ||
|
408 | ||
|
409 | ||
|
410 | ||
|
411 | ||
|
412 | ||
|
413 | ||
|
414 | ||
|
415 | ||
|
416 | ||
|
417 | ||
|
418 | ||
|
419 | ||
|
420 | ||
|
421 | ||
|
422 | ||
|
423 | ||
|
424 | ||
|
425 | ||
|
426 |
@@ -1,6 +1,9 | |||
|
1 | 1 | ''' |
|
2 | 2 | @author: roj-idl71 |
|
3 | 3 | ''' |
|
4 | #USED IN jroplot_voltage.py | |
|
5 | VOLT_ACF_CODE =11 # Volt Autocorrelation function | |
|
6 | ||
|
4 | 7 | #USED IN jroplot_spectra.py |
|
5 | 8 | RTI_CODE = 0 #Range time intensity (RTI). |
|
6 | 9 | SPEC_CODE = 1 #Spectra (and Cross-spectra) information. |
@@ -14,6 +17,7 HEIGHT_CODE = 8 #Height profile. | |||
|
14 | 17 | PHASE_CODE = 9 #Signal Phase. |
|
15 | 18 | ACF_CODE = 10 #Autocorrelation function. |
|
16 | 19 | |
|
20 | ||
|
17 | 21 | POWER_CODE = 16 |
|
18 | 22 | NOISE_CODE = 17 |
|
19 | 23 | BEACON_CODE = 18 |
@@ -1462,6 +1462,7 class voltACFLags(Operation): | |||
|
1462 | 1462 | dataOut.data = self.tmp |
|
1463 | 1463 | dataOut.mode = self.mode |
|
1464 | 1464 | dataOut.nLags = len(self.lags) |
|
1465 | dataOut.nProfiles = len(self.lags) | |
|
1465 | 1466 | dataOut.pairsList = pairsList |
|
1466 | 1467 | dataOut.nPairs = len(pairsList) |
|
1467 | 1468 | dataOut.lagRange = numpy.array(self.lags)*delta |
@@ -16,7 +16,7 if __name__ == '__main__': | |||
|
16 | 16 | |
|
17 | 17 | desc = "High altitude experiment SHORT " |
|
18 | 18 | filename = "schain.xml" |
|
19 |
dpath = '/ |
|
|
19 | dpath = '/media/soporte/APOLLO/hybrid'#'/home/soporte/test_avp' | |
|
20 | 20 | figpath = "/home/soporte/pics" |
|
21 | 21 | remotefolder = "/home/wmaster/graficos" |
|
22 | 22 | t=['0','24'] |
@@ -31,11 +31,11 if __name__ == '__main__': | |||
|
31 | 31 | |
|
32 | 32 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
33 | 33 | path=dpath, |
|
34 |
startDate='2019/10/1 |
|
|
34 | startDate='2019/10/16', | |
|
35 | 35 | # startDate='2018/06/18', |
|
36 |
endDate='2019/10/1 |
|
|
36 | endDate='2019/10/16', | |
|
37 | 37 | # endDate='2018/06/18', |
|
38 |
startTime=' |
|
|
38 | startTime='00:00:00', | |
|
39 | 39 | endTime='23:59:59', |
|
40 | 40 | online=0, |
|
41 | 41 | walk=0, |
General Comments 0
You need to be logged in to leave comments.
Login now