To follow up on this… I plan on applying baseline correction to a hilbert transformed data.
- Apply hilbert transform
hilbert_raw=raw_tmp.apply_hilbert()
- Epoch the data
epochs = mne.Epochs(raw=hilbert_raw, events=events, tmin=-2.0, tmax=1.0, event_id=event_dict,
baseline=None, preload=True)
- Average the epochs as I want to apply baseline correction to averaged data
epochs_averaged = epochs.average()
epochs_baseline_corrected=epochs_averaged.apply_function(fun=mne.baseline.rescale,times=epochs.times,baseline=(-2.0, 0),mode='zscore')
- I need to plot a spectrogram for this baseline corrected data. The matplotlib library uses this function pcolormesh – how do I extract frequencies (n_freqs) to be used for pcolormesh? For the hilbert transform function, I dont see any returns as n_freqs (unlike pwelch ).
plt.pcolormesh(times, freq, data, shading='auto')
plt.rcParams['pcolor.shading'] ='nearest'
plt.ylabel('Frequency [Hz]')
plt.xlabel('Time [sec]')
plt.pcolormesh(times,freq,data)