How to get the phase of alpha over time?

Hello,

I hope everyone is well!
I am looking for some pointers on how to start phase analysis.
My goal is to get the phase of alpha at each time point of a trial.
Is there a way to extract this using mne?

Many thanks!

Ana P

@anapesq - For phase connnectivity analysis look into PLI and wPLI. If you are just looking for the phase, you can do the following inspired by the scipy page:
https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.hilbert.html

#raw.resample(50) - uncomment to make it faster
raw.filter(8,12)  #Extract the alpha
raw.apply_hilbert()

epochs = mne.Epochs(raw, events)
epochs.load_data()
phase_mat = np.array([np.angle(epoch.data) for epoch in epochs])
#Have to remake the epochs because the numbers are no longer complex
phase_epochs = mne.EpochsArray(phase_mat, epochs.info)  

phase_epochs.plot(scalings=dict(mag=1))

This is channel level, but you can do similar for the source level activity.

-Jeff

4 Likes

@jstout211 Thank you so much for your answer!