classifiers/hand_movement_classifier.py
def compute_rolling_std(x, window_length):
    '''
    Method to compute rolling standard deviation.
    :param x: 1D numpy array
    :param window_length: Length of window for computing rolling standard deviation. Must be an odd number.
    :return: Numpy array with rolling standard deviation values calculated over given window length.
    '''
    if window_length % 2 == 0:
        print "Window length should be an odd number."
        return

    y = np.zeros(len(x))
    for i in range(len(x)):
        if i < window_length/2:
            y[i] = np.std(x[0:i + window_length / 2])
        elif len(x) - i < window_length / 2:
            y[i] = np.std(x[i - window_length / 2:])
        else:
            y[i] = np.std(x[i - window_length / 2: i + window_length / 2])

    return y

    Method to compute rolling standard deviation.
    :param x: 1D numpy array
    :param window_length: Length of window for computing rolling standard deviation. Must be an odd number.
    :return: Numpy array with rolling standard deviation values calculated over given window length.
    
Method to compute rolling standard deviation.
Method to compute rolling standard deviation .
def compute_rolling_std(x, window_length):
    if window_length % 2 == 0:
        print "Window length should be an odd number."
        return
    y = np.zeros(len(x))
    for i in range(len(x)):
        if i < window_length/2:
            y[i] = np.std(x[0:i + window_length / 2])
        elif len(x) - i < window_length / 2:
            y[i] = np.std(x[i - window_length / 2:])
        else:
            y[i] = np.std(x[i - window_length / 2: i + window_length / 2])
    return y
def compute_rolling_std ( x , window_length ) : if window_length % 2 == 0 : print "Window length should be an odd number." return y = np . zeros ( len ( x ) ) for i in range ( len ( x ) ) : if i < window_length / 2 : y [ i ] = np . std ( x [ 0 : i + window_length / 2 ] ) elif len ( x ) - i < window_length / 2 : y [ i ] = np . std ( x [ i - window_length / 2 : ] ) else : y [ i ] = np . std ( x [ i - window_length / 2 : i + window_length / 2 ] ) return y
Method to compute rolling standard deviation.
Method to compute rolling standard deviation .
'''
    Method to compute rolling standard deviation.
    :param x: 1D numpy array
    :param window_length: Length of window for computing rolling standard deviation. Must be an odd number.
    :return: Numpy array with rolling standard deviation values calculated over given window length.
    '''
Numpy array with rolling standard deviation values calculated over given window length.
Numpy array with rolling standard deviation values calculated over given window length .
x
1D numpy array
1D numpy array
window_length
Length of window for computing rolling standard deviation. Must be an odd number.
Length of window for computing rolling standard deviation . Must be an odd number .