def Morlet (sampr, freq, width=7.0):
  """ Morlet's wavelet for frequency f and time t
      Wavelet normalized so total energy is 1
      freq: specific frequency (Hz)
      width: number of cycles for the Morlet wavelet
      output returned: final units are 1/s
  """
  dt = 1. / sampr
  sf = freq / width # sf in Hz
  st = 1. / (2. * np.pi * sf) # st in s
  t = np.arange(-3.5*st, 3.5*st, dt)
  A = 1. / (st * np.sqrt(2.*np.pi)) # A in 1 / s
  # units: 1/s * (exp (s**2 / s**2)) * exp( 1/ s * s)
  return A * np.exp(-t**2. / (2. * st**2.)) * np.exp(1.j * 2. * np.pi * freq * t)