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


Python special.kv方法代码示例

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


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

示例1: flux_distrib

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def flux_distrib(self):
        """

        :return: flux in ph/sec/mrad**2/0.1%BW
        """
        C_om = 1.3255e22 #ph/(sec * rad**2 * GeV**2 * A)
        g = self.gamma
        #self.eph_c = 1.
        ksi = lambda w,t: 1./2.*w * (1. + g*g*t*t)**(3./2.)
        F = lambda w, t: (1.+g*g*t*t)**2  * (1.+
                         g*g*t*t/(1.+g*g*t*t) * (kv(1./3.,ksi(w, t))/kv(2./3.,ksi(w, t)))**2)

        dw_over_w = 0.001  # 0.1% BW
        mrad2 = 1e-6 # transform rad to mrad
        I = lambda eph, theta: mrad2*C_om * self.energy**2*self.I* dw_over_w* (eph/self.eph_c)**2 * kv(2./3.,ksi(eph/self.eph_c,theta))**2 * F(eph/self.eph_c, theta)
        return I 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:18,代码来源:generaSR.py

示例2: test_ticket_854

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_ticket_854(self):
        """Real-valued Bessel domains"""
        assert_(isnan(special.jv(0.5, -1)))
        assert_(isnan(special.iv(0.5, -1)))
        assert_(isnan(special.yv(0.5, -1)))
        assert_(isnan(special.yv(1, -1)))
        assert_(isnan(special.kv(0.5, -1)))
        assert_(isnan(special.kv(1, -1)))
        assert_(isnan(special.jve(0.5, -1)))
        assert_(isnan(special.ive(0.5, -1)))
        assert_(isnan(special.yve(0.5, -1)))
        assert_(isnan(special.yve(1, -1)))
        assert_(isnan(special.kve(0.5, -1)))
        assert_(isnan(special.kve(1, -1)))
        assert_(isnan(special.airye(-1)[0:2]).all(), special.airye(-1))
        assert_(not isnan(special.airye(-1)[2:4]).any(), special.airye(-1)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:18,代码来源:test_basic.py

示例3: test_besselk

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_besselk(self):
        def mpbesselk(v, x):
            r = float(mpmath.besselk(v, x, **HYPERKW))
            if abs(r) > 1e305:
                # overflowing to inf a bit earlier is OK
                r = np.inf * np.sign(r)
            if abs(v) == abs(x) and abs(r) == np.inf and abs(x) > 1:
                # wrong result (kv(x,x) -> 0 for x > 1),
                # try with higher dps
                old_dps = mpmath.mp.dps
                mpmath.mp.dps = 200
                try:
                    r = float(mpmath.besselk(v, x, **HYPERKW))
                finally:
                    mpmath.mp.dps = old_dps
            return r
        assert_mpmath_equal(sc.kv,
                            _exception_to_nan(mpbesselk),
                            [Arg(-1e100, 1e100), Arg()]) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:21,代码来源:test_mpmath.py

示例4: K

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def K(self, X, Xstar):
        """
        Computes covariance function values over `X` and `Xstar`.

        Parameters
        ----------
        X: np.ndarray, shape=((n, nfeatures))
            Instances
        Xstar: np.ndarray, shape=((n, nfeatures))
            Instances

        Returns
        -------
        np.ndarray
            Computed covariance matrix.
        """
        r = l2norm_(X, Xstar)
        bessel = kv(self.v, np.sqrt(2 * self.v) * r / self.l)
        f = 2 ** (1 - self.v) / gamma(self.v) * (np.sqrt(2 * self.v) * r / self.l) ** self.v
        res = f * bessel
        res[np.isnan(res)] = 1
        res = self.sigmaf * res + self.sigman * kronDelta(X, Xstar)
        return (res) 
开发者ID:josejimenezluna,项目名称:pyGPGO,代码行数:25,代码来源:covfunc.py

示例5: cov_mat

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def cov_mat(h, sill=1.0, rng=1.0, shp=0.5):
    """matern covariance function"""
    """Matern Covariance Function Family:
        shp = 0.5 --> Exponential Model
        shp = inf --> Gaussian Model
    """
    h = np.asanyarray(h)

    # for v > 100 shit happens --> use Gaussian model
    if shp > 100:
        c = cov_gau(h, sill, rng)
    else:
        # modified bessel function of second kind of order v
        kv = special.kv
        # Gamma function
        tau = special.gamma

        fac1 = h / rng * 2.0 * np.sqrt(shp)
        fac2 = tau(shp) * 2.0 ** (shp - 1.0)

        c = np.where(h != 0, sill * 1.0 / fac2 * fac1 ** shp * kv(shp, fac1), sill)

    return c 
开发者ID:wradlib,项目名称:wradlib,代码行数:25,代码来源:ipol.py

示例6: flux_total

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def flux_total(self):
        C_fi = 3.9614e19 #ph/(sec * rad * GeV * A)
        mrad = 1e-3 # transform rad to mrad
        S = lambda w: 9.*sqrt(3)/8./pi*w*simps(kv(5./3.,linspace(w, 20, num=200)))
        F = lambda eph: mrad*C_fi*self.energy*self.I*eph/self.eph_c*S(eph/self.eph_c)
        return F 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:8,代码来源:generaSR.py

示例7: _check_kv

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

示例8: test_k0

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_k0(self):
        ozk = special.k0(.1)
        ozkr = special.kv(0,.1)
        assert_almost_equal(ozk,ozkr,8) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:test_basic.py

示例9: test_k1

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_k1(self):
        o1k = special.k1(.1)
        o1kr = special.kv(1,.1)
        assert_almost_equal(o1k,o1kr,8) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:6,代码来源:test_basic.py

示例10: test_negv_kv

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

示例11: test_kv0

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_kv0(self):
        kv0 = special.kv(0,.2)
        assert_almost_equal(kv0, 1.7527038555281462, 10) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_basic.py

示例12: test_kv2

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_kv2(self):
        kv2 = special.kv(2,0.2)
        assert_almost_equal(kv2, 49.51242928773287, 10) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_basic.py

示例13: test_kv_largearg

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

示例14: test_kve

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_kve(self):
        kve1 = special.kve(0,.2)
        kv1 = special.kv(0,.2)*exp(.2)
        assert_almost_equal(kve1,kv1,8)
        z = .2+1j
        kve2 = special.kve(0,z)
        kv2 = special.kv(0,z)*exp(z)
        assert_almost_equal(kve2,kv2,8) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:10,代码来源:test_basic.py

示例15: test_kvp_v0n1

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import kv [as 别名]
def test_kvp_v0n1(self):
        z = 2.2
        assert_almost_equal(-special.kv(1,z), special.kvp(0,z, n=1), 10) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:5,代码来源:test_basic.py


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