@@ -0,0 +1,10 | |||
|
1 | import numpy | |
|
2 | cimport numpy | |
|
3 | ||
|
4 | def decoder(numpy.ndarray[numpy.float32_t, ndim=2] fft_code, numpy.ndarray[numpy.float32_t, ndim=2] data): | |
|
5 | ||
|
6 | fft_data = numpy.fft.fft(data, axis=1) | |
|
7 | conv = fft_data*fft_code | |
|
8 | data = numpy.fft.ifft(conv, axis=1) | |
|
9 | ||
|
10 | return data No newline at end of file |
@@ -0,0 +1,6 | |||
|
1 | from distutils.core import setup | |
|
2 | from distutils.extension import Extension | |
|
3 | from Cython.Distutils import build_ext | |
|
4 | setup( | |
|
5 | cmdclass = {'build_ext': build_ext}, | |
|
6 | ext_modules = [Extension("cfunctions", ["cfunctions.pyx"])] ) No newline at end of file |
@@ -12,6 +12,11 from jrodata import * | |||
|
12 | 12 | from jrodataIO import * |
|
13 | 13 | from jroplot import * |
|
14 | 14 | |
|
15 | try: | |
|
16 | import cfunctions | |
|
17 | except: | |
|
18 | pass | |
|
19 | ||
|
15 | 20 | class ProcessingUnit: |
|
16 | 21 | |
|
17 | 22 | """ |
@@ -591,9 +596,9 class Decoder(Operation): | |||
|
591 | 596 | |
|
592 | 597 | self.__nChannels, self.__nHeis = shape |
|
593 | 598 | |
|
594 | self.__codeBuffer = numpy.zeros((self.nCode, self.__nHeis)) | |
|
599 | self.__codeBuffer = numpy.zeros((self.nCode, self.__nHeis), dtype=numpy.float) | |
|
595 | 600 | |
|
596 |
self.__codeBuffer[:,0:self.nBaud] = self.code |
|
|
601 | self.__codeBuffer[:,0:self.nBaud] = self.code | |
|
597 | 602 | |
|
598 | 603 | self.fft_code = numpy.conj(numpy.fft.fft(self.__codeBuffer, axis=1)) |
|
599 | 604 | |
@@ -623,7 +628,23 class Decoder(Operation): | |||
|
623 | 628 | |
|
624 | 629 | return ndatadec, datadec |
|
625 | 630 | |
|
631 | def convolutionInFreqOpt(self, data): | |
|
632 | ||
|
633 | fft_code = self.fft_code[self.__profIndex].reshape(1,-1) | |
|
634 | ||
|
635 | data = cfunctions.decoder(fft_code, data) | |
|
626 | 636 | |
|
637 | datadec = data[:,:-self.nBaud+1] | |
|
638 | ndatadec = self.__nHeis - self.nBaud + 1 | |
|
639 | ||
|
640 | if self.__profIndex == self.nCode-1: | |
|
641 | self.__profIndex = 0 | |
|
642 | return ndatadec, datadec | |
|
643 | ||
|
644 | self.__profIndex += 1 | |
|
645 | ||
|
646 | return ndatadec, datadec | |
|
647 | ||
|
627 | 648 | def convolutionInTime(self, data): |
|
628 | 649 | |
|
629 | 650 | self.__nChannels, self.__nHeis = data.shape |
General Comments 0
You need to be logged in to leave comments.
Login now