-----
    Brief
    -----
    Function to window the input signal, that return the windowed signal.

    -----------
    Description
    -----------
    Machine learning pipelines usually use features to represent each sample of the input signals.
    In order to extract those features, it is required to window the signal in time intervals,
    in the case of time series, that may be or may not be of the same duration with or without overlap.

    This function allows to window the input signal in similar time windows with or without overlap.

    ----------
    Parameters
    ----------
    signal : list or numpy.array
        Signal to be windowed.
    sampling_rate : int
        Sampling rate of the input signal.
    time_window : float or int
        Time in seconds of each window.
	overlap : float
		Percentage of overlap relative to the time window.

    Returns
    -------
        Windowed signal

def windowing(signal, sampling_rate=1000, time_window=.25, overlap=0):
    """
    -----
    Brief
    -----
    Function to window the input signal, that return the windowed signal.

    -----------
    Description
    -----------
    Machine learning pipelines usually use features to represent each sample of the input signals.
    In order to extract those features, it is required to window the signal in time intervals,
    in the case of time series, that may be or may not be of the same duration with or without overlap.

    This function allows to window the input signal in similar time windows with or without overlap.

    ----------
    Parameters
    ----------
    signal : list or numpy.array
        Signal to be windowed.
    sampling_rate : int
        Sampling rate of the input signal.
    time_window : float or int
        Time in seconds of each window.
	overlap : float
		Percentage of overlap relative to the time window.

    Returns
    -------
        Windowed signal

    """
    if  overlap < 0 or overlap >= 1:
        raise ValueError("overlap should be a float in [0, 1)")
    over = 1 - overlap
    
    app_window = int(sampling_rate * time_window)

    num_windows = int(len(signal) / (app_window*over))
    signal_windows = np.zeros(shape=(num_windows, app_window))

    for i, win in enumerate(range(0, len(signal), int(over*app_window))):
        if win + app_window < len(signal) and i < num_windows:
            signal_windows[i] = signal[win:win + app_window]
    return signal_windows