Skip to content

Commit

Permalink
Minor documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVinyard committed Feb 15, 2019
1 parent 69c2d6e commit 7a75d80
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 8 deletions.
3 changes: 3 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,8 @@ class ZoundsDocsMock(mock.Mock):
__version__ = 1.0

ndarray = object
Module = object
Node = object

def __init__(self, *args, **kwargs):
super(ZoundsDocsMock, self).__init__(side_effect=None)
Expand Down Expand Up @@ -381,5 +383,6 @@ def __rtruediv__(self, other):

ZoundsDocsMock.timedelta64 = ZoundsDocsMock


for mod_name in MOCK_MODULES:
sys.modules[mod_name] = ZoundsDocsMock()
13 changes: 9 additions & 4 deletions docs/source/learn.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,28 @@ Learn
.. automodule:: zounds.learn
.. currentmodule:: zounds.learn

PyTorch Modules
---------------
.. autoclass:: FilterBank
.. autoclass:: SincLayer

The Basics
----------
.. autoclass:: PreprocessingPipeline

.. autoclass:: Pipeline

.. autoclass:: Preprocessor
:members:

.. autoclass:: PreprocessResult

.. autoclass:: PipelineResult

Custom Losses
-------------
.. autoclass:: PerceptualLoss

Custom Layers
-------------
.. autoclass:: SincLayer

Data Preparation
----------------
.. autoclass:: UnitNorm
Expand Down
6 changes: 6 additions & 0 deletions docs/source/spectral.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ Representations
.. autoclass:: FrequencyAdaptive
:members:

Functions
---------
.. autofunction:: fft

.. autofunction:: morlet_filter_bank

Processing Nodes
----------------
.. autoclass:: SlidingWindow
Expand Down
2 changes: 1 addition & 1 deletion zounds/learn/spectral.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FilterBank(nn.Module):
See Also:
:class:`~zounds.spectral.AWeighting`
:function:`~zounds.spectral.morlet_filter_bank`
:func:`~zounds.spectral.morlet_filter_bank`
"""

def __init__(
Expand Down
23 changes: 21 additions & 2 deletions zounds/spectral/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,27 @@ def morlet_filter_bank(
scaling_factor,
normalize=True):
"""
Create a bank of finite impulse response filters, with
frequencies centered on the sub-bands of scale
Create a :class:`~zounds.core.ArrayWithUnits` instance with a
:class:`~zounds.timeseries.TimeDimension` and a
:class:`~zounds.spectral.FrequencyDimension` representing a bank of morlet
wavelets centered on the sub-bands of the scale.
Args:
samplerate (SampleRate): the samplerate of the input signal
kernel_size (int): the length in samples of each filter
scale (FrequencyScale): a scale whose center frequencies determine the
fundamental frequency of each filer
scaling_factor (int or list of int): Scaling factors for each band,
which determine the time-frequency resolution tradeoff.
The number(s) should fall between 0 and 1, with smaller numbers
achieving better frequency resolution, and larget numbers better
time resolution
normalize (bool): When true, ensure that each filter in the bank
has unit norm
See Also:
:class:`~zounds.spectral.FrequencyScale`
:class:`~zounds.timeseries.SampleRate`
"""
basis_size = len(scale)
basis = np.zeros((basis_size, kernel_size), dtype=np.complex128)
Expand Down
2 changes: 1 addition & 1 deletion zounds/timeseries/audiosamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def encode(self, flo=None, fmt='WAV', subtype='PCM_16'):
Args:
flo (file-like): A file-like object to write the bytes to. If flo
is not supplied, a new :class:`io.BytesIO` instance will be
created and returned
created and returned
fmt (str): A libsndfile-friendly identifier for an audio encoding
(detailed here: http://www.mega-nerd.com/libsndfile/api.html)
subtype (str): A libsndfile-friendly identifier for an audio
Expand Down

0 comments on commit 7a75d80

Please sign in to comment.