15.12.2012 Views

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

scipy tutorial - Baustatik-Info-Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

SciPy Reference Guide, Release 0.8.dev<br />

3.3.3 Helper functions<br />

fftshift(x[, axes]) Shift the zero-frequency component to the center of the spectrum.<br />

ifftshift(x[, axes]) The inverse of fftshift.<br />

dftfreq<br />

rfftfreq(n[, d]) rfftfreq(n, d=1.0) -> f<br />

fftshift(x, axes=None)<br />

Shift the zero-frequency component to the center of the spectrum.<br />

This function swaps half-spaces for all axes listed (defaults to all). Note that y[0] is the Nyquist component<br />

only if len(x) is even.<br />

See Also:<br />

Parameters<br />

x : array_like<br />

Input array.<br />

axes : int or shape tuple, optional<br />

Returns<br />

y : ndarray<br />

Axes over which to shift. Default is None, which shifts all axes.<br />

The shifted array.<br />

ifftshift<br />

The inverse of fftshift.<br />

Examples<br />

>>> freqs = np.fft.fftfreq(10, 0.1)<br />

>>> freqs<br />

array([ 0., 1., 2., 3., 4., -5., -4., -3., -2., -1.])<br />

>>> np.fft.fftshift(freqs)<br />

array([-5., -4., -3., -2., -1., 0., 1., 2., 3., 4.])<br />

Shift the zero-frequency component only along the second axis:<br />

>>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3)<br />

>>> freqs<br />

array([[ 0., 1., 2.],<br />

[ 3., 4., -4.],<br />

[-3., -2., -1.]])<br />

>>> np.fft.fftshift(freqs, axes=(1,))<br />

array([[ 2., 0., 1.],<br />

[-4., 3., 4.],<br />

[-1., -3., -2.]])<br />

ifftshift(x, axes=None)<br />

The inverse of fftshift.<br />

Parameters<br />

x : array_like<br />

Input array.<br />

axes : int or shape tuple, optional<br />

174 Chapter 3. Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!