Changeset 55b6260


Ignore:
Timestamp:
Oct 26, 2018, 6:23:34 PM (13 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master
Children:
0bb2d63
Parents:
7df8df7
Message:

[python] add docstrings to alpha_norm and zero_crossing_rate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/aubiomodule.c

    r7df8df7 r55b6260  
    1111
    1212static char Py_alpha_norm_doc[] = ""
    13 "alpha_norm(fvec, integer) -> float\n"
    14 "\n"
    15 "Compute alpha normalisation factor on vector, given alpha\n"
     13"alpha_norm(vec, alpha)\n"
     14"\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"
    1628"\n"
    1729"Example\n"
    1830"-------\n"
    1931"\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"";
    2144
    2245static char Py_bintomidi_doc[] = ""
     
    131154
    132155static char Py_zero_crossing_rate_doc[] = ""
    133 "zero_crossing_rate(fvec) -> float\n"
    134 "\n"
    135 "Compute Zero crossing rate of a vector\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"
     164"\n"
     165"Returns\n"
     166"-------\n"
     167"float\n"
     168"   Zero-crossing rate.\n"
    136169"\n"
    137170"Example\n"
    138171"-------\n"
    139172"\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"";
    141177
    142178static char Py_min_removal_doc[] = ""
    143 "min_removal(fvec) -> float\n"
    144 "\n"
    145 "Remove the minimum value of a vector, in-place modification\n"
     179"min_removal(vec)\n"
     180"\n"
     181"Remove the minimum value of a vector to each of its element.\n"
     182"\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"
    146194"\n"
    147195"Example\n"
    148196"-------\n"
    149197"\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"";
    151201
    152202extern void add_ufuncs ( PyObject *m );
Note: See TracChangeset for help on using the changeset viewer.