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