Skip to content

Commit 3f5b260

Browse files
committed
docs: python get started
1 parent b14eacf commit 3f5b260

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import numpy as np
2+
import openae.features
3+
4+
# generate random data
5+
rng = np.random.default_rng()
6+
timedata = rng.normal(0, 1, 1024)
7+
8+
# compute spectrum
9+
spectrum = np.fft.rfft(timedata)
10+
11+
# generate input for feature extraction algorithms
12+
input_ = openae.features.Input(
13+
samplerate=1.0,
14+
timedata=timedata,
15+
spectrum=spectrum,
16+
)
17+
18+
# compute features
19+
print(openae.features.rms(input_))
20+
print(openae.features.spectral_centroid(input_))
21+
print(openae.features.spectral_flatness(input_))

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Contents
1717
:maxdepth: 1
1818
:caption: Python
1919

20+
python/get-started
2021
python/api
2122

2223
Indices and tables

docs/python/get-started.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Get Started
2+
3+
## Install
4+
5+
The Python library can be easily installed with [PyPI](https://pypi.org/project/openae/):
6+
7+
```shell
8+
$ pip install openae
9+
```
10+
11+
## Minimal example
12+
13+
```{literalinclude} ../../bindings/python/examples/features_minimal.py
14+
```

0 commit comments

Comments
 (0)