Exemple #1
0
def FixedResGlobal(nsigma):
    n_levels = len(nsigma)
    q_perlevel = np.empty(n_levels, dtype=object)
    for l, lev in enumerate(nsigma):
        q_total = 0
        nQs = len(lev)
        for j, sig in enumerate(lev):
            pval = mp.erfc(abs(sig)/mp.sqrt(2))
            q = -2*mp.log(pval)
            q_total += q
        q_perlevel[l] = [q_total, nQs]

    nsigma_fixedres = np.zeros(n_levels)
    for i, entry in enumerate(q_perlevel):
        qT = entry[0]
        nQ = entry[1]
        Dchi2 = mp.gammainc(nQ, 0, 0.5*qT)/mp.gamma(nQ)
        nsigma_ell = mp.sqrt(2)*mp.erfinv(Dchi2)
        nsigma_fixedres[i] = nsigma_ell
    return nsigma_fixedres
Exemple #2
0
def norm_q(prob):
    r"""
    A multi-precision calculation of the
    standard normal quantile function:

    .. math::

       \int_{-\infty}^{q(p)} \frac{e^{-z^2/2}}{\sqrt{2\pi}} \; dz = p

    where $p$ is `prob`.

    Parameters
    ----------

    prob : float

    Returns
    -------

    quantile : float

    """
    return np.array(mp.erfinv(2*prob-1)*mp.sqrt(2))
Exemple #3
0
def _nsigma(pLessX):
    return mp.sqrt(2) * mp.erfinv(pLessX)
def Phi_inv(x):
    return( -mp.sqrt(2)*mp.erfinv(mp.mpf(1)-mp.mpf(2)*x) )