ref: e3c4d00e60ec59b92cd40a38a787fb2a339d65ea
parent: fb1c5e2054eb859d412e1e28cb9c045c8219854c
author: Paul Brossier <piem@piem.org>
date: Fri Oct 26 14:08:38 EDT 2018
[python] add docstrings to ufuncs
--- a/python/ext/ufuncs.c
+++ b/python/ext/ufuncs.c
@@ -58,8 +58,23 @@
//NPY_OBJECT, NPY_OBJECT,
};
-static char Py_unwrap2pi_doc[] = "map angle to unit circle [-pi, pi[";
+// Note: these docstrings should *not* include the function signatures
+static char Py_unwrap2pi_doc[] = ""
+"\n"
+"Map angle to unit circle :math:`[-\\pi, \\pi[`.\n"
+"\n"
+"Parameters\n"
+"----------\n"
+"x : numpy.ndarray\n"
+" input array\n"
+"\n"
+"Returns\n"
+"-------\n"
+"numpy.ndarray\n"
+" values clamped to the unit circle :math:`[-\\pi, \\pi[`\n"
+"";
+
static void* Py_unwrap2pi_data[] = {
(void *)aubio_unwrap2pi,
(void *)aubio_unwrap2pi,
@@ -67,7 +82,20 @@
//(void *)unwrap2pio,
};
-static char Py_freqtomidi_doc[] = "convert frequency to midi";
+static char Py_freqtomidi_doc[] = ""
+"\n"
+"Convert frequency `[0; 23000[` to midi `[0; 128[`.\n"
+"\n"
+"Parameters\n"
+"----------\n"
+"x : numpy.ndarray\n"
+" Array of frequencies, in Hz.\n"
+"\n"
+"Returns\n"
+"-------\n"
+"numpy.ndarray\n"
+" Converted frequencies, in midi note.\n"
+"";
static void* Py_freqtomidi_data[] = {
(void *)aubio_freqtomidi,
@@ -74,7 +102,20 @@
(void *)aubio_freqtomidi,
};
-static char Py_miditofreq_doc[] = "convert midi to frequency";
+static char Py_miditofreq_doc[] = ""
+"\n"
+"Convert midi `[0; 128[` to frequency `[0, 23000]`.\n"
+"\n"
+"Parameters\n"
+"----------\n"
+"x : numpy.ndarray\n"
+" Array of frequencies, in midi note.\n"
+"\n"
+"Returns\n"
+"-------\n"
+"numpy.ndarray\n"
+" Converted frequencies, in Hz\n"
+"";
static void* Py_miditofreq_data[] = {
(void *)aubio_miditofreq,