1

I'm using pythran to convert my python+numpy code into C++, so far everything works really well with very efficient resulting code. However, my code requires the use of numpy.ffr.rfft and irfft (Fast Fourier Transform), which pythran apparently does not support:

import numpy as np

# pythran export testFunc(float[])
def testFunc(signal):
    X = np.fft.rfft(signal,n=1024)

>pythran Foo.py
CRITICAL I am in trouble. Your input file does not seem to match 
Pythran's constraints...
E: Attribute 'fft' unknown (Foo.py, line 5)

How could I possibly make this happen? If I call a C implementation of the fast fourier transform from the python code (I know this can be done) will pythran use that or will it complain about it?

EDIT: I compiled a simple C function into an so module which I can then call from my python code. All this works fine when invoked from python, but pythran does not work on the import:

CRITICAL I've got a bad feeling about this...
E: source code not available

So it looks like pythran does not work well with compiled .so files.

jeanl
  • 11
  • 4

1 Answers1

0

Short answer:

Support for numpy.fft.rfft has beed added to Pythran with commit eb9e89373b and your code should now compile properly.

Long answer:

Adding support for new functions / packages in Pythran means writing the C++ code for this function (possibly a wrapper to an existing function) and registering it into Pythran so that the translator knows enough about it to guide its compilation process.

serge-sans-paille
  • 2,109
  • 11
  • 9