l
ÉÅðQc               @   s(   d  g Z  d d l Z d d d „ Z d S(   u   extendi    Nu
   reflectionu   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 | … ƒ } nl | d	 k rÑ t j |  |  d | … ƒ } nA | d
 k rt j |  t j | d |  j ƒƒ } n t d | ƒ | S(   un  
    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])
    u   powerof2i   i    u   doubleu   length %s is not availableu
   reflectionNi   u   periodicu   zerosu   dtypeu   method %s is not availableiÿÿÿÿ(   u   intu   npu   log2u   shapeu
   ValueErroru   appendu   zerosu   dtype(   u   xu   methodu   lengthu   ltu   lpu   xret(    (    uT   /golem/database/velin//includes/analysis/Magnetics/0411Spectrograms_TO.ON/_extend.pyu   extend   s    $,'(   u   __all__u   numpyu   npu   extend(    (    (    uT   /golem/database/velin//includes/analysis/Magnetics/0411Spectrograms_TO.ON/_extend.pyu   <module>   s   	