def _wmorlet(f0, sd, sampling_rate, ns=5):
    """
    adapted from nitime

    returns a complex morlet wavelet in the time domain

    Parameters
    ----------
        f0 : center frequency
        sd : standard deviation of frequency
        sampling_rate : samplingrate
        ns : window length in number of standard deviations
    """
    st = 1. / (2. * pi * sd)
    w_sz = float(int(ns * st * sampling_rate))  # half time window size
    t = arange(-w_sz, w_sz + 1, dtype=float) / sampling_rate
    w = (exp(-t ** 2 / (2. * st ** 2)) * exp(2j * pi * f0 * t) /
         sqrt(sqrt(pi) * st * sampling_rate))
    return w
def _wmorlet ( f0 , sd , sampling_rate , ns = 5 ) : st = 1. / ( 2. * pi * sd ) w_sz = float ( int ( ns * st * sampling_rate ) ) t = arange ( - w_sz , w_sz + 1 , dtype = float ) / sampling_rate w = ( exp ( - t ** 2 / ( 2. * st ** 2 ) ) * exp ( 2j * pi * f0 * t ) / sqrt ( sqrt ( pi ) * st * sampling_rate ) ) return w
adapted from nitime

    returns a complex morlet wavelet in the time domain

    Parameters
    ----------
        f0 : center frequency
        sd : standard deviation of frequency
        sampling_rate : samplingrate
        ns : window length in number of standard deviations