daily pastebin goal
90%
SHARE
TWEET

Untitled

a guest Sep 14th, 2018 196 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. """
  2. Spindles-like Morlet wavelet.
  3. Useful for automatic spindles detection.
  4. ---
  5. Author: Raphael Vallat <raphaelvallat9@gmail.com>
  6. Date: September 14, 2018
  7. """
  8. import numpy as np
  9. import matplotlib.pyplot as plt
  10. from mne.time_frequency import morlet
  11.  
  12. # Parameters
  13. sf = 100    # Sampling rate of the signal
  14. cf = 13.5   # Central spindles frequency
  15. nc = 12     # Number of cycles in the spindles
  16.  
  17. # Compute the wavelet and its envelope
  18. wlt = morlet(sf, [cf], n_cycles=nc, zero_mean=True)[0]
  19. wlt_env = np.abs(wlt)
  20.  
  21. # Plot
  22. t = np.arange(wlt.size) / sf
  23. plt.plot(t, wlt)
  24. plt.plot(t, wlt_env, 'k')
  25. plt.xlabel('Time (seconds)')
  26. plt.ylabel('Amplitude')
  27. plt.show()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top