def align(w,signals,mode):
    """ Align various waves in a specific point.
    
    Given a mode of alignment, this function computes the specific time point of 
    a wave where all the waves would be aligned. With the difference between the
    time point of the reference wave and the time points of all the other waves, 
    we have the amount of samples the waves will move to align in the specific 
    point computed. 
   
    Parameters
    ----------
    w: array-like
      the input signal to use as a reference of alignment (all the other signals
      will be aligned with this one).
    signals: array-like or matrix-like
      the input signals to align. 
    mode: string
      the mode used in the alignment, from 'max', 'min', 'peak', 'peak_neg', 
      'infMaxAlign' and 'infMinAlign'. 

    Returns
    -------
    nw: a masked array
      a new set of aligned signals in a masked array (some cells have NAN values
      due to the alignment).
        
    Example
    -------
    >>> align([6,3,4,5,2,2],[10,30,28,26,13,20],'max')
    [masked_array(data = [30.0 28.0 26.0 13.0 20.0 --],
                 mask = [False False False False False  True],
           fill_value = 1e+20)
    ]
    >>> align([6,3,4,5,2,2],[10,30,28,26,13,20],'peak')
    [masked_array(data = [-- -- 10.0 30.0 28.0 26.0],
                 mask = [ True  True False False False False],
           fill_value = 1e+20)
    ]
    >>> align([34,4,8],[[100,550,278,67,613,120],[10,470,230,189,856,420]],'min')
    [masked_array(data = [278.0 67.0 613.0 120.0 -- --],
                 mask = [False False False False  True  True],
           fill_value = 1e+20)
    , masked_array(data = [-- 10.0 470.0 230.0 189.0 856.0],
                 mask = [ True False False False False False],
           fill_value = 1e+20)
    ]
    """ 
    
    nw = []
    
    if len(shape(signals))==1:       
        signals = [signals]
               
    for i in range(len(signals)):
        
        if (mode == 'max'):
            al = maxAlign(w,signals[i])
        elif (mode == 'min'):
            al = minAlign(w,signals[i])
        elif (mode == 'peak'):
            al = peakAlign(w,signals[i])
        elif (mode == 'peak_neg'):
            al = peakNegAlign(w,signals[i])
        elif (mode == 'infMaxAlign'):
            al = infMaxAlign(w,signals[i])
        elif (mode == 'infMinAlign'):
            al = infMinAlign(w,signals[i])
                
        nw += [ moveWave(signals[i],al) ]
          
    return nw
Align various waves in a specific point.
    
    Given a mode of alignment, this function computes the specific time point of 
    a wave where all the waves would be aligned. With the difference between the
    time point of the reference wave and the time points of all the other waves, 
    we have the amount of samples the waves will move to align in the specific 
    point computed. 
   
    Parameters
    ----------
    w: array-like
      the input signal to use as a reference of alignment (all the other signals
      will be aligned with this one).
    signals: array-like or matrix-like
      the input signals to align. 
    mode: string
      the mode used in the alignment, from 'max', 'min', 'peak', 'peak_neg', 
      'infMaxAlign' and 'infMinAlign'. 

    Returns
    -------
    nw: a masked array
      a new set of aligned signals in a masked array (some cells have NAN values
      due to the alignment).
        
    Example
    -------
    >>> align([6,3,4,5,2,2],[10,30,28,26,13,20],'max')
    [masked_array(data = [30.0 28.0 26.0 13.0 20.0 --],
                 mask = [False False False False False  True],
           fill_value = 1e+20)
    ]
    >>> align([6,3,4,5,2,2],[10,30,28,26,13,20],'peak')
    [masked_array(data = [-- -- 10.0 30.0 28.0 26.0],
                 mask = [ True  True False False False False],
           fill_value = 1e+20)
    ]
    >>> align([34,4,8],[[100,550,278,67,613,120],[10,470,230,189,856,420]],'min')
    [masked_array(data = [278.0 67.0 613.0 120.0 -- --],
                 mask = [False False False False  True  True],
           fill_value = 1e+20)
    , masked_array(data = [-- 10.0 470.0 230.0 189.0 856.0],
                 mask = [ True False False False False False],
           fill_value = 1e+20)
    ]