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


Python numpy.arccosh函数代码示例

本文整理汇总了Python中numpy.arccosh函数的典型用法代码示例。如果您正苦于以下问题:Python arccosh函数的具体用法?Python arccosh怎么用?Python arccosh使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: genCheby

	def genCheby(self):
		# find order first
		n = np.ceil((np.arccosh(np.sqrt(self.sat-1)/self.epsilon))/(np.arccosh(self.ws/self.w1)));

		#find coefficients
		beta = np.sinh(np.arctanh(1/np.sqrt(1+self.epsilon**2))/n)

		cbk = [1];
		for i in range(1,len(str(n))+1):
			cbk.append(2*np.sin(((2*i-1)*np.pi)/(2*n)));

		ck = np.ones(len(str(n))+1);

		for i in range(1,len(cbk)):
			if (i == 1):
				ck[i] = cbk[i]/beta;
			else: 
				ck[i] = (cbk[i]*cbk[i-1])/(ck[i-1]*(beta**2+np.sin((i-1)*np.pi/n)**2));

		if (self.firsty == "l"):
			for i in range(1, len(str(n))+1):
				if (i%2 == 1):
					tmp = "L" + str(i)
					self.components.append(Component(tmp, "inductor", self.zin*ck[i]/self.w1));
				elif (i%2 == 0):
					tmp = "C" + str(i)
					self.components.append(Component(tmp, "capacitor", ck[i]/(self.w1*self.zin)));
		elif (self.firsty == "c"):
			for i in range(1, len(str(n))+1):
				if (i%2 == 1):
					tmp = "C" + str(i)
					self.components.append(Component(tmp, "capacitor", ck[i]/(self.w1*self.zin)));
				elif (i%2 == 0):
					tmp = "L" + str(i)
					self.components.append(Component(tmp, "inductor", self.zin*ck[i]/self.w1));
开发者ID:Dudemanword,项目名称:ECE-4990-Code,代码行数:35,代码来源:filter.py

示例2: generate_dolph_chebyshev

def generate_dolph_chebyshev(lobe_fraction, tolerance):
    def cheb(m, x):
        if np.abs(x) <= 1:
            return np.cos(m * np.arccos(x))
        else:
            return np.cosh(m * np.arccosh(np.abs(x))).real

    w = int((1 / np.pi) * (1 / lobe_fraction) * np.arccosh(1 / tolerance))

    if w % 2 == 0:
        w -= 1

    beta = np.cosh(np.arccosh(1 / tolerance) / float(w - 1))

    print("lobe_fraction = {0}, tolerance = {1}, w = {2}, beta = {3}".format(lobe_fraction, tolerance, w, beta))

    x = np.empty(w, dtype=np.complex128)

    for i in xrange(w):
        x[i] = cheb(w - 1, beta * np.cos(np.pi * i / w)) * tolerance

    x = fft(x, n=w)
    x = fftshift(x)
    x = np.real(x)

    return {"x": x, "w": w}
开发者ID:jianyuan,项目名称:fyp-faster-gps,代码行数:26,代码来源:filters.py

示例3: test_arccosh

 def test_arccosh(self):
     q = [1, 2, 3, 4, 6] * self.ureg.dimensionless
     x = np.ones((1,1))  * self.ureg.rad
     self.assertEqual(
         np.arccosh(q),
         np.arccosh(q.magnitude * self.ureg.rad)
     )
开发者ID:MySchizoBuddy,项目名称:pint,代码行数:7,代码来源:test_umath.py

示例4: AF_zeros

