[pymvpa] Searchlight Permutation Testing with Monte Carlo Selection

Jessica Goold jessi.goold at gmail.com
Wed Jan 31 20:44:28 UTC 2018


Hi All,

Thanks in advance for the help.

I am trying to create a monte carlo permutation distribution to test my
group searchlight against, but am worried that I set it up wrong and am
also not sure where to go from here.

Currently, I have 40 subjects with 15 permuted searchlights per subject as
well as the actual searchlights which I want to test against the permuted
distribution all saved as nifti files. I just created different permuted
attribute files and did each permuted searchlight one by one across 3
computers in the lab to try to speed up the process, but now I'm not sure
how to recombine everything and do the actual monte carlo distribution.

What I've found online in the PyMVPA manual has the permutator and
estimator within the cross validation script so I'm worried I may need to
redo everything which will take another month or longer to do on one
computer in my lab.

Long story short, is there a way to create a monte carlo distribution with
searchlights that have already been created and what's the best way to do
this?

Here is the code I used for one permuted searchlight, I'm also worried I
didn't save all the information I needed, can someone let me know if that
is the case?

Thank you,
Jessica

#source /opt/rh/python27/enable
from mvpa2.suite import *
import numpy as np
import scipy.stats as sp
import scipy.io
import nibabel
import random

subjects =
[.....'20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','36','37','38','39','40','41','42','43']
path = '/Users/Desktop/SearchlightPermutation/'

for sub in subjects:
verbose(1,'processing subject: %s'%sub)
#load dataset
attr = SampleAttributes(os.path.join(path, 'Attributes11thIt.txt'))
fds = fmri_dataset(samples=os.path.join(path,
'Beta_allStim_sub%s.nii'%sub), targets = attr.targets, chunks=attr.chunks,
mask = os.path.join(path, 'mask_anat.sub%s.nii'%sub))
    #zscore detrended data
zscore(fds, chunks_attr=None)
    #set up classifier
clf = LinearCSVMC()
cvte = CrossValidation(clf, NFoldPartitioner(), errorfx=lambda p, t:
np.mean(p == t), enable_ca=['stats'])
sl = sphere_searchlight(cvte, radius=3, space='voxel_indices',
postproc=mean_sample(), nproc=8)
res = sl(fds)
    #save searchlight
niftiresults = map2nifti(fds,
res.samples).to_filename('searchlight_allcond_sub%s_it11.nii'%sub)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20180131/d7633eec/attachment.html>


More information about the Pkg-ExpPsy-PyMVPA mailing list