##// END OF EJS Templates
Bug fixed in jroIO_usrp: nProfiles and profileIndex values were defined. (nProfiles = number of profiles in one second)
Miguel Valdez -
r823:459a29f11c52
parent child
Show More
@@ -54,7 +54,9 class USRPReader(ProcessingUnit):
54 54 '''
55 55 In this method will be initialized every parameter of dataOut object (header, no data)
56 56 '''
57 nProfiles = self.__sample_rate #Number of profiles by second
57 ippSeconds = 1.0*self.__nSamples/self.__sample_rate
58
59 nProfiles = 1.0/ippSeconds #Number of profiles in one second
58 60
59 61 self.dataOut.radarControllerHeaderObj = RadarControllerHeader(ippKm=self.__ippKm,
60 62 txA=0,
@@ -113,7 +115,7 class USRPReader(ProcessingUnit):
113 115
114 116 self.dataOut.flagShiftFFT = False
115 117
116 self.dataOut.ippSeconds = 1.0*self.__nSamples/self.__sample_rate
118 self.dataOut.ippSeconds = ippSeconds
117 119
118 120 #Time interval between profiles
119 121 #self.dataOut.timeInterval = self.dataOut.ippSeconds * self.dataOut.nCohInt
@@ -505,10 +507,14 class USRPReader(ProcessingUnit):
505 507 self.dataOut.utctime = (self.__thisUnixSample + self.__bufferIndex)/self.__sample_rate
506 508 self.dataOut.flagNoData = False
507 509 self.dataOut.flagDiscontinuousBlock = self.__flagDiscontinuousBlock
510 self.dataOut.profileIndex = self.profileIndex
508 511
509 512 self.__bufferIndex += self.__nSamples
510 513 self.profileIndex += 1
511 514
515 if self.profileIndex == self.dataOut.nProfiles:
516 self.profileIndex = 0
517
512 518 return True
513 519
514 520 def printInfo(self):
@@ -869,7 +869,7 class ProfileSelector(Operation):
869 869 maxIndex = profileRangeList[1]
870 870
871 871 if self.isThisProfileInRange(dataOut.profileIndex, minIndex, maxIndex):
872
872
873 873 self.nProfiles = maxIndex - minIndex + 1
874 874 dataOut.nProfiles = self.nProfiles
875 875 dataOut.profileIndex = self.profileIndex
@@ -918,9 +918,7 class ProfileSelector(Operation):
918 918
919 919 raise ValueError, "ProfileSelector needs profileList, profileRangeList or rangeList parameter"
920 920
921 return False
922
923
921 return False
924 922
925 923 class Reshaper(Operation):
926 924
@@ -1024,7 +1022,109 class Reshaper(Operation):
1024 1022 dataOut.profileIndex = profileIndex
1025 1023
1026 1024 dataOut.ippSeconds /= self.__nTxs
1027 #
1025
1026 class SplitProfiles(Operation):
1027
1028 def __init__(self):
1029
1030 Operation.__init__(self)
1031
1032 def run(self, dataOut, n):
1033
1034 dataOut.flagNoData = True
1035 profileIndex = None
1036
1037 if dataOut.flagDataAsBlock:
1038
1039 #nchannels, nprofiles, nsamples
1040 shape = dataOut.data.shape
1041
1042 if shape[2] % n != 0:
1043 raise ValueError, "Could not split the data, n=%d has to be multiple of %d" %(n, shape[2])
1044
1045 new_shape = shape[0], shape[1]*n, shape[2]/n
1046
1047 dataOut.data = numpy.reshape(dataOut.data, new_shape)
1048 dataOut.flagNoData = False
1049
1050 profileIndex = int(dataOut.nProfiles/n) - 1
1051
1052 else:
1053
1054 raise ValueError, "Could not split the data when is read Profile by Profile. Use VoltageReader(..., getblock=True)"
1055
1056 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1057
1058 dataOut.heightList = numpy.arange(dataOut.nHeights/n) * deltaHeight + dataOut.heightList[0]
1059
1060 dataOut.nProfiles = int(dataOut.nProfiles*n)
1061
1062 dataOut.profileIndex = profileIndex
1063
1064 dataOut.ippSeconds /= n
1065
1066 class CombineProfiles(Operation):
1067
1068 def __init__(self):
1069
1070 Operation.__init__(self)
1071
1072 self.__remData = None
1073 self.__profileIndex = 0
1074
1075 def run(self, dataOut, n):
1076
1077 dataOut.flagNoData = True
1078 profileIndex = None
1079
1080 if dataOut.flagDataAsBlock:
1081
1082 #nchannels, nprofiles, nsamples
1083 shape = dataOut.data.shape
1084 new_shape = shape[0], shape[1]/n, shape[2]*n
1085
1086 if shape[1] % n != 0:
1087 raise ValueError, "Could not split the data, n=%d has to be multiple of %d" %(n, shape[1])
1088
1089 dataOut.data = numpy.reshape(dataOut.data, new_shape)
1090 dataOut.flagNoData = False
1091
1092 profileIndex = int(dataOut.nProfiles*n) - 1
1093
1094 else:
1095
1096 #nchannels, nsamples
1097 if self.__remData is None:
1098 newData = dataOut.data
1099 else:
1100 newData = numpy.concatenate((self.__remData, dataOut.data), axis=1)
1101
1102 self.__profileIndex += 1
1103
1104 if self.__profileIndex < n:
1105 self.__remData = newData
1106 #continue
1107 return
1108
1109 self.__profileIndex = 0
1110 self.__remData = None
1111
1112 dataOut.data = newData
1113 dataOut.flagNoData = False
1114
1115 profileIndex = dataOut.profileIndex/n
1116
1117
1118 deltaHeight = dataOut.heightList[1] - dataOut.heightList[0]
1119
1120 dataOut.heightList = numpy.arange(dataOut.nHeights*n) * deltaHeight + dataOut.heightList[0]
1121
1122 dataOut.nProfiles = int(dataOut.nProfiles/n)
1123
1124 dataOut.profileIndex = profileIndex
1125
1126 dataOut.ippSeconds *= n
1127
1028 1128 # import collections
1029 1129 # from scipy.stats import mode
1030 1130 #
General Comments 0
You need to be logged in to leave comments. Login now