Merge branch 'master' into feature/pydocstrings
[aubio.git] / python / ext / py-fft.c
index 0fce627..a08af4e 100644 (file)
@@ -1,6 +1,24 @@
 #include "aubio-types.h"
 
-static char Py_fft_doc[] = "fft object";
+static char Py_fft_doc[] = ""
+"fft(size=1024)\n"
+"\n"
+"Compute Fast Fourier Transorms.\n"
+"\n"
+"Parameters\n"
+"----------\n"
+"size : int\n"
+"    size of the FFT to compute\n"
+"\n"
+"Example\n"
+"-------\n"
+">>> x = aubio.fvec(512)\n"
+">>> f = aubio.fft(512)\n"
+">>> c = f(x); c\n"
+"aubio cvec of 257 elements\n"
+">>> x2 = f.rdo(c); x2.shape\n"
+"(512,)\n"
+"";
 
 typedef struct
 {
@@ -51,11 +69,8 @@ Py_fft_init (Py_fft * self, PyObject * args, PyObject * kwds)
 {
   self->o = new_aubio_fft (self->win_s);
   if (self->o == NULL) {
-    PyErr_Format(PyExc_RuntimeError,
-        "error creating fft with win_s=%d "
-        "(should be a power of 2 greater than 1; "
-        "try recompiling aubio with --enable-fftw3)",
-        self->win_s);
+    // PyErr_Format(PyExc_RuntimeError, ...) was set above by new_ which called
+    // AUBIO_ERR when failing
     return -1;
   }
 
@@ -187,4 +202,13 @@ PyTypeObject Py_fftType = {
   (initproc) Py_fft_init,
   0,
   Py_fft_new,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
+  0,
 };