Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -10,14 +10,37 @@ · 9 unmodified lines | ||
| 10 | 10 | static char aubio_module_doc[] = "Python module for the aubio library"; |
| 11 | 11 | |
| 12 | 12 | static char Py_alpha_norm_doc[] = "" |
| 13 | −"alpha_norm(fvec, integer) -> float\n" | |
| 13 | +"alpha_norm(vec, alpha)\n" | |
| 14 | 14 | "\n" |
| 15 | −"Compute alpha normalisation factor on vector, given alpha\n" | |
| 15 | +"Compute `alpha` normalisation factor of vector `vec`.\n" | |
| 16 | +"\n" | |
| 17 | +"Parameters\n" | |
| 18 | +"----------\n" | |
| 19 | +"vec : fvec\n" | |
| 20 | +" input vector\n" | |
| 21 | +"alpha : float\n" | |
| 22 | +" norm factor\n" | |
| 23 | +"\n" | |
| 24 | +"Returns\n" | |
| 25 | +"-------\n" | |
| 26 | +"float\n" | |
| 27 | +" p-norm of the input vector, where `p=alpha`\n" | |
| 16 | 28 | "\n" |
| 17 | 29 | "Example\n" |
| 18 | 30 | "-------\n" |
| 19 | 31 | "\n" |
| 20 | −">>> b = alpha_norm(a, 9)"; | |
| 32 | +">>> a = aubio.fvec(np.arange(10)); alpha = 2\n" | |
| 33 | +">>> aubio.alpha_norm(a, alpha), (sum(a**alpha)/len(a))**(1./alpha)\n" | |
| 34 | +"(5.338539123535156, 5.338539126015656)\n" | |
| 35 | +"\n" | |
| 36 | +"Note\n" | |
| 37 | +"----\n" | |
| 38 | +"Computed as:\n" | |
| 39 | +"\n" | |
| 40 | +".. math::\n" | |
| 41 | +" l_{\\alpha} = \n" | |
| 42 | +" \\|\\frac{\\sum_{n=0}^{N-1}{{x_n}^{\\alpha}}}{N}\\|^{1/\\alpha}\n" | |
| 43 | +""; | |
| 21 | 44 | |
| 22 | 45 | static char Py_bintomidi_doc[] = "" |
| 23 | 46 | "bintomidi(fftbin, samplerate, fftsize)\n" |
| @@ -130,24 +153,51 @@ static char Py_freqtobin_doc[] = "" · 106 unmodified lines | ||
| 130 | 153 | ""; |
| 131 | 154 | |
| 132 | 155 | static char Py_zero_crossing_rate_doc[] = "" |
| 133 | −"zero_crossing_rate(fvec) -> float\n" | |
| 156 | +"zero_crossing_rate(vec)\n" | |
| 157 | +"\n" | |
| 158 | +"Compute zero-crossing rate of `vec`.\n" | |
| 159 | +"\n" | |
| 160 | +"Parameters\n" | |
| 161 | +"----------\n" | |
| 162 | +"vec : fvec\n" | |
| 163 | +" input vector\n" | |
| 134 | 164 | "\n" |
| 135 | −"Compute Zero crossing rate of a vector\n" | |
| 165 | +"Returns\n" | |
| 166 | +"-------\n" | |
| 167 | +"float\n" | |
| 168 | +" Zero-crossing rate.\n" | |
| 136 | 169 | "\n" |
| 137 | 170 | "Example\n" |
| 138 | 171 | "-------\n" |
| 139 | 172 | "\n" |
| 140 | −">>> z = zero_crossing_rate(a)"; | |
| 173 | +">>> a = np.linspace(-1., 1., 1000, dtype=aubio.float_type)\n" | |
| 174 | +">>> aubio.zero_crossing_rate(a), 1/1000\n" | |
| 175 | +"(0.0010000000474974513, 0.001)\n" | |
| 176 | +""; | |
| 141 | 177 | |
| 142 | 178 | static char Py_min_removal_doc[] = "" |
| 143 | −"min_removal(fvec) -> float\n" | |
| 179 | +"min_removal(vec)\n" | |
| 180 | +"\n" | |
| 181 | +"Remove the minimum value of a vector to each of its element.\n" | |
| 144 | 182 | "\n" |
| 145 | −"Remove the minimum value of a vector, in-place modification\n" | |
| 183 | +"Modifies the input vector in-place and returns a reference to it.\n" | |
| 184 | +"\n" | |
| 185 | +"Parameters\n" | |
| 186 | +"----------\n" | |
| 187 | +"vec : fvec\n" | |
| 188 | +" input vector\n" | |
| 189 | +"\n" | |
| 190 | +"Returns\n" | |
| 191 | +"-------\n" | |
| 192 | +"fvec\n" | |
| 193 | +" modified input vector\n" | |
| 146 | 194 | "\n" |
| 147 | 195 | "Example\n" |
| 148 | 196 | "-------\n" |
| 149 | 197 | "\n" |
| 150 | −">>> min_removal(a)"; | |
| 198 | +">>> aubio.min_removal(aubio.fvec(np.arange(1,4)))\n" | |
| 199 | +"array([0., 1., 2.], dtype=" AUBIO_NPY_SMPL_STR ")\n" | |
| 200 | +""; | |
| 151 | 201 | |
| 152 | 202 | extern void add_ufuncs ( PyObject *m ); |
| 153 | 203 | extern int generated_types_ready(void); |