def rmse_2pi(x, xhat):
    ''' Calcualte rmse between vector or matrix x and xhat, ignoring mod of 2pi.'''
    real_diff = from_0_to_pi(x - xhat)
    np.square(real_diff, out=real_diff)
    sum_ = np.sum(real_diff)
    return sqrt(sum_ / len(x))
Calcualte rmse between vector or matrix x and xhat, ignoring mod of 2pi.