diff --git a/autopilot/transform/timeseries.py b/autopilot/transform/timeseries.py index da6c392d..f2b35485 100644 --- a/autopilot/transform/timeseries.py +++ b/autopilot/transform/timeseries.py @@ -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` diff --git a/docs/conf.py b/docs/conf.py index 07ac6880..34916949 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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', @@ -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),