@@ -24,6 +24,7 DTYPES = { | |||
|
24 | 24 | 'Spectra': '.pdata' |
|
25 | 25 | } |
|
26 | 26 | |
|
27 | ||
|
27 | 28 | def MPProject(project, n=cpu_count()): |
|
28 | 29 | ''' |
|
29 | 30 | Project wrapper to run schain in n processes |
@@ -72,6 +73,7 def MPProject(project, n=cpu_count()): | |||
|
72 | 73 | |
|
73 | 74 | time.sleep(3) |
|
74 | 75 | |
|
76 | ||
|
75 | 77 | class ParameterConf(): |
|
76 | 78 | |
|
77 | 79 | id = None |
@@ -261,6 +263,7 class ParameterConf(): | |||
|
261 | 263 | |
|
262 | 264 | print 'Parameter[%s]: name = %s, value = %s, format = %s' %(self.id, self.name, self.value, self.format) |
|
263 | 265 | |
|
266 | ||
|
264 | 267 | class OperationConf(): |
|
265 | 268 | |
|
266 | 269 | id = None |
@@ -279,7 +282,6 class OperationConf(): | |||
|
279 | 282 | self.priority = None |
|
280 | 283 | self.type = 'self' |
|
281 | 284 | |
|
282 | ||
|
283 | 285 | def __getNewId(self): |
|
284 | 286 | |
|
285 | 287 | return int(self.id)*10 + len(self.parmConfObjList) + 1 |
@@ -337,7 +339,6 class OperationConf(): | |||
|
337 | 339 | |
|
338 | 340 | return value |
|
339 | 341 | |
|
340 | ||
|
341 | 342 | def getKwargs(self): |
|
342 | 343 | |
|
343 | 344 | kwargs = {} |
@@ -440,7 +441,6 class OperationConf(): | |||
|
440 | 441 | |
|
441 | 442 | def createObject(self, plotter_queue=None): |
|
442 | 443 | |
|
443 | ||
|
444 | 444 | if self.type == 'self': |
|
445 | 445 | raise ValueError, 'This operation type cannot be created' |
|
446 | 446 | |
@@ -505,7 +505,6 class ProcUnitConf(): | |||
|
505 | 505 | |
|
506 | 506 | def updateId(self, new_id, parentId=parentId): |
|
507 | 507 | |
|
508 | ||
|
509 | 508 | new_id = int(parentId)*10 + (int(self.id) % 10) |
|
510 | 509 | new_inputId = int(parentId)*10 + (int(self.inputId) % 10) |
|
511 | 510 | |
@@ -525,7 +524,6 class ProcUnitConf(): | |||
|
525 | 524 | self.id = str(new_id) |
|
526 | 525 | self.inputId = str(new_inputId) |
|
527 | 526 | |
|
528 | ||
|
529 | 527 | def getInputId(self): |
|
530 | 528 | |
|
531 | 529 | return self.inputId |
@@ -659,7 +657,6 class ProcUnitConf(): | |||
|
659 | 657 | for opConfObj in self.opConfObjList: |
|
660 | 658 | opConfObj.printattr() |
|
661 | 659 | |
|
662 | ||
|
663 | 660 | def getKwargs(self): |
|
664 | 661 | |
|
665 | 662 | opObj = self.opConfObjList[0] |
@@ -678,7 +675,8 class ProcUnitConf(): | |||
|
678 | 675 | if opConfObj.type=='self' and self.name=='run': |
|
679 | 676 | continue |
|
680 | 677 | elif opConfObj.type=='self': |
|
681 |
procUnitObj.addOperationKwargs( |
|
|
678 | procUnitObj.addOperationKwargs( | |
|
679 | opConfObj.id, **opConfObj.getKwargs()) | |
|
682 | 680 | continue |
|
683 | 681 | |
|
684 | 682 | opObj = opConfObj.createObject(plotter_queue) |
@@ -725,6 +723,7 class ProcUnitConf(): | |||
|
725 | 723 | |
|
726 | 724 | return |
|
727 | 725 | |
|
726 | ||
|
728 | 727 | class ReadUnitConf(ProcUnitConf): |
|
729 | 728 | |
|
730 | 729 | path = None |
@@ -790,7 +789,8 class ReadUnitConf(ProcUnitConf): | |||
|
790 | 789 | self.name = '%sReader' %(datatype) |
|
791 | 790 | self.datatype = self.name.replace('Reader', '') |
|
792 | 791 | |
|
793 |
attrs = ('path', 'startDate', 'endDate', |
|
|
792 | attrs = ('path', 'startDate', 'endDate', | |
|
793 | 'startTime', 'endTime', 'parentId') | |
|
794 | 794 | |
|
795 | 795 | for attr in attrs: |
|
796 | 796 | if attr in kwargs: |
@@ -811,19 +811,24 class ReadUnitConf(ProcUnitConf): | |||
|
811 | 811 |
opObj = self.addOperation(name |
|
812 | 812 | |
|
813 | 813 | if self.server is None: |
|
814 | opObj.addParameter(name='datatype', value=self.datatype, format='str') | |
|
814 | opObj.addParameter( | |
|
815 | name='datatype', value=self.datatype, format='str') | |
|
815 | 816 | opObj.addParameter(name='path', value=self.path, format='str') |
|
816 | opObj.addParameter(name='startDate', value=self.startDate, format='date') | |
|
817 |
|
|
|
818 | opObj.addParameter(name='startTime', value=self.startTime, format='time') | |
|
819 |
|
|
|
817 | opObj.addParameter( | |
|
818 | name='startDate', value=self.startDate, format='date') | |
|
819 | opObj.addParameter( | |
|
820 | name='endDate', value=self.endDate, format='date') | |
|
821 | opObj.addParameter( | |
|
822 | name='startTime', value=self.startTime, format='time') | |
|
823 | opObj.addParameter( | |
|
824 | name='endTime', value=self.endTime, format='time') | |
|
820 | 825 | |
|
821 | 826 | for key, value in kwargs.items(): |
|
822 |
opObj.addParameter(name=key, value=value, |
|
|
827 | opObj.addParameter(name=key, value=value, | |
|
828 | format=type(value).__name__) | |
|
823 | 829 | else: |
|
824 | 830 |
opObj.addParameter(name='server' |
|
825 | 831 | |
|
826 | ||
|
827 | 832 | return opObj |
|
828 | 833 | |
|
829 | 834 | def updateRunOperation(self, **kwargs): |
@@ -833,13 +838,16 class ReadUnitConf(ProcUnitConf): | |||
|
833 | 838 | |
|
834 | 839 | opObj.addParameter(name='datatype', value=self.datatype, format='str') |
|
835 | 840 | opObj.addParameter(name='path', value=self.path, format='str') |
|
836 | opObj.addParameter(name='startDate', value=self.startDate, format='date') | |
|
841 | opObj.addParameter( | |
|
842 | name='startDate', value=self.startDate, format='date') | |
|
837 | 843 | opObj.addParameter(name='endDate', value=self.endDate, format='date') |
|
838 | opObj.addParameter(name='startTime', value=self.startTime, format='time') | |
|
844 | opObj.addParameter( | |
|
845 | name='startTime', value=self.startTime, format='time') | |
|
839 | 846 | opObj.addParameter(name='endTime', value=self.endTime, format='time') |
|
840 | 847 | |
|
841 | 848 | for key, value in kwargs.items(): |
|
842 |
opObj.addParameter(name=key, value=value, |
|
|
849 | opObj.addParameter(name=key, value=value, | |
|
850 | format=type(value).__name__) | |
|
843 | 851 | |
|
844 | 852 | return opObj |
|
845 | 853 | |
@@ -872,6 +880,7 class ReadUnitConf(ProcUnitConf): | |||
|
872 | 880 | self.startTime = opConfObj.getParameterValue('startTime') |
|
873 | 881 | self.endTime = opConfObj.getParameterValue('endTime') |
|
874 | 882 | |
|
883 | ||
|
875 | 884 | class Project(Process): |
|
876 | 885 | |
|
877 | 886 | id = None |
@@ -969,7 +978,8 class Project(Process): | |||
|
969 | 978 | idReadUnit = str(id) |
|
970 | 979 | |
|
971 | 980 | readUnitConfObj = ReadUnitConf() |
|
972 |
readUnitConfObj.setup(idReadUnit, name, datatype, |
|
|
981 | readUnitConfObj.setup(idReadUnit, name, datatype, | |
|
982 | parentId=self.id, **kwargs) | |
|
973 | 983 | |
|
974 | 984 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
975 | 985 | |
@@ -980,7 +990,8 class Project(Process): | |||
|
980 | 990 | idProcUnit = self.__getNewId() |
|
981 | 991 | |
|
982 | 992 | procUnitConfObj = ProcUnitConf() |
|
983 |
procUnitConfObj.setup(idProcUnit, name, datatype, |
|
|
993 | procUnitConfObj.setup(idProcUnit, name, datatype, | |
|
994 | inputId, parentId=self.id) | |
|
984 | 995 | |
|
985 | 996 | self.procUnitConfObjDict[procUnitConfObj.getId()] = procUnitConfObj |
|
986 | 997 | |
@@ -1096,7 +1107,8 class Project(Process): | |||
|
1096 | 1107 | self.name = self.projectElement.get('name') |
|
1097 | 1108 |
self.description = self.projectElement.get('description') |
|
1098 | 1109 | |
|
1099 |
readUnitElementList = self.projectElement.iter( |
|
|
1110 | readUnitElementList = self.projectElement.iter( | |
|
1111 | ReadUnitConf().getElementName()) | |
|
1100 | 1112 | |
|
1101 | 1113 | for readUnitElement in readUnitElementList: |
|
1102 | 1114 | readUnitConfObj = ReadUnitConf() |
@@ -1107,7 +1119,8 class Project(Process): | |||
|
1107 | 1119 | |
|
1108 | 1120 | self.procUnitConfObjDict[readUnitConfObj.getId()] = readUnitConfObj |
|
1109 | 1121 | |
|
1110 |
procUnitElementList = self.projectElement.iter( |
|
|
1122 | procUnitElementList = self.projectElement.iter( | |
|
1123 | ProcUnitConf().getElementName()) | |
|
1111 | 1124 | |
|
1112 | 1125 | for procUnitElement in procUnitElementList: |
|
1113 | 1126 | procUnitConfObj = ProcUnitConf() |
@@ -1176,10 +1189,13 class Project(Process): | |||
|
1176 | 1189 | if not send_email: |
|
1177 | 1190 | return |
|
1178 | 1191 | |
|
1179 |
subject = |
|
|
1192 | subject = 'SChain v%s: Error running %s\n' % ( | |
|
1193 | schainpy.__version__, procUnitConfObj.name) | |
|
1180 | 1194 | |
|
1181 | subtitle = '%s: %s\n' %(procUnitConfObj.getElementName() ,procUnitConfObj.name) | |
|
1182 | subtitle += 'Hostname: %s\n' %socket.gethostbyname(socket.gethostname()) | |
|
1195 | subtitle = '%s: %s\n' % ( | |
|
1196 | procUnitConfObj.getElementName(), procUnitConfObj.name) | |
|
1197 | subtitle += 'Hostname: %s\n' % socket.gethostbyname( | |
|
1198 | socket.gethostname()) | |
|
1183 | 1199 | subtitle += 'Working directory: %s\n' %os.path.abspath('./') |
|
1184 | 1200 | subtitle += 'Configuration file: %s\n' %self.filename |
|
1185 | 1201 | subtitle += 'Time: %s\n' %str(datetime.datetime.now()) |
@@ -15,6 +15,7 import tempfile | |||
|
15 | 15 | from StringIO import StringIO |
|
16 | 16 | # from _sha import blocksize |
|
17 | 17 | |
|
18 | ||
|
18 | 19 | class VoltageReader(JRODataReader, ProcessingUnit): |
|
19 | 20 | """ |
|
20 | 21 | Esta clase permite leer datos de voltage desde archivos en formato rawdata (.r). La lectura |
@@ -177,7 +178,6 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
177 | 178 | |
|
178 | 179 | return 0 |
|
179 | 180 | |
|
180 | ||
|
181 | 181 | def getBlockDimension(self): |
|
182 | 182 | """ |
|
183 | 183 | Obtiene la cantidad de puntos a leer por cada bloque de datos |
@@ -188,11 +188,10 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
188 | 188 | Return: |
|
189 | 189 | None |
|
190 | 190 | """ |
|
191 |
pts2read = self.processingHeaderObj.profilesPerBlock * |
|
|
191 | pts2read = self.processingHeaderObj.profilesPerBlock * \ | |
|
192 | self.processingHeaderObj.nHeights * self.systemHeaderObj.nChannels | |
|
192 | 193 | self.blocksize = pts2read |
|
193 | 194 | |
|
194 | ||
|
195 | ||
|
196 | 195 | def readBlock(self): |
|
197 | 196 | """ |
|
198 | 197 | readBlock lee el bloque de datos desde la posicion actual del puntero del archivo |
@@ -230,13 +229,15 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
230 | 229 |
junk = numpy.fromfile( |
|
231 | 230 | |
|
232 | 231 | try: |
|
233 |
junk = junk.reshape( |
|
|
232 | junk = junk.reshape((self.processingHeaderObj.profilesPerBlock, | |
|
233 | self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels)) | |
|
234 | 234 | except: |
|
235 | 235 | #print "The read block (%3d) has not enough data" %self.nReadBlocks |
|
236 | 236 | |
|
237 | 237 | if self.waitDataBlock(pointer_location=current_pointer_location): |
|
238 | 238 |
junk = numpy.fromfile( |
|
239 |
junk = junk.reshape( |
|
|
239 | junk = junk.reshape((self.processingHeaderObj.profilesPerBlock, | |
|
240 | self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels)) | |
|
240 | 241 | # return 0 |
|
241 | 242 | |
|
242 | 243 | #Dimensions : nChannels, nProfiles, nSamples |
@@ -280,15 +281,18 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
280 | 281 | |
|
281 | 282 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock |
|
282 | 283 | |
|
283 | self.dataOut.heightList = numpy.arange(self.processingHeaderObj.nHeights) *self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight | |
|
284 | self.dataOut.heightList = numpy.arange( | |
|
285 | self.processingHeaderObj.nHeights) * self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight | |
|
284 | 286 | |
|
285 | 287 | self.dataOut.channelList = range(self.systemHeaderObj.nChannels) |
|
286 | 288 | |
|
287 | 289 | self.dataOut.nCohInt = self.processingHeaderObj.nCohInt |
|
288 | 290 | |
|
289 | self.dataOut.flagDecodeData = self.processingHeaderObj.flag_decode #asumo q la data no esta decodificada | |
|
291 | # asumo q la data no esta decodificada | |
|
292 | self.dataOut.flagDecodeData = self.processingHeaderObj.flag_decode | |
|
290 | 293 | |
|
291 | self.dataOut.flagDeflipData = self.processingHeaderObj.flag_deflip #asumo q la data no esta sin flip | |
|
294 | # asumo q la data no esta sin flip | |
|
295 | self.dataOut.flagDeflipData = self.processingHeaderObj.flag_deflip | |
|
292 | 296 | |
|
293 | 297 | self.dataOut.flagShiftFFT = self.processingHeaderObj.shif_fft |
|
294 | 298 | |
@@ -301,15 +305,19 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
301 | 305 | return |
|
302 | 306 | |
|
303 | 307 | if self.nTxs < 1 and self.processingHeaderObj.profilesPerBlock % (1./self.nTxs) != 0: |
|
304 |
raise ValueError, "1./nTxs (=%f), should be a multiple of nProfiles (=%d)" %( |
|
|
308 | raise ValueError, "1./nTxs (=%f), should be a multiple of nProfiles (=%d)" % ( | |
|
309 | 1. / self.nTxs, self.processingHeaderObj.profilesPerBlock) | |
|
305 | 310 | |
|
306 | 311 | if self.nTxs > 1 and self.processingHeaderObj.nHeights % self.nTxs != 0: |
|
307 |
raise ValueError, "nTxs (=%d), should be a multiple of nHeights (=%d)" %( |
|
|
312 | raise ValueError, "nTxs (=%d), should be a multiple of nHeights (=%d)" % ( | |
|
313 | self.nTxs, self.processingHeaderObj.nHeights) | |
|
308 | 314 | |
|
309 | self.datablock = self.datablock.reshape((self.systemHeaderObj.nChannels, self.processingHeaderObj.profilesPerBlock*self.nTxs, self.processingHeaderObj.nHeights/self.nTxs)) | |
|
315 | self.datablock = self.datablock.reshape( | |
|
316 | (self.systemHeaderObj.nChannels, self.processingHeaderObj.profilesPerBlock * self.nTxs, self.processingHeaderObj.nHeights / self.nTxs)) | |
|
310 | 317 | |
|
311 | 318 | self.dataOut.nProfiles = self.processingHeaderObj.profilesPerBlock*self.nTxs |
|
312 |
self.dataOut.heightList = numpy.arange(self.processingHeaderObj.nHeights/self.nTxs) * |
|
|
319 | self.dataOut.heightList = numpy.arange(self.processingHeaderObj.nHeights / self.nTxs) * \ | |
|
320 | self.processingHeaderObj.deltaHeight + self.processingHeaderObj.firstHeight | |
|
313 | 321 | self.dataOut.radarControllerHeaderObj.ippSeconds = self.radarControllerHeaderObj.ippSeconds/self.nTxs |
|
314 | 322 | |
|
315 | 323 | return |
@@ -320,7 +328,8 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
320 | 328 | |
|
321 | 329 | self.firstHeaderSize = self.basicHeaderObj.size |
|
322 | 330 | |
|
323 |
datatype = int(numpy.log2((self.processingHeaderObj.processFlags & |
|
|
331 | datatype = int(numpy.log2((self.processingHeaderObj.processFlags & | |
|
332 | PROCFLAG.DATATYPE_MASK)) - numpy.log2(PROCFLAG.DATATYPE_CHAR)) | |
|
324 | 333 | if datatype == 0: |
|
325 | 334 | datatype_str = numpy.dtype([('real','<i1'),('imag','<i1')]) |
|
326 | 335 | elif datatype == 1: |
@@ -338,12 +347,13 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
338 | 347 | |
|
339 | 348 | self.dtype = datatype_str |
|
340 | 349 | #self.ippSeconds = 2 * 1000 * self.radarControllerHeaderObj.ipp / self.c |
|
341 |
self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + |
|
|
350 | self.fileSizeByHeader = self.processingHeaderObj.dataBlocksPerFile * self.processingHeaderObj.blockSize + \ | |
|
351 | self.firstHeaderSize + self.basicHeaderSize * \ | |
|
352 | (self.processingHeaderObj.dataBlocksPerFile - 1) | |
|
342 | 353 | # self.dataOut.channelList = numpy.arange(self.systemHeaderObj.numChannels) |
|
343 | 354 | # self.dataOut.channelIndexList = numpy.arange(self.systemHeaderObj.numChannels) |
|
344 | 355 | self.getBlockDimension() |
|
345 | 356 | |
|
346 | ||
|
347 | 357 |
def getFromServer(self): |
|
348 | 358 | self.flagDiscontinuousBlock = 0 |
|
349 | 359 | self.profileIndex = 0 |
@@ -368,15 +378,19 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
368 | 378 | timestamp = self.basicHeaderObj.get_datatime() |
|
369 | 379 | print '[Reading] - Block {} - {}'.format(self.nTotalBlocks, timestamp) |
|
370 | 380 | current_pointer_location = self.blockPointer |
|
371 | junk = numpy.fromstring( block[self.blockPointer:], self.dtype, self.blocksize ) | |
|
381 | junk = numpy.fromstring( | |
|
382 | block[self.blockPointer:], self.dtype, self.blocksize) | |
|
372 | 383 | |
|
373 | 384 | try: |
|
374 |
junk = junk.reshape( |
|
|
385 | junk = junk.reshape((self.processingHeaderObj.profilesPerBlock, | |
|
386 | self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels)) | |
|
375 | 387 | except: |
|
376 | 388 | #print "The read block (%3d) has not enough data" %self.nReadBlocks |
|
377 | 389 | if self.waitDataBlock(pointer_location=current_pointer_location): |
|
378 | junk = numpy.fromstring( block[self.blockPointer:], self.dtype, self.blocksize ) | |
|
379 | junk = junk.reshape( (self.processingHeaderObj.profilesPerBlock, self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels) ) | |
|
390 | junk = numpy.fromstring( | |
|
391 | block[self.blockPointer:], self.dtype, self.blocksize) | |
|
392 | junk = junk.reshape((self.processingHeaderObj.profilesPerBlock, | |
|
393 | self.processingHeaderObj.nHeights, self.systemHeaderObj.nChannels)) | |
|
380 | 394 | # return 0 |
|
381 | 395 | |
|
382 | 396 | #Dimensions : nChannels, nProfiles, nSamples |
@@ -384,17 +398,21 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
384 | 398 | junk = numpy.transpose(junk, (2,0,1)) |
|
385 | 399 |
self.datablock = junk['real'] + junk['imag'] * 1j |
|
386 | 400 | self.profileIndex = 0 |
|
387 |
if self.selBlocksize == None: |
|
|
401 | if self.selBlocksize == None: | |
|
402 | self.selBlocksize = self.dataOut.nProfiles | |
|
388 | 403 | if self.selBlocktime != None: |
|
389 | 404 | if self.dataOut.nCohInt is not None: |
|
390 | 405 | nCohInt = self.dataOut.nCohInt |
|
391 | 406 | else: |
|
392 | 407 | nCohInt = 1 |
|
393 |
self.selBlocksize = int(self.dataOut.nProfiles*round(self.selBlocktime/( |
|
|
394 | self.dataOut.data = self.datablock[:,self.profileIndex:self.profileIndex+self.selBlocksize,:] | |
|
408 | self.selBlocksize = int(self.dataOut.nProfiles * round(self.selBlocktime / ( | |
|
409 | nCohInt * self.dataOut.ippSeconds * self.dataOut.nProfiles))) | |
|
410 | self.dataOut.data = self.datablock[:, | |
|
411 | self.profileIndex:self.profileIndex + self.selBlocksize, :] | |
|
395 | 412 | datasize = self.dataOut.data.shape[1] |
|
396 | 413 | if datasize < self.selBlocksize: |
|
397 | buffer = numpy.zeros((self.dataOut.data.shape[0], self.selBlocksize, self.dataOut.data.shape[2]), dtype = 'complex') | |
|
414 | buffer = numpy.zeros( | |
|
415 | (self.dataOut.data.shape[0], self.selBlocksize, self.dataOut.data.shape[2]), dtype='complex') | |
|
398 | 416 | buffer[:,:datasize,:] = self.dataOut.data |
|
399 | 417 | self.dataOut.data = buffer |
|
400 | 418 | self.profileIndex = blockIndex |
@@ -486,20 +504,24 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
486 | 504 | """ |
|
487 | 505 | Return a block |
|
488 | 506 | """ |
|
489 |
if self.selBlocksize == None: |
|
|
507 | if self.selBlocksize == None: | |
|
508 | self.selBlocksize = self.dataOut.nProfiles | |
|
490 | 509 | if self.selBlocktime != None: |
|
491 | 510 | if self.dataOut.nCohInt is not None: |
|
492 | 511 | nCohInt = self.dataOut.nCohInt |
|
493 | 512 | else: |
|
494 | 513 | nCohInt = 1 |
|
495 |
self.selBlocksize = int(self.dataOut.nProfiles*round(self.selBlocktime/( |
|
|
514 | self.selBlocksize = int(self.dataOut.nProfiles * round(self.selBlocktime / ( | |
|
515 | nCohInt * self.dataOut.ippSeconds * self.dataOut.nProfiles))) | |
|
496 | 516 | |
|
497 |
self.dataOut.data = self.datablock[:, |
|
|
517 | self.dataOut.data = self.datablock[:, | |
|
518 | self.profileIndex:self.profileIndex + self.selBlocksize, :] | |
|
498 | 519 | self.profileIndex += self.selBlocksize |
|
499 | 520 | datasize = self.dataOut.data.shape[1] |
|
500 | 521 | |
|
501 | 522 | if datasize < self.selBlocksize: |
|
502 | buffer = numpy.zeros((self.dataOut.data.shape[0],self.selBlocksize,self.dataOut.data.shape[2]), dtype = 'complex') | |
|
523 | buffer = numpy.zeros( | |
|
524 | (self.dataOut.data.shape[0], self.selBlocksize, self.dataOut.data.shape[2]), dtype='complex') | |
|
503 | 525 | buffer[:,:datasize,:] = self.dataOut.data |
|
504 | 526 | |
|
505 | 527 | while datasize < self.selBlocksize: #Not enough profiles to fill the block |
@@ -514,7 +536,8 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
514 | 536 | blockIndex = self.selBlocksize - datasize |
|
515 | 537 | datablock1 = self.datablock[:,:blockIndex,:] |
|
516 | 538 | |
|
517 |
buffer[:,datasize:datasize+ |
|
|
539 | buffer[:, datasize:datasize + | |
|
540 | datablock1.shape[1], :] = datablock1 | |
|
518 | 541 | datasize += datablock1.shape[1] |
|
519 | 542 | |
|
520 | 543 | self.dataOut.data = buffer |
@@ -531,6 +554,7 class VoltageReader(JRODataReader, ProcessingUnit): | |||
|
531 | 554 | |
|
532 | 555 | return self.dataOut.data |
|
533 | 556 | |
|
557 | ||
|
534 | 558 | class VoltageWriter(JRODataWriter, Operation): |
|
535 | 559 | """ |
|
536 | 560 | Esta clase permite escribir datos de voltajes a archivos procesados (.r). La escritura |
@@ -543,7 +567,6 class VoltageWriter(JRODataWriter, Operation): | |||
|
543 | 567 | |
|
544 | 568 | shapeBuffer = None |
|
545 | 569 | |
|
546 | ||
|
547 | 570 | def __init__(self, **kwargs): |
|
548 | 571 | """ |
|
549 | 572 | Inicializador de la clase VoltageWriter para la escritura de datos de espectros. |
@@ -590,7 +613,6 class VoltageWriter(JRODataWriter, Operation): | |||
|
590 | 613 | return 1 |
|
591 | 614 | return 0 |
|
592 | 615 | |
|
593 | ||
|
594 | 616 | def setBlockDimension(self): |
|
595 | 617 | """ |
|
596 | 618 | Obtiene las formas dimensionales del los subbloques de datos que componen un bloque |
@@ -689,12 +711,12 class VoltageWriter(JRODataWriter, Operation): | |||
|
689 | 711 | |
|
690 | 712 | dtype_width = self.getDtypeWidth() |
|
691 | 713 | |
|
692 |
blocksize = int(self.dataOut.nHeights * self.dataOut.nChannels * |
|
|
714 | blocksize = int(self.dataOut.nHeights * self.dataOut.nChannels * | |
|
715 | self.profilesPerBlock * dtype_width * 2) | |
|
693 | 716 | |
|
694 | 717 | return blocksize |
|
695 | 718 | |
|
696 | 719 | def setFirstHeader(self): |
|
697 | ||
|
698 | 720 | """ |
|
699 | 721 | Obtiene una copia del First Header |
|
700 | 722 | |
@@ -715,10 +737,13 class VoltageWriter(JRODataWriter, Operation): | |||
|
715 | 737 | self.processingHeaderObj.blockSize = self.__getBlockSize() |
|
716 | 738 | self.processingHeaderObj.profilesPerBlock = self.profilesPerBlock |
|
717 | 739 | self.processingHeaderObj.dataBlocksPerFile = self.blocksPerFile |
|
718 |
|
|
|
740 | # podria ser 1 o self.dataOut.processingHeaderObj.nWindows | |
|
741 | self.processingHeaderObj.nWindows = 1 | |
|
719 | 742 | self.processingHeaderObj.nCohInt = self.dataOut.nCohInt |
|
720 |
|
|
|
721 | self.processingHeaderObj.totalSpectra = 0 # Cuando la data de origen es de tipo Voltage | |
|
743 | # Cuando la data de origen es de tipo Voltage | |
|
744 | self.processingHeaderObj.nIncohInt = 1 | |
|
745 | # Cuando la data de origen es de tipo Voltage | |
|
746 | self.processingHeaderObj.totalSpectra = 0 | |
|
722 | 747 | |
|
723 | 748 | if self.dataOut.code is not None: |
|
724 | 749 | self.processingHeaderObj.code = self.dataOut.code |
@@ -727,7 +752,8 class VoltageWriter(JRODataWriter, Operation): | |||
|
727 | 752 | |
|
728 | 753 | if self.processingHeaderObj.nWindows != 0: |
|
729 | 754 | self.processingHeaderObj.firstHeight = self.dataOut.heightList[0] |
|
730 |
self.processingHeaderObj.deltaHeight = self.dataOut.heightList[1] - |
|
|
755 | self.processingHeaderObj.deltaHeight = self.dataOut.heightList[1] - \ | |
|
756 | self.dataOut.heightList[0] | |
|
731 | 757 | self.processingHeaderObj.nHeights = self.dataOut.nHeights |
|
732 | 758 | self.processingHeaderObj.samplesWin = self.dataOut.nHeights |
|
733 | 759 |
General Comments 0
You need to be logged in to leave comments.
Login now