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