@@ -305,7 +305,7 class JROData(GenericData): | |||||
305 |
|
305 | |||
306 | _lambda = self.C/self.frequency |
|
306 | _lambda = self.C/self.frequency | |
307 |
|
307 | |||
308 | vmax = self.getFmax() * _lambda |
|
308 | vmax = self.getFmax() * _lambda/2 | |
309 |
|
309 | |||
310 | return vmax |
|
310 | return vmax | |
311 |
|
311 | |||
@@ -484,8 +484,10 class Voltage(JROData): | |||||
484 | data = self.data |
|
484 | data = self.data | |
485 |
|
485 | |||
486 | power = data * numpy.conjugate(data) |
|
486 | power = data * numpy.conjugate(data) | |
|
487 | powerdB = 10*numpy.log10(power.real) | |||
|
488 | powerdB = numpy.squeeze(powerdB) | |||
487 |
|
489 | |||
488 |
return |
|
490 | return powerdB | |
489 |
|
491 | |||
490 | def getTimeInterval(self): |
|
492 | def getTimeInterval(self): | |
491 |
|
493 | |||
@@ -638,7 +640,7 class Spectra(JROData): | |||||
638 | def getVelRange(self, extrapoints=0): |
|
640 | def getVelRange(self, extrapoints=0): | |
639 |
|
641 | |||
640 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) |
|
642 | deltav = self.getVmax() / (self.nFFTPoints*self.ippFactor) | |
641 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) - deltav/2 |
|
643 | velrange = deltav*(numpy.arange(self.nFFTPoints+extrapoints)-self.nFFTPoints/2.) #- deltav/2 | |
642 |
|
644 | |||
643 | return velrange |
|
645 | return velrange | |
644 |
|
646 | |||
@@ -926,33 +928,39 class Fits(JROData): | |||||
926 | ltctime = property(getltctime, "I'm the 'ltctime' property") |
|
928 | ltctime = property(getltctime, "I'm the 'ltctime' property") | |
927 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
929 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
928 |
|
930 | |||
|
931 | ||||
929 | class Correlation(JROData): |
|
932 | class Correlation(JROData): | |
930 |
|
933 | |||
931 | noise = None |
|
934 | noise = None | |
932 |
|
935 | |||
933 | SNR = None |
|
936 | SNR = None | |
934 |
|
937 | |||
935 | pairsAutoCorr = None #Pairs of Autocorrelation |
|
|||
936 |
|
||||
937 | #-------------------------------------------------- |
|
938 | #-------------------------------------------------- | |
938 |
|
939 | |||
939 |
|
|
940 | mode = None | |
940 |
|
941 | |||
941 | data_volt = None |
|
942 | split = False | |
|
943 | ||||
|
944 | data_cf = None | |||
942 |
|
945 | |||
943 | lagT = None # each element value is a profileIndex |
|
946 | lags = None | |
944 |
|
947 | |||
945 | lagR = None # each element value is in km |
|
948 | lagRange = None | |
946 |
|
949 | |||
947 | pairsList = None |
|
950 | pairsList = None | |
948 |
|
951 | |||
949 | calculateVelocity = None |
|
952 | normFactor = None | |
950 |
|
953 | |||
951 | nPoints = None |
|
954 | #-------------------------------------------------- | |
952 |
|
955 | |||
953 | nAvg = None |
|
956 | # calculateVelocity = None | |
|
957 | ||||
|
958 | nLags = None | |||
954 |
|
959 | |||
955 |
|
|
960 | nPairs = None | |
|
961 | ||||
|
962 | nAvg = None | |||
|
963 | ||||
956 |
|
964 | |||
957 | def __init__(self): |
|
965 | def __init__(self): | |
958 | ''' |
|
966 | ''' | |
@@ -995,56 +1003,11 class Correlation(JROData): | |||||
995 | self.pairsList = None |
|
1003 | self.pairsList = None | |
996 |
|
1004 | |||
997 | self.nPoints = None |
|
1005 | self.nPoints = None | |
998 |
|
1006 | |||
999 | def getLagTRange(self, extrapoints=0): |
|
|||
1000 |
|
||||
1001 | lagTRange = self.lagT |
|
|||
1002 | diff = lagTRange[1] - lagTRange[0] |
|
|||
1003 | extra = numpy.arange(1,extrapoints + 1)*diff + lagTRange[-1] |
|
|||
1004 | lagTRange = numpy.hstack((lagTRange, extra)) |
|
|||
1005 |
|
||||
1006 | return lagTRange |
|
|||
1007 |
|
||||
1008 | def getLagRRange(self, extrapoints=0): |
|
|||
1009 |
|
||||
1010 | return self.lagR |
|
|||
1011 |
|
||||
1012 | def getPairsList(self): |
|
1007 | def getPairsList(self): | |
1013 |
|
1008 | |||
1014 | return self.pairsList |
|
1009 | return self.pairsList | |
1015 |
|
1010 | |||
1016 | def getCalculateVelocity(self): |
|
|||
1017 |
|
||||
1018 | return self.calculateVelocity |
|
|||
1019 |
|
||||
1020 | def getNPoints(self): |
|
|||
1021 |
|
||||
1022 | return self.nPoints |
|
|||
1023 |
|
||||
1024 | def getNAvg(self): |
|
|||
1025 |
|
||||
1026 | return self.nAvg |
|
|||
1027 |
|
||||
1028 | def getBufferSize(self): |
|
|||
1029 |
|
||||
1030 | return self.bufferSize |
|
|||
1031 |
|
||||
1032 | def getPairsAutoCorr(self): |
|
|||
1033 | pairsList = self.pairsList |
|
|||
1034 | pairsAutoCorr = numpy.zeros(self.nChannels, dtype = 'int')*numpy.nan |
|
|||
1035 |
|
||||
1036 | for l in range(len(pairsList)): |
|
|||
1037 | firstChannel = pairsList[l][0] |
|
|||
1038 | secondChannel = pairsList[l][1] |
|
|||
1039 |
|
||||
1040 | #Obteniendo pares de Autocorrelacion |
|
|||
1041 | if firstChannel == secondChannel: |
|
|||
1042 | pairsAutoCorr[firstChannel] = int(l) |
|
|||
1043 |
|
||||
1044 | pairsAutoCorr = pairsAutoCorr.astype(int) |
|
|||
1045 |
|
||||
1046 | return pairsAutoCorr |
|
|||
1047 |
|
||||
1048 | def getNoise(self, mode = 2): |
|
1011 | def getNoise(self, mode = 2): | |
1049 |
|
1012 | |||
1050 | indR = numpy.where(self.lagR == 0)[0][0] |
|
1013 | indR = numpy.where(self.lagR == 0)[0][0] | |
@@ -1092,17 +1055,53 class Correlation(JROData): | |||||
1092 |
|
1055 | |||
1093 | def getTimeInterval(self): |
|
1056 | def getTimeInterval(self): | |
1094 |
|
1057 | |||
1095 |
timeInterval = self.ippSeconds * self.nCohInt * self.nP |
|
1058 | timeInterval = self.ippSeconds * self.nCohInt * self.nProfiles | |
1096 |
|
1059 | |||
1097 | return timeInterval |
|
1060 | return timeInterval | |
1098 |
|
1061 | |||
|
1062 | def splitFunctions(self): | |||
|
1063 | ||||
|
1064 | pairsList = self.pairsList | |||
|
1065 | ccf_pairs = [] | |||
|
1066 | acf_pairs = [] | |||
|
1067 | ccf_ind = [] | |||
|
1068 | acf_ind = [] | |||
|
1069 | for l in range(len(pairsList)): | |||
|
1070 | chan0 = pairsList[l][0] | |||
|
1071 | chan1 = pairsList[l][1] | |||
|
1072 | ||||
|
1073 | #Obteniendo pares de Autocorrelacion | |||
|
1074 | if chan0 == chan1: | |||
|
1075 | acf_pairs.append(chan0) | |||
|
1076 | acf_ind.append(l) | |||
|
1077 | else: | |||
|
1078 | ccf_pairs.append(pairsList[l]) | |||
|
1079 | ccf_ind.append(l) | |||
|
1080 | ||||
|
1081 | data_acf = self.data_cf[acf_ind] | |||
|
1082 | data_ccf = self.data_cf[ccf_ind] | |||
|
1083 | ||||
|
1084 | return acf_ind, ccf_ind, acf_pairs, ccf_pairs, data_acf, data_ccf | |||
|
1085 | ||||
|
1086 | def getNormFactor(self): | |||
|
1087 | acf_ind, ccf_ind, acf_pairs, ccf_pairs, data_acf, data_ccf = self.splitFunctions() | |||
|
1088 | acf_pairs = numpy.array(acf_pairs) | |||
|
1089 | normFactor = numpy.zeros((self.nPairs,self.nHeights)) | |||
|
1090 | ||||
|
1091 | for p in range(self.nPairs): | |||
|
1092 | pair = self.pairsList[p] | |||
|
1093 | ||||
|
1094 | ch0 = pair[0] | |||
|
1095 | ch1 = pair[1] | |||
|
1096 | ||||
|
1097 | ch0_max = numpy.max(data_acf[acf_pairs==ch0,:,:], axis=1) | |||
|
1098 | ch1_max = numpy.max(data_acf[acf_pairs==ch1,:,:], axis=1) | |||
|
1099 | normFactor[p,:] = numpy.sqrt(ch0_max*ch1_max) | |||
|
1100 | ||||
|
1101 | return normFactor | |||
|
1102 | ||||
1099 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") |
|
1103 | timeInterval = property(getTimeInterval, "I'm the 'timeInterval' property") | |
1100 |
|
|
1104 | normFactor = property(getNormFactor, "I'm the 'normFactor property'") | |
1101 | # nPoints = property(getNPoints, "I'm the 'nPoints' property.") |
|
|||
1102 | calculateVelocity = property(getCalculateVelocity, "I'm the 'calculateVelocity' property.") |
|
|||
1103 | nAvg = property(getNAvg, "I'm the 'nAvg' property.") |
|
|||
1104 | bufferSize = property(getBufferSize, "I'm the 'bufferSize' property.") |
|
|||
1105 |
|
||||
1106 |
|
1105 | |||
1107 | class Parameters(JROData): |
|
1106 | class Parameters(JROData): | |
1108 |
|
1107 | |||
@@ -1152,6 +1151,7 class Parameters(JROData): | |||||
1152 |
|
1151 | |||
1153 | data_output = None #Out signal |
|
1152 | data_output = None #Out signal | |
1154 |
|
1153 | |||
|
1154 | nAvg = None | |||
1155 |
|
1155 | |||
1156 |
|
1156 | |||
1157 | def __init__(self): |
|
1157 | def __init__(self): |
General Comments 0
You need to be logged in to leave comments.
Login now