ó
ŕ¸#Rc           @   s>   d  d l  m Z m Z m Z d  d l j j Z d d  Z	 d S(   i˙˙˙˙(   t   asarrayt   concatenatet   swapaxesNc         C   sÚ   t  |   } | d k r* t | j  } n$ t | t t j f  rN | f } n  | } x | D]w } | j | } | d d } t	 | d |  } t
 | | d  d f | d |  d f f  } t	 | d |  } q[ W| S(   s˛  
Shift the zero-frequency component to the center of the spectrum.

This function swaps half-spaces for all axes listed (defaults to all).
Note that ``y[0]`` is the Nyquist component only if ``len(x)`` is even.

Parameters
----------
x : array_like
Input array.
axes : int or shape tuple, optional
Axes over which to shift. Default is None, which shifts all axes.

Returns
-------
y : ndarray
The shifted array.

See Also
--------
ifftshift : The inverse of `fftshift`.

Examples
--------
>>> freqs = np.fft.fftfreq(10, 0.1)
>>> freqs
array([ 0., 1., 2., 3., 4., -5., -4., -3., -2., -1.])
>>> np.fft.fftshift(freqs)
array([-5., -4., -3., -2., -1., 0., 1., 2., 3., 4.])

Shift the zero-frequency component only along the second axis:

>>> freqs = np.fft.fftfreq(9, d=1./9).reshape(3, 3)
>>> freqs
array([[ 0., 1., 2.],
[ 3., 4., -4.],
[-3., -2., -1.]])
>>> np.fft.fftshift(freqs, axes=(1,))
array([[ 2., 0., 1.],
[-4., 3., 4.],
[-1., -3., -2.]])

i   i   i    N.(   R    t   Nonet   ranget   ndimt
   isinstancet   intt   ntt   integert   shapeR   R   (   t   xt   axest   tmpt   yt   kt   nt   p2(    (    sS   /golem/database/velin//includes/analysis/Radiation/1212Impurities_TO.ON/fftshift.pyt   fftshift   s    ,2(
   t
   numpy.coreR    R   R   t   numpy.core.numerictypest   coret   numerictypesR   R   R   (    (    (    sS   /golem/database/velin//includes/analysis/Radiation/1212Impurities_TO.ON/fftshift.pyt   <module>   s   