Showing the changes to python/ext (1 of 1 file). Show all
Unified · Split
| @@ -19,7 +19,36 @@ typedef struct · 18 unmodified lines | |||
| 19 | uint_t length; | 19 | uint_t length; |
| 20 | } Py_cvec; | 20 | } Py_cvec; |
| 21 | 21 | ||
| 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 | ""; | ||
| 23 | 52 | ||
| 24 | 53 | ||
| 25 | PyObject * | 54 | PyObject * |
| @@ -182,7 +211,7 @@ Py_cvec_set_phas (Py_cvec * vec, PyObject *input, void * closure) · 156 unmodified lines | |||
| 182 | static PyMemberDef Py_cvec_members[] = { | 211 | static PyMemberDef Py_cvec_members[] = { |
| 183 | // TODO remove READONLY flag and define getter/setter | 212 | // TODO remove READONLY flag and define getter/setter |
| 184 | {"length", T_INT, offsetof (Py_cvec, length), READONLY, | 213 | {"length", T_INT, offsetof (Py_cvec, length), READONLY, |
| 185 | "length attribute"}, | 214 | "int: Length of `norm` and `phas` vectors."}, |
| 186 | {NULL} /* Sentinel */ | 215 | {NULL} /* Sentinel */ |
| 187 | }; | 216 | }; |
| 188 | 217 | ||
| @@ -191,11 +220,11 @@ static PyMethodDef Py_cvec_methods[] = { · 2 unmodified lines | |||
| 191 | }; | 220 | }; |
| 192 | 221 | ||
| 193 | static PyGetSetDef Py_cvec_getseters[] = { | 222 | static PyGetSetDef Py_cvec_getseters[] = { |
| 194 | {"norm", (getter)Py_cvec_get_norm, (setter)Py_cvec_set_norm, | 223 | {"norm", (getter)Py_cvec_get_norm, (setter)Py_cvec_set_norm, |
| 195 | "Numpy vector of shape (length,) containing the magnitude", | 224 | "numpy.ndarray: Vector of shape `(length,)` containing the magnitude.", |
| 196 | NULL}, | 225 | NULL}, |
| 197 | {"phas", (getter)Py_cvec_get_phas, (setter)Py_cvec_set_phas, | 226 | {"phas", (getter)Py_cvec_get_phas, (setter)Py_cvec_set_phas, |
| 198 | "Numpy vector of shape (length,) containing the phase", | 227 | "numpy.ndarray: Vector of shape `(length,)` containing the phase.", |
| 199 | NULL}, | 228 | NULL}, |
| 200 | {NULL} /* sentinel */ | 229 | {NULL} /* sentinel */ |
| 201 | }; | 230 | }; |