Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sneakers-the-rat committed Oct 20, 2021
1 parent 8a2cc71 commit 775b1cb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
31 changes: 31 additions & 0 deletions autopilot/transform/timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,37 @@ class Gammatone(Transform):
Thin wrapper around :class:`scipy.signal.gammatone` !! (started rewriting this and realized they had made a legible
version <3 ty scipy team, additional implementations in the references)
Examples:
.. plot::
import matplotlib.pyplot as plt
import numpy as np
from autopilot.transform.timeseries import Gammatone
gamma_1k = Gammatone(1000, fs=44100)
gamma_15k = Gammatone(15000, fs=44100)
signal = (np.random.rand(44100)-0.5)*2
filt_1k = gamma_1k.process(signal)
filt_15k = gamma_15k.process(signal)
fig, ax = plt.subplots(1,3, subplot_kw={'aspect':'equal'})
ax[0].set_title('White Noise')
ax[0].specgram(signal, Fs=44100)
ax[1].set_title('1kHz Gammatone Filter')
ax[1].axes.yaxis.set_visible(False)
ax[1].specgram(filt_1k, Fs=44100)
ax[2].set_title('15kHz Gammatone Filter')
ax[2].axes.yaxis.set_visible(False)
ax[2].specgram(filt_15k, Fs=44100)
plt.tight_layout()
plt.show()
References:
* :cite:`slaneyEfficientImplementationPattersonHoldsworth1997`
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
'sphinx.ext.graphviz',
'sphinx.ext.autosummary',
'sphinx.ext.imgconverter',
'matplotlib.sphinxext.plot_directive',
#'sphinx_automodapi.automodapi',
'autodocsumm', # https://github.com/Chilipp/autodocsumm
#'sphinxcontrib.fulltoc',
Expand Down Expand Up @@ -285,7 +286,7 @@
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
'PySide2': ('https://doc.qt.io/qtforpython/PySide2/', None),
'tables': ('https://pytables.readthedocs.io/en/latest/', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/objects.inv', None),
'pandas': ('https://pandas.pydata.org/pandas-docs/stable/', None),
'zmq': ('https://pyzmq.readthedocs.io/en/latest/', None),
'tornado': ('https://www.tornadoweb.org/en/stable/', None),
'pyqtgraph': ('https://pyqtgraph.readthedocs.io/en/latest/', None),
Expand Down

0 comments on commit 775b1cb

Please sign in to comment.