def rn_theory(af, b):
    """ R(n) ratio expected from theory for given noise type
    
        alpha = b + 2
    """
    # From IEEE1139-2008
    #   alpha   beta    ADEV_mu MDEV_mu Rn_mu
    #   -2      -4       1       1       0      Random Walk FM
    #   -1      -3       0       0       0      Flicker FM
    #    0      -2      -1      -1       0      White FM
    #    1      -1      -2      -2       0      Flicker PM
    #    2      0       -2      -3      -1      White PM
    
    # (a=-3 flicker walk FM)
    # (a=-4 random run FM)
    if b==0:
        return pow(af,-1)
    elif b==-1:
        # f_h = 0.5/tau0  (assumed!)
        # af = tau/tau0
        # so f_h*tau = 0.5/tau0 * af*tau0 = 0.5*af
        avar = (1.038+3*np.log(2*np.pi*0.5*af)) / (4.0*pow(np.pi,2))
        mvar = 3*np.log(256.0/27.0)/(8.0*pow(np.pi,2))
        return mvar/avar
    else:
        return pow(af,0)