##// END OF EJS Templates
Remove numpy.float, numpy.int, numpy.complex
Juan C. Espinoza -
r1594:16c6f41ffb3e
parent child
Show More
@@ -110,7 +110,7 class DigitalRFReader(ProcessingUnit):
110 110 self.dataOut.nProfiles = int(nProfiles)
111 111
112 112 self.dataOut.heightList = self.__firstHeigth + \
113 numpy.arange(self.__nSamples, dtype=numpy.float) * \
113 numpy.arange(self.__nSamples, dtype=numpy.float32) * \
114 114 self.__deltaHeigth
115 115
116 116 self.dataOut.channelList = list(range(self.__num_subchannels))
@@ -233,7 +233,7 class DigitalRFReader(ProcessingUnit):
233 233 nCode=1,
234 234 nBaud=1,
235 235 flagDecodeData=False,
236 code=numpy.ones((1, 1), dtype=numpy.int),
236 code=numpy.ones((1, 1), dtype=numpy.int32),
237 237 **kwargs):
238 238 '''
239 239 In this method we should set all initial parameters.
@@ -404,7 +404,7 class DigitalRFReader(ProcessingUnit):
404 404 self.__thisUnixSample = int(startUTCSecond * self.__sample_rate) - self.__samples_to_read
405 405
406 406 self.__data_buffer = numpy.zeros(
407 (self.__num_subchannels, self.__samples_to_read), dtype=numpy.complex)
407 (self.__num_subchannels, self.__samples_to_read), dtype=complex)
408 408
409 409 self.__setFileHeader()
410 410 self.isConfig = True
@@ -686,7 +686,7 class HFReader(ProcessingUnit):
686 686
687 687 def __setLocalVariables(self):
688 688
689 self.datablock = numpy.zeros((self.nChannels, self.nHeights, self.nProfiles), dtype=numpy.complex)
689 self.datablock = numpy.zeros((self.nChannels, self.nHeights, self.nProfiles), dtype=complex)
690 690 #
691 691
692 692
@@ -743,7 +743,7 class HFReader(ProcessingUnit):
743 743
744 744 self.dataOut.nProfiles = 1
745 745
746 self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype=numpy.float) * self.__deltaHeigth
746 self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype=numpy.float32) * self.__deltaHeigth
747 747
748 748 self.dataOut.channelList = list(range(self.nChannels))
749 749
@@ -360,13 +360,24 class HDFWriter(Operation):
360 360 Operation.__init__(self)
361 361 return
362 362
363 def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, description=None):
363 def set_kwargs(self, **kwargs):
364
365 for key, value in kwargs.items():
366 setattr(self, key, value)
367
368 def set_kwargs_obj(self, obj, **kwargs):
369
370 for key, value in kwargs.items():
371 setattr(obj, key, value)
372
373 def setup(self, path=None, blocksPerFile=10, metadataList=None, dataList=None, setType=None, description=None, **kwargs):
364 374 self.path = path
365 375 self.blocksPerFile = blocksPerFile
366 376 self.metadataList = metadataList
367 377 self.dataList = [s.strip() for s in dataList]
368 378 self.setType = setType
369 379 self.description = description
380 self.set_kwargs(**kwargs)
370 381
371 382 if self.metadataList is None:
372 383 self.metadataList = self.dataOut.metadata_list
@@ -385,7 +396,7 class HDFWriter(Operation):
385 396
386 397 if dataAux is None:
387 398 continue
388 elif isinstance(dataAux, (int, float, numpy.integer, numpy.float)):
399 elif isinstance(dataAux, (int, float, numpy.integer, numpy.float32)):
389 400 dsDict['nDim'] = 0
390 401 else:
391 402 dsDict['nDim'] = len(dataAux.shape)
@@ -422,13 +433,14 class HDFWriter(Operation):
422 433 return False
423 434
424 435 def run(self, dataOut, path, blocksPerFile=10, metadataList=None,
425 dataList=[], setType=None, description={}):
436 dataList=[], setType=None, description={}, **kwargs):
426 437
427 438 self.dataOut = dataOut
439 self.set_kwargs_obj(self.dataOut, **kwargs)
428 440 if not(self.isConfig):
429 441 self.setup(path=path, blocksPerFile=blocksPerFile,
430 442 metadataList=metadataList, dataList=dataList,
431 setType=setType, description=description)
443 setType=setType, description=description, **kwargs)
432 444
433 445 self.isConfig = True
434 446 self.setNextFile()
@@ -508,15 +520,17 class HDFWriter(Operation):
508 520 return key
509 521 return name
510 522 else:
523 if 'Data' in self.description:
524 data = self.description['Data']
511 525 if 'Metadata' in self.description:
512 meta = self.description['Metadata']
513 else:
514 meta = self.description
515 if name in meta:
516 if isinstance(meta[name], list):
517 return meta[name][x]
518 elif isinstance(meta[name], dict):
519 for key, value in meta[name].items():
526 data.update(self.description['Metadata'])
527 else:
528 data = self.description
529 if name in data:
530 if isinstance(data[name], list):
531 return data[name][x]
532 elif isinstance(data[name], dict):
533 for key, value in data[name].items():
520 534 return value[x]
521 535 if 'cspc' in name:
522 536 return 'pair{:02d}'.format(x)
@@ -706,7 +720,7 class ASCIIWriter(Operation):
706 720
707 721 if dataAux is None:
708 722 continue
709 elif isinstance(dataAux, (int, float, numpy.integer, numpy.float)):
723 elif isinstance(dataAux, (int, float, numpy.integer, numpy.float32)):
710 724 dsDict['nDim'] = 0
711 725 else:
712 726 dsDict['nDim'] = len(dataAux.shape)
@@ -332,7 +332,7 class SimulatorReader(JRODataReader, ProcessingUnit):
332 332 Hdoppler = self.Hdoppler
333 333 Adoppler = self.Adoppler
334 334
335 self.datablock = numpy.zeros([channels, prof_gen, Samples], dtype=numpy.complex64)
335 self.datablock = numpy.zeros([channels, prof_gen, Samples], dtype=complex)
336 336 for i in range(channels):
337 337 for k in range(prof_gen):
338 338 #-----------------------NOISE---------------
@@ -358,7 +358,7 class SimulatorReader(JRODataReader, ProcessingUnit):
358 358 #----------------DOPPLER SIGNAL...............................................
359 359 time_vec = numpy.linspace(0, (prof_gen - 1) * ippSec, int(prof_gen)) + self.nReadBlocks * ippSec * prof_gen + (self.nReadFiles - 1) * ippSec * prof_gen
360 360 fd = Fdoppler # +(600.0/120)*self.nReadBlocks
361 d_signal = Adoppler * numpy.array(numpy.exp(1.0j * 2.0 * math.pi * fd * time_vec), dtype=numpy.complex64)
361 d_signal = Adoppler * numpy.array(numpy.exp(1.0j * 2.0 * math.pi * fd * time_vec), dtype=complex)
362 362 #-------------Senal con ancho espectral--------------------
363 363 if prof_gen % 2 == 0:
364 364 min = int(prof_gen / 2.0 - 1.0)
@@ -371,7 +371,7 class SimulatorReader(JRODataReader, ProcessingUnit):
371 371 A = 20
372 372 specw_sig = specw_sig / w
373 373 specw_sig = numpy.sinc(specw_sig)
374 specw_sig = A * numpy.array(specw_sig, dtype=numpy.complex64)
374 specw_sig = A * numpy.array(specw_sig, dtype=complex)
375 375 #------------------ DATABLOCK + DOPPLER--------------------
376 376 HD = int(Hdoppler / self.AcqDH_0)
377 377 for i in range(12):
@@ -86,7 +86,7 class USRPReader(ProcessingUnit):
86 86
87 87 self.dataOut.nProfiles = nProfiles
88 88
89 self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype=numpy.float) * self.__deltaHeigth
89 self.dataOut.heightList = self.__firstHeigth + numpy.arange(self.__nSamples, dtype=numpy.float32) * self.__deltaHeigth
90 90
91 91 self.dataOut.channelList = self.__channelList
92 92
@@ -257,7 +257,7 class USRPReader(ProcessingUnit):
257 257
258 258 nCode = 1
259 259 nBaud = 1
260 code = numpy.ones((nCode, nBaud), dtype=numpy.int)
260 code = numpy.ones((nCode, nBaud), dtype=numpy.int32)
261 261
262 262 if codeType:
263 263 nCode = this_metadata_file['nCode'].value
@@ -341,7 +341,7 class USRPReader(ProcessingUnit):
341 341
342 342 self.__thisUnixSample = int(startUTCSecond * self.__sample_rate) - self.__samples_to_read
343 343
344 self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype=numpy.complex)
344 self.__data_buffer = numpy.zeros((self.__nChannels, self.__samples_to_read), dtype=complex)
345 345
346 346 self.__setFileHeader()
347 347 self.isConfig = True
General Comments 0
You need to be logged in to leave comments. Login now