def AF_zeros(a, M, R, dist_type, nbar=False, alpha=0):
    r"""
    This function gives array-factor zeros corresponding to different
    types of array distributions. Unless you know what you are doing exactly,
    do not use this function directly. Instead, user can use the function :func:`dist`.
    
    :param a:        separation between the elements along the x-axis in wavelengths
    :param M:        number of elements along the x-axis
    :param R:        side-lobe ratio in linear scale
    :param dist_type:type of the distribution, e.g., 'Dolph-Chebyshev', 'Riblet', etc.
    :param nbar:     transition index for dilation
    :param alpha:    Taylor's asymptotic tapering parameter
    
    :rtype:          U0, a Numpy array of size (*,1)
    """
    k = 2 * np.pi  # (angular) wave-number, which is 2*pi when lambda = 1
    m = np.ceil((M - 2) / 2)
    n = np.arange(1, 1 + m, 1)  # number of zeros for symmetric array-factors
    na = np.arange(1, M, 1)  # number of zeros for 'asymmetric' array-factors
    
    if(dist_type == "Dolph-Chebyshev"):  # Dolph zeros
        c = np.cosh(np.arccosh(R) / (M - 1))
        print c
        U0 = (2 / (a * k)) * np.arccos((np.cos(np.pi * (2 * n - 1) / (2 * M - 2))) / c)        
    elif(dist_type == "Riblet"):  # Riblet zeros
        c1 = np.cosh(np.arccosh(R) / m)
        c = np.sqrt((1 + c1) / (2 + (c1 - 1) * np.cos(k * a / 2) ** 2))
        alph = c * np.cos(k * a / 2)
        xi = (1 / c) * np.sqrt(((1 + alph ** 2) / 2) + ((1 - alph ** 2) / 2) * 
                               np.cos(((2 * n - 1) * np.pi) / (2 * m)))
        U0 = (2 / (a * k)) * np.arccos(xi)
    elif(dist_type == "Duhamel-b"):  # Duhamel bi-directional end-fire array zeros
        if(a < 0.5): c = np.cosh(np.arccosh(R) / (M - 1)) / np.sin((k * a) / 2)
        else: c = np.cosh(np.arccosh(R) / (M - 1))
        U0 = (2 / (a * k)) * np.arcsin((np.cos(np.pi * (2 * n - 1) / (2 * M - 2))) / c)
    elif(dist_type == "Duhamel-u"):  # Duhamel uni-directional end-fire array zeros
        Lamb = np.cosh(np.arccosh(R) / (M - 1))
        xi = (2 / a) * (0.5 * np.pi - (np.arctan(np.tan(k * a / 2) * ((Lamb + 1) / (Lamb - 1)))))
        c = 1 / (np.sin((xi - k) * a / 2))
        U0 = -(xi / k) + (2 / (a * k)) * np.arcsin((
                            np.cos(np.pi * (2 * na - 1) / (2 * M - 2))) / c)
    elif(dist_type == "McNamara-s"):  # McNamara-Zolotarev sum-pattern zeros
        U0 = "Yet to be done"
    elif(dist_type == "McNamara-d"):  # McNamara-Zolotarev difference-pattern zeros
        if(a < 0.5): c = 1 / np.sin((k * a) / 2)
        else: c = 1
        m1 = Zol.z_m_frm_R(M - 1, R)
        xn = Zol.z_Zolotarev_poly(N=M - 1, m=m1)[1][m + 1:]
        U0 = (2 / (a * k)) * np.arcsin(xn / c)
    if(nbar):  # Taylor's Dilation procedure
        if((dist_type == "Dolph-Chebyshev") or (dist_type == "Riblet") or (dist_type == "McNamara-s")):
            n_gen = np.arange(nbar, 1 + m, 1)  # indices of the generic zeros
            U0_gen = (n_gen + alpha / 2) * (1 / (M * a))  # generic sum zeros
        elif(dist_type == "McNamara-d"):
            n_gen = np.arange(nbar, 1 + m, 1)  # indices of the generic zeros
            U0_gen = (n_gen + (alpha + 1) / 2) * (1 / (M * a))  # generic difference zeros
        sigma = U0_gen[0] / U0[nbar - 1]  # Dilation factor
        U0 = np.hstack((sigma * U0[0:nbar - 1], U0_gen))  # Dilated zeros
    U0 = np.reshape(U0, (len(U0), -1))
    return U0
开发者ID:ZhouJ-sh,项目名称:arraytool,代码行数:60,代码来源:planar.py

示例5: geodesic

 def geodesic(self, P1, P2, theta):
     if np.ndim(P1)==1:
          arg =np.array([np.arccosh(2*P1[0]*P2[0]-np.inner(P1, P2))])
     else:
         arg = np.arccosh(2*P1[:,0]*P2[:,0]-np.einsum('ij...,ij...->i...',P1, P2))
         arg = arg[:, np.newaxis,...]
     return ((1-theta)*sinhc((1-theta)*arg)*P1 + theta*sinhc(theta*arg)*P2)/sinhc(arg)
开发者ID:olivierverdier,项目名称:bsplinelab,代码行数:7,代码来源:hyperbolic.py

示例6: test_arccosh

    def test_arccosh(self):
        import math
        from numpy import arccosh

        for v in [1.0, 1.1, 2]:
            assert math.acosh(v) == arccosh(v)
        for v in [-1.0, 0, 0.99]:
            assert math.isnan(arccosh(v))
