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


Python fft.ifft方法代码示例

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

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

示例1: cconv

# 需要导入模块: 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,代码来源:util.py


示例2: cconv

# 需要导入模块: 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,代码来源:util.py


示例3: _dhtm

# 需要导入模块: 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,代码来源:fir_filter_design.py


示例4: filter

# 需要导入模块: 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,代码来源:fftarma.py


示例5: invpowerspd

# 需要导入模块: 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,代码来源:fftarma.py


示例6: synthesize

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def synthesize(f_hat, axis=0):
        """
        Compute the inverse / synthesis Fourier transform of the function f_hat : Z -> C.
        The function f_hat(n) is sampled at points in a limited range -floor(N/2) <= n <= ceil(N/2) - 1

        This function returns
        f[k] = f(theta_k) = sum_{n=-floor(N/2)}^{ceil(N/2)-1} f_hat(n) exp(i n theta_k)
        where theta_k = 2 pi k / N
        for k = 0, ..., N - 1

        :param f_hat:
        :param axis:
        :return:
        """

        f_hat = ifftshift(f_hat * f_hat.shape[axis], axes=axis)
        f = ifft(f_hat, axis=axis)
        return f 
开发者ID:AMLab-Amsterdam,项目名称:lie_learn,代码行数:20,代码来源:T1FFT.py


示例7: xcorr

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def xcorr(x1,x2,Nlags):
    """
    r12, k = xcorr(x1,x2,Nlags), r12 and k are ndarray's
    Compute the energy normalized cross correlation between the sequences
    x1 and x2. If x1 = x2 the cross correlation is the autocorrelation.
    The number of lags sets how many lags to return centered about zero
    """
    K = 2*(int(np.floor(len(x1)/2)))
    X1 = fft.fft(x1[:K])
    X2 = fft.fft(x2[:K])
    E1 = sum(abs(x1[:K])**2)
    E2 = sum(abs(x2[:K])**2)
    r12 = np.fft.ifft(X1*np.conj(X2))/np.sqrt(E1*E2)
    k = np.arange(K) - int(np.floor(K/2))
    r12 = np.fft.fftshift(r12)
    idx = np.nonzero(np.ravel(abs(k) <= Nlags))
    return r12[idx], k[idx] 
开发者ID:mwickert,项目名称:scikit-dsp-comm,代码行数:19,代码来源:digitalcom.py


示例8: ccorr

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def ccorr(a, b):
    """
    Circular correlation of vectors

    Computes the circular correlation of two vectors a and b via their
    fast fourier transforms

    a \ast b = \mathcal{F}^{-1}(\overline{\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
       correlation of a and b
    """

    return ifft(np.conj(fft(a)) * fft(b)).real 
开发者ID:mnick,项目名称:scikit-kge,代码行数:23,代码来源:util.py


示例9: ccorr

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def ccorr(a, b):
	"""
	Circular correlation of vectors

	Computes the circular correlation of two vectors a and b via their
	fast fourier transforms

	a \ast b = \mathcal{F}^{-1}(\overline{\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
	   correlation of a and b
	"""

	return ifft(np.conj(fft(a)) * fft(b)).real 
开发者ID:malllabiisc,项目名称:cesi,代码行数:23,代码来源:util.py


示例10: _frft2

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def _frft2(x, alpha):
    assert x.ndim == 2, "x must be a 2 dimensional array"
    m, n = x.shape
    # TODO please remove this confusing comment. Is it 'm' or 'm-1' ?
    # TODO If 'p = m', more code cleaning is easy to do.
    p = m  # m-1 # deveria incrementarse el sigiente pow
    y = zeros((2 * p, n), dtype=complex)
    z = zeros((2 * p, n), dtype=complex)

    j = indices(z.shape)[0]
    y[(p - m) // 2 : (p + m) // 2, :] = x * exp(
        -1.0j * pi * (j[0:m] ** 2) * float(alpha) / m
    )

    z[0:m, :] = exp(1.0j * pi * (j[0:m] ** 2) * float(alpha) / m)
    z[-m:, :] = exp(1.0j * pi * ((j[-m:] - 2 * p) ** 2) * float(alpha) / m)

    d = exp(-1.0j * pi * j ** 2 ** float(alpha) / m) * ifft(
        fft(y, axis=0) * fft(z, axis=0), axis=0
    )

    return d[0:m]


