当前位置: 首页>>代码示例>>Python>>正文


Python special.i0方法代码示例

本文整理汇总了Python中scipy.special.i0方法的典型用法代码示例。如果您正苦于以下问题:Python special.i0方法的具体用法?Python special.i0怎么用?Python special.i0使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scipy.special的用法示例。


在下文中一共展示了special.i0方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: estimate_kappa

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def estimate_kappa(N, ssx, scx):
        if N == 0:
            return 10.**-6
        elif N == 1:
            return 10*pi
        else:
            rbar2 = (ssx / N) ** 2. + (scx / N) ** 2.
            rbar = rbar2 ** .5
            kappa = rbar*(2. - rbar2) / (1. - rbar2)

        A_p = lambda k : bessel_1(k) / bessel_0(k)

        Apk = A_p(kappa)
        kappa_1 = kappa - (Apk - rbar)/(1. - Apk**2 - (1. / kappa) * Apk)
        Apk = A_p(kappa_1)
        kappa = kappa_1 - (Apk - rbar)/(1. - Apk**2 - (1. / kappa_1) * Apk)
        Apk = A_p(kappa)
        kappa_1 = kappa - (Apk - rbar)/(1. - Apk**2 - (1. / kappa) * Apk)
        Apk = A_p(kappa_1)
        kappa = kappa_1 - (Apk - rbar)/(1. - Apk**2 - (1. / kappa_1) * Apk)

        if isnan(kappa):
            return 10.**-6
        else:
            return abs(kappa) 
开发者ID:probcomp,项目名称:cgpm,代码行数:27,代码来源:vonmises.py

示例2: mmse_stsa

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def mmse_stsa(xi, gamma):
	"""
	Computes the MMSE-STSA gain function.

	Argument/s:
		xi - a priori SNR.
		gamma - a posteriori SNR.

	Returns:
		G - MMSE-STSA gain function.
	"""
	nu = np.multiply(xi, np.divide(gamma, np.add(1, xi)))
	G = np.multiply(np.multiply(np.multiply(np.divide(np.sqrt(np.pi), 2),
		np.divide(np.sqrt(nu), gamma)), np.exp(np.divide(-nu,2))),
		np.add(np.multiply(np.add(1, nu), i0(np.divide(nu,2))),
		np.multiply(nu, i1(np.divide(nu, 2))))) # MMSE-STSA gain function.
	idx = np.isnan(G) | np.isinf(G) # replace by Wiener gain.
	G[idx] = np.divide(xi[idx], np.add(1, xi[idx])) # Wiener gain.
	return G 
开发者ID:anicolson,项目名称:DeepXi,代码行数:21,代码来源:gain.py

示例3: kaiserbessel_eval

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def kaiserbessel_eval(x, p):
    """

    Parameters
    ----------
    x: array-like
        arguments to the KB function
    p: array-like
        The Kaiser-Bessel window parameters [alpha, tau] (wikipedia) or [beta, W/2] (Jackson, J. I., Meyer, C. H.,
        Nishimura, D. G. & Macovski, A. Selection of a convolution function for Fourier inversion using gridding
        [computerised tomography application]. IEEE Trans. Med. Imaging 10, 473–478 (1991))

    Returns
    -------

    """
    normfac = sps.i0(p[0] * np.sqrt(1.0 - np.square((0.0 / p[1])))) / p[1]
    return np.where(np.fabs(x) <= p[1], sps.i0(p[0] * np.sqrt(1.0 - np.square((x / p[1])))) / p[1] / normfac, 0.0) 
开发者ID:bbfrederick,项目名称:rapidtide,代码行数:20,代码来源:fit.py

示例4: log_bessel_0

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def log_bessel_0(x):
    besa = bessel_0(x)
    # If bessel_0(a) is inf, then use the exponential approximation to
    # prevent numerical overflow.
    if isinf(besa):
        I0 = x - .5*log(2*pi*x)
    else:
        I0 = log(besa)
    return I0 
开发者ID:probcomp,项目名称:cgpm,代码行数:11,代码来源:vonmises.py

