ó
µß{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 … |  ƒ } nf | d	 k rÅ t j |  |  |  ƒ } nA | d
 k rø t j |  t j | d |  j ƒƒ } 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   zerost   dtypes   method %s is not available(   t   intt   npt   log2t   shapet
   ValueErrort   appendR   R   (   t   xt   methodt   lengtht   ltt   lpt   xret(    (    s]   /srv/fyzport/fyzika/golem/velin/includes/analysis/Magnetics/0411Spectrograms_TO.ON/_extend.pyR       s    $&'(   t   __all__t   numpyR   R    (    (    (    s]   /srv/fyzport/fyzika/golem/velin/includes/analysis/Magnetics/0411Spectrograms_TO.ON/_extend.pyt   <module>   s   	