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


Python special.jn方法代码示例

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


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

示例1: f_n

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def f_n(self, nharm, K):
        v1 = ((nharm-1)/2.)
        v2 = ((nharm+1)/2.)
        x = nharm*K*K/(4.+2.*K*K)
        return nharm*nharm*K*K/((1+K*K/2.)**2)*(jn(v1,x) - jn(v2,x))**2 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:7,代码来源:undulator_params.py

示例2: test_jn

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

示例3: test_j0

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

示例4: test_j1

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

示例5: test_jnjnp_zeros

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

        def jnp(n, x):
            return (jn(n-1,x) - jn(n+1,x))/2
        for nt in range(1, 30):
            z, n, m, t = special.jnjnp_zeros(nt)
            for zz, nn, tt in zip(z, n, t):
                if tt == 0:
                    assert_allclose(jn(nn, zz), 0, atol=1e-6)
                elif tt == 1:
                    assert_allclose(jnp(nn, zz), 0, atol=1e-6)
                else:
                    raise AssertionError("Invalid t return for nt=%d" % nt) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:test_basic.py

示例6: test_lmbda

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def test_lmbda(self):
        lam = special.lmbda(1,.1)
        lamr = (array([special.jn(0,.1), 2*special.jn(1,.1)/.1]),
                array([special.jvp(0,.1), -2*special.jv(1,.1)/.01 + 2*special.jvp(1,.1)/.1]))
        assert_array_almost_equal(lam,lamr,8) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:test_basic.py

示例7: perpendicular_attenuation

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def perpendicular_attenuation(
        self, q, diameter
    ):
        "Returns the cylinder's perpendicular signal attenuation."
        radius = diameter / 2
        # Eq. [6] in the paper
        E = ((2 * special.jn(1, 2 * np.pi * q * radius)) ** 2 /
             (2 * np.pi * q * radius) ** 2)
        return E 
开发者ID:AthenaEPI,项目名称:dmipy,代码行数:11,代码来源:cylinder_models.py

示例8: get_an

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def get_an(n, mc, dl, h0, F, e):
    """
    Compute a_n from Eq. 22 of Taylor et al. (2016).

    :param n: Harmonic number
    :param mc: Chirp mass of binary [Solar Mass]
    :param dl: Luminosity distance [Mpc]
    :param F: Orbital frequency of binary [Hz]
    :param e: Orbital Eccentricity

    :returns: a_n
    """

    # convert to seconds
    mc *= const.Tsun
    dl *= const.Mpc / const.c

    omega = 2 * np.pi * F

    if h0 is None:
        amp = n * mc ** (5 / 3) * omega ** (2 / 3) / dl
    elif h0 is not None:
        amp = n * h0 / 2.0

    ret = -amp * (
        ss.jn(n - 2, n * e)
        - 2 * e * ss.jn(n - 1, n * e)
        + (2 / n) * ss.jn(n, n * e)
        + 2 * e * ss.jn(n + 1, n * e)
        - ss.jn(n + 2, n * e)
    )

    return ret 
开发者ID:nanograv,项目名称:enterprise,代码行数:35,代码来源:utils.py

示例9: get_bn

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def get_bn(n, mc, dl, h0, F, e):
    """
    Compute b_n from Eq. 22 of Taylor et al. (2015).

    :param n: Harmonic number
    :param mc: Chirp mass of binary [Solar Mass]
    :param dl: Luminosity distance [Mpc]
    :param F: Orbital frequency of binary [Hz]
    :param e: Orbital Eccentricity

    :returns: b_n
    """

    # convert to seconds
    mc *= const.Tsun
    dl *= const.Mpc / const.c

    omega = 2 * np.pi * F

    if h0 is None:
        amp = n * mc ** (5 / 3) * omega ** (2 / 3) / dl
    elif h0 is not None:
        amp = n * h0 / 2.0

    ret = -amp * np.sqrt(1 - e ** 2) * (ss.jn(n - 2, n * e) - 2 * ss.jn(n, n * e) + ss.jn(n + 2, n * e))

    return ret 
开发者ID:nanograv,项目名称:enterprise,代码行数:29,代码来源:utils.py

示例10: get_cn

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def get_cn(n, mc, dl, h0, F, e):
    """
    Compute c_n from Eq. 22 of Taylor et al. (2016).

    :param n: Harmonic number
    :param mc: Chirp mass of binary [Solar Mass]
    :param dl: Luminosity distance [Mpc]
    :param F: Orbital frequency of binary [Hz]
    :param e: Orbital Eccentricity

    :returns: c_n
    """

    # convert to seconds
    mc *= const.Tsun
    dl *= const.Mpc / const.c

    omega = 2 * np.pi * F

    if h0 is None:
        amp = 2 * mc ** (5 / 3) * omega ** (2 / 3) / dl
    elif h0 is not None:
        amp = h0

    ret = amp * ss.jn(n, n * e) / (n * omega)

    return ret 
开发者ID:nanograv,项目名称:enterprise,代码行数:29,代码来源:utils.py

示例11: createWindow

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jn [as 别名]
def createWindow(widget):
    ''' Example on creating a new plot window in the
        main window MDI-Area
    '''
    import plotWidget
    from PySide import QtGui
    from numpy import linspace
    from scipy.special import jn
    from chaco.api import ArrayPlotData, Plot

    window = widget.createNewWindow()
    container = plotWidget.plotContainer(window)
    plotWidget = plotWidget.PlotWidget(container)
    container.setPlotWidget(plotWidget)

    x = linspace(-2.0, 10.0, 100)
    pd = ArrayPlotData(index=x)
    for i in range(5):
        pd.set_data("y" + str(i), jn(i, x))
    plot = Plot(pd, title=None, padding_left=60, padding_right=5, padding_top=5, padding_bottom=30, border_visible=True)
    plot.plot(("index", "y0", "y1", "y2"), name="j_n, n<3", color="red")
    plotWidget.setPlot(plot)

    layout = QtGui.QBoxLayout(QtGui.QBoxLayout.TopToBottom)
    layout.addWidget(container)
    window.setLayout(layout)
    window.show() 
开发者ID:PySimulator,项目名称:PySimulator,代码行数:29,代码来源:MinMax.py


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