示例5: von_mises_cdf_normalapprox

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def von_mises_cdf_normalapprox(k, x):
    b = np.sqrt(2/np.pi)*np.exp(k)/i0(k)
    z = b*np.sin(x/2.)
    return scipy.stats.norm.cdf(z) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:6,代码来源:vonmises.py

示例6: _pdf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def _pdf(self, x, b):
        # rice.pdf(x, b) = x * exp(-(x**2+b**2)/2) * I[0](x*b)
        #
        # We use (x**2 + b**2)/2 = ((x-b)**2)/2 + xb.
        # The factor of np.exp(-xb) is then included in the i0e function
        # in place of the modified Bessel function, i0, improving
        # numerical stability for large values of xb.
        return x * np.exp(-(x-b)*(x-b)/2.0) * sc.i0e(x*b) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:10,代码来源:_continuous_distns.py

示例7: _entropy

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def _entropy(self, kappa):
        return (-kappa * sc.i1(kappa) / sc.i0(kappa) +
                np.log(2 * np.pi * sc.i0(kappa))) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:5,代码来源:_continuous_distns.py

示例8: von_mises_cdf_normalapprox

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def von_mises_cdf_normalapprox(k,x,C1):
    b = np.sqrt(2/np.pi)*np.exp(k)/i0(k)
    z = b*np.sin(x/2.)
    C = 24*k
    chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2
    return scipy.stats.norm.cdf(z) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:8,代码来源:vonmises.py

示例9: test_i0

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def test_i0(self):
        assert_equal(cephes.i0(0),1.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:4,代码来源:test_basic.py

示例10: test_i0_series

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def test_i0_series(self):
        for z in [1., 10., 200.5]:
            value, err = self.iv_series(0, z)
            assert_tol_equal(special.i0(z), value, atol=err, err_msg=z) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:test_basic.py

示例11: test_rice_overflow

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def test_rice_overflow(self):
        # rice.pdf(999, 0.74) was inf since special.i0 silentyly overflows
        # check that using i0e fixes it
        assert_(np.isfinite(stats.rice.pdf(999, 0.74)))

        assert_(np.isfinite(stats.rice.expect(lambda x: 1, args=(0.74,))))
        assert_(np.isfinite(stats.rice.expect(lambda x: 2, args=(0.74,))))
        assert_(np.isfinite(stats.rice.expect(lambda x: 3, args=(0.74,)))) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:10,代码来源:test_distributions.py

示例12: test_i0_series

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def test_i0_series(self):
        for z in [1., 10., 200.5]:
            value, err = self.iv_series(0, z)
            assert_allclose(special.i0(z), value, atol=err, err_msg=z) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:6,代码来源:test_basic.py

示例13: test_i0

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def test_i0(self):
        values = [[0.0, 1.0],
                  [1e-10, 1.0],
                  [0.1, 0.9071009258],
                  [0.5, 0.6450352706],
                  [1.0, 0.4657596077],
                  [2.5, 0.2700464416],
                  [5.0, 0.1835408126],
                  [20.0, 0.0897803119],
                  ]
        for i, (x, v) in enumerate(values):
            cv = special.i0(x) * exp(-x)
            assert_almost_equal(cv, v, 8, err_msg='test #%d' % i) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:15,代码来源:test_basic.py

示例14: i0

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def i0(*args, **kwargs):
        from scipy.special import i0
        return i0(*args, **kwargs) 
开发者ID:CalebBell,项目名称:fluids,代码行数:5,代码来源:__init__.py

示例15: erf

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import i0 [as 别名]
def erf(*args, **kwargs):
            from scipy.special import erf
            return erf(*args, **kwargs)


#    from scipy.special import lambertw, ellipe, gammaincc, gamma # fluids
#    from scipy.special import i1, i0, k1, k0, iv # ht
#    from scipy.special import hyp2f1    
#    if erf is None:
#        from scipy.special import erf 
开发者ID:CalebBell,项目名称:fluids,代码行数:12,代码来源:__init__.py


注:本文中的scipy.special.i0方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。