History

[python] improve cvec doc

Paul Brossier committed 8 years ago

Commit 92948ab1 parent 06293561 file · +35 −6Browse files

Showing the changes to python/ext (1 of 1 file). Show all

Unified · Split

python/ext/py-cvec.c+35−6
@@ -19,7 +19,36 @@ typedef struct · 18 unmodified lines
1919 uint_t length;
2020 } Py_cvec;
2121
22−static char Py_cvec_doc[] = "cvec object";
22+static char Py_cvec_doc[] = ""
23+"cvec(size)\n"
24+"\n"
25+"Data structure to hold spectral vectors.\n"
26+"\n"
27+"A vector holding spectral data in two vectors, :attr:`phas`\n"
28+"and :attr:`norm`. Each vector is a :class:`numpy.ndarray`\n"
29+"of shape `(length,)`, where `length = size // 2 + 1`.\n"
30+"\n"
31+"Parameters\n"
32+"----------\n"
33+"size: int\n"
34+" Size of spectrum to create.\n"
35+"\n"
36+"Examples\n"
37+"--------\n"
38+">>> c = aubio.cvec(1024)\n"
39+">>> c\n"
40+"aubio cvec of 513 elements\n"
41+">>> c.length\n"
42+"513\n"
43+">>> c.norm.dtype, c.phas.dtype\n"
44+"(dtype('float32'), dtype('float32'))\n"
45+">>> c.norm.shape, c.phas.shape\n"
46+"((513,), (513,))\n"
47+"\n"
48+"See Also\n"
49+"--------\n"
50+"fft, pvoc\n"
51+"";
2352
2453
2554 PyObject *
@@ -182,7 +211,7 @@ Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) · 156 unmodified lines
182211 static PyMemberDef Py_cvec_members[] = {
183212 // TODO remove READONLY flag and define getter/setter
184213 {"length", T_INT, offsetof (Py_cvec, length), READONLY,
185− "length attribute"},
214+ "int: Length of `norm` and `phas` vectors."},
186215 {NULL} /* Sentinel */
187216 };
188217
@@ -191,11 +220,11 @@ static PyMethodDef Py_cvec_methods[] = { · 2 unmodified lines
191220 };
192221
193222 static PyGetSetDef Py_cvec_getseters[] = {
194− {"norm", (getter)Py_cvec_get_norm, (setter)Py_cvec_set_norm,
195− "Numpy vector of shape (length,) containing the magnitude",
223+ {"norm", (getter)Py_cvec_get_norm, (setter)Py_cvec_set_norm,
224+ "numpy.ndarray: Vector of shape `(length,)` containing the magnitude.",
196225 NULL},
197− {"phas", (getter)Py_cvec_get_phas, (setter)Py_cvec_set_phas,
198− "Numpy vector of shape (length,) containing the phase",
226+ {"phas", (getter)Py_cvec_get_phas, (setter)Py_cvec_set_phas,
227+ "numpy.ndarray: Vector of shape `(length,)` containing the phase.",
199228 NULL},
200229 {NULL} /* sentinel */
201230 };

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t