quick way to get lateralisation

hello,

potentially a stupid question, but I don’t think there’s a current implementation in mne for this. Is there a quick way of subtracting activity in one hemisphere from the other, per time point? e.g. after this, PO8 wouldn’t be PO8, but would be PO8-PO7, and vice versa.

the tl;dr is that currently im just making a duplicate object, reordering channels, subtracting their data objects and reassigning, but not sure if this is the best

tfr = mne.time_frequency.read_tfrs(fname); tfr = tfr[0] #it reads in a list of tfr objects idk why
tmp  = tfr.copy()

chs = [ ... ] # long list of channel names
chs_flipped = [ ... ] #manually reorder to have it flipped around z-line

tmp = tmp.copy().reorder_channels(chs_flipped)
tmp2 = np.subtract(tfr.copy().data, tmp.copy().data)

tf_flipped = tfr.copy() #creates EpochsTFR object with original info
tf_flipped.data = tmp2 #assign subtracted data

it’s possibly the best to be done at the moment, but wasn’t sure if there was a less cumbersome way of doing it

thanks!

Hi, you can use the bipolar referencing feature to create new virtual channels that are formed by subtracting the signals of two existing channels.

Here’s an example I quickly cooked up:

# %%
import mne

# Load the data
ssvep_folder = mne.datasets.ssvep.data_path()
ssvep_data_raw_path = (
    ssvep_folder / "sub-02" / "ses-01" / "eeg" / "sub-02_ses-01_task-ssvep_eeg.vhdr"
)
raw = mne.io.read_raw_brainvision(ssvep_data_raw_path, preload=True)
raw.set_montage("easycap-M1")

# %%
# Split channel names into Left, Right, Midline
channel_selection = mne.channels.make_1020_channel_selections(
    info=raw.info, return_ch_names=True
)

# %%
# Perform the subtraction
raw_reref = mne.set_bipolar_reference(
    raw,
    anode=channel_selection["Left"],
    cathode=channel_selection["Right"],
)

# %%
# Visualize results
raw_reref.plot()

We also have a somewhat related example, which you can find at Using contralateral referencing for EEG — MNE 1.5.1 documentation

Best wishes,
Richard

1 Like