@@ -0,0 +1,47 | |||||
|
1 | import os, sys | |||
|
2 | ||||
|
3 | path = os.path.split(os.getcwd())[0] | |||
|
4 | sys.path.append(path) | |||
|
5 | ||||
|
6 | from controller import * | |||
|
7 | ||||
|
8 | desc = "AMISR Experiment Test" | |||
|
9 | filename = "amisr.xml" | |||
|
10 | ||||
|
11 | controllerObj = Project() | |||
|
12 | ||||
|
13 | controllerObj.setup(id = '191', name='test01', description=desc) | |||
|
14 | ||||
|
15 | path = '/home/administrator/Documents/amisr' | |||
|
16 | ||||
|
17 | readUnitConfObj = controllerObj.addReadUnit(datatype='AMISR', | |||
|
18 | path=path, | |||
|
19 | startDate='2014/08/18', | |||
|
20 | endDate='2014/08/18', | |||
|
21 | startTime='00:00:00', | |||
|
22 | endTime='23:59:59', | |||
|
23 | walk=1) | |||
|
24 | ||||
|
25 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
26 | ||||
|
27 | opObj11 = procUnitConfObj0.addOperation(name='Scope', optype='other') | |||
|
28 | opObj11.addParameter(name='id', value='101', format='int') | |||
|
29 | opObj11.addParameter(name='wintitle', value='AMISR', format='str') | |||
|
30 | opObj11.addParameter(name='type', value='iq', format='str') | |||
|
31 | ||||
|
32 | opObj11 = procUnitConfObjBeam1.addOperation(name='ProfileSelector', optype='other') | |||
|
33 | opObj11.addParameter(name='profileRangeList', value='0,81', format='intlist') | |||
|
34 | ||||
|
35 | opObj11 = procUnitConfObj0.addOperation(name='PowerProfile', optype='other') | |||
|
36 | opObj11.addParameter(name='id', value='102', format='int') | |||
|
37 | opObj11.addParameter(name='wintitle', value='AMISR Power Profile', format='str') | |||
|
38 | ||||
|
39 | ||||
|
40 | print "Escribiendo el archivo XML" | |||
|
41 | controllerObj.writeXml(filename) | |||
|
42 | print "Leyendo el archivo XML" | |||
|
43 | controllerObj.readXml(filename) | |||
|
44 | ||||
|
45 | controllerObj.createObjects() | |||
|
46 | controllerObj.connectObjects() | |||
|
47 | controllerObj.run() |
@@ -0,0 +1,93 | |||||
|
1 | import os, sys | |||
|
2 | ||||
|
3 | path = os.path.split(os.getcwd())[0] | |||
|
4 | sys.path.append(path) | |||
|
5 | ||||
|
6 | from controller import * | |||
|
7 | ||||
|
8 | desc = "AMISR Experiment Test" | |||
|
9 | filename = "amisr.xml" | |||
|
10 | ||||
|
11 | controllerObj = Project() | |||
|
12 | ||||
|
13 | controllerObj.setup(id = '191', name='test01', description=desc) | |||
|
14 | ||||
|
15 | path = '/home/administrator/Documents/amisr' | |||
|
16 | ||||
|
17 | readUnitConfObj = controllerObj.addReadUnit(datatype='AMISR', | |||
|
18 | path=path, | |||
|
19 | startDate='2014/08/18', | |||
|
20 | endDate='2014/08/18', | |||
|
21 | startTime='00:00:00', | |||
|
22 | endTime='23:59:59', | |||
|
23 | walk=1) | |||
|
24 | ||||
|
25 | procUnitConfObjBeam0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
26 | procUnitConfObjBeam1 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
27 | procUnitConfObjBeam2 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
28 | procUnitConfObjBeam3 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
29 | procUnitConfObjBeam4 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
30 | procUnitConfObjBeam5 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
31 | procUnitConfObjBeam6 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |||
|
32 | ||||
|
33 | # Beam0 | |||
|
34 | opObj11 = procUnitConfObjBeam0.addOperation(name='ProfileSelector', optype='other') | |||
|
35 | opObj11.addParameter(name='profileRangeList', value='0,81', format='intlist') | |||
|
36 | ||||
|
37 | opObj11 = procUnitConfObjBeam0.addOperation(name='PowerProfile', optype='other') | |||
|
38 | opObj11.addParameter(name='id', value='10', format='int') | |||
|
39 | opObj11.addParameter(name='wintitle', value='AMISR Beam0 - Power Profile', format='str') | |||
|
40 | ||||
|
41 | # Beam1 | |||
|
42 | opObj11 = procUnitConfObjBeam1.addOperation(name='ProfileSelector', optype='other') | |||
|
43 | opObj11.addParameter(name='profileRangeList', value='82,209', format='intlist') | |||
|
44 | opObj11 = procUnitConfObjBeam1.addOperation(name='PowerProfile', optype='other') | |||
|
45 | opObj11.addParameter(name='id', value='11', format='int') | |||
|
46 | opObj11.addParameter(name='wintitle', value='AMISR Beam1 - Power Profile', format='str') | |||
|
47 | ||||
|
48 | # # Beam2 | |||
|
49 | opObj11 = procUnitConfObjBeam2.addOperation(name='ProfileSelector', optype='other') | |||
|
50 | opObj11.addParameter(name='profileRangeList', value='210,337', format='intlist') | |||
|
51 | opObj11 = procUnitConfObjBeam2.addOperation(name='PowerProfile', optype='other') | |||
|
52 | opObj11.addParameter(name='id', value='12', format='int') | |||
|
53 | opObj11.addParameter(name='wintitle', value='AMISR Beam2 - Power Profile', format='str') | |||
|
54 | # | |||
|
55 | # # Beam3 | |||
|
56 | opObj11 = procUnitConfObjBeam3.addOperation(name='ProfileSelector', optype='other') | |||
|
57 | opObj11.addParameter(name='profileRangeList', value='338,465', format='intlist') | |||
|
58 | opObj11 = procUnitConfObjBeam3.addOperation(name='PowerProfile', optype='other') | |||
|
59 | opObj11.addParameter(name='id', value='13', format='int') | |||
|
60 | opObj11.addParameter(name='wintitle', value='AMISR Beam3 - Power Profile', format='str') | |||
|
61 | ||||
|
62 | # # Beam4 | |||
|
63 | opObj11 = procUnitConfObjBeam4.addOperation(name='ProfileSelector', optype='other') | |||
|
64 | opObj11.addParameter(name='profileRangeList', value='466,593', format='intlist') | |||
|
65 | opObj11 = procUnitConfObjBeam4.addOperation(name='PowerProfile', optype='other') | |||
|
66 | opObj11.addParameter(name='id', value='14', format='int') | |||
|
67 | opObj11.addParameter(name='wintitle', value='AMISR Beam4 - Power Profile', format='str') | |||
|
68 | # | |||
|
69 | # # Beam5 | |||
|
70 | # opObj11 = procUnitConfObjBeam5.addOperation(name='ProfileSelector', optype='other') | |||
|
71 | # opObj11.addParameter(name='profileRangeList', value='594,721', format='intlist') | |||
|
72 | # opObj11 = procUnitConfObjBeam5.addOperation(name='PowerProfile', optype='other') | |||
|
73 | # opObj11.addParameter(name='id', value='15', format='int') | |||
|
74 | # opObj11.addParameter(name='wintitle', value='AMISR Beam5 - Power Profile', format='str') | |||
|
75 | # | |||
|
76 | # # Beam6 | |||
|
77 | # opObj11 = procUnitConfObjBeam6.addOperation(name='ProfileSelector', optype='other') | |||
|
78 | # opObj11.addParameter(name='profileRangeList', value='722,849', format='intlist') | |||
|
79 | # opObj11 = procUnitConfObjBeam6.addOperation(name='PowerProfile', optype='other') | |||
|
80 | # opObj11.addParameter(name='id', value='16', format='int') | |||
|
81 | # opObj11.addParameter(name='wintitle', value='AMISR Beam6 - Power Profile', format='str') | |||
|
82 | ||||
|
83 | ||||
|
84 | ||||
|
85 | ||||
|
86 | print "Escribiendo el archivo XML" | |||
|
87 | controllerObj.writeXml(filename) | |||
|
88 | print "Leyendo el archivo XML" | |||
|
89 | controllerObj.readXml(filename) | |||
|
90 | ||||
|
91 | controllerObj.createObjects() | |||
|
92 | controllerObj.connectObjects() | |||
|
93 | controllerObj.run() |
@@ -82,7 +82,7 def printLabels(ax, xlabel, ylabel, title): | |||||
82 | def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', |
|
82 | def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='', | |
83 | ticksize=9, xtick_visible=True, ytick_visible=True, |
|
83 | ticksize=9, xtick_visible=True, ytick_visible=True, | |
84 | nxticks=4, nyticks=10, |
|
84 | nxticks=4, nyticks=10, | |
85 | grid=None): |
|
85 | grid=None,color='blue'): | |
86 |
|
86 | |||
87 | """ |
|
87 | """ | |
88 |
|
88 | |||
@@ -120,7 +120,7 def createPline(ax, x, y, xmin, xmax, ymin, ymax, xlabel='', ylabel='', title='' | |||||
120 | for tick in ax.yaxis.get_major_ticks(): |
|
120 | for tick in ax.yaxis.get_major_ticks(): | |
121 | tick.label.set_fontsize(ticksize) |
|
121 | tick.label.set_fontsize(ticksize) | |
122 |
|
122 | |||
123 | ax.plot(x, y) |
|
123 | ax.plot(x, y, color=color) | |
124 | iplot = ax.lines[-1] |
|
124 | iplot = ax.lines[-1] | |
125 |
|
125 | |||
126 | ###################################################### |
|
126 | ###################################################### |
@@ -652,6 +652,39 class AMISR: | |||||
652 | self.utctime = None |
|
652 | self.utctime = None | |
653 | self.type = "AMISR" |
|
653 | self.type = "AMISR" | |
654 |
|
654 | |||
|
655 | #propiedades para compatibilidad con Voltages | |||
|
656 | self.timeZone = 0#self.dataIn.timeZone | |||
|
657 | self.dstFlag = 0#self.dataIn.dstFlag | |||
|
658 | self.errorCount = 0#self.dataIn.errorCount | |||
|
659 | self.useLocalTime = True#self.dataIn.useLocalTime | |||
|
660 | ||||
|
661 | self.radarControllerHeaderObj = None#self.dataIn.radarControllerHeaderObj.copy() | |||
|
662 | self.systemHeaderObj = None#self.dataIn.systemHeaderObj.copy() | |||
|
663 | self.channelList = [1]#self.dataIn.channelList esto solo aplica para el caso de AMISR | |||
|
664 | self.dtype = numpy.dtype([('real','<f4'),('imag','<f4')]) | |||
|
665 | ||||
|
666 | self.flagTimeBlock = None#self.dataIn.flagTimeBlock | |||
|
667 | #self.utctime = #self.firstdatatime | |||
|
668 | self.flagDecodeData = None#self.dataIn.flagDecodeData #asumo q la data esta decodificada | |||
|
669 | self.flagDeflipData = None#self.dataIn.flagDeflipData #asumo q la data esta sin flip | |||
|
670 | ||||
|
671 | self.nCohInt = 1#self.dataIn.nCohInt | |||
|
672 | self.nIncohInt = 1 | |||
|
673 | self.ippSeconds = 0.004#self.dataIn.ippSeconds, segun el filename/Setup/Tufile | |||
|
674 | self.windowOfFilter = None#self.dataIn.windowOfFilter | |||
|
675 | ||||
|
676 | self.timeInterval = None#self.dataIn.timeInterval*self.dataOut.nFFTPoints*self.dataOut.nIncohInt | |||
|
677 | self.frequency = 20000#self.dataIn.frequency | |||
|
678 | self.realtime = 0#self.dataIn.realtime | |||
|
679 | ||||
|
680 | #actualizar en la lectura de datos | |||
|
681 | self.heightList = None#self.dataIn.heightList | |||
|
682 | self.nProfiles = None#self.dataOut.nFFTPoints | |||
|
683 | self.nBaud = None#self.dataIn.nBaud | |||
|
684 | self.nCode = None#self.dataIn.nCode | |||
|
685 | self.code = None#self.dataIn.code | |||
|
686 | ||||
|
687 | ||||
655 | def isEmpty(self): |
|
688 | def isEmpty(self): | |
656 |
|
689 | |||
657 | return self.flagNoData No newline at end of file |
|
690 | return self.flagNoData |
@@ -3667,7 +3667,8 class AMISRReader(ProcessingUnit): | |||||
3667 |
|
3667 | |||
3668 | def readRanges(self): |
|
3668 | def readRanges(self): | |
3669 | dataset = self.amisrFilePointer.get('Raw11/Data/Samples/Range') |
|
3669 | dataset = self.amisrFilePointer.get('Raw11/Data/Samples/Range') | |
3670 |
self.rangeFromFile = dataset.value |
|
3670 | #self.rangeFromFile = dataset.value | |
|
3671 | self.rangeFromFile = numpy.reshape(dataset.value,(-1)) | |||
3671 | return range |
|
3672 | return range | |
3672 |
|
3673 | |||
3673 |
|
3674 | |||
@@ -3750,7 +3751,9 class AMISRReader(ProcessingUnit): | |||||
3750 | if self.flagIsNewFile: |
|
3751 | if self.flagIsNewFile: | |
3751 | self.dataByFrame = self.__setDataByFrame() |
|
3752 | self.dataByFrame = self.__setDataByFrame() | |
3752 | self.beamCodeByFrame = self.amisrFilePointer.get('Raw11/Data/RadacHeader/BeamCode').value[idrecord, :] |
|
3753 | self.beamCodeByFrame = self.amisrFilePointer.get('Raw11/Data/RadacHeader/BeamCode').value[idrecord, :] | |
3753 |
|
3754 | |||
|
3755 | #reading ranges | |||
|
3756 | self.readRanges() | |||
3754 | #reading dataset |
|
3757 | #reading dataset | |
3755 | self.dataset = self.__readDataSet() |
|
3758 | self.dataset = self.__readDataSet() | |
3756 |
|
3759 | |||
@@ -3788,6 +3791,13 class AMISRReader(ProcessingUnit): | |||||
3788 | return 1 |
|
3791 | return 1 | |
3789 | return 0 |
|
3792 | return 0 | |
3790 |
|
3793 | |||
|
3794 | def setObjProperties(self): | |||
|
3795 | self.dataOut.heightList = self.rangeFromFile/1000.0 #km | |||
|
3796 | self.dataOut.nProfiles = self.radacHeaderObj.npulses | |||
|
3797 | self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt | |||
|
3798 | self.dataOut.nBaud = None | |||
|
3799 | self.dataOut.nCode = None | |||
|
3800 | self.dataOut.code = None | |||
3791 |
|
3801 | |||
3792 | def getData(self): |
|
3802 | def getData(self): | |
3793 |
|
3803 | |||
@@ -3820,6 +3830,7 class AMISRReader(ProcessingUnit): | |||||
3820 | def run(self, **kwargs): |
|
3830 | def run(self, **kwargs): | |
3821 | if not(self.isConfig): |
|
3831 | if not(self.isConfig): | |
3822 | self.setup(**kwargs) |
|
3832 | self.setup(**kwargs) | |
|
3833 | self.setObjProperties() | |||
3823 | self.isConfig = True |
|
3834 | self.isConfig = True | |
3824 |
|
3835 | |||
3825 | self.getData() |
|
3836 | self.getData() |
@@ -866,7 +866,7 class Scope(Figure): | |||||
866 | def __init__(self): |
|
866 | def __init__(self): | |
867 |
|
867 | |||
868 | self.__isConfig = False |
|
868 | self.__isConfig = False | |
869 |
self.WIDTH = |
|
869 | self.WIDTH = 300 | |
870 | self.HEIGHT = 200 |
|
870 | self.HEIGHT = 200 | |
871 | self.counter_imagwr = 0 |
|
871 | self.counter_imagwr = 0 | |
872 |
|
872 | |||
@@ -890,13 +890,80 class Scope(Figure): | |||||
890 |
|
890 | |||
891 | for i in range(nplots): |
|
891 | for i in range(nplots): | |
892 | self.addAxes(nrow, ncol, i, 0, colspan, rowspan) |
|
892 | self.addAxes(nrow, ncol, i, 0, colspan, rowspan) | |
|
893 | ||||
|
894 | def plot_iq(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): | |||
|
895 | yreal = y[channelIndexList,:].real | |||
|
896 | yimag = y[channelIndexList,:].imag | |||
|
897 | ||||
|
898 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |||
|
899 | xlabel = "Range (Km)" | |||
|
900 | ylabel = "Intensity - IQ" | |||
|
901 | ||||
|
902 | if not self.__isConfig: | |||
|
903 | nplots = len(channelIndexList) | |||
893 |
|
904 | |||
|
905 | self.setup(id=id, | |||
|
906 | nplots=nplots, | |||
|
907 | wintitle='', | |||
|
908 | show=show) | |||
|
909 | ||||
|
910 | if xmin == None: xmin = numpy.nanmin(x) | |||
|
911 | if xmax == None: xmax = numpy.nanmax(x) | |||
|
912 | if ymin == None: ymin = min(numpy.nanmin(yreal),numpy.nanmin(yimag)) | |||
|
913 | if ymax == None: ymax = max(numpy.nanmax(yreal),numpy.nanmax(yimag)) | |||
|
914 | ||||
|
915 | self.__isConfig = True | |||
|
916 | ||||
|
917 | self.setWinTitle(title) | |||
|
918 | ||||
|
919 | for i in range(len(self.axesList)): | |||
|
920 | title = "Channel %d" %(i) | |||
|
921 | axes = self.axesList[i] | |||
|
922 | ||||
|
923 | axes.pline(x, yreal[i,:], | |||
|
924 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, | |||
|
925 | xlabel=xlabel, ylabel=ylabel, title=title) | |||
|
926 | ||||
|
927 | axes.addpline(x, yimag[i,:], idline=1, color="red", linestyle="solid", lw=2) | |||
|
928 | ||||
|
929 | def plot_power(self, x, y, id, channelIndexList, thisDatetime, wintitle, show, xmin, xmax, ymin, ymax): | |||
|
930 | y = y[channelIndexList,:] * numpy.conjugate(y[channelIndexList,:]) | |||
|
931 | yreal = y.real | |||
|
932 | ||||
|
933 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |||
|
934 | xlabel = "Range (Km)" | |||
|
935 | ylabel = "Intensity" | |||
|
936 | ||||
|
937 | if not self.__isConfig: | |||
|
938 | nplots = len(channelIndexList) | |||
|
939 | ||||
|
940 | self.setup(id=id, | |||
|
941 | nplots=nplots, | |||
|
942 | wintitle='', | |||
|
943 | show=show) | |||
|
944 | ||||
|
945 | if xmin == None: xmin = numpy.nanmin(x) | |||
|
946 | if xmax == None: xmax = numpy.nanmax(x) | |||
|
947 | if ymin == None: ymin = numpy.nanmin(yreal) | |||
|
948 | if ymax == None: ymax = numpy.nanmax(yreal) | |||
|
949 | ||||
|
950 | self.__isConfig = True | |||
|
951 | ||||
|
952 | self.setWinTitle(title) | |||
894 |
|
953 | |||
|
954 | for i in range(len(self.axesList)): | |||
|
955 | title = "Channel %d" %(i) | |||
|
956 | axes = self.axesList[i] | |||
|
957 | ychannel = yreal[i,:] | |||
|
958 | axes.pline(x, ychannel, | |||
|
959 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, | |||
|
960 | xlabel=xlabel, ylabel=ylabel, title=title) | |||
|
961 | ||||
895 |
|
962 | |||
896 | def run(self, dataOut, id, wintitle="", channelList=None, |
|
963 | def run(self, dataOut, id, wintitle="", channelList=None, | |
897 | xmin=None, xmax=None, ymin=None, ymax=None, save=False, |
|
964 | xmin=None, xmax=None, ymin=None, ymax=None, save=False, | |
898 | figpath='./', figfile=None, show=True, wr_period=1, |
|
965 | figpath='./', figfile=None, show=True, wr_period=1, | |
899 | server=None, folder=None, username=None, password=None): |
|
966 | server=None, folder=None, username=None, password=None, type='power'): | |
900 |
|
967 | |||
901 | """ |
|
968 | """ | |
902 |
|
969 | |||
@@ -924,36 +991,34 class Scope(Figure): | |||||
924 | y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) |
|
991 | y = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) | |
925 | y = y.real |
|
992 | y = y.real | |
926 |
|
993 | |||
927 | #thisDatetime = dataOut.datatime |
|
|||
928 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
994 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) | |
929 | title = wintitle + " Scope: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
|||
930 | xlabel = "Range (Km)" |
|
|||
931 | ylabel = "Intensity" |
|
|||
932 |
|
995 | |||
933 | if not self.__isConfig: |
|
996 | if type == "power": | |
934 | nplots = len(channelIndexList) |
|
997 | self.plot_power(dataOut.heightList, | |
935 |
|
998 | dataOut.data, | ||
936 | self.setup(id=id, |
|
999 | id, | |
937 |
|
|
1000 | channelIndexList, | |
938 |
|
|
1001 | thisDatetime, | |
939 |
|
|
1002 | wintitle, | |
940 |
|
1003 | show, | ||
941 | if xmin == None: xmin = numpy.nanmin(x) |
|
1004 | xmin, | |
942 | if xmax == None: xmax = numpy.nanmax(x) |
|
1005 | xmax, | |
943 | if ymin == None: ymin = numpy.nanmin(y) |
|
1006 | ymin, | |
944 | if ymax == None: ymax = numpy.nanmax(y) |
|
1007 | ymax) | |
945 |
|
|
1008 | ||
946 | self.__isConfig = True |
|
1009 | if type == "iq": | |
947 |
|
1010 | self.plot_iq(dataOut.heightList, | ||
948 | self.setWinTitle(title) |
|
1011 | dataOut.data, | |
|
1012 | id, | |||
|
1013 | channelIndexList, | |||
|
1014 | thisDatetime, | |||
|
1015 | wintitle, | |||
|
1016 | show, | |||
|
1017 | xmin, | |||
|
1018 | xmax, | |||
|
1019 | ymin, | |||
|
1020 | ymax) | |||
949 |
|
1021 | |||
950 | for i in range(len(self.axesList)): |
|
|||
951 | title = "Channel %d" %(i) |
|
|||
952 | axes = self.axesList[i] |
|
|||
953 | ychannel = y[i,:] |
|
|||
954 | axes.pline(x, ychannel, |
|
|||
955 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
|||
956 | xlabel=xlabel, ylabel=ylabel, title=title) |
|
|||
957 |
|
1022 | |||
958 | self.draw() |
|
1023 | self.draw() | |
959 |
|
1024 | |||
@@ -970,7 +1035,7 class Scope(Figure): | |||||
970 | self.sendByFTP_Thread(ftp_filename, server, folder, username, password) |
|
1035 | self.sendByFTP_Thread(ftp_filename, server, folder, username, password) | |
971 | self.counter_imagwr = 0 |
|
1036 | self.counter_imagwr = 0 | |
972 |
|
1037 | |||
973 |
class PowerProfile |
|
1038 | class PowerProfile(Figure): | |
974 | __isConfig = None |
|
1039 | __isConfig = None | |
975 | __nsubplots = None |
|
1040 | __nsubplots = None | |
976 |
|
1041 | |||
@@ -1027,15 +1092,28 class PowerProfilePlot(Figure): | |||||
1027 | raise ValueError, "Channel %d is not in dataOut.channelList" |
|
1092 | raise ValueError, "Channel %d is not in dataOut.channelList" | |
1028 | channelIndexList.append(dataOut.channelList.index(channel)) |
|
1093 | channelIndexList.append(dataOut.channelList.index(channel)) | |
1029 |
|
1094 | |||
1030 | factor = dataOut.normFactor |
|
1095 | try: | |
1031 | y = dataOut.getHeiRange() |
|
1096 | factor = dataOut.normFactor | |
1032 | x = dataOut.data_spc[channelIndexList,:,:]/factor |
|
1097 | except: | |
1033 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) |
|
1098 | factor = 1 | |
1034 | avg = numpy.average(x, axis=1) |
|
|||
1035 |
|
1099 | |||
1036 | avgdB = 10*numpy.log10(avg) |
|
1100 | y = dataOut.getHeiRange() | |
|
1101 | ||||
|
1102 | #for voltage | |||
|
1103 | if dataOut.type == 'Voltage': | |||
|
1104 | x = dataOut.data[channelIndexList,:] * numpy.conjugate(dataOut.data[channelIndexList,:]) | |||
|
1105 | x = x.real | |||
|
1106 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) | |||
|
1107 | ||||
|
1108 | #for spectra | |||
|
1109 | if dataOut.type == 'Spectra': | |||
|
1110 | x = dataOut.data_spc[channelIndexList,:,:]/factor | |||
|
1111 | x = numpy.where(numpy.isfinite(x), x, numpy.NAN) | |||
|
1112 | x = numpy.average(x, axis=1) | |||
|
1113 | ||||
|
1114 | ||||
|
1115 | xdB = 10*numpy.log10(x) | |||
1037 |
|
1116 | |||
1038 | #thisDatetime = dataOut.datatime |
|
|||
1039 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) |
|
1117 | thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1]) | |
1040 | title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y")) |
|
1118 | title = wintitle + " Power Profile %s" %(thisDatetime.strftime("%d-%b-%Y")) | |
1041 | xlabel = "dB" |
|
1119 | xlabel = "dB" | |
@@ -1052,19 +1130,18 class PowerProfilePlot(Figure): | |||||
1052 |
|
1130 | |||
1053 | if ymin == None: ymin = numpy.nanmin(y) |
|
1131 | if ymin == None: ymin = numpy.nanmin(y) | |
1054 | if ymax == None: ymax = numpy.nanmax(y) |
|
1132 | if ymax == None: ymax = numpy.nanmax(y) | |
1055 |
if xmin == None: xmin = numpy.nanmin( |
|
1133 | if xmin == None: xmin = numpy.nanmin(xdB)*0.9 | |
1056 |
if xmax == None: xmax = numpy.nanmax( |
|
1134 | if xmax == None: xmax = numpy.nanmax(xdB)*0.9 | |
1057 |
|
1135 | |||
1058 | self.__isConfig = True |
|
1136 | self.__isConfig = True | |
1059 |
|
1137 | |||
1060 | self.setWinTitle(title) |
|
1138 | self.setWinTitle(title) | |
1061 |
|
1139 | |||
1062 |
|
||||
1063 | title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) |
|
1140 | title = "Power Profile: %s" %(thisDatetime.strftime("%d-%b-%Y %H:%M:%S")) | |
1064 | axes = self.axesList[0] |
|
1141 | axes = self.axesList[0] | |
1065 |
|
1142 | |||
1066 | legendlabels = ["channel %d"%x for x in channelList] |
|
1143 | legendlabels = ["channel %d"%x for x in channelList] | |
1067 |
axes.pmultiline( |
|
1144 | axes.pmultiline(xdB, y, | |
1068 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, |
|
1145 | xmin=xmin, xmax=xmax, ymin=ymin, ymax=ymax, | |
1069 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, |
|
1146 | xlabel=xlabel, ylabel=ylabel, title=title, legendlabels=legendlabels, | |
1070 | ytick_visible=True, nxticks=5, |
|
1147 | ytick_visible=True, nxticks=5, |
@@ -223,9 +223,31 class VoltageProc(ProcessingUnit): | |||||
223 | self.dataOut = Voltage() |
|
223 | self.dataOut = Voltage() | |
224 | self.flip = 1 |
|
224 | self.flip = 1 | |
225 |
|
225 | |||
|
226 | def __updateObjFromAmisrInput(self): | |||
|
227 | ||||
|
228 | self.dataOut.timeZone = self.dataIn.timeZone | |||
|
229 | self.dataOut.dstFlag = self.dataIn.dstFlag | |||
|
230 | self.dataOut.errorCount = self.dataIn.errorCount | |||
|
231 | self.dataOut.useLocalTime = self.dataIn.useLocalTime | |||
|
232 | ||||
|
233 | self.dataOut.flagNoData = self.dataIn.flagNoData | |||
|
234 | self.dataOut.data = self.dataIn.data | |||
|
235 | self.dataOut.utctime = self.dataIn.utctime | |||
|
236 | self.dataOut.channelList = self.dataIn.channelList | |||
|
237 | self.dataOut.timeInterval = self.dataIn.timeInterval | |||
|
238 | self.dataOut.heightList = self.dataIn.heightList | |||
|
239 | self.dataOut.nProfiles = self.dataIn.nProfiles | |||
|
240 | ||||
|
241 | pass | |||
|
242 | ||||
226 | def init(self): |
|
243 | def init(self): | |
227 |
|
244 | |||
228 | self.dataOut.copy(self.dataIn) |
|
245 | ||
|
246 | if self.dataIn.type == 'AMISR': | |||
|
247 | self.__updateObjFromAmisrInput() | |||
|
248 | ||||
|
249 | if self.dataIn.type == 'Voltage': | |||
|
250 | self.dataOut.copy(self.dataIn) | |||
229 | # No necesita copiar en cada init() los atributos de dataIn |
|
251 | # No necesita copiar en cada init() los atributos de dataIn | |
230 | # la copia deberia hacerse por cada nuevo bloque de datos |
|
252 | # la copia deberia hacerse por cada nuevo bloque de datos | |
231 |
|
253 |
@@ -16,11 +16,12 path='/remote/ewdrifts/RAW_EXP/EW_DRIFT_FARADAY/EW_Drift' | |||||
16 |
|
16 | |||
17 | path = '/Users/dsuarez/Documents/Radar/drifts' |
|
17 | path = '/Users/dsuarez/Documents/Radar/drifts' | |
18 | path = '/Users/dsuarez/Documents/EW_DRIFT_WITH_TR' |
|
18 | path = '/Users/dsuarez/Documents/EW_DRIFT_WITH_TR' | |
|
19 | path = '/home/administrator/Radar/drifts/2014' | |||
19 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', |
|
20 | readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', | |
20 | path=path, |
|
21 | path=path, | |
21 |
startDate='201 |
|
22 | startDate='2014/01/11', | |
22 |
endDate='201 |
|
23 | endDate='2014/12/12', | |
23 |
startTime=' |
|
24 | startTime='00:00:00', | |
24 | endTime='23:59:59', |
|
25 | endTime='23:59:59', | |
25 | online=0, |
|
26 | online=0, | |
26 | delay=5, |
|
27 | delay=5, | |
@@ -28,46 +29,48 readUnitConfObj = controllerObj.addReadUnit(datatype='Voltage', | |||||
28 |
|
29 | |||
29 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) |
|
30 | procUnitConfObj0 = controllerObj.addProcUnit(datatype='Voltage', inputId=readUnitConfObj.getId()) | |
30 |
|
31 | |||
31 |
opObj11 = procUnitConfObj0.addOperation(name=' |
|
32 | opObj11 = procUnitConfObj0.addOperation(name='Scope', optype='other') | |
32 | opObj11.addParameter(name='profileRangeList', value='0,127', format='intlist') |
|
|||
33 |
|
||||
34 | opObj11 = procUnitConfObj0.addOperation(name='filterByHeights') |
|
|||
35 | opObj11.addParameter(name='window', value='3', format='int') |
|
|||
36 |
|
||||
37 | opObj11 = procUnitConfObj0.addOperation(name='Decoder', optype='other') |
|
|||
38 |
|
||||
39 |
|
||||
40 | procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) |
|
|||
41 | procUnitConfObj1.addParameter(name='nFFTPoints', value='128', format='int') |
|
|||
42 | procUnitConfObj1.addParameter(name='nProfiles', value='128', format='int') |
|
|||
43 |
|
||||
44 |
|
||||
45 | opObj11 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') |
|
|||
46 | opObj11.addParameter(name='timeInterval', value='60', format='float') |
|
|||
47 |
|
||||
48 | opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') |
|
|||
49 | opObj11.addParameter(name='id', value='100', format='int') |
|
|||
50 | opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') |
|
|||
51 | #opObj11.addParameter(name='channelList', value='0,1,2,3', format='intlist') |
|
|||
52 | # opObj11.addParameter(name='zmin', value='0', format='int') |
|
|||
53 | # opObj11.addParameter(name='zmax', value='100', format='int') |
|
|||
54 | opObj11.addParameter(name='showprofile', value='0', format='int') |
|
|||
55 | opObj11.addParameter(name='save', value='1', format='bool') |
|
|||
56 | opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format='str') |
|
|||
57 |
|
||||
58 |
|
||||
59 | opObj11 = procUnitConfObj1.addOperation(name='Noise', optype='other') |
|
|||
60 | opObj11.addParameter(name='id', value='101', format='int') |
|
33 | opObj11.addParameter(name='id', value='101', format='int') | |
61 |
opObj11.addParameter(name='wintitle', value=' |
|
34 | opObj11.addParameter(name='wintitle', value='AMISR', format='str') | |
62 | opObj11.addParameter(name='xmin', value='10', format='float') |
|
|||
63 | opObj11.addParameter(name='xmax', value='11.5', format='float') |
|
|||
64 | opObj11.addParameter(name='ymin', value='55', format='float') |
|
|||
65 | opObj11.addParameter(name='ymax', value='65', format='float') |
|
|||
66 | opObj11.addParameter(name='save', value='1', format='bool') |
|
|||
67 | opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format='str') |
|
|||
68 |
|
||||
69 |
|
||||
70 |
|
35 | |||
|
36 | # | |||
|
37 | # opObj11 = procUnitConfObj0.addOperation(name='ProfileSelector', optype='other') | |||
|
38 | # opObj11.addParameter(name='profileRangeList', value='0,127', format='intlist') | |||
|
39 | # | |||
|
40 | # opObj11 = procUnitConfObj0.addOperation(name='filterByHeights') | |||
|
41 | # opObj11.addParameter(name='window', value='3', format='int') | |||
|
42 | # | |||
|
43 | # opObj11 = procUnitConfObj0.addOperation(name='Decoder', optype='other') | |||
|
44 | # | |||
|
45 | # | |||
|
46 | # procUnitConfObj1 = controllerObj.addProcUnit(datatype='Spectra', inputId=procUnitConfObj0.getId()) | |||
|
47 | # procUnitConfObj1.addParameter(name='nFFTPoints', value='128', format='int') | |||
|
48 | # procUnitConfObj1.addParameter(name='nProfiles', value='128', format='int') | |||
|
49 | # | |||
|
50 | # | |||
|
51 | # opObj11 = procUnitConfObj1.addOperation(name='IncohInt', optype='other') | |||
|
52 | # opObj11.addParameter(name='timeInterval', value='60', format='float') | |||
|
53 | # | |||
|
54 | # opObj11 = procUnitConfObj1.addOperation(name='SpectraPlot', optype='other') | |||
|
55 | # opObj11.addParameter(name='id', value='100', format='int') | |||
|
56 | # opObj11.addParameter(name='wintitle', value='SpectraPlot', format='str') | |||
|
57 | # #opObj11.addParameter(name='channelList', value='0,1,2,3', format='intlist') | |||
|
58 | # # opObj11.addParameter(name='zmin', value='0', format='int') | |||
|
59 | # # opObj11.addParameter(name='zmax', value='100', format='int') | |||
|
60 | # opObj11.addParameter(name='showprofile', value='0', format='int') | |||
|
61 | # opObj11.addParameter(name='save', value='1', format='bool') | |||
|
62 | # opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format='str') | |||
|
63 | # | |||
|
64 | # | |||
|
65 | # opObj11 = procUnitConfObj1.addOperation(name='Noise', optype='other') | |||
|
66 | # opObj11.addParameter(name='id', value='101', format='int') | |||
|
67 | # opObj11.addParameter(name='wintitle', value='TR800KW', format='str') | |||
|
68 | # opObj11.addParameter(name='xmin', value='10', format='float') | |||
|
69 | # opObj11.addParameter(name='xmax', value='11.5', format='float') | |||
|
70 | # opObj11.addParameter(name='ymin', value='55', format='float') | |||
|
71 | # opObj11.addParameter(name='ymax', value='65', format='float') | |||
|
72 | # opObj11.addParameter(name='save', value='1', format='bool') | |||
|
73 | # opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format='str') | |||
71 |
|
74 | |||
72 | # |
|
75 | # | |
73 | #opObj11 = procUnitConfObj1.addOperation(name='PowerProfilePlot', optype='other') |
|
76 | #opObj11 = procUnitConfObj1.addOperation(name='PowerProfilePlot', optype='other') | |
@@ -92,19 +95,19 opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format= | |||||
92 | # opObj11.addParameter(name='save', value='1', format='bool') |
|
95 | # opObj11.addParameter(name='save', value='1', format='bool') | |
93 | # opObj11.addParameter(name='figpath', value='/home/dsuarez/Pictures/ew_drifts_mz', format='str') |
|
96 | # opObj11.addParameter(name='figpath', value='/home/dsuarez/Pictures/ew_drifts_mz', format='str') | |
94 | # |
|
97 | # | |
95 | # |
|
98 | # # | |
96 | opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') |
|
99 | # opObj11 = procUnitConfObj1.addOperation(name='RTIPlot', optype='other') | |
97 | opObj11.addParameter(name='id', value='102', format='int') |
|
100 | # opObj11.addParameter(name='id', value='102', format='int') | |
98 | opObj11.addParameter(name='wintitle', value='RTIPLot', format='str') |
|
101 | # opObj11.addParameter(name='wintitle', value='RTIPLot', format='str') | |
99 | opObj11.addParameter(name='xmin', value='10', format='float') |
|
102 | # opObj11.addParameter(name='xmin', value='10', format='float') | |
100 | opObj11.addParameter(name='xmax', value='11.5', format='float') |
|
103 | # opObj11.addParameter(name='xmax', value='11.5', format='float') | |
101 | # opObj11.addParameter(name='zmin', value='20', format='int') |
|
104 | # # opObj11.addParameter(name='zmin', value='20', format='int') | |
102 | # opObj11.addParameter(name='zmax', value='40', format='int') |
|
105 | # # opObj11.addParameter(name='zmax', value='40', format='int') | |
103 | # #opObj11.addParameter(name='channelList', value='0,1,2,3', format='intlist') |
|
106 | # # #opObj11.addParameter(name='channelList', value='0,1,2,3', format='intlist') | |
104 | # #opObj11.addParameter(name='timerange', value='86400', format='int') |
|
107 | # # #opObj11.addParameter(name='timerange', value='86400', format='int') | |
105 | opObj11.addParameter(name='showprofile', value='0', format='int') |
|
108 | # opObj11.addParameter(name='showprofile', value='0', format='int') | |
106 | opObj11.addParameter(name='save', value='1', format='bool') |
|
109 | # opObj11.addParameter(name='save', value='1', format='bool') | |
107 | opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format='str') |
|
110 | # opObj11.addParameter(name='figpath', value='/Users/dsuarez/Pictures/tr', format='str') | |
108 |
|
111 | |||
109 | print "Escribiendo el archivo XML" |
|
112 | print "Escribiendo el archivo XML" | |
110 | controllerObj.writeXml(filename) |
|
113 | controllerObj.writeXml(filename) |
General Comments 0
You need to be logged in to leave comments.
Login now