feature_extractors.py 603 B

12345678910111213141516
  1. from mne.time_frequency import tfr_array_morlet
  2. def filterbank_extractor(data, sfreq, filter_banks, reshape_freqs_dim=False):
  3. n_cycles = filter_banks / 4
  4. power = tfr_array_morlet(data[None],
  5. sfreq=sfreq,
  6. freqs=filter_banks,
  7. n_cycles=n_cycles,
  8. output='avg_power',
  9. verbose=False)
  10. # (n_ch, n_freqs, n_times)
  11. # remove power line noise, * f to normalize
  12. if reshape_freqs_dim:
  13. power = power.reshape((-1, power.shape[-1]))
  14. return power