# TODO better docstring 
开发者ID:cihologramas,项目名称:pyoptools,代码行数:27,代码来源:frft.py


示例11: _ncc_c

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def _ncc_c(x, y):
    """
    >>> _ncc_c([1,2,3,4], [1,2,3,4])
    array([ 0.13333333,  0.36666667,  0.66666667,  1.        ,  0.66666667,
            0.36666667,  0.13333333])
    >>> _ncc_c([1,1,1], [1,1,1])
    array([ 0.33333333,  0.66666667,  1.        ,  0.66666667,  0.33333333])
    >>> _ncc_c([1,2,3], [-1,-1,-1])
    array([-0.15430335, -0.46291005, -0.9258201 , -0.77151675, -0.46291005])
    """
    den = np.array(norm(x) * norm(y))
    den[den == 0] = np.Inf

    x_len = len(x)
    fft_size = 1 << (2*x_len-1).bit_length()
    cc = ifft(fft(x, fft_size) * np.conj(fft(y, fft_size)))
    cc = np.concatenate((cc[-(x_len-1):], cc[:x_len]))
    return np.real(cc) / den 
开发者ID:johnpaparrizos,项目名称:kshape,代码行数:20,代码来源:core.py


示例12: csr_convolution

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def csr_convolution(a, b):
    P = len(a)
    Q = len(b)
    L = P + Q - 1
    K = 2 ** nextpow2(L)
    a_pad = np.pad(a, (0, K - P), 'constant', constant_values=(0))
    b_pad = np.pad(b, (0, K - Q), 'constant', constant_values=(0))
    c = ifft(fft(a_pad)*fft(b_pad))
    c = c[0:L-1].real
    return c 
开发者ID:ocelot-collab,项目名称:ocelot,代码行数:12,代码来源:csr.py


示例13: bench_random

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def bench_random(self):
        from numpy.fft import ifft as numpy_ifft
        print()
        print('       Inverse Fast Fourier Transform')
        print('===============================================')
        print('      |     real input    |    complex input   ')
        print('-----------------------------------------------')
        print(' size |  scipy  |  numpy  |  scipy  |  numpy  ')
        print('-----------------------------------------------')
        for size,repeat in [(100,7000),(1000,2000),
                            (256,10000),
                            (512,10000),
                            (1024,1000),
                            (2048,1000),
                            (2048*2,500),
                            (2048*4,500),
                            ]:
            print('%5s' % size, end=' ')
            sys.stdout.flush()

            for x in [random([size]).astype(double),
                      random([size]).astype(cdouble)+random([size]).astype(cdouble)*1j
                      ]:
                if size > 500:
                    y = ifft(x)
                else:
                    y = direct_idft(x)
                assert_array_almost_equal(ifft(x),y)
                print('|%8.2f' % measure('ifft(x)',repeat), end=' ')
                sys.stdout.flush()

                assert_array_almost_equal(numpy_ifft(x),y)
                print('|%8.2f' % measure('numpy_ifft(x)',repeat), end=' ')
                sys.stdout.flush()

            print(' (secs for %s calls)' % (repeat))
        sys.stdout.flush() 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:39,代码来源:bench_basic.py


