returns confidence interval (dev_min, dev_max) 
        for a given deviation dev = Xdev( x, tau = af*(1/rate) )
        
        steps:
        1) identify noise type
        2) compute EDF
        3) compute confidence interval
        
    Parameters
    ----------
    x: numpy.array
        time-series
    dev: float
        Mean value (e.g. adev) around which we produce the confidence interval
    af: int
        averaging factor
    dev_type: string
        adev, oadev, mdev, tdev, hdev, ohdev
    data_type:
        "phase" or "freq"
    ci: float, defaults to scipy.special.erf(1/math.sqrt(2))
        for 1-sigma standard error set
        ci = scipy.special.erf(1/math.sqrt(2))
            = 0.68268949213708585
        
    Returns
    -------
    (dev_min, dev_max): (float, float)
        Confidence interval

def confidence_interval_noiseID(x, dev, af, dev_type="adev", data_type="phase", ci=ONE_SIGMA_CI):
    """ returns confidence interval (dev_min, dev_max) 
        for a given deviation dev = Xdev( x, tau = af*(1/rate) )
        
        steps:
        1) identify noise type
        2) compute EDF
        3) compute confidence interval
        
    Parameters
    ----------
    x: numpy.array
        time-series
    dev: float
        Mean value (e.g. adev) around which we produce the confidence interval
    af: int
        averaging factor
    dev_type: string
        adev, oadev, mdev, tdev, hdev, ohdev
    data_type:
        "phase" or "freq"
    ci: float, defaults to scipy.special.erf(1/math.sqrt(2))
        for 1-sigma standard error set
        ci = scipy.special.erf(1/math.sqrt(2))
            = 0.68268949213708585
        
    Returns
    -------
    (dev_min, dev_max): (float, float)
        Confidence interval
    """
    # 1) noise ID
    dmax = 2
    if (dev_type is "hdev") or (dev_type is "ohdev"):
        dmax = 3
    alpha_int = autocorr_noise_id( x, int(af), data_type=data_type, dmin=0, dmax=dmax)[0]

    # 2) EDF
    if dev_type is "adev":
        edf = edf_greenhall( alpha=alpha_int, d=2, m=af, N=len(x), overlapping = False, modified=False )
    elif dev_type is "oadev":
        edf = edf_greenhall( alpha=alpha_int, d=2, m=af, N=len(x), overlapping = True, modified=False  )
    elif (dev_type is "mdev") or (dev_type is "tdev"):
        edf = edf_greenhall( alpha=alpha_int, d=2, m=af, N=len(x), overlapping = True, modified=True  )
    elif dev_type is "hdev":
        edf = edf_greenhall( alpha=alpha_int, d=3, m=af, N=len(x), overlapping = False, modified=False  )
    elif dev_type is "ohdev":
        edf = edf_greenhall( alpha=alpha_int, d=3, m=af, N=len(x), overlapping = True, modified=False  )
    else:
        raise NotImplementedError

    # 3) confidence interval
    (low, high)  = confidence_interval(dev, edf, ci)
    return (low, high)