我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用scipy.special.wofz()。
def _voigt(x, *parameters): """ Evaluate a Voigt profile at x, given the profile parameters. :param x: The x-values to evaluate the Voigt profile at. :param parameters: The position, fwhm, amplitude, and shape of the Voigt profile. """ try: n = len(x) except TypeError: n = 1 position, fwhm, amplitude, shape = parameters profile = 1 / wofz(np.zeros((n)) + 1j * np.sqrt(np.log(2.0)) * shape).real profile *= amplitude * wofz(2*np.sqrt(np.log(2.0)) * (x - position)/fwhm \ + 1j * np.sqrt(np.log(2.0))*shape).real return profile
def voigt(x, a): """ Real part of Faddeeva function, where w(z) = exp(-z^2) erfc(jz) """ z = x + 1j*a return wofz(z).real
def voigt(x, a, b, c, d): z = (x-b+1j*d)/c/numpy.sqrt(2) result = a*numpy.real(wofz(z))/c/numpy.sqrt(2*numpy.pi) return result
def Z(zeta): return wofz(zeta) #Initialize some variables only once
def voigt(x, x0=0., gamma=1., sigma=0.01, scale=1.): if gamma!=0. and sigma/gamma < 1.e-16: return lorentz(x, x0, gamma, scale) else: return scale*wofz(((x - x0)+1.j*gamma)/sqrt(2.)/sigma).real/(sqrt(2.*pi)*sigma)