@@ -580,7 +580,7 class Decoder(Operation): | |||
|
580 | 580 | |
|
581 | 581 | self.__isConfig = False |
|
582 | 582 | |
|
583 | def setup(self, code): | |
|
583 | def setup(self, code, shape): | |
|
584 | 584 | |
|
585 | 585 | self.__profIndex = 0 |
|
586 | 586 | |
@@ -589,15 +589,21 class Decoder(Operation): | |||
|
589 | 589 | self.nCode = len(code) |
|
590 | 590 | self.nBaud = len(code[0]) |
|
591 | 591 | |
|
592 | self.__nChannels, self.__nHeis = shape | |
|
593 | ||
|
594 | self.__codeBuffer = numpy.zeros(self.nCode, self.__nHeis) | |
|
595 | ||
|
596 | self.__codeBuffer[:,0:self.nBaud] = self.code[:,:] | |
|
597 | ||
|
598 | self.fft_code = numpy.conj(numpy.fft.fft(self.__codeBuffer, axis=1)) | |
|
599 | ||
|
600 | ||
|
592 | 601 | def convolutionInFreq(self, data): |
|
593 | 602 | |
|
594 | nchannel, ndata = data.shape | |
|
595 | newcode = numpy.zeros(ndata) | |
|
596 | newcode[0:self.nBaud] = self.code[self.__profIndex] | |
|
603 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) | |
|
597 | 604 | |
|
598 | 605 | fft_data = numpy.fft.fft(data, axis=1) |
|
599 | fft_code = numpy.conj(numpy.fft.fft(newcode)) | |
|
600 | fft_code = fft_code.reshape(1,len(fft_code)) | |
|
606 | ||
|
601 | 607 | |
|
602 | 608 | # conv = fft_data.copy() |
|
603 | 609 | # conv.fill(0) |
@@ -607,7 +613,7 class Decoder(Operation): | |||
|
607 | 613 | data = numpy.fft.ifft(conv,axis=1) |
|
608 | 614 | |
|
609 | 615 | datadec = data[:,:-self.nBaud+1] |
|
610 |
ndatadec = |
|
|
616 | ndatadec = self.__nHeis - self.nBaud + 1 | |
|
611 | 617 | |
|
612 | 618 | if self.__profIndex == self.nCode-1: |
|
613 | 619 | self.__profIndex = 0 |
@@ -620,14 +626,14 class Decoder(Operation): | |||
|
620 | 626 | |
|
621 | 627 | def convolutionInTime(self, data): |
|
622 | 628 | |
|
623 |
|
|
|
624 |
|
|
|
625 |
ndatadec = |
|
|
629 | self.__nChannels, self.__nHeis = data.shape | |
|
630 | self.__codeBuffer = self.code[self.__profIndex] | |
|
631 | ndatadec = self.__nHeis - self.nBaud + 1 | |
|
626 | 632 | |
|
627 |
datadec = numpy.zeros(( |
|
|
633 | datadec = numpy.zeros((self.__nChannels, ndatadec)) | |
|
628 | 634 | |
|
629 |
for i in range( |
|
|
630 |
datadec[i,:] = numpy.correlate(data[i,:], |
|
|
635 | for i in range(self.__nChannels): | |
|
636 | datadec[i,:] = numpy.correlate(data[i,:], self.__codeBuffer) | |
|
631 | 637 | |
|
632 | 638 | if self.__profIndex == self.nCode-1: |
|
633 | 639 | self.__profIndex = 0 |
@@ -650,7 +656,7 class Decoder(Operation): | |||
|
650 | 656 | return 1 |
|
651 | 657 | |
|
652 | 658 | if not self.__isConfig: |
|
653 | self.setup(code) | |
|
659 | self.setup(code, data.shape) | |
|
654 | 660 | self.__isConfig = True |
|
655 | 661 | |
|
656 | 662 | if mode == 0: |
General Comments 0
You need to be logged in to leave comments.
Login now