diff --git a/schainpy2/IO/JROHeader.py b/schainpy2/IO/JROHeader.py index 8dc735e..8331a6f 100644 --- a/schainpy2/IO/JROHeader.py +++ b/schainpy2/IO/JROHeader.py @@ -429,7 +429,7 @@ class ProcessingHeader(Header): if self.processFlags & PROCFLAG.DEFINE_PROCESS_CODE == PROCFLAG.DEFINE_PROCESS_CODE: - nCode = self.nCode + nCode = self.nCode #Probar con un dato que almacene codigo, hasta el momento no se hizo la prueba nCode.tofile(fp) nBaud = self.nBaud diff --git a/schainpy2/IO/SpectraIO.py b/schainpy2/IO/SpectraIO.py index 2f54c04..13beb1c 100644 --- a/schainpy2/IO/SpectraIO.py +++ b/schainpy2/IO/SpectraIO.py @@ -441,7 +441,7 @@ class SpectraWriter(JRODataWriter): # # self.nWrPairs = len(pairList) - self.wrPairList = self.dataOutObj.pairList + self.wrPairList = self.dataOutObj.pairsList self.nWrPairs = self.dataOutObj.nPairs @@ -505,7 +505,7 @@ class SpectraWriter(JRODataWriter): self.processingHeaderObj.nHeights, self.processingHeaderObj.profilesPerBlock) - self.shape_dc_Buffer = (self.systemHeaderObj.nChannels, + self.shape_dc_Buffer = (self.dataOutObj.nChannels, self.processingHeaderObj.nHeights) @@ -583,13 +583,16 @@ class SpectraWriter(JRODataWriter): self.data_dc.fill(0) self.setNextFile() + if self.flagIsNewFile == 0: + self.getBasicHeader() + self.data_spc = self.dataOutObj.data_spc self.data_cspc = self.dataOutObj.data_cspc self.data_dc = self.dataOutObj.data_dc # #self.processingHeaderObj.dataBlocksPerFile) if self.hasAllDataInBuffer(): - self.getDataHeader() +# self.getDataHeader() self.writeNextBlock() if self.flagNoMoreFiles: @@ -714,6 +717,7 @@ class SpectraWriter(JRODataWriter): """ self.systemHeaderObj = self.dataOutObj.systemHeaderObj.copy() + self.systemHeaderObj.nChannels = self.dataOutObj.nChannels self.radarControllerHeaderObj = self.dataOutObj.radarControllerHeaderObj.copy() self.getBasicHeader() @@ -721,27 +725,50 @@ class SpectraWriter(JRODataWriter): processingHeaderSize = 40 # bytes self.processingHeaderObj.dtype = 0 # Voltage self.processingHeaderObj.blockSize = self.__getBlockSize() - self.processingHeaderObj.profilesPerBlock = self.profilesPerBlock + self.processingHeaderObj.profilesPerBlock = self.dataOutObj.nFFTPoints self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile self.processingHeaderObj.nWindows = 1 #podria ser 1 o self.dataOutObj.processingHeaderObj.nWindows self.processingHeaderObj.processFlags = self.__getProcessFlags() - self.processingHeaderObj.nCohInt = self.dataOutObj.nCohInt - self.processingHeaderObj.nIncohInt = 1 # Cuando la data de origen es de tipo Voltage - self.processingHeaderObj.totalSpectra = 0 # Cuando la data de origen es de tipo Voltage + self.processingHeaderObj.nCohInt = 1# Cuando la data de origen es de tipo Spectra + self.processingHeaderObj.nIncohInt = self.dataOutObj.nIncohInt + self.processingHeaderObj.totalSpectra = self.dataOutObj.nPairs + self.dataOutObj.nChannels + + if self.processingHeaderObj.totalSpectra > 0: + channelList = [] + for channel in range(self.dataOutObj.nChannels): + channelList.append(channel) + channelList.append(channel) + + pairsList = [] + for pair in self.dataOutObj.pairsList: + pairsList.append(pair[0]) + pairsList.append(pair[1]) + spectraComb = channelList + pairsList + spectraComb = numpy.array(spectraComb,dtype="u1") + self.processingHeaderObj.spectraComb = spectraComb + sizeOfSpcComb = len(spectraComb) + processingHeaderSize += sizeOfSpcComb if self.dataOutObj.code != None: self.processingHeaderObj.code = self.dataOutObj.code self.processingHeaderObj.nCode = self.dataOutObj.nCode self.processingHeaderObj.nBaud = self.dataOutObj.nBaud - codesize = int(8 + 4 * self.dataOutObj.nCode * self.dataOutObj.nBaud) - processingHeaderSize += codesize + nCodeSize = 4 # bytes + nBaudSize = 4 # bytes + codeSize = 4 # bytes + sizeOfCode = int(nCodeSize + nBaudSize + codeSize * self.dataOutObj.nCode * self.dataOutObj.nBaud) + processingHeaderSize += sizeOfCode if self.processingHeaderObj.nWindows != 0: self.processingHeaderObj.firstHeight = self.dataOutObj.heightList[0] self.processingHeaderObj.deltaHeight = self.dataOutObj.heightList[1] - self.dataOutObj.heightList[0] self.processingHeaderObj.nHeights = self.dataOutObj.nHeights self.processingHeaderObj.samplesWin = self.dataOutObj.nHeights - processingHeaderSize += 12 + sizeOfFirstHeight = 4 + sizeOfdeltaHeight = 4 + sizeOfnHeights = 4 + sizeOfWindows = (sizeOfFirstHeight + sizeOfdeltaHeight + sizeOfnHeights)*self.processingHeaderObj.nWindows + processingHeaderSize += sizeOfWindows self.processingHeaderObj.size = processingHeaderSize diff --git a/schainpy2/IO/VoltageIO.py b/schainpy2/IO/VoltageIO.py index 9983a54..515d1ab 100644 --- a/schainpy2/IO/VoltageIO.py +++ b/schainpy2/IO/VoltageIO.py @@ -551,6 +551,7 @@ class VoltageWriter(JRODataWriter): """ self.systemHeaderObj = self.dataOutObj.systemHeaderObj.copy() + self.systemHeaderObj.nChannels = self.dataOutObj.nChannels self.radarControllerHeaderObj = self.dataOutObj.radarControllerHeaderObj.copy() self.getBasicHeader() diff --git a/schainpy2/Processing/SpectraProcessor.py b/schainpy2/Processing/SpectraProcessor.py index 30f4f94..2771a3b 100644 --- a/schainpy2/Processing/SpectraProcessor.py +++ b/schainpy2/Processing/SpectraProcessor.py @@ -257,7 +257,7 @@ class SpectraProcessor: # self.getNoise() def addWriter(self, wrpath, profilesPerBlock, blocksPerFile): - objWriter = SpectraWriter(self.dataOutObj, pairList) + objWriter = SpectraWriter(self.dataOutObj) objWriter.setup(wrpath, profilesPerBlock, blocksPerFile) self.writerObjList.append(objWriter) diff --git a/schainpy2/testSchainSpecExp.py b/schainpy2/testSchainSpecExp.py index 530ac56..a7f0e8a 100644 --- a/schainpy2/testSchainSpecExp.py +++ b/schainpy2/testSchainSpecExp.py @@ -33,7 +33,7 @@ class TestSChain: # paramatros para Escritura de Pdata self.wrpath = "/Users/danielangelsuarezmunoz/Data/testWR_pdata" - self.profilesPerBlock = 16 + self.profilesPerBlock = 8 self.blocksPerFile = 5 # self.pairList = [(0,1),(0,2)]