|
@@
-7,7
+7,7
import os
|
|
7
|
import datetime
|
|
7
|
import datetime
|
|
8
|
import numpy
|
|
8
|
import numpy
|
|
9
|
|
|
9
|
|
|
10
|
from figure import Figure, isRealtime
|
|
10
|
from figure import Figure, isRealtime, isTimeInHourRange
|
|
11
|
from plotting_codes import *
|
|
11
|
from plotting_codes import *
|
|
12
|
|
|
12
|
|
|
13
|
class SpectraPlot(Figure):
|
|
13
|
class SpectraPlot(Figure):
|
|
@@
-382,14
+382,14
class CrossSpectraPlot(Figure):
|
|
382
|
# phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
|
|
382
|
# phase = numpy.arctan(-1*coherenceComplex.imag/coherenceComplex.real)*180/numpy.pi
|
|
383
|
phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
|
|
383
|
phase = numpy.arctan2(coherenceComplex.imag, coherenceComplex.real)*180/numpy.pi
|
|
384
|
|
|
384
|
|
|
385
|
title = "Coherence %d%d" %(pair[0], pair[1])
|
|
385
|
title = "Coherence Ch%d * Ch%d" %(pair[0], pair[1])
|
|
386
|
axes0 = self.axesList[i*self.__nsubplots+2]
|
|
386
|
axes0 = self.axesList[i*self.__nsubplots+2]
|
|
387
|
axes0.pcolor(x, y, coherence,
|
|
387
|
axes0.pcolor(x, y, coherence,
|
|
388
|
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=coh_min, zmax=coh_max,
|
|
388
|
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=coh_min, zmax=coh_max,
|
|
389
|
xlabel=xlabel, ylabel=ylabel, title=title,
|
|
389
|
xlabel=xlabel, ylabel=ylabel, title=title,
|
|
390
|
ticksize=9, colormap=coherence_cmap, cblabel='')
|
|
390
|
ticksize=9, colormap=coherence_cmap, cblabel='')
|
|
391
|
|
|
391
|
|
|
392
|
title = "Phase %d%d" %(pair[0], pair[1])
|
|
392
|
title = "Phase Ch%d * Ch%d" %(pair[0], pair[1])
|
|
393
|
axes0 = self.axesList[i*self.__nsubplots+3]
|
|
393
|
axes0 = self.axesList[i*self.__nsubplots+3]
|
|
394
|
axes0.pcolor(x, y, phase,
|
|
394
|
axes0.pcolor(x, y, phase,
|
|
395
|
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
|
|
395
|
xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
|
|
@@
-420,7
+420,7
class RTIPlot(Figure):
|
|
420
|
def __init__(self):
|
|
420
|
def __init__(self):
|
|
421
|
|
|
421
|
|
|
422
|
self.timerange = None
|
|
422
|
self.timerange = None
|
|
423
|
self.__isConfig = False
|
|
423
|
self.isConfig = False
|
|
424
|
self.__nsubplots = 1
|
|
424
|
self.__nsubplots = 1
|
|
425
|
|
|
425
|
|
|
426
|
self.WIDTH = 800
|
|
426
|
self.WIDTH = 800
|
|
@@
-507,6
+507,9
class RTIPlot(Figure):
|
|
507
|
zmax : None
|
|
507
|
zmax : None
|
|
508
|
"""
|
|
508
|
"""
|
|
509
|
|
|
509
|
|
|
|
|
|
510
|
if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
|
|
|
|
|
511
|
return
|
|
|
|
|
512
|
|
|
510
|
if channelList == None:
|
|
513
|
if channelList == None:
|
|
511
|
channelIndexList = dataOut.channelIndexList
|
|
514
|
channelIndexList = dataOut.channelIndexList
|
|
512
|
else:
|
|
515
|
else:
|
|
@@
-516,11
+519,6
class RTIPlot(Figure):
|
|
516
|
raise ValueError, "Channel %d is not in dataOut.channelList"
|
|
519
|
raise ValueError, "Channel %d is not in dataOut.channelList"
|
|
517
|
channelIndexList.append(dataOut.channelList.index(channel))
|
|
520
|
channelIndexList.append(dataOut.channelList.index(channel))
|
|
518
|
|
|
521
|
|
|
519
|
# if timerange != None:
|
|
|
|
|
520
|
# self.timerange = timerange
|
|
|
|
|
521
|
|
|
|
|
|
522
|
#tmin = None
|
|
|
|
|
523
|
#tmax = None
|
|
|
|
|
524
|
factor = dataOut.normFactor
|
|
522
|
factor = dataOut.normFactor
|
|
525
|
x = dataOut.getTimeRange()
|
|
523
|
x = dataOut.getTimeRange()
|
|
526
|
y = dataOut.getHeiRange()
|
|
524
|
y = dataOut.getHeiRange()
|
|
@@
-530,15
+528,16
class RTIPlot(Figure):
|
|
530
|
avg = numpy.average(z, axis=1)
|
|
528
|
avg = numpy.average(z, axis=1)
|
|
531
|
|
|
529
|
|
|
532
|
avgdB = 10.*numpy.log10(avg)
|
|
530
|
avgdB = 10.*numpy.log10(avg)
|
|
533
|
|
|
|
|
|
534
|
|
|
531
|
|
|
535
|
# thisDatetime = dataOut.datatime
|
|
532
|
thisDatetime = dataOut.datatime
|
|
536
|
thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
|
|
533
|
# thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
|
|
537
|
title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
534
|
title = wintitle + " RTI" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
538
|
xlabel = ""
|
|
535
|
xlabel = ""
|
|
539
|
ylabel = "Range (Km)"
|
|
536
|
ylabel = "Range (Km)"
|
|
540
|
|
|
537
|
|
|
541
|
if not self.__isConfig:
|
|
538
|
update_figfile = False
|
|
|
|
|
539
|
|
|
|
|
|
540
|
if not self.isConfig:
|
|
542
|
|
|
541
|
|
|
543
|
nplots = len(channelIndexList)
|
|
542
|
nplots = len(channelIndexList)
|
|
544
|
|
|
543
|
|
|
@@
-567,14
+566,12
class RTIPlot(Figure):
|
|
567
|
self.PLOT_POS = plot_pos
|
|
566
|
self.PLOT_POS = plot_pos
|
|
568
|
|
|
567
|
|
|
569
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
568
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
570
|
self.__isConfig = True
|
|
569
|
self.isConfig = True
|
|
571
|
self.figfile = figfile
|
|
570
|
self.figfile = figfile
|
|
572
|
|
|
571
|
update_figfile = True
|
|
|
|
|
572
|
|
|
573
|
self.setWinTitle(title)
|
|
573
|
self.setWinTitle(title)
|
|
574
|
|
|
574
|
|
|
575
|
if ((self.xmax - x[1]) < (x[1]-x[0])):
|
|
|
|
|
576
|
x[1] = self.xmax
|
|
|
|
|
577
|
|
|
|
|
|
578
|
for i in range(self.nplots):
|
|
575
|
for i in range(self.nplots):
|
|
579
|
index = channelIndexList[i]
|
|
576
|
index = channelIndexList[i]
|
|
580
|
title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
577
|
title = "Channel %d: %s" %(dataOut.channelList[index], thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
@@
-595,12
+592,12
class RTIPlot(Figure):
|
|
595
|
ytick_visible=False,
|
|
592
|
ytick_visible=False,
|
|
596
|
grid='x')
|
|
593
|
grid='x')
|
|
597
|
|
|
594
|
|
|
598
|
self.draw()
|
|
595
|
self.draw()
|
|
599
|
|
|
596
|
|
|
600
|
if x[1] >= self.axesList[0].xmax:
|
|
597
|
if dataOut.ltctime >= self.xmax:
|
|
601
|
self.counter_imagwr = wr_period
|
|
598
|
self.counter_imagwr = wr_period
|
|
602
|
self.__isConfig = False
|
|
599
|
self.isConfig = False
|
|
603
|
self.figfile = None
|
|
600
|
update_figfile = True
|
|
604
|
|
|
601
|
|
|
605
|
self.save(figpath=figpath,
|
|
602
|
self.save(figpath=figpath,
|
|
606
|
figfile=figfile,
|
|
603
|
figfile=figfile,
|
|
@@
-608,7
+605,7
class RTIPlot(Figure):
|
|
608
|
ftp=ftp,
|
|
605
|
ftp=ftp,
|
|
609
|
wr_period=wr_period,
|
|
606
|
wr_period=wr_period,
|
|
610
|
thisDatetime=thisDatetime,
|
|
607
|
thisDatetime=thisDatetime,
|
|
611
|
update_figfile=False)
|
|
608
|
update_figfile=update_figfile)
|
|
612
|
|
|
609
|
|
|
613
|
class CoherenceMap(Figure):
|
|
610
|
class CoherenceMap(Figure):
|
|
614
|
isConfig = None
|
|
611
|
isConfig = None
|
|
@@
-680,7
+677,10
class CoherenceMap(Figure):
|
|
680
|
coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
|
|
677
|
coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
|
|
681
|
server=None, folder=None, username=None, password=None,
|
|
678
|
server=None, folder=None, username=None, password=None,
|
|
682
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
679
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
683
|
|
|
680
|
|
|
|
|
|
681
|
if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
|
|
|
|
|
682
|
return
|
|
|
|
|
683
|
|
|
684
|
if pairsList == None:
|
|
684
|
if pairsList == None:
|
|
685
|
pairsIndexList = dataOut.pairsIndexList
|
|
685
|
pairsIndexList = dataOut.pairsIndexList
|
|
686
|
else:
|
|
686
|
else:
|
|
@@
-700,17
+700,16
class CoherenceMap(Figure):
|
|
700
|
phase_min = -180
|
|
700
|
phase_min = -180
|
|
701
|
if phase_max == None:
|
|
701
|
if phase_max == None:
|
|
702
|
phase_max = 180
|
|
702
|
phase_max = 180
|
|
703
|
|
|
703
|
|
|
704
|
# tmin = None
|
|
|
|
|
705
|
# tmax = None
|
|
|
|
|
706
|
x = dataOut.getTimeRange()
|
|
704
|
x = dataOut.getTimeRange()
|
|
707
|
y = dataOut.getHeiRange()
|
|
705
|
y = dataOut.getHeiRange()
|
|
708
|
|
|
706
|
|
|
709
|
#thisDatetime = dataOut.datatime
|
|
707
|
thisDatetime = dataOut.datatime
|
|
710
|
thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
|
|
708
|
|
|
711
|
title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
709
|
title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
712
|
xlabel = ""
|
|
710
|
xlabel = ""
|
|
713
|
ylabel = "Range (Km)"
|
|
711
|
ylabel = "Range (Km)"
|
|
|
|
|
712
|
update_figfile = False
|
|
714
|
|
|
713
|
|
|
715
|
if not self.isConfig:
|
|
714
|
if not self.isConfig:
|
|
716
|
nplots = len(pairsIndexList)
|
|
715
|
nplots = len(pairsIndexList)
|
|
@@
-738,12
+737,10
class CoherenceMap(Figure):
|
|
738
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
737
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
739
|
|
|
738
|
|
|
740
|
self.isConfig = True
|
|
739
|
self.isConfig = True
|
|
|
|
|
740
|
update_figfile = True
|
|
741
|
|
|
741
|
|
|
742
|
self.setWinTitle(title)
|
|
742
|
self.setWinTitle(title)
|
|
743
|
|
|
743
|
|
|
744
|
if ((self.xmax - x[1]) < (x[1]-x[0])):
|
|
|
|
|
745
|
x[1] = self.xmax
|
|
|
|
|
746
|
|
|
|
|
|
747
|
for i in range(self.nplots):
|
|
744
|
for i in range(self.nplots):
|
|
748
|
|
|
745
|
|
|
749
|
pair = dataOut.pairsList[pairsIndexList[i]]
|
|
746
|
pair = dataOut.pairsList[pairsIndexList[i]]
|
|
@@
-760,7
+757,7
class CoherenceMap(Figure):
|
|
760
|
|
|
757
|
|
|
761
|
counter = 0
|
|
758
|
counter = 0
|
|
762
|
|
|
759
|
|
|
763
|
title = "Coherence %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
|
|
760
|
title = "Coherence Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
|
|
764
|
axes = self.axesList[i*self.__nsubplots*2]
|
|
761
|
axes = self.axesList[i*self.__nsubplots*2]
|
|
765
|
axes.pcolorbuffer(x, y, z,
|
|
762
|
axes.pcolorbuffer(x, y, z,
|
|
766
|
xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
|
|
763
|
xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=zmin, zmax=zmax,
|
|
@@
-782,7
+779,7
class CoherenceMap(Figure):
|
|
782
|
|
|
779
|
|
|
783
|
z = phase.reshape((1,-1))
|
|
780
|
z = phase.reshape((1,-1))
|
|
784
|
|
|
781
|
|
|
785
|
title = "Phase %d%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
|
|
782
|
title = "Phase Ch%d * Ch%d: %s" %(pair[0], pair[1], thisDatetime.strftime("%d-%b-%Y %H:%M:%S"))
|
|
786
|
axes = self.axesList[i*self.__nsubplots*2 + counter]
|
|
783
|
axes = self.axesList[i*self.__nsubplots*2 + counter]
|
|
787
|
axes.pcolorbuffer(x, y, z,
|
|
784
|
axes.pcolorbuffer(x, y, z,
|
|
788
|
xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
|
|
785
|
xmin=self.xmin, xmax=self.xmax, ymin=ymin, ymax=ymax, zmin=phase_min, zmax=phase_max,
|
|
@@
-800,10
+797,10
class CoherenceMap(Figure):
|
|
800
|
|
|
797
|
|
|
801
|
self.draw()
|
|
798
|
self.draw()
|
|
802
|
|
|
799
|
|
|
803
|
if x[1] >= self.axesList[0].xmax:
|
|
800
|
if dataOut.ltctime >= self.xmax:
|
|
804
|
self.counter_imagwr = wr_period
|
|
801
|
self.counter_imagwr = wr_period
|
|
805
|
self.__isConfig = False
|
|
802
|
self.isConfig = False
|
|
806
|
self.figfile = None
|
|
803
|
update_figfile = True
|
|
807
|
|
|
804
|
|
|
808
|
self.save(figpath=figpath,
|
|
805
|
self.save(figpath=figpath,
|
|
809
|
figfile=figfile,
|
|
806
|
figfile=figfile,
|
|
@@
-811,7
+808,7
class CoherenceMap(Figure):
|
|
811
|
ftp=ftp,
|
|
808
|
ftp=ftp,
|
|
812
|
wr_period=wr_period,
|
|
809
|
wr_period=wr_period,
|
|
813
|
thisDatetime=thisDatetime,
|
|
810
|
thisDatetime=thisDatetime,
|
|
814
|
update_figfile=False)
|
|
811
|
update_figfile=update_figfile)
|
|
815
|
|
|
812
|
|
|
816
|
class PowerProfilePlot(Figure):
|
|
813
|
class PowerProfilePlot(Figure):
|
|
817
|
|
|
814
|
|
|
@@
-913,7
+910,7
class PowerProfilePlot(Figure):
|
|
913
|
if xmin == None: xmin = numpy.nanmin(xdB)*0.9
|
|
910
|
if xmin == None: xmin = numpy.nanmin(xdB)*0.9
|
|
914
|
if xmax == None: xmax = numpy.nanmax(xdB)*1.1
|
|
911
|
if xmax == None: xmax = numpy.nanmax(xdB)*1.1
|
|
915
|
|
|
912
|
|
|
916
|
self.__isConfig = True
|
|
913
|
self.isConfig = True
|
|
917
|
|
|
914
|
|
|
918
|
self.setWinTitle(title)
|
|
915
|
self.setWinTitle(title)
|
|
919
|
|
|
916
|
|
|
@@
-949,8
+946,8
class Noise(Figure):
|
|
949
|
self.isConfig = False
|
|
946
|
self.isConfig = False
|
|
950
|
self.__nsubplots = 1
|
|
947
|
self.__nsubplots = 1
|
|
951
|
self.counter_imagwr = 0
|
|
948
|
self.counter_imagwr = 0
|
|
952
|
self.WIDTH = 600
|
|
949
|
self.WIDTH = 800
|
|
953
|
self.HEIGHT = 300
|
|
950
|
self.HEIGHT = 400
|
|
954
|
self.WIDTHPROF = 120
|
|
951
|
self.WIDTHPROF = 120
|
|
955
|
self.HEIGHTPROF = 0
|
|
952
|
self.HEIGHTPROF = 0
|
|
956
|
self.xdata = None
|
|
953
|
self.xdata = None
|
|
@@
-1033,6
+1030,9
class Noise(Figure):
|
|
1033
|
server=None, folder=None, username=None, password=None,
|
|
1030
|
server=None, folder=None, username=None, password=None,
|
|
1034
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
1031
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
1035
|
|
|
1032
|
|
|
|
|
|
1033
|
if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
|
|
|
|
|
1034
|
return
|
|
|
|
|
1035
|
|
|
1036
|
if channelList == None:
|
|
1036
|
if channelList == None:
|
|
1037
|
channelIndexList = dataOut.channelIndexList
|
|
1037
|
channelIndexList = dataOut.channelIndexList
|
|
1038
|
channelList = dataOut.channelList
|
|
1038
|
channelList = dataOut.channelList
|
|
@@
-1049,11
+1049,12
class Noise(Figure):
|
|
1049
|
noise = dataOut.noise[channelIndexList]/factor
|
|
1049
|
noise = dataOut.noise[channelIndexList]/factor
|
|
1050
|
noisedB = 10*numpy.log10(noise)
|
|
1050
|
noisedB = 10*numpy.log10(noise)
|
|
1051
|
|
|
1051
|
|
|
1052
|
#thisDatetime = dataOut.datatime
|
|
1052
|
thisDatetime = dataOut.datatime
|
|
1053
|
thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
|
|
1053
|
|
|
1054
|
title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
1054
|
title = wintitle + " Noise" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
1055
|
xlabel = ""
|
|
1055
|
xlabel = ""
|
|
1056
|
ylabel = "Intensity (dB)"
|
|
1056
|
ylabel = "Intensity (dB)"
|
|
|
|
|
1057
|
update_figfile = False
|
|
1057
|
|
|
1058
|
|
|
1058
|
if not self.isConfig:
|
|
1059
|
if not self.isConfig:
|
|
1059
|
|
|
1060
|
|
|
@@
-1085,13
+1086,14
class Noise(Figure):
|
|
1085
|
self.xdata = numpy.array([])
|
|
1086
|
self.xdata = numpy.array([])
|
|
1086
|
self.ydata = numpy.array([])
|
|
1087
|
self.ydata = numpy.array([])
|
|
1087
|
|
|
1088
|
|
|
|
|
|
1089
|
update_figfile = True
|
|
|
|
|
1090
|
|
|
1088
|
#open file beacon phase
|
|
1091
|
#open file beacon phase
|
|
1089
|
path = '%s%03d' %(self.PREFIX, self.id)
|
|
1092
|
path = '%s%03d' %(self.PREFIX, self.id)
|
|
1090
|
noise_file = os.path.join(path,'%s.txt'%self.name)
|
|
1093
|
noise_file = os.path.join(path,'%s.txt'%self.name)
|
|
1091
|
self.filename_noise = os.path.join(figpath,noise_file)
|
|
1094
|
self.filename_noise = os.path.join(figpath,noise_file)
|
|
1092
|
|
|
1095
|
|
|
1093
|
self.setWinTitle(title)
|
|
1096
|
self.setWinTitle(title)
|
|
1094
|
|
|
|
|
|
1095
|
|
|
1097
|
|
|
1096
|
title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
1098
|
title = "Noise %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
1097
|
|
|
1099
|
|
|
@@
-1114,12
+1116,10
class Noise(Figure):
|
|
1114
|
|
|
1116
|
|
|
1115
|
self.draw()
|
|
1117
|
self.draw()
|
|
1116
|
|
|
1118
|
|
|
1117
|
if x[1] >= self.axesList[0].xmax:
|
|
1119
|
if dataOut.ltctime >= self.xmax:
|
|
1118
|
self.counter_imagwr = wr_period
|
|
1120
|
self.counter_imagwr = wr_period
|
|
1119
|
del self.xdata
|
|
1121
|
self.isConfig = False
|
|
1120
|
del self.ydata
|
|
1122
|
update_figfile = True
|
|
1121
|
self.__isConfig = False
|
|
|
|
|
1122
|
self.figfile = None
|
|
|
|
|
1123
|
|
|
1123
|
|
|
1124
|
self.save(figpath=figpath,
|
|
1124
|
self.save(figpath=figpath,
|
|
1125
|
figfile=figfile,
|
|
1125
|
figfile=figfile,
|
|
@@
-1127,7
+1127,7
class Noise(Figure):
|
|
1127
|
ftp=ftp,
|
|
1127
|
ftp=ftp,
|
|
1128
|
wr_period=wr_period,
|
|
1128
|
wr_period=wr_period,
|
|
1129
|
thisDatetime=thisDatetime,
|
|
1129
|
thisDatetime=thisDatetime,
|
|
1130
|
update_figfile=False)
|
|
1130
|
update_figfile=update_figfile)
|
|
1131
|
|
|
1131
|
|
|
1132
|
#store data beacon phase
|
|
1132
|
#store data beacon phase
|
|
1133
|
if save:
|
|
1133
|
if save:
|
|
@@
-1143,11
+1143,11
class BeaconPhase(Figure):
|
|
1143
|
def __init__(self):
|
|
1143
|
def __init__(self):
|
|
1144
|
|
|
1144
|
|
|
1145
|
self.timerange = 24*60*60
|
|
1145
|
self.timerange = 24*60*60
|
|
1146
|
self.__isConfig = False
|
|
1146
|
self.isConfig = False
|
|
1147
|
self.__nsubplots = 1
|
|
1147
|
self.__nsubplots = 1
|
|
1148
|
self.counter_imagwr = 0
|
|
1148
|
self.counter_imagwr = 0
|
|
1149
|
self.WIDTH = 600
|
|
1149
|
self.WIDTH = 800
|
|
1150
|
self.HEIGHT = 300
|
|
1150
|
self.HEIGHT = 400
|
|
1151
|
self.WIDTHPROF = 120
|
|
1151
|
self.WIDTHPROF = 120
|
|
1152
|
self.HEIGHTPROF = 0
|
|
1152
|
self.HEIGHTPROF = 0
|
|
1153
|
self.xdata = None
|
|
1153
|
self.xdata = None
|
|
@@
-1214,14
+1214,17
class BeaconPhase(Figure):
|
|
1214
|
|
|
1214
|
|
|
1215
|
|
|
1215
|
|
|
1216
|
def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
|
|
1216
|
def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
|
|
1217
|
xmin=None, xmax=None, ymin=None, ymax=None,
|
|
1217
|
xmin=None, xmax=None, ymin=None, ymax=None, hmin=None, hmax=None,
|
|
1218
|
timerange=None,
|
|
1218
|
timerange=None,
|
|
1219
|
save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
|
|
1219
|
save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
|
|
1220
|
server=None, folder=None, username=None, password=None,
|
|
1220
|
server=None, folder=None, username=None, password=None,
|
|
1221
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
1221
|
ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
|
|
1222
|
|
|
1222
|
|
|
|
|
|
1223
|
if not isTimeInHourRange(dataOut.datatime, xmin, xmax):
|
|
|
|
|
1224
|
return
|
|
|
|
|
1225
|
|
|
1223
|
if pairsList == None:
|
|
1226
|
if pairsList == None:
|
|
1224
|
pairsIndexList = dataOut.pairsIndexList
|
|
1227
|
pairsIndexList = dataOut.pairsIndexList[:10]
|
|
1225
|
else:
|
|
1228
|
else:
|
|
1226
|
pairsIndexList = []
|
|
1229
|
pairsIndexList = []
|
|
1227
|
for pair in pairsList:
|
|
1230
|
for pair in pairsList:
|
|
@@
-1234,34
+1237,53
class BeaconPhase(Figure):
|
|
1234
|
|
|
1237
|
|
|
1235
|
# if len(pairsIndexList) > 4:
|
|
1238
|
# if len(pairsIndexList) > 4:
|
|
1236
|
# pairsIndexList = pairsIndexList[0:4]
|
|
1239
|
# pairsIndexList = pairsIndexList[0:4]
|
|
|
|
|
1240
|
|
|
|
|
|
1241
|
hmin_index = None
|
|
|
|
|
1242
|
hmax_index = None
|
|
1237
|
|
|
1243
|
|
|
|
|
|
1244
|
if hmin != None and hmax != None:
|
|
|
|
|
1245
|
indexes = numpy.arange(dataOut.nHeights)
|
|
|
|
|
1246
|
hmin_list = indexes[dataOut.heightList >= hmin]
|
|
|
|
|
1247
|
hmax_list = indexes[dataOut.heightList <= hmax]
|
|
|
|
|
1248
|
|
|
|
|
|
1249
|
if hmin_list.any():
|
|
|
|
|
1250
|
hmin_index = hmin_list[0]
|
|
|
|
|
1251
|
|
|
|
|
|
1252
|
if hmax_list.any():
|
|
|
|
|
1253
|
hmax_index = hmax_list[-1]+1
|
|
|
|
|
1254
|
|
|
1238
|
x = dataOut.getTimeRange()
|
|
1255
|
x = dataOut.getTimeRange()
|
|
1239
|
#y = dataOut.getHeiRange()
|
|
1256
|
#y = dataOut.getHeiRange()
|
|
1240
|
|
|
1257
|
|
|
1241
|
|
|
1258
|
|
|
1242
|
#thisDatetime = dataOut.datatime
|
|
1259
|
thisDatetime = dataOut.datatime
|
|
1243
|
thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[0])
|
|
1260
|
|
|
1244
|
title = wintitle + " Phase of Beacon Signal" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
1261
|
title = wintitle + " Signal Phase" # : %s" %(thisDatetime.strftime("%d-%b-%Y"))
|
|
1245
|
xlabel = "Local Time"
|
|
1262
|
xlabel = "Local Time"
|
|
1246
|
ylabel = "Phase"
|
|
1263
|
ylabel = "Phase (degrees)"
|
|
|
|
|
1264
|
|
|
|
|
|
1265
|
update_figfile = False
|
|
1247
|
|
|
1266
|
|
|
1248
|
nplots = len(pairsIndexList)
|
|
1267
|
nplots = len(pairsIndexList)
|
|
1249
|
#phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
|
|
1268
|
#phase = numpy.zeros((len(pairsIndexList),len(dataOut.beacon_heiIndexList)))
|
|
1250
|
phase_beacon = numpy.zeros(len(pairsIndexList))
|
|
1269
|
phase_beacon = numpy.zeros(len(pairsIndexList))
|
|
1251
|
for i in range(nplots):
|
|
1270
|
for i in range(nplots):
|
|
1252
|
pair = dataOut.pairsList[pairsIndexList[i]]
|
|
1271
|
pair = dataOut.pairsList[pairsIndexList[i]]
|
|
1253
|
ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i],:,:],axis=0)
|
|
1272
|
ccf = numpy.average(dataOut.data_cspc[pairsIndexList[i], :, hmin_index:hmax_index], axis=0)
|
|
1254
|
powa = numpy.average(dataOut.data_spc[pair[0],:,:],axis=0)
|
|
1273
|
powa = numpy.average(dataOut.data_spc[pair[0], :, hmin_index:hmax_index], axis=0)
|
|
1255
|
powb = numpy.average(dataOut.data_spc[pair[1],:,:],axis=0)
|
|
1274
|
powb = numpy.average(dataOut.data_spc[pair[1], :, hmin_index:hmax_index], axis=0)
|
|
1256
|
avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
|
|
1275
|
avgcoherenceComplex = ccf/numpy.sqrt(powa*powb)
|
|
1257
|
phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
|
|
1276
|
phase = numpy.arctan2(avgcoherenceComplex.imag, avgcoherenceComplex.real)*180/numpy.pi
|
|
1258
|
|
|
1277
|
|
|
1259
|
#print "Phase %d%d" %(pair[0], pair[1])
|
|
1278
|
#print "Phase %d%d" %(pair[0], pair[1])
|
|
1260
|
#print phase[dataOut.beacon_heiIndexList]
|
|
1279
|
#print phase[dataOut.beacon_heiIndexList]
|
|
1261
|
|
|
1280
|
|
|
1262
|
phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
|
|
1281
|
if dataOut.beacon_heiIndexList:
|
|
|
|
|
1282
|
phase_beacon[i] = numpy.average(phase[dataOut.beacon_heiIndexList])
|
|
|
|
|
1283
|
else:
|
|
|
|
|
1284
|
phase_beacon[i] = numpy.average(phase)
|
|
1263
|
|
|
1285
|
|
|
1264
|
if not self.__isConfig:
|
|
1286
|
if not self.isConfig:
|
|
1265
|
|
|
1287
|
|
|
1266
|
nplots = len(pairsIndexList)
|
|
1288
|
nplots = len(pairsIndexList)
|
|
1267
|
|
|
1289
|
|
|
@@
-1276,8
+1298,8
class BeaconPhase(Figure):
|
|
1276
|
|
|
1298
|
|
|
1277
|
self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
|
|
1299
|
self.xmin, self.xmax = self.getTimeLim(x, xmin, xmax, timerange)
|
|
1278
|
|
|
1300
|
|
|
1279
|
if ymin == None: ymin = numpy.nanmin(phase_beacon) - 10.0
|
|
1301
|
if ymin == None: ymin = 0
|
|
1280
|
if ymax == None: ymax = numpy.nanmax(phase_beacon) + 10.0
|
|
1302
|
if ymax == None: ymax = 360
|
|
1281
|
|
|
1303
|
|
|
1282
|
self.FTP_WEI = ftp_wei
|
|
1304
|
self.FTP_WEI = ftp_wei
|
|
1283
|
self.EXP_CODE = exp_code
|
|
1305
|
self.EXP_CODE = exp_code
|
|
@@
-1285,11
+1307,13
class BeaconPhase(Figure):
|
|
1285
|
self.PLOT_POS = plot_pos
|
|
1307
|
self.PLOT_POS = plot_pos
|
|
1286
|
|
|
1308
|
|
|
1287
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
1309
|
self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
|
|
1288
|
self.__isConfig = True
|
|
1310
|
self.isConfig = True
|
|
1289
|
self.figfile = figfile
|
|
1311
|
self.figfile = figfile
|
|
1290
|
self.xdata = numpy.array([])
|
|
1312
|
self.xdata = numpy.array([])
|
|
1291
|
self.ydata = numpy.array([])
|
|
1313
|
self.ydata = numpy.array([])
|
|
1292
|
|
|
1314
|
|
|
|
|
|
1315
|
update_figfile = True
|
|
|
|
|
1316
|
|
|
1293
|
#open file beacon phase
|
|
1317
|
#open file beacon phase
|
|
1294
|
path = '%s%03d' %(self.PREFIX, self.id)
|
|
1318
|
path = '%s%03d' %(self.PREFIX, self.id)
|
|
1295
|
beacon_file = os.path.join(path,'%s.txt'%self.name)
|
|
1319
|
beacon_file = os.path.join(path,'%s.txt'%self.name)
|
|
@@
-1303,9
+1327,9
class BeaconPhase(Figure):
|
|
1303
|
self.setWinTitle(title)
|
|
1327
|
self.setWinTitle(title)
|
|
1304
|
|
|
1328
|
|
|
1305
|
|
|
1329
|
|
|
1306
|
title = "Beacon Signal %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
1330
|
title = "Phase Plot %s" %(thisDatetime.strftime("%Y/%m/%d %H:%M:%S"))
|
|
1307
|
|
|
1331
|
|
|
1308
|
legendlabels = ["pairs %d%d"%(pair[0], pair[1]) for pair in dataOut.pairsList]
|
|
1332
|
legendlabels = ["Pair (%d,%d)"%(pair[0], pair[1]) for pair in dataOut.pairsList]
|
|
1309
|
|
|
1333
|
|
|
1310
|
axes = self.axesList[0]
|
|
1334
|
axes = self.axesList[0]
|
|
1311
|
|
|
1335
|
|
|
@@
-1325,12
+1349,10
class BeaconPhase(Figure):
|
|
1325
|
|
|
1349
|
|
|
1326
|
self.draw()
|
|
1350
|
self.draw()
|
|
1327
|
|
|
1351
|
|
|
1328
|
if x[1] >= self.axesList[0].xmax:
|
|
1352
|
if dataOut.ltctime >= self.xmax:
|
|
1329
|
self.counter_imagwr = wr_period
|
|
1353
|
self.counter_imagwr = wr_period
|
|
1330
|
del self.xdata
|
|
1354
|
self.isConfig = False
|
|
1331
|
del self.ydata
|
|
1355
|
update_figfile = True
|
|
1332
|
self.__isConfig = False
|
|
|
|
|
1333
|
self.figfile = None
|
|
|
|
|
1334
|
|
|
1356
|
|
|
1335
|
self.save(figpath=figpath,
|
|
1357
|
self.save(figpath=figpath,
|
|
1336
|
figfile=figfile,
|
|
1358
|
figfile=figfile,
|
|
@@
-1338,4
+1360,4
class BeaconPhase(Figure):
|
|
1338
|
ftp=ftp,
|
|
1360
|
ftp=ftp,
|
|
1339
|
wr_period=wr_period,
|
|
1361
|
wr_period=wr_period,
|
|
1340
|
thisDatetime=thisDatetime,
|
|
1362
|
thisDatetime=thisDatetime,
|
|
1341
|
update_figfile=False)
|
|
1363
|
update_figfile=update_figfile)
|