當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。