[Mne_analysis] single trial dSPM plots

Matt Erhart merhart at ucsd.edu
Mon Apr 21 15:08:20 EDT 2014
Search archives:

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:

...
#left/right tones
stcs_RL = apply_inverse_epochs(epochs_ica['RL'], inverse_operator, lambda2,
method,
                            pick_ori="normal")

#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

mean_stc2 = sum(stcs_LR[:])
mean_stc2._data /= len(stcs_LR[:])

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)')

mean_timecourse = xfun(mean_stc2.in_label(label).data, times)
plt.plot(times,mean_timecourse.T,linewidth=5)

<http://imgur.com/sJHzdIb>
Here's a image of the single trials under the average across
trials.<http://imgur.com/sJHzdIb>They don't seem to match up but the
average is what I would expect.

If there was a gist around somewhere that shows how to plot single trials
from a label and the average together correctly, that'd be great.

thanks,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20140421/f92cae25/attachment.html 


More information about the Mne_analysis mailing list