本文整理汇总了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
示例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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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
示例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
示例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
示例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()