root mean square for each variable in the segmented time series

def root_mean_square(X):
    ''' root mean square for each variable in the segmented time series '''
    segment_width = X.shape[1]
    return np.sqrt(np.sum(X * X, axis=1) / segment_width)