ó
“µéQc           @   s(   d  g Z  d d l Z d d d „ Z d S(   t   extendiÿÿÿÿNt
   reflectiont   powerof2c         C   s«  | d k rD d d t  t j |  j d ƒ ƒ } | |  j d } n* | d k r` |  j d } n t d | ƒ | d k r¾ t j |  |  d d d … d d … f d | … d d … f ƒ } né | d	 k r*d
 GHt j |  |  d | … d d … f ƒ } t j t j |  |  d | … d d … f ƒ ƒ GHn} | d k r™t j t j | d |  j d f d |  j ƒ|  t j | | d |  j d f d |  j ƒf } n t d | ƒ | S(   sn  
    Extend the 1D numpy array x beyond its original length.

    :Parameters:
      x : 1d ndarray
        data
      method : string ('reflection', 'periodic', 'zeros')
             indicates which extension method to use
      length : string  ('powerof2', 'double')
             indicates how to determinate the length
             of the extended data

    :Returns:
      xe : 1d ndarray
         extended version of x

    Example:

    >>> import numpy as np
    >>> import mlpy
    >>> a = np.array([1,2,3,4,5])
    >>> mlpy.extend(a, method='periodic', length='powerof2')
    array([1, 2, 3, 4, 5, 1, 2, 3])
    R   i   i    t   doubles   length %s is not availableR   Niÿÿÿÿt   periodict	   periodicst   zerosi   t   dtypes   method %s is not available(	   t   intt   npt   log2t   shapet
   ValueErrort   appendt   r_R   R   (   t   xt   methodt   lengtht   ltt   lpt   xret(    (    sY   /srv/fyzport/fyzika/golem/velin/includes/analysis/Magnetics/0712MultiCWT_TO.ON/_extend.pyR       s     $D(3c(   t   __all__t   numpyR	   R    (    (    (    sY   /srv/fyzport/fyzika/golem/velin/includes/analysis/Magnetics/0712MultiCWT_TO.ON/_extend.pyt   <module>   s   	