How should I scale single trial dspm timecourses (from a label) so they can
be plotted together with the average across trials? Currently, my average
across trials looks good, but the single trials don't seem to match the
average, so I assume I am scaling the single trials wrong. Here's the
plotting code snippet:
#https://gist.github.com/dengemann/9470121
times = epochs_ica.times * 1e3
def xfun(x, times):
x = np.abs(x).mean(0)
baseline = times < 0
x -= x[baseline].mean(0)[None]
x /= x[baseline].std(0)[None]
return x
for i in range(np.shape(stcs_LR)[0]):
time_course2 = xfun(stcs_LR[i].in_label(label).data, times)
plt.plot(times, time_course2)
plt.xlabel('Time (ms)')
I am unsure if this is a scaling problem. Remember the dSPM is
essentially an F test against the noise. The brain is very busy all
the time, so your SNR is pretty low, because you are only interested
in the activity relative to your task, while all that other brain
activity is going on in the single trial data. Averaging dramatically
improves the SNR.
Short version: If you are use the dSPM, I expect the single trial to
look very poor (especially if you are using prestimulus data for the
noise covariance matrix). It may make more sense to look at single
trial data using the MNE. And if you really must use single trial data
with a dSPM, I recommend using emptyroom data (if this is MEG) instead
of prestimulus data for your noise covariance matrix.
I don't think it would be a problem for a figure to show the average
dSPM and the single trial MNE (with two y axes: the left with the dSPM
score and the right with the MNE amplitudes for the single trial
data).
I feel like the recommendation to use MNE instead of dSPM in single-trial
source solutions has come up on the mailing list more than once, I think,
but the example code distributed with MNE Python still uses dSPM:
It would be great to get a inverse epochs example that reflects the current
thinking in single trial localization, especially one that shows the best
way organize, scale, and display the single trials. Ultimately, I just want
to do some stats between conditions for single subjects or to plot sem
around an average condition waveform for a subject, so including that kind
of thing would be even better.
Here, the single trial dSPM and the evoked dSPM are shown from the same
label (pooled across vertices of the label).. I have used the same inverse
operator for the two (i.e., scaled the noise-cov identically).. Not sure
if this is representative of "current thinking" but nonetheless something
I look at for exploratory purposes when I want to view single trials..