I'm working with group data that's been preprocessed in MNE then grand averaged into a numpy array and am interested in using some of the plotting methods available, however none seem to take plain numpy array data. Is there any way to copy over relevant information from say an individual's object (like times, channel listings etc) and "wrap" it to the array?
Thanks and my apologies if this is a relatively simple question.
Here's some sample code that grand-averages stc files from one hemisphere
(I imagine it should work the same for e.g. evoked sensor data; I haven't
tried it for this, though; also note that here my stc files are all morphed
to fsaverage, hence the last line):
# path to data
stcdir = <path to where stc files are saved>
# participant list
participants = <list of participant IDs>
# template for the filenames
fname = os.path.join( stcdir, '%s-' + '-lh.stc' )
# read all subjects' stc files into a big list of stc files
stcs = [mne.read_source_estimate(fname % subject) for subject in
participants]
# average (by summing the stcs and then dividing by the number of subjects
stc_avg = reduce(add, stcs)
stc_avg /= len(stcs)
stc_avg.subject = 'fsaverage'
The output of this can then be plotted the same way as a single-participant
stc could be.
I believe that they're working on this, but it's not in an official
release. If you check out the repository on github, there's some code in
mne.io.array that should work (more or less), but it's not fully vetted yet
so might be a bit buggy...
Are the averaged data time courses from vertices on the template
(fsaverage) brain? If so, you could do:
mne.SourceEstimate to create an stc object in Python. However, you would
need to know what type of source space was used to create the MNE (or at
least which version of the fsaverage brain the data were projected to).