ECoG CSP pattern plot

In our pilot experiment we did not include any information about the ECoG location, so once we have generated the CSP patterns we can’t plot it using the plot_patterns function.

The ECoG is a 7x4 array, is there a way to plot the activations on a grid somehow manually?

So the code is really simple

info = mne.create_info(ch_names, ch_types='ecog', sfreq=sf)

csp = CSP(n_components=4, reg=None, log=True, norm_trace=False), y)

csp.plot_filters(info, ch_type='ecog', units='Patterns (AU)')

Hello @mangoez and welcome to the forum!

I’m tagging @alexrockhill and @adam2392 who’ve worked with intracranial EEG data in the past.

Best wishes,

1 Like

The plot_filters function takes a montage as fas a I know so you could either define your own montage and assign it to the info as a rectangle in the general position of the grid, you’d still have the head outline in this case, or, if you didnt want the head outline, which is not officially supported, you could take the weights from the CSP, plot your rectangle of points and handle your own image interpolation with matplotlib. Hope that helps!

1 Like

Thanks Alex!

So once you have fitted CSP:


To get the patterns. And then use the first n rows as the patterns as per n_components?

That sounds very reasonable, I would compare it to what you get if you assign a rectangle and plot on the head with the built-in function to be sure.