Cython: Fourier Transform

This project demonstrates wrapping C/C++ functions in Cython. It also shows how to pass numpy arrays to C/C++ arrays and vice versa.

There are potential execution speed advantages to this mixed language approach.
The sample source code uses this approach to calculate a Fourier transform from a time history signal.
The scripts on this page require the utility module tompy.py

The C/C++ source code and its header file are: fourier_ccode.cpp & fourier_ccode.h

The Cython file and its setup script are: fourier_trans.pyx & ft_setup.py

The Cython & C/C++ files are compiled in command-line via: python ft_setup.py build_ext –inplace

The main Python file is: fourier_c.py
This project was developed using the reference material at: Wrapping Cython

Tom Irvine

Advertisements

One thought on “Cython: Fourier Transform

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s