开发者ID:Qointum,项目名称:pypy,代码行数:8,代码来源:test_ufuncs.py

示例7: localized

def localized(T, a, xi):
    '''
    total transmission distribution for 1D localized system;
    effective localization length also fit parameter (in units
    of L)
    '''
    return (a * np.sqrt(np.arccosh(T**(-1./2.))) / (T**(3./2.) * (1.-T)**(1./4.)) \
        * np.exp(-0.5 * xi * np.arccosh(T**(-1./2.))**2.)).real
开发者ID:pambichl,项目名称:VSC-Scripts,代码行数:8,代码来源:fitfuncs.py

示例8: chebwin

def chebwin(M, at, sym=True):
    """Return a Dolph-Chebyshev window.

    Parameters
    ----------
    M : int
        Number of points in the output window. If zero or less, an empty
        array is returned.
    at : float
        Attenuation (in dB).
    sym : bool, optional
        When True, generates a symmetric window, for use in filter design.
        When False, generates a periodic window, for use in spectral analysis.

    Returns
    -------
    w : ndarray
        The window, with the maximum value always normalized to 1

    """
    if M < 1:
        return np.array([])
    if M == 1:
        return np.ones(1, 'd')

    odd = M % 2
    if not sym and not odd:
        M = M + 1

    # compute the parameter beta
    order = M - 1.0
    beta = np.cosh(1.0 / order * np.arccosh(10 ** (np.abs(at) / 20.)))
    k = np.r_[0:M] * 1.0
    x = beta * np.cos(np.pi * k / M)
    # Find the window's DFT coefficients
    # Use analytic definition of Chebyshev polynomial instead of expansion
    # from scipy.special. Using the expansion in scipy.special leads to errors.
    p = np.zeros(x.shape)
    p[x > 1] = np.cosh(order * np.arccosh(x[x > 1]))
    p[x < -1] = (1 - 2 * (order % 2)) * np.cosh(order * np.arccosh(-x[x < -1]))
    p[np.abs(x) <= 1] = np.cos(order * np.arccos(x[np.abs(x) <= 1]))

    # Appropriate IDFT and filling up
    # depending on even/odd M
    if M % 2:
        w = np.real(fft(p))
        n = (M + 1) / 2
        w = w[:n] / w[0]
        w = np.concatenate((w[n - 1:0:-1], w))
    else:
        p = p * np.exp(1.j * np.pi / M * np.r_[0:M])
        w = np.real(fft(p))
        n = M / 2 + 1
        w = w / w[1]
        w = np.concatenate((w[n - 1:0:-1], w[1:n]))
    if not sym and not odd:
        w = w[:-1]
    return w
开发者ID:87,项目名称:scipy,代码行数:58,代码来源:windows.py

示例9: acosh

def acosh(x):
    """
    Inverse hyperbolic cosine
    """
    if isinstance(x, UncertainFunction):
        mcpts = np.arccosh(x._mcpts)
        return UncertainFunction(mcpts)
    else:
        return np.arccosh(x)
开发者ID:mkouhia,项目名称:mcerp,代码行数:9,代码来源:umath.py

示例10: test_arccosh

def test_arccosh():
    # Domain for arccosh starts at 1
    a = afnumpy.random.random((2,3))+1
    b = numpy.array(a)
    fassert(afnumpy.arccosh(a), numpy.arccosh(b))
    c = afnumpy.random.random((2,3))
    d = numpy.array(a)
    fassert(afnumpy.arccosh(a, out=c), numpy.arccosh(b, out=d))
    fassert(c, d)
开发者ID:daurer,项目名称:afnumpy,代码行数:9,代码来源:test_lib.py

示例11: localized_log

def localized_log(T, a, xi):
    '''
    total transmission distribution for 1D localized system;
    distribution for lnT ( P(lnT) = T * P(T); prefactor ln(10), which can
    be considered as contained in amplitude a
    effective localization length also fit parameter (in units
    of L)
    '''
    return (a * T * np.sqrt(np.arccosh(T**(-1./2.))) / (T**(3./2.) * (1.-T)**(1./4.)) \
        * np.exp(-0.5 * xi * np.arccosh(T**(-1./2.))**2.)).real
开发者ID:pambichl,项目名称:VSC-Scripts,代码行数:10,代码来源:fitfuncs.py

