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


Python special.jnp_zeros方法代码示例

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


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

示例1: __init__

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def __init__(
        self,
        diameter=None,
        diffusion_constant=CONSTANTS['water_in_axons_diffusion_constant'],
        number_of_roots=20,
        number_of_functions=50,
    ):

        self.diameter = diameter
        self.Dintra = diffusion_constant
        self.alpha = np.empty((number_of_roots, number_of_functions))
        self.alpha[0, 0] = 0
        if number_of_roots > 1:
            self.alpha[1:, 0] = special.jnp_zeros(0, number_of_roots - 1)
        for m in range(1, number_of_functions):
            self.alpha[:, m] = special.jnp_zeros(m, number_of_roots) 
开发者ID:AthenaEPI,项目名称:dmipy,代码行数:18,代码来源:sphere_models.py

示例2: __init__

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def __init__(
        self,
        mu=None, lambda_par=None,
        diameter=None,
        diffusion_perpendicular=CONSTANTS['water_in_axons_diffusion_constant'],
        number_of_roots=20,
        number_of_functions=50,
    ):
        self.mu = mu
        self.lambda_par = lambda_par
        self.diffusion_perpendicular = diffusion_perpendicular
        self.diameter = diameter

        self.alpha = np.empty((number_of_roots, number_of_functions))
        self.alpha[0, 0] = 0
        if number_of_roots > 1:
            self.alpha[1:, 0] = special.jnp_zeros(0, number_of_roots - 1)
        for m in range(1, number_of_functions):
            self.alpha[:, m] = special.jnp_zeros(m, number_of_roots) 
开发者ID:AthenaEPI,项目名称:dmipy,代码行数:21,代码来源:cylinder_models.py

示例3: _ncrs_python

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def _ncrs_python(self, Delta, delta, d, R, G):
        if R == 0 or R < np.finfo(float).eps:
            return 0

        GAMMA = 267.5987E6
        alpha_roots = jnp_zeros(1, 16) / R

        sum = 0
        for i in range(alpha_roots.shape[0]):
            alpha = alpha_roots[i]

            num = (2 * d * alpha**2 * delta
                   - 2
                   + 2 * np.exp(-d * alpha**2 * delta)
                   + 2 * np.exp(-d * alpha**2 * Delta)
                   - np.exp(-d * alpha**2 * (Delta - delta))
                   - np.exp(-d * alpha**2 * (Delta + delta)))
            dem = d**2 * alpha**6 * (R**2 * alpha**2 - 1)

            sum += (num / dem)

        return -2 * GAMMA**2 * G**2 * sum 
开发者ID:robbert-harms,项目名称:MDT,代码行数:24,代码来源:VanGelderenCylindricalRestrictedSignal.py

示例4: test_jnp_zeros

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def test_jnp_zeros(self):
        jnp = special.jnp_zeros(1,5)
        assert_array_almost_equal(jnp, array([1.84118,
                                                5.33144,
                                                8.53632,
                                                11.70600,
                                                14.86359]),4)
        jnp = special.jnp_zeros(443,5)
        assert_tol_equal(special.jvp(443, jnp), 0, atol=1e-15) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:11,代码来源:test_basic.py

示例5: disk_harmonic_energy

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def disk_harmonic_energy(n, m, bc='dirichlet'):
	'''Get the energy of a disk harmonic function.

	This allows for functions to sort a disk harmonic mode basis on energy.

	Parameters
	----------
	n : int
		Radial order
	m : int
		Azimuthal order
	bc : string
		The boundary conditions to use. This can be either 'dirichlet', or
		'neumann' for a Dirichlet or Neumann boundary condition respectively.

	Returns
	-------
	scalar
		The energy corresponding to the mode.

	Raises
	------
	ValueError
		If the boundary condition is not recognized.
	'''
	m = abs(m)

	if bc == 'dirichlet':
		lambda_mn = jn_zeros(m, n)[-1]
	elif bc == 'neumann':
		lambda_mn = jnp_zeros(m, n)[-1]
	else:
		raise ValueError('Boundary condition not recognized.')

	return lambda_mn**2 
开发者ID:ehpor,项目名称:hcipy,代码行数:37,代码来源:disk_harmonic.py

示例6: test_jnp_zeros

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def test_jnp_zeros(self):
        jnp = special.jnp_zeros(1,5)
        assert_array_almost_equal(jnp, array([1.84118,
                                                5.33144,
                                                8.53632,
                                                11.70600,
                                                14.86359]),4)
        jnp = special.jnp_zeros(443,5)
        assert_allclose(special.jvp(443, jnp), 0, atol=1e-15) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:11,代码来源:test_basic.py

示例7: disk_harmonic

# 需要导入模块: from scipy import special [as 别名]
# 或者: from scipy.special import jnp_zeros [as 别名]
def disk_harmonic(n, m, D=1, bc='dirichlet', grid=None):
	'''Create a disk harmonic.

	Parameters
	----------
	n : int
		Radial order
	m : int
		Azimuthal order
	D : scalar
		The diameter of the pupil.
	bc : string
		The boundary conditions to use. This can be either 'dirichlet', or
		'neumann' for a Dirichlet or Neumann boundary condition respectively.
	grid : Grid
		The grid on which to evaluate the function.

	Returns
	-------
	Field
		The disk harmonic function evaluated on `grid`.

	Raises
	------
	ValueError
		If the boundary condition is not recognized.
	'''
	polar_grid = grid.as_('polar')
	r = 2 * polar_grid.r / D
	theta = polar_grid.theta

	m_negative = m < 0
	m = abs(m)

	if bc == 'dirichlet':
		lambda_mn = jn_zeros(m, n)[-1]
		norm = 1
	elif bc == 'neumann':
		lambda_mn = jnp_zeros(m, n)[-1]
		norm = 1
	else:
		raise ValueError('Boundary condition not recognized.')

	if m_negative:
		z = norm * jv(m, lambda_mn * r) * np.sin(m * theta)
	else:
		z = norm * jv(m, lambda_mn * r) * np.cos(m * theta)

	# Do manual normalization for now...
	mask = circular_aperture(D)(grid) > 0.5
	norm = np.sqrt(np.sum(z[mask]**2))

	return Field(z * mask / norm, grid) 
开发者ID:ehpor,项目名称:hcipy,代码行数:55,代码来源:disk_harmonic.py


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