@@ -608,61 +608,39 class Decoder(Operation): | |||
|
608 | 608 | |
|
609 | 609 | def convolutionInFreq(self, data): |
|
610 | 610 | |
|
611 | ini = time.time() | |
|
612 | ||
|
613 | 611 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) |
|
614 | 612 | |
|
615 | print "Freq0 ", time.time() - ini | |
|
616 | ||
|
617 | 613 | fft_data = numpy.fft.fft(data, axis=1) |
|
618 | 614 | |
|
619 | print "Freq1 ", time.time() - ini | |
|
620 | ||
|
621 | 615 | conv = fft_data*fft_code |
|
622 | ||
|
623 | print "Freq2 ", time.time() - ini | |
|
624 | 616 | |
|
625 | 617 | data = numpy.fft.ifft(conv,axis=1) |
|
626 | 618 | |
|
627 | print "Freq3 ", time.time() - ini | |
|
628 | ||
|
629 | 619 | datadec = data[:,:-self.nBaud+1] |
|
630 | 620 | |
|
631 | print "Freq4 ", time.time() - ini | |
|
632 | ||
|
633 | 621 | return datadec |
|
634 | 622 | |
|
635 | 623 | def convolutionInFreqOpt(self, data): |
|
636 | 624 | |
|
637 | ini = time.time() | |
|
638 | ||
|
639 | 625 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) |
|
640 | 626 | |
|
641 | 627 | data = cfunctions.decoder(fft_code, data) |
|
642 | 628 | |
|
643 | 629 | datadec = data[:,:-self.nBaud+1] |
|
644 | 630 | |
|
645 | print "OptFreq ", time.time() - ini | |
|
646 | ||
|
647 | 631 | return datadec |
|
648 | 632 | |
|
649 | 633 | def convolutionInTime(self, data): |
|
650 | 634 | |
|
651 | ini = time.time() | |
|
652 | ||
|
653 | 635 | code = self.code[self.__profIndex] |
|
654 | 636 | |
|
655 | print self.datadecTime.shape, data.shape, code.shape | |
|
656 | ||
|
657 | 637 | for i in range(self.__nChannels): |
|
658 | 638 | self.datadecTime[i,:] = numpy.correlate(data[i,:], code, mode='valid') |
|
659 | 639 | |
|
660 | print "Time ", time.time() - ini | |
|
661 | ||
|
662 | 640 | return self.datadecTime |
|
663 | 641 | |
|
664 | 642 | def run(self, dataOut, code=None, nCode=None, nBaud=None, mode = 0): |
|
665 | ini = time.time() | |
|
643 | ||
|
666 | 644 | if not self.__isConfig: |
|
667 | 645 | |
|
668 | 646 | if code == None: |
@@ -679,13 +657,11 class Decoder(Operation): | |||
|
679 | 657 | self.setup(code, dataOut.data.shape) |
|
680 | 658 | self.__isConfig = True |
|
681 | 659 | |
|
682 | print "DAta shape ", dataOut.data.shape | |
|
683 | ||
|
684 | 660 | if mode == 0: |
|
685 |
datadec = self.convolutionIn |
|
|
661 | datadec = self.convolutionInTime(dataOut.data) | |
|
686 | 662 | |
|
687 | 663 | if mode == 1: |
|
688 |
datadec = self.convolutionIn |
|
|
664 | datadec = self.convolutionInFreq(dataOut.data) | |
|
689 | 665 | |
|
690 | 666 | if mode == 2: |
|
691 | 667 | datadec = self.convolutionInFreqOpt(dataOut.data) |
@@ -695,8 +671,6 class Decoder(Operation): | |||
|
695 | 671 | dataOut.heightList = dataOut.heightList[0:self.ndatadec] |
|
696 | 672 | |
|
697 | 673 | dataOut.flagDecodeData = True #asumo q la data no esta decodificada |
|
698 | ||
|
699 | print time.time() - ini, "prof = %d, nCode=%d" %(self.__profIndex, self.nCode) | |
|
700 | 674 | |
|
701 | 675 | if self.__profIndex == self.nCode-1: |
|
702 | 676 | self.__profIndex = 0 |
General Comments 0
You need to be logged in to leave comments.
Login now