code: def morlet(freq, s_freq, ratio=5, sigma_f=None, dur_in_sd=4, dur_in_s=None,
             normalization='peak', zero_mean=False):
      if sigma_f is None:
          sigma_f = freq / ratio
      else:
          ratio = freq / sigma_f
      sigma_t = 1 / (2 * pi * sigma_f)
      if ratio < 5 and not zero_mean:
          lg.info('The wavelet won\'t have zero mean, set zero_mean=True to '
                  'correct it')
      if dur_in_s is None:
          dur_in_s = sigma_t * dur_in_sd * 2
      t = arange(-dur_in_s / 2, dur_in_s / 2, 1 / s_freq)
      w = exp(1j * 2 * pi * freq * t)
      if zero_mean:
          w -= exp(-1 / 2 * ratio ** 2)
      w *= exp(-t ** 2 / (2 * sigma_t ** 2))
      if normalization == 'area':
          w /= sqrt(sqrt(pi) * sigma_t * s_freq)
      elif normalization == 'max':
          w /= 2 * sigma_t * sqrt(2 * pi) / s_freq
      elif normalization == 'peak':
          pass
      lg.info('At freq {0: 9.3f}Hz, sigma_f={1: 9.3f}Hz, sigma_t={2: 9.3f}s, '
              'total duration={3: 9.3f}s'.format(freq, sigma_f, sigma_t,
                                                 dur_in_s))
      lg.debug('    Real peak={0: 9.3f}, Mean={1: 12.6f}, '
               'Energy={2: 9.3f}'.format(max(real(w)), mean(w), norm(w) ** 2))
      return w