# Path: signalz/misc.py
# def check_type_or_raise(obj, expected_type, obj_name):
#     """
#     This fuction raises error if the object does not have expected type.
#     """
#     if not isinstance(obj, expected_type):
#         raise TypeError(
#             "'{}' must be {}, not {}".format(
#                 obj_name,
#                 expected_type.__name__,
#                 obj.__class__.__name__)
#             )
# 
# Path: signalz/generators/gaussian_white_noise.py
# def gaussian_white_noise(n, offset=0, std=1):
#     """
#     Random values with normal distribution.
# 
#     **Args:**
#     
#     * `n` - length of the output data (int) - how many samples will be on output
#     
#     **Kwargs:**
# 
#     * `offset` - mean value (float)
#          
#     * `std` - standard deviation (float)
#     
#     **Returns:**
#     
#     * vector of values representing the noise (1d array)   
#     """
#     return np.random.normal(offset, std, n)
# 
# Path: signalz/generators/uniform_white_noise.py
# def uniform_white_noise(n, minimum=-1, maximum=1):
#     """
#     Random values with uniform distribution.
# 
#     **Args:**
#     
#     * `n` - length of the output data (int) - how many samples will be on output
#     
#     **Kwargs:**
# 
#     * `minimum` - minimal value (float)
#          
#     * `maximum` - maximal value (float)
#     
#     **Returns:**
#     
#     * vector of values representing the noise (1d array)   
#     """
#     return np.random.uniform(low=minimum, high=maximum, size=n)


import numpy as np
from signalz.misc import check_type_or_raise
from signalz.generators.gaussian_white_noise import gaussian_white_noise
from signalz.generators.uniform_white_noise import uniform_white_noise
"""


def brownian_noise(n, leak=0., start=0, std=1., source="gaussian"):
    """
    This function produces Browninan noise.

    **Args:**
    
    * `n` - length of the output data (int) - how many samples will be on output
    
    **Kwargs:**
    
    * `leak` - leakage during integration (float), this should prevent signal
      from wander off. Possible value is `0 <= leak < 1`
      
    * `start` - offset on the start (float)

    * `std` - standard deviation of source white noise (float), in case of
      uniform distribution it is the difference between min and max value. 
    
    * `source` - distribution of source white noise (str). Options are
      `gaussian` or `uniform`
    
    **Returns:**
    
    * vector of values representing the noise (1d array)
    """
    # check inputs
    check_type_or_raise(n, int, "n")

# Path: signalz/misc.py
# def check_type_or_raise(obj, expected_type, obj_name):
#     """
#     This fuction raises error if the object does not have expected type.
#     """
#     if not isinstance(obj, expected_type):
#         raise TypeError(
#             "'{}' must be {}, not {}".format(
#                 obj_name,
#                 expected_type.__name__,
#                 obj.__class__.__name__)
#             )
# 
# Path: signalz/generators/gaussian_white_noise.py
# def gaussian_white_noise(n, offset=0, std=1):
#     """
#     Random values with normal distribution.
# 
#     **Args:**
#     
#     * `n` - length of the output data (int) - how many samples will be on output
#     
#     **Kwargs:**
# 
#     * `offset` - mean value (float)
#          
#     * `std` - standard deviation (float)
#     
#     **Returns:**
#     
#     * vector of values representing the noise (1d array)   
#     """
#     return np.random.normal(offset, std, n)
# 
# Path: signalz/generators/uniform_white_noise.py
# def uniform_white_noise(n, minimum=-1, maximum=1):
#     """
#     Random values with uniform distribution.
# 
#     **Args:**
#     
#     * `n` - length of the output data (int) - how many samples will be on output
#     
#     **Kwargs:**
# 
#     * `minimum` - minimal value (float)
#          
#     * `maximum` - maximal value (float)
#     
#     **Returns:**
#     
#     * vector of values representing the noise (1d array)   
#     """
#     return np.random.uniform(low=minimum, high=maximum, size=n)


# Path: signalz/generators/brownian_noise.py
import numpy as np
from signalz.misc import check_type_or_raise
from signalz.generators.gaussian_white_noise import gaussian_white_noise
from signalz.generators.uniform_white_noise import uniform_white_noise

"""


def brownian_noise(n, leak=0., start=0, std=1., source="gaussian"):
    """
    This function produces Browninan noise.

    **Args:**
    
    * `n` - length of the output data (int) - how many samples will be on output
    
    **Kwargs:**
    
    * `leak` - leakage during integration (float), this should prevent signal
      from wander off. Possible value is `0 <= leak < 1`
      
    * `start` - offset on the start (float)

    * `std` - standard deviation of source white noise (float), in case of
      uniform distribution it is the difference between min and max value. 
    
    * `source` - distribution of source white noise (str). Options are
      `gaussian` or `uniform`
    
    **Returns:**
    
    * vector of values representing the noise (1d array)
    """
    # check inputs
    check_type_or_raise(n, int, "n")

    check_type_or_raise(leak, float, "leak")