python nextpow2_Python fft.ifft方法代碼示例

本文详细介绍了Python中numpy.fft.ifft方法的多个应用场景,包括圆周卷积、圆周相关、离散希尔伯特变换、滤波、自相关、傅里叶变换的逆运算等。通过具体的代码示例展示了该方法在不同场景下的实现,适用于对傅里叶变换和信号处理感兴趣的读者参考学习。
摘要由CSDN通过智能技术生成

本文整理匯總了Python中numpy.fft.ifft方法的典型用法代碼示例。如果您正苦於以下問題:Python fft.ifft方法的具體用法?Python fft.ifft怎麽用?Python fft.ifft使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在模塊numpy.fft的用法示例。

在下文中一共展示了fft.ifft方法的25個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。

示例1: cconv

​點讚 7

# 需要導入模塊: from numpy import fft [as 別名]

# 或者: from numpy.fft import ifft [as 別名]

def cconv(a, b):

"""

Circular convolution of vectors

Computes the circular convolution of two vectors a and b via their

fast fourier transforms

a \ast b = \mathcal{F}^{-1}(\mathcal{F}(a) \odot \mathcal{F}(b))

Parameter

---------

a: real valued array (shape N)

b: real valued array (shape N)

Returns

-------

c: real valued array (shape N), representing the circular

convolution of a and b

"""

return ifft(fft(a) * fft(b)).real

開發者ID:mnick,項目名稱:scikit-kge,代碼行數:22,

示例2: cconv

​點讚 7

# 需要導入模塊: from numpy import fft [as 別名]

# 或者: from numpy.fft import ifft [as 別名]

def cconv(a, b):

"""

Circular convolution of vectors

Computes the circular convolution of two vectors a and b via their

fast fourier transforms

a \ast b = \mathcal{F}^{-1}(\mathcal{F}(a) \odot \mathcal{F}(b))

Parameter

---------

a: real valued array (shape N)

b: real valued array (shape N)

Returns

-------

c: real valued array (shape N), representing the circular

convolution of a and b

"""

return ifft(fft(a) * fft(b)).real

開發者ID:malllabiisc,項目名稱:cesi,代碼行數:22,

示例3: _dhtm

​點讚 6

# 需要導入模塊: from numpy import fft [as 別名]

# 或者: from numpy.fft import ifft [as 別名]

def _dhtm(mag):

"""Compute the modified 1D discrete Hilbert transform

Parameters

----------

mag : ndarray

The magnitude spectrum. Should be 1D with an even length, and

preferably a fast length for FFT/IFFT.

"""

# Adapted based on code by Niranjan Damera-Venkata,

# Brian L. Evans and Shawn R. McCaslin (see refs for `minimum_phase`)

sig = np.zeros(len(mag))

# Leave Nyquist and DC at 0, knowing np.abs(fftfreq(N)[midpt]) == 0.5

midpt = len(mag) // 2

sig[1:midpt] = 1

sig[midpt+1:] = -1

# eventually if we want to support complex filters, we will need a

# np.abs() on the mag inside the log, and should remove the .real

recon = ifft(mag * np.exp(fft(sig * ifft(np.log(mag))))).real

return recon

開發者ID:ryfeus,項目名稱:lambda-packs,代碼行數:22,

示例4: filter

​點讚 6

# 需要導入模塊: from numpy import fft [as 別名]

# 或者: from numpy.fft import ifft [as 別名]

def filter(self, x):

'''

filter a timeseries with the ARMA filter

padding with zero is missing, in example I needed the padding to get

initial conditions identical to direct filter

Initial filtered observations differ from filter2 and signal.lfilter, but

at end they are the same.

See Also

--------

tsa.filters.fftconvolve

'''

n = x.shape[0]

if n == self.fftarma:

fftarma = self.fftarma

else:

fftarma = self.fftma(n) / self.fftar(n)

tmpfft = fftarma * fft.fft(x)

return fft.ifft(tmpfft)

開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:24,

示例5: invpowerspd

​點讚 6

# 需要導入模塊: from numpy import fft [as 別名]

# 或者: from numpy.fft import ifft [as 別名]

def invpowerspd(self, n):

'''autocovariance from spectral density

scaling is correct, but n needs to be large for numerical accuracy

maybe padding with zero in fft would be faster

without slicing it returns 2-sided autocovariance with fftshift

>>> ArmaFft([1, -0.5], [1., 0.4], 40).invpowerspd(2**8)[:10]

array([ 2.08 , 1.44 , 0.72 , 0.36 , 0.18 , 0.09 ,

0.045 , 0.0225 , 0.01125 , 0.005625])

>>> ArmaFft([1, -0.5], [1., 0.4], 40).acovf(10)

array([ 2.08 , 1.44 , 0.72 , 0.36 , 0.18 , 0.09 ,

0.045 , 0.0225 , 0.01125 , 0.005625])

'''

hw = self.fftarma(n)

return np.real_if_close(fft.ifft(hw*hw.conj()), tol=200)[:n]

開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:18,

示例6: synthesize

​點讚 6

# 需要導入模塊: from numpy import fft [as 別名]<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值