示例14: test_djbfft

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_djbfft(self):
        from numpy.fft import ifft as numpy_ifft
        for i in range(2,14):
            n = 2**i
            x = list(range(n))
            x1 = zeros((n,),dtype=cdouble)
            x1[0] = x[0]
            for k in range(1, n//2):
                x1[k] = x[2*k-1]+1j*x[2*k]
                x1[n-k] = x[2*k-1]-1j*x[2*k]
            x1[n//2] = x[-1]
            y1 = numpy_ifft(x1)
            y = fftpack.drfft(x,direction=-1)
            assert_array_almost_equal(y,y1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:16,代码来源:test_basic.py


示例15: test_fourier_gaussian_real01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_gaussian_real01(self):
        for shape in [(32, 16), (31, 15)]:
            for type in [numpy.float32, numpy.float64]:
                a = numpy.zeros(shape, type)
                a[0, 0] = 1.0
                a = fft.rfft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_gaussian(a, [5.0, 2.5],
                                                       shape[0], 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.irfft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a), 1) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_ndimage.py


示例16: test_fourier_gaussian_complex01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_gaussian_complex01(self):
        for shape in [(32, 16), (31, 15)]:
            for type in [numpy.complex64, numpy.complex128]:
                a = numpy.zeros(shape, type)
                a[0, 0] = 1.0
                a = fft.fft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_gaussian(a, [5.0, 2.5], -1,
                                                       0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.ifft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a.real), 1.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_ndimage.py


示例17: test_fourier_uniform_real01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_uniform_real01(self):
        for shape in [(32, 16), (31, 15)]:
            for type in [numpy.float32, numpy.float64]:
                a = numpy.zeros(shape, type)
                a[0, 0] = 1.0
                a = fft.rfft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_uniform(a, [5.0, 2.5],
                                                      shape[0], 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.irfft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a), 1.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_ndimage.py


示例18: test_fourier_shift_real01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_shift_real01(self):
        for shape in [(32, 16), (31, 15)]:
            for dtype in [numpy.float32, numpy.float64]:
                expected = numpy.arange(shape[0] * shape[1], dtype=dtype)
                expected.shape = shape
                a = fft.rfft(expected, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_shift(a, [1, 1], shape[0], 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.irfft(a, shape[0], 0)
                assert_array_almost_equal(a[1:, 1:], expected[:-1, :-1])
                assert_array_almost_equal(a.imag, numpy.zeros(shape)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_ndimage.py


示例19: test_fourier_shift_complex01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_shift_complex01(self):
        for shape in [(32, 16), (31, 15)]:
            for type in [numpy.complex64, numpy.complex128]:
                expected = numpy.arange(shape[0] * shape[1],
                                       dtype=type)
                expected.shape = shape
                a = fft.fft(expected, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_shift(a, [1, 1], -1, 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.ifft(a, shape[0], 0)
                assert_array_almost_equal(a.real[1:, 1:], expected[:-1, :-1])
                assert_array_almost_equal(a.imag, numpy.zeros(shape)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:15,代码来源:test_ndimage.py


示例20: test_fourier_ellipsoid_real01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_ellipsoid_real01(self):
        for shape in [(32, 16), (31, 15)]:
            for type in [numpy.float32, numpy.float64]:
                a = numpy.zeros(shape, type)
                a[0, 0] = 1.0
                a = fft.rfft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_ellipsoid(a, [5.0, 2.5],
                                              shape[0], 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.irfft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a), 1.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_ndimage.py


示例21: test_fourier_ellipsoid_complex01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_ellipsoid_complex01(self):
        for shape in [(32, 16), (31, 15)]:
            for type in [numpy.complex64, numpy.complex128]:
                a = numpy.zeros(shape, type)
                a[0, 0] = 1.0
                a = fft.fft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_ellipsoid(a, [5.0, 2.5], -1,
                                                        0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.ifft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a.real), 1.0) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:14,代码来源:test_ndimage.py


示例22: track

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def track(self, im, pos, base_target_sz, current_scale_factor):
        """
            track the scale using the scale filter
        """
        # get scale filter features
        scales = current_scale_factor * self.scale_size_factors
        xs = self._extract_scale_sample(im, pos, base_target_sz, scales, self.scale_model_sz)

        # project
        xs = self.basis.dot(xs) * self.window

        # get scores
        xsf = fft(xs, axis=1)
        scale_responsef = np.sum(self.sf_num * xsf, 0) / (self.sf_den + config.lamBda)
        interp_scale_response = np.real(ifft(resize_dft(scale_responsef, config.number_of_interp_scales)))
        recovered_scale_index = np.argmax(interp_scale_response)
        if config.do_poly_interp:
            # fit a quadratic polynomial to get a refined scale estimate
            id1 = (recovered_scale_index - 1) % config.number_of_interp_scales
            id2 = (recovered_scale_index + 1) % config.number_of_interp_scales
            poly_x = np.array([self.interp_scale_factors[id1], self.interp_scale_factors[recovered_scale_index], self.interp_scale_factors[id2]])
            poly_y = np.array([interp_scale_response[id1], interp_scale_response[recovered_scale_index], interp_scale_response[id2]])
            poly_A = np.array([[poly_x[0]**2, poly_x[0], 1],
                               [poly_x[1]**2, poly_x[1], 1],
                               [poly_x[2]**2, poly_x[2], 1]], dtype=np.float32)
            poly = np.linalg.inv(poly_A).dot(poly_y.T)
            scale_change_factor = - poly[1] / (2 * poly[0])
        else:
            scale_change_factor = self.interp_scale_factors[recovered_scale_index]
        return scale_change_factor 
开发者ID:StrangerZhang,项目名称:pyECO,代码行数:32,代码来源:scale_filter.py


示例23: test_mls_output

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_mls_output(self):
        # define some alternate working taps
        alt_taps = {2: [1], 3: [2], 4: [3], 5: [4, 3, 2], 6: [5, 4, 1], 7: [4],
                    8: [7, 5, 3]}
        # assume the other bit levels work, too slow to test higher orders...
        for nbits in range(2, 8):
            for state in [None, np.round(np.random.rand(nbits))]:
                for taps in [None, alt_taps[nbits]]:
                    if state is not None and np.all(state == 0):
                        state[0] = 1  # they can't all be zero
                    orig_m = max_len_seq(nbits, state=state,
                                         taps=taps)[0]
                    m = 2. * orig_m - 1.  # convert to +/- 1 representation
                    # First, make sure we got all 1's or -1
                    err_msg = "mls had non binary terms"
                    assert_array_equal(np.abs(m), np.ones_like(m),
                                       err_msg=err_msg)
                    # Test via circular cross-correlation, which is just mult.
                    # in the frequency domain with one signal conjugated
                    tester = np.real(ifft(fft(m) * np.conj(fft(m))))
                    out_len = 2**nbits - 1
                    # impulse amplitude == test_len
                    err_msg = "mls impulse has incorrect value"
                    assert_allclose(tester[0], out_len, err_msg=err_msg)
                    # steady-state is -1
                    err_msg = "mls steady-state has incorrect value"
                    assert_allclose(tester[1:], -1 * np.ones(out_len - 1),
                                    err_msg=err_msg)
                    # let's do the split thing using a couple options
                    for n in (1, 2**(nbits - 1)):
                        m1, s1 = max_len_seq(nbits, state=state, taps=taps,
                                             length=n)
                        m2, s2 = max_len_seq(nbits, state=s1, taps=taps,
                                             length=1)
                        m3, s3 = max_len_seq(nbits, state=s2, taps=taps,
                                             length=out_len - n - 1)
                        new_m = np.concatenate((m1, m2, m3))
                        assert_array_equal(orig_m, new_m) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:40,代码来源:test_max_len_seq.py


示例24: test_fourier_gaussian_real01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_gaussian_real01(self):
        for shape in [(32, 16), (31, 15)]:
            for type_, dec in zip([numpy.float32, numpy.float64], [6, 14]):
                a = numpy.zeros(shape, type_)
                a[0, 0] = 1.0
                a = fft.rfft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_gaussian(a, [5.0, 2.5], shape[0], 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.irfft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a), 1, decimal=dec) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:13,代码来源:test_ndimage.py


示例25: test_fourier_gaussian_complex01

# 需要导入模块: from numpy import fft [as 别名]
# 或者: from numpy.fft import ifft [as 别名]
def test_fourier_gaussian_complex01(self):
        for shape in [(32, 16), (31, 15)]:
            for type_, dec in zip([numpy.complex64, numpy.complex128], [6, 14]):
                a = numpy.zeros(shape, type_)
                a[0, 0] = 1.0
                a = fft.fft(a, shape[0], 0)
                a = fft.fft(a, shape[1], 1)
                a = ndimage.fourier_gaussian(a, [5.0, 2.5], -1, 0)
                a = fft.ifft(a, shape[1], 1)
                a = fft.ifft(a, shape[0], 0)
                assert_almost_equal(ndimage.sum(a.real), 1.0, decimal=dec) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:13,代码来源:test_ndimage.py



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