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