Skip to content

Commit

Permalink
Stub documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVinyard committed Aug 27, 2017
1 parent f582cb1 commit 80381a8
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/source/core.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: zounds.core
1 change: 1 addition & 0 deletions docs/source/spectral.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.. automodule:: zounds.spectral
2 changes: 1 addition & 1 deletion zounds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
FrequencyAdaptiveTransform, ExplicitScale, ExplicitFrequencyDimension, \
FrequencyAdaptive

from loudness import log_modulus, inverse_log_modulus, decibel
from loudness import log_modulus, inverse_log_modulus, decibel, mu_law, MuLaw

from segment import MeasureOfTransience, MovingAveragePeakPicker, \
ComplexDomain, TimeSliceFeature
Expand Down
11 changes: 11 additions & 0 deletions zounds/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
"""
Core
====
Here is some text about core.
.. autoclass:: ArrayWithUnits
"""

from dimensions import Dimension, IdentityDimension
from axis import ArrayWithUnits

__all__ = [Dimension, IdentityDimension, ArrayWithUnits]
4 changes: 4 additions & 0 deletions zounds/core/axis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ def __init__(self):


class ArrayWithUnits(np.ndarray):
"""
Here is documentation for ArrayWithUnits
"""

def __new__(cls, arr, dimensions):
if arr.ndim != len(dimensions):
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion zounds/loudness/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from loudness import log_modulus, inverse_log_modulus, decibel
from loudness import log_modulus, inverse_log_modulus, decibel, mu_law, MuLaw
15 changes: 15 additions & 0 deletions zounds/loudness/loudness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
from featureflow import Node


def log_modulus(x):
Expand All @@ -11,3 +12,17 @@ def inverse_log_modulus(x):

def decibel(x):
return 20 * np.log10(x)


def mu_law(x, mu=255):
s = np.sign(x)
return s * (np.log(1 + (mu * np.abs(x))) / np.log(1 + mu))


class MuLaw(Node):
def __init__(self, mu=255, needs=None):
super(MuLaw, self).__init__(needs=needs)
self.mu = mu

def _process(self, data):
yield mu_law(data, mu=self.mu)
14 changes: 14 additions & 0 deletions zounds/spectral/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
"""
Spectral
========
Welcome to the spectral stuff
.. autoclass:: FrequencyBand
.. autoclass:: FrequencyScale
.. autoclass:: LinearScale
.. autoclass:: GeometricScale
.. autoclass:: FrequencyDimension
.. autoclass:: ExplicitFrequencyDimension
"""

from sliding_window import \
SlidingWindow, OggVorbisWindowingFunc, NDSlidingWindow, WindowingFunc, \
HanningWindowingFunc
Expand Down

0 comments on commit 80381a8

Please sign in to comment.