def cwt_morlet(X, sfreq, freqs, use_fft=True, n_cycles=7.0, zero_mean=False,
               decim=1):
    mode = 'same'
    # mode = "valid"
    n_signals, n_times = X[:, ::decim].shape

    # Precompute wavelets for given frequency range to save time
    Ws = morlet(sfreq, freqs, n_cycles=n_cycles, zero_mean=zero_mean)

    coefs = cwt(X, Ws, use_fft=use_fft, mode=mode, decim=decim)

    tfrs = np.empty((n_signals, len(freqs), n_times), dtype=np.complex)
    for k, tfr in enumerate(coefs):
        tfrs[k] = tfr

    return tfrs
Compute time freq decomposition with Morlet wavelets
dataset/ETHPy150Open mne-tools/mne-python/mne/time_frequency/tfr.py/cwt_morlet