示例12: test_der_arccosh

    def test_der_arccosh():
        x = np.linspace(1.2, 5, 5)
        h = 1e-8
        der1 = np.arccosh(bicomplex(x + h * 1j, 0)).imag1 / h
        np.testing.assert_allclose(der1, 1. / np.sqrt(x**2 - 1))

        h = (_default_base_step(x, scale=2.5) + 1) - 1
        der2 = np.arccosh(bicomplex(x + h * 1j, h)).imag12 / h**2
        true_der2 = -x / (x**2-1)**(3. / 2)
        np.testing.assert_allclose(der2, true_der2, atol=1e-5)
开发者ID:inonchiu,项目名称:numdifftools,代码行数:10,代码来源:test_multicomplex.py

示例13: arccosh

def arccosh(x, out=None):
    """
    Raises a ValueError if input cannot be rescaled to a dimensionless
    quantity.
    """
    if not isinstance(x, Quantity):
        return np.arccosh(x, out)

    return Quantity(
        np.arccosh(x.rescale(dimensionless).magnitude, out),
        dimensionless,
        copy=False
    )
开发者ID:CatherineH,项目名称:python-quantities,代码行数:13,代码来源:umath.py

示例14: chebwin

def chebwin(M, at, sym=1):
    """Dolph-Chebyshev window.

    INPUTS:

      M : int
        Window size
      at : float
        Attenuation (in dB)
      sym : bool
        Generates symmetric window if True.

    """
    if M < 1:
        return array([])
    if M == 1:
        return ones(1,'d')

    odd = M % 2
    if not sym and not odd:
        M = M+1

    # compute the parameter beta
    order = M - 1.0
    beta = cosh(1.0/order * arccosh(10**(abs(at)/20.)))
    k = r_[0:M]*1.0
    x = beta*cos(pi*k/M)
    #find the window's DFT coefficients
    # Use analytic definition of Chebyshev polynomial instead of expansion
    # from scipy.special. Using the expansion in scipy.special leads to errors.
    p = zeros(x.shape)
    p[x > 1] = cosh(order * arccosh(x[x > 1]))
    p[x < -1] = (1 - 2*(order%2)) * cosh(order * arccosh(-x[x < -1]))
    p[np.abs(x) <=1 ] = cos(order * arccos(x[np.abs(x) <= 1]))

    # Appropriate IDFT and filling up
    # depending on even/odd M
    if M % 2:
        w = real(fft(p))
        n = (M + 1) / 2
        w = w[:n] / w[0]
        w = concatenate((w[n - 1:0:-1], w))
    else:
        p = p * exp(1.j*pi / M * r_[0:M])
        w = real(fft(p))
        n = M / 2 + 1
        w = w / w[1]
        w = concatenate((w[n - 1:0:-1], w[1:n]))
    if not sym and not odd:
        w = w[:-1]
    return w
开发者ID:mullens,项目名称:khk-lights,代码行数:51,代码来源:signaltools.py

示例15: chebwin

def chebwin(M, at, sym=1):
    """Dolph-Chebyshev window.

    INPUTS:

      M : int
        Window size
      at : float
        Attenuation (in dB)
      sym : bool
        Generates symmetric window if True.

    """
    if M < 1:
        return array([])
    if M == 1:
        return ones(1,'d')

    odd = M % 2
    if not sym and not odd:
        M = M+1

    # compute the parameter beta
    beta = cosh(1.0/(M-1.0)*arccosh(10**(at/20.)))
    k = r_[0:M]*1.0
    x = beta*cos(pi*k/M)
    #find the window's DFT coefficients
    p = zeros(x.shape) * 1.0
    for i in range(len(x)):
        if x[i] < 1:
            p[i] = cos((M - 1) * arccos(x[i]))
        else:
            p[i] = cosh((M - 1) * arccosh(x[i]))

    # Appropriate IDFT and filling up
    # depending on even/odd M
    if M % 2:
        w = real(fft(p));
        n = (M + 1) / 2;
        w = w[:n] / w[0];
        w = concatenate((w[n - 1:0:-1], w))
    else:
        p = p * exp(1.j*pi / M * r_[0:M])
        w = real(fft(p));
        n = M / 2 + 1;
        w = w / w[1];
        w = concatenate((w[n - 1:0:-1], w[1:n]));
    if not sym and not odd:
        w = w[:-1]
    return w
开发者ID:mbentz80,项目名称:jzigbeercp,代码行数:50,代码来源:signaltools.py


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