Trying Searchlight


In [1]:
%matplotlib inline

In [2]:
from nipype.interfaces import afni as afni

import numpy as np
import pandas as pd
import os as os
import re as re
import glob as glob
import nibabel as nibabel
from mvpa2.tutorial_suite import *

In [3]:
### SET Working directory
% cd /Volumes/group/iang/biac3/gotlib7/data/PARC/testingGround/PARC_mvpa/


/Volumes/group/iang/biac3/gotlib7/data/PARC/testingGround/PARC_mvpa

In [4]:



BADALIGN_PARC_sub_2736.LSSbetas.BLOCK6.study.uber.nii* PARC_sub_2874_fs_brain.subj.nii.gz*
PARC_sub_2699.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2874_study_timingdata.csv*
PARC_sub_2699.LSSbetas.GAM.test.uber.nii*              PARC_sub_2874_test_timingdata.csv*
PARC_sub_2699.labelVolume.nii.gz*                      PARC_sub_2879.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2699.mean_func.r02.nii.gz*                    PARC_sub_2879.LSSbetas.GAM.test.uber.nii*
PARC_sub_2699.parafusi.nii*                            PARC_sub_2879.labelVolume.nii.gz*
PARC_sub_2699_FSPGR_1.nii.gz*                          PARC_sub_2879.mean_func.r02.nii.gz*
PARC_sub_2699_fs_brain.subj.nii.gz*                    PARC_sub_2879.parafusi.nii*

PARC_sub_2699_test_timingdata.csv*                     PARC_sub_2879_fs_brain.subj.nii.gz*
PARC_sub_2718.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2879_study_timingdata.csv*
PARC_sub_2718.LSSbetas.GAM.test.uber.nii*              PARC_sub_2879_test_timingdata.csv*
PARC_sub_2718.labelVolume.nii.gz*                      PARC_sub_2885.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2718.mean_func.r02.nii.gz*                    PARC_sub_2885.LSSbetas.GAM.test.uber.nii*
PARC_sub_2718.parafusi.nii*                            PARC_sub_2885.labelVolume.nii.gz*
PARC_sub_2718_FSPGR_1.nii.gz*                          PARC_sub_2885.mean_func.r02.nii.gz*
PARC_sub_2718_fs_brain.subj.nii.gz*                    PARC_sub_2885.parafusi.nii*
PARC_sub_2718_study_timingdata.csv*                    PARC_sub_2885_FSPGR_1.nii.gz*
PARC_sub_2718_test_timingdata.csv*                     PARC_sub_2885_fs_brain.subj.nii.gz*
PARC_sub_2726.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2885_study_timingdata.csv*
PARC_sub_2726.LSSbetas.GAM.test.uber.nii*              PARC_sub_2885_test_timingdata.csv*
PARC_sub_2726.labelVolume.nii.gz*                      PARC_sub_2903.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2726.mean_func.r02.nii.gz*                    PARC_sub_2903.LSSbetas.GAM.test.uber.nii*
PARC_sub_2726.parafusi.nii*                            PARC_sub_2903.labelVolume.nii.gz*
PARC_sub_2726_FSPGR_1.nii.gz*                          PARC_sub_2903.mean_func.r02.nii.gz*
PARC_sub_2726_fs_brain.subj.nii.gz*                    PARC_sub_2903.parafusi.nii*
PARC_sub_2726_study_timingdata.csv*                    PARC_sub_2903_FSPGR_1.nii.gz*
PARC_sub_2726_test_timingdata.csv*                     PARC_sub_2903_fs_brain.subj.nii.gz*
PARC_sub_2736.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2903_study_timingdata.csv*
PARC_sub_2736.LSSbetas.GAM.test.uber.nii*              PARC_sub_2903_test_timingdata.csv*
PARC_sub_2736.labelVolume.nii.gz*                      PARC_sub_2908_FSPGR_1.nii.gz*
PARC_sub_2736.mean_func.r02.nii.gz*                    PARC_sub_2908_study_timingdata.csv*
PARC_sub_2736.parafusi.nii*                            PARC_sub_2908_test_timingdata.csv*
PARC_sub_2736_FSPGR_1.nii.gz*                          PARC_sub_2917.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2736_fs_brain.subj.nii.gz*                    PARC_sub_2917.LSSbetas.GAM.test.uber.nii*
PARC_sub_2736_study_timingdata.csv*                    PARC_sub_2917.labelVolume.nii.gz*
PARC_sub_2736_test_timingdata.csv*                     PARC_sub_2917.mean_func.r02.nii.gz*
PARC_sub_2747.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2917.parafusi.nii*
PARC_sub_2747.LSSbetas.GAM.test.uber.nii*              PARC_sub_2917_FSPGR_1.nii.gz*
PARC_sub_2747.labelVolume.nii.gz*                      PARC_sub_2917_fs_brain.subj.nii.gz*
PARC_sub_2747.mean_func.r02.nii.gz*                    PARC_sub_2917_study_timingdata.csv*
PARC_sub_2747.parafusi.nii*                            PARC_sub_2917_test_timingdata.csv*
PARC_sub_2747_FSPGR_1.nii.gz*                          PARC_sub_2927.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2747_fs_brain.subj.nii.gz*                    PARC_sub_2927.LSSbetas.GAM.test.uber.nii*
PARC_sub_2747_study_timingdata.csv*                    PARC_sub_2927.labelVolume.nii.gz*
PARC_sub_2747_test_timingdata.csv*                     PARC_sub_2927.mean_func.r02.nii.gz*
PARC_sub_2754.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2927.parafusi.nii*
PARC_sub_2754.LSSbetas.GAM.test.uber.nii*              PARC_sub_2927_FSPGR_1.nii.gz*
PARC_sub_2754.labelVolume.nii.gz*                      PARC_sub_2927_fs_brain.subj.nii.gz*
PARC_sub_2754.mean_func.r02.nii.gz*                    PARC_sub_2927_study_timingdata.csv*
PARC_sub_2754.parafusi.nii*                            PARC_sub_2927_test_timingdata.csv*
PARC_sub_2754_FSPGR_1.nii.gz*                          PARC_sub_2938.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2754_fs_brain.subj.nii.gz*                    PARC_sub_2938.LSSbetas.GAM.test.uber.nii*
PARC_sub_2754_study_timingdata.csv*                    PARC_sub_2938.labelVolume.nii.gz*
PARC_sub_2754_test_timingdata.csv*                     PARC_sub_2938.mean_func.r02.nii.gz*
PARC_sub_2759.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2938.parafusi.nii*
PARC_sub_2759.LSSbetas.GAM.test.uber.nii*              PARC_sub_2938_FSPGR_1.nii.gz*
PARC_sub_2759.labelVolume.nii.gz*                      PARC_sub_2938_fs_brain.subj.nii.gz*
PARC_sub_2759.mean_func.r02.nii.gz*                    PARC_sub_2938_study_timingdata.csv*
PARC_sub_2759.parafusi.nii*                            PARC_sub_2938_test_timingdata.csv*
PARC_sub_2759_FSPGR_1.nii.gz*                          PARC_sub_2939.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2759_fs_brain.subj.nii.gz*                    PARC_sub_2939.LSSbetas.GAM.test.uber.nii*
PARC_sub_2759_study_timingdata.csv*                    PARC_sub_2939.labelVolume.nii.gz*
PARC_sub_2759_test_timingdata.csv*                     PARC_sub_2939.mean_func.r02.nii.gz*
PARC_sub_2761.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2939.parafusi.nii*
PARC_sub_2761.LSSbetas.GAM.test.uber.nii*              PARC_sub_2939_FSPGR_1.nii.gz*
PARC_sub_2761.labelVolume.nii.gz*                      PARC_sub_2939_fs_brain.subj.nii.gz*
PARC_sub_2761.mean_func.r02.nii.gz*                    PARC_sub_2939_study_timingdata.csv*
PARC_sub_2761.parafusi.nii*                            PARC_sub_2939_test_timingdata.csv*
PARC_sub_2761_FSPGR_1.nii.gz*                          PARC_sub_2945.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2761_fs_brain.subj.nii.gz*                    PARC_sub_2945.LSSbetas.GAM.test.uber.nii*
PARC_sub_2761_study_timingdata.csv*                    PARC_sub_2945.labelVolume.nii.gz*
PARC_sub_2761_test_timingdata.csv*                     PARC_sub_2945.mean_func.r02.nii.gz*
PARC_sub_2778.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2945.parafusi.nii*
PARC_sub_2778.LSSbetas.GAM.test.uber.nii*              PARC_sub_2945_FSPGR_1.nii.gz*
PARC_sub_2778.labelVolume.nii.gz*                      PARC_sub_2945_fs_brain.subj.nii.gz*
PARC_sub_2778.mean_func.r02.nii.gz*                    PARC_sub_2945_study_timingdata.csv*
PARC_sub_2778.parafusi.nii*                            PARC_sub_2945_test_timingdata.csv*
PARC_sub_2778_FSPGR_1.nii.gz*                          PARC_sub_2955.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2778_fs_brain.subj.nii.gz*                    PARC_sub_2955.LSSbetas.GAM.test.uber.nii*
PARC_sub_2778_study_timingdata.csv*                    PARC_sub_2955.labelVolume.nii.gz*
PARC_sub_2778_test_timingdata.csv*                     PARC_sub_2955.mean_func.r02.nii.gz*
PARC_sub_2784.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2955.parafusi.nii*
PARC_sub_2784.LSSbetas.GAM.test.uber.nii*              PARC_sub_2955_FSPGR_1.nii.gz*
PARC_sub_2784.labelVolume.nii.gz*                      PARC_sub_2955_fs_brain.subj.nii.gz*
PARC_sub_2784.mean_func.r02.nii.gz*                    PARC_sub_2955_study_timingdata.csv*
PARC_sub_2784.parafusi.nii*                            PARC_sub_2955_test_timingdata.csv*
PARC_sub_2784_FSPGR_1.nii.gz*                          PARC_sub_2956.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2784_fs_brain.subj.nii.gz*                    PARC_sub_2956.LSSbetas.GAM.test.uber.nii*
PARC_sub_2784_study_timingdata.csv*                    PARC_sub_2956.labelVolume.nii.gz*
PARC_sub_2784_test_timingdata.csv*                     PARC_sub_2956.mean_func.r02.nii.gz*
PARC_sub_2786.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2956.parafusi.nii*
PARC_sub_2786.LSSbetas.GAM.test.uber.nii*              PARC_sub_2956_FSPGR_1.nii.gz*
PARC_sub_2786.labelVolume.nii.gz*                      PARC_sub_2956_fs_brain.subj.nii.gz*
PARC_sub_2786.mean_func.r02.nii.gz*                    PARC_sub_2956_study_timingdata.csv*
PARC_sub_2786.parafusi.nii*                            PARC_sub_2956_test_timingdata.csv*
PARC_sub_2786_FSPGR_1.nii.gz*                          PARC_sub_2958.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2786_fs_brain.subj.nii.gz*                    PARC_sub_2958.LSSbetas.GAM.test.uber.nii*
PARC_sub_2786_study_timingdata.csv*                    PARC_sub_2958.labelVolume.nii.gz*
PARC_sub_2786_test_timingdata.csv*                     PARC_sub_2958.mean_func.r02.nii.gz*
PARC_sub_2787.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2958.parafusi.nii*
PARC_sub_2787.LSSbetas.GAM.test.uber.nii*              PARC_sub_2958_FSPGR_1.nii.gz*
PARC_sub_2787.labelVolume.nii.gz*                      PARC_sub_2958_fs_brain.subj.nii.gz*
PARC_sub_2787.mean_func.r02.nii.gz*                    PARC_sub_2958_study_timingdata.csv*
PARC_sub_2787.parafusi.nii*                            PARC_sub_2958_test_timingdata.csv*
PARC_sub_2787_FSPGR_1.nii.gz*                          PARC_sub_2967.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2787_fs_brain.subj.nii.gz*                    PARC_sub_2967.LSSbetas.GAM.test.uber.nii*
PARC_sub_2787_study_timingdata.csv*                    PARC_sub_2967.labelVolume.nii.gz*
PARC_sub_2787_test_timingdata.csv*                     PARC_sub_2967.mean_func.r02.nii.gz*
PARC_sub_2788.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2967.parafusi.nii*
PARC_sub_2788.LSSbetas.GAM.test.uber.nii*              PARC_sub_2967_FSPGR_1.nii.gz*
PARC_sub_2788.labelVolume.nii.gz*                      PARC_sub_2967_fs_brain.subj.nii.gz*
PARC_sub_2788.mean_func.r02.nii.gz*                    PARC_sub_2967_study_timingdata.csv*
PARC_sub_2788.parafusi.nii*                            PARC_sub_2967_test_timingdata.csv*
PARC_sub_2788_FSPGR_1.nii.gz*                          PARC_sub_2987.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2788_fs_brain.subj.nii.gz*                    PARC_sub_2987.LSSbetas.GAM.test.uber.nii*
PARC_sub_2788_study_timingdata.csv*                    PARC_sub_2987.labelVolume.nii.gz*
PARC_sub_2788_test_timingdata.csv*                     PARC_sub_2987.mean_func.r02.nii.gz*
PARC_sub_2792.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2987.parafusi.nii*
PARC_sub_2792.LSSbetas.GAM.test.uber.nii*              PARC_sub_2987_FSPGR_1.nii.gz*
PARC_sub_2792.labelVolume.nii.gz*                      PARC_sub_2987_fs_brain.subj.nii.gz*
PARC_sub_2792.mean_func.r02.nii.gz*                    PARC_sub_2987_study_timingdata.csv*
PARC_sub_2792.parafusi.nii*                            PARC_sub_2987_test_timingdata.csv*
PARC_sub_2792_FSPGR_1.nii.gz*                          PARC_sub_2993.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2792_fs_brain.subj.nii.gz*                    PARC_sub_2993.LSSbetas.GAM.test.uber.nii*
PARC_sub_2792_study_timingdata.csv*                    PARC_sub_2993.labelVolume.nii.gz*
PARC_sub_2792_test_timingdata.csv*                     PARC_sub_2993.mean_func.r02.nii.gz*
PARC_sub_2796.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_2993.parafusi.nii*
PARC_sub_2796.LSSbetas.GAM.test.uber.nii*              PARC_sub_2993_FSPGR_1.nii.gz*
PARC_sub_2796.labelVolume.nii.gz*                      PARC_sub_2993_fs_brain.subj.nii.gz*
PARC_sub_2796.mean_func.r02.nii.gz*                    PARC_sub_2993_study_timingdata.csv*
PARC_sub_2796.parafusi.nii*                            PARC_sub_2993_test_timingdata.csv*
PARC_sub_2796_FSPGR_1.nii.gz*                          PARC_sub_3010.LSSbetas.BLOCK6.study.uber.nii*
PARC_sub_2796_fs_brain.subj.nii.gz*                    PARC_sub_3010.LSSbetas.GAM.test.uber.nii*
PARC_sub_2796_study_timingdata.csv*                    PARC_sub_3010.labelVolume.nii.gz*
PARC_sub_2796_test_timingdata.csv*                     PARC_sub_3010.mean_func.r02.nii.gz*
PARC_sub_2799.LSSbetas.BLOCK6.study.uber.nii*          PARC_sub_3010.parafusi.nii*
PARC_sub_2799.LSSbetas.GAM.test.uber.nii*              PARC_sub_3010_FSPGR_1.nii.gz*
PARC_sub_2799.labelVolume.nii.gz*                      PARC_sub_3010_fs_brain.subj.nii.gz*
PARC_sub_2799.mean_func.r02.nii.gz*                    PARC_sub_3010_study_timingdata.csv*
PARC_sub_2799.parafusi.nii*                            PARC_sub_3010_test_timingdata.csv*
PARC_sub_2799_FSPGR_1.nii.gz*                          pb02.PARC_sub_2699.r02.volreg+orig.BRIK*
PARC_sub_2799_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2699.r02.volreg+orig.HEAD*
PARC_sub_2799_study_timingdata.csv*                    pb02.PARC_sub_2718.r02.volreg+orig.BRIK*
PARC_sub_2799_test_timingdata.csv*                     pb02.PARC_sub_2718.r02.volreg+orig.HEAD*
PARC_sub_2825.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2726.r02.volreg+orig.BRIK*
PARC_sub_2825.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2726.r02.volreg+orig.HEAD*
PARC_sub_2825.labelVolume.nii.gz*                      pb02.PARC_sub_2736.r02.volreg+orig.BRIK*
PARC_sub_2825.mean_func.r02.nii.gz*                    pb02.PARC_sub_2736.r02.volreg+orig.HEAD*
PARC_sub_2825.parafusi.nii*                            pb02.PARC_sub_2747.r02.volreg+orig.BRIK*
PARC_sub_2825_FSPGR_1.nii.gz*                          pb02.PARC_sub_2747.r02.volreg+orig.HEAD*
PARC_sub_2825_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2754.r02.volreg+orig.BRIK*
PARC_sub_2825_study_timingdata.csv*                    pb02.PARC_sub_2754.r02.volreg+orig.HEAD*
PARC_sub_2825_test_timingdata.csv*                     pb02.PARC_sub_2759.r02.volreg+orig.BRIK*
PARC_sub_2829.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2759.r02.volreg+orig.HEAD*
PARC_sub_2829.labelVolume.nii.gz*                      pb02.PARC_sub_2761.r02.volreg+orig.BRIK*
PARC_sub_2829.mean_func.r02.nii.gz*                    pb02.PARC_sub_2761.r02.volreg+orig.HEAD*
PARC_sub_2829.parafusi.nii*                            pb02.PARC_sub_2778.r02.volreg+orig.BRIK*
PARC_sub_2829_FSPGR_1.nii.gz*                          pb02.PARC_sub_2778.r02.volreg+orig.HEAD*
PARC_sub_2829_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2784.r02.volreg+orig.BRIK*
PARC_sub_2829_study_timingdata.csv*                    pb02.PARC_sub_2784.r02.volreg+orig.HEAD*
PARC_sub_2829_test_timingdata.csv*                     pb02.PARC_sub_2786.r02.volreg+orig.BRIK*
PARC_sub_2834.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2786.r02.volreg+orig.HEAD*
PARC_sub_2834.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2787.r02.volreg+orig.BRIK*
PARC_sub_2834.labelVolume.nii.gz*                      pb02.PARC_sub_2787.r02.volreg+orig.HEAD*
PARC_sub_2834.mean_func.r02.nii.gz*                    pb02.PARC_sub_2788.r02.volreg+orig.BRIK*
PARC_sub_2834.parafusi.nii*                            pb02.PARC_sub_2788.r02.volreg+orig.HEAD*
PARC_sub_2834_FSPGR_1.nii.gz*                          pb02.PARC_sub_2792.r02.volreg+orig.BRIK*
PARC_sub_2834_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2792.r02.volreg+orig.HEAD*
PARC_sub_2834_study_timingdata.csv*                    pb02.PARC_sub_2796.r02.volreg+orig.BRIK*
PARC_sub_2834_test_timingdata.csv*                     pb02.PARC_sub_2796.r02.volreg+orig.HEAD*
PARC_sub_2838.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2799.r02.volreg+orig.BRIK*
PARC_sub_2838.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2799.r02.volreg+orig.HEAD*
PARC_sub_2838.labelVolume.nii.gz*                      pb02.PARC_sub_2825.r02.volreg+orig.BRIK*
PARC_sub_2838.mean_func.r02.nii.gz*                    pb02.PARC_sub_2825.r02.volreg+orig.HEAD*
PARC_sub_2838.parafusi.nii*                            pb02.PARC_sub_2829.r02.volreg+orig.BRIK*
PARC_sub_2838_FSPGR_1.nii.gz*                          pb02.PARC_sub_2829.r02.volreg+orig.HEAD*
PARC_sub_2838_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2834.r02.volreg+orig.BRIK*
PARC_sub_2838_study_timingdata.csv*                    pb02.PARC_sub_2834.r02.volreg+orig.HEAD*
PARC_sub_2838_test_timingdata.csv*                     pb02.PARC_sub_2838.r02.volreg+orig.BRIK*
PARC_sub_2841.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2838.r02.volreg+orig.HEAD*
PARC_sub_2841.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2841.r02.volreg+orig.BRIK*
PARC_sub_2841.labelVolume.nii.gz*                      pb02.PARC_sub_2841.r02.volreg+orig.HEAD*
PARC_sub_2841.mean_func.r02.nii.gz*                    pb02.PARC_sub_2848.r02.volreg+orig.BRIK*
PARC_sub_2841.parafusi.nii*                            pb02.PARC_sub_2848.r02.volreg+orig.HEAD*
PARC_sub_2841_FSPGR_1.nii.gz*                          pb02.PARC_sub_2853.r02.volreg+orig.BRIK*
PARC_sub_2841_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2853.r02.volreg+orig.HEAD*
PARC_sub_2841_study_timingdata.csv*                    pb02.PARC_sub_2865.r02.volreg+orig.BRIK*
PARC_sub_2841_test_timingdata.csv*                     pb02.PARC_sub_2865.r02.volreg+orig.HEAD*
PARC_sub_2848.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2874.r02.volreg+orig.BRIK*
PARC_sub_2848.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2874.r02.volreg+orig.HEAD*
PARC_sub_2848.labelVolume.nii.gz*                      pb02.PARC_sub_2879.r02.volreg+orig.BRIK*
PARC_sub_2848.mean_func.r02.nii.gz*                    pb02.PARC_sub_2879.r02.volreg+orig.HEAD*
PARC_sub_2848.parafusi.nii*                            pb02.PARC_sub_2885.r02.volreg+orig.BRIK*
PARC_sub_2848_FSPGR_1.nii.gz*                          pb02.PARC_sub_2885.r02.volreg+orig.HEAD*
PARC_sub_2848_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2903.r02.volreg+orig.BRIK*
PARC_sub_2848_study_timingdata.csv*                    pb02.PARC_sub_2903.r02.volreg+orig.HEAD*
PARC_sub_2848_test_timingdata.csv*                     pb02.PARC_sub_2917.r02.volreg+orig.BRIK*
PARC_sub_2853.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2917.r02.volreg+orig.HEAD*
PARC_sub_2853.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2927.r02.volreg+orig.BRIK*
PARC_sub_2853.labelVolume.nii.gz*                      pb02.PARC_sub_2927.r02.volreg+orig.HEAD*
PARC_sub_2853.mean_func.r02.nii.gz*                    pb02.PARC_sub_2938.r02.volreg+orig.BRIK*
PARC_sub_2853.parafusi.nii*                            pb02.PARC_sub_2938.r02.volreg+orig.HEAD*
PARC_sub_2853_FSPGR_1.nii.gz*                          pb02.PARC_sub_2939.r02.volreg+orig.BRIK*
PARC_sub_2853_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2939.r02.volreg+orig.HEAD*
PARC_sub_2853_study_timingdata.csv*                    pb02.PARC_sub_2945.r02.volreg+orig.BRIK*
PARC_sub_2853_test_timingdata.csv*                     pb02.PARC_sub_2945.r02.volreg+orig.HEAD*
PARC_sub_2865.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2955.r02.volreg+orig.BRIK*
PARC_sub_2865.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2955.r02.volreg+orig.HEAD*
PARC_sub_2865.labelVolume.nii.gz*                      pb02.PARC_sub_2956.r02.volreg+orig.BRIK*
PARC_sub_2865.mean_func.r02.nii.gz*                    pb02.PARC_sub_2956.r02.volreg+orig.HEAD*
PARC_sub_2865.parafusi.nii*                            pb02.PARC_sub_2958.r02.volreg+orig.BRIK*
PARC_sub_2865_FSPGR_1.nii.gz*                          pb02.PARC_sub_2958.r02.volreg+orig.HEAD*
PARC_sub_2865_fs_brain.subj.nii.gz*                    pb02.PARC_sub_2967.r02.volreg+orig.BRIK*
PARC_sub_2865_study_timingdata.csv*                    pb02.PARC_sub_2967.r02.volreg+orig.HEAD*
PARC_sub_2865_test_timingdata.csv*                     pb02.PARC_sub_2987.r02.volreg+orig.BRIK*
PARC_sub_2874.LSSbetas.BLOCK6.study.uber.nii*          pb02.PARC_sub_2987.r02.volreg+orig.HEAD*
PARC_sub_2874.LSSbetas.GAM.test.uber.nii*              pb02.PARC_sub_2993.r02.volreg+orig.BRIK*
PARC_sub_2874.labelVolume.nii.gz*                      pb02.PARC_sub_2993.r02.volreg+orig.HEAD*
PARC_sub_2874.mean_func.r02.nii.gz*                    pb02.PARC_sub_3010.r02.volreg+orig.BRIK*
PARC_sub_2874.parafusi.nii*                            pb02.PARC_sub_3010.r02.volreg+orig.HEAD*
PARC_sub_2874_FSPGR_1.nii.gz*

In [5]:
study_beta_prefix = 'LSSbetas.BLOCK6.study.uber'
test_beta_prefix = 'LSSbetas.GAM.test.uber'
mask_prefix = 'parafusi'
mask_labels = [1007, 2007, 1016, 2016]
subj = 'PARC_sub_2848'
predDf = pd.DataFrame()
    
    # load behavioral data
study_csv_name = subj + '_study_timingdata.csv'
test_csv_name = subj + '_test_timingdata.csv'
study_data = pd.read_csv(study_csv_name, sep=',')
test_data = pd.read_csv(test_csv_name, sep=',')

# make variables to load neural data
study_labels = list(study_data.imgType)
test_labels = list(test_data.imgType)
trials = np.array(range(1,97))
runs = np.repeat(range(1,7),16, axis= 0)

# load neural data 
print 'loading neural data...' 
study_beta_name = subj + '.' + study_beta_prefix + '.nii'
mask_name = subj + '.' + mask_prefix + '.nii'
# mask_name =  'PARC_sub_2848_wholeMask.nii.g'
test_beta_name = subj + '.' + test_beta_prefix + '.nii'

ds_study = fmri_dataset(samples = study_beta_name, mask = mask_name, chunks= runs, targets=study_labels)
ds_test = fmri_dataset(samples = test_beta_name, mask = mask_name, chunks= runs, targets=test_labels)
zscore(ds_study)
zscore(ds_test)


loading neural data...

In [6]:
### CV TEST

clf = LinearCSVMC(C=-1)
cv = CrossValidation(clf, NFoldPartitioner())

In [7]:
sl = sphere_searchlight(cv, radius=12, postproc=mean_sample())

In [8]:
res = sl(ds_study)

In [9]:
sphere_errors = res.samples[0]
res_mean = np.mean(res)
res_std = np.std(res)

chance_level = 1.0 - (1.0 / len(ds_study.uniquetargets))
frac_lower = np.round(np.mean(sphere_errors < chance_level - 2 * res_std), 3)

In [13]:
frac_lower


Out[13]:
1.0

In [14]:
hist(sphere_errors, bins=np.linspace(0, 1, 18))


Out[14]:
[<matplotlib.axes.AxesSubplot at 0x10f988dd0>]

In [12]:
map2nifti(ds_study, 1.0 - sphere_errors).to_filename('PARC_sub_2848_paraFusi_Searchlight.nii.gz')

In [26]:

now try notebook w/ whole brain


In [16]:
study_beta_prefix = 'LSSbetas.BLOCK6.study.uber'
test_beta_prefix = 'LSSbetas.GAM.test.uber'
mask_prefix = 'parafusi'
mask_labels = [1007, 2007, 1016, 2016]
subj = 'PARC_sub_2848'
predDf = pd.DataFrame()
    
    # load behavioral data
study_csv_name = subj + '_study_timingdata.csv'
test_csv_name = subj + '_test_timingdata.csv'
study_data = pd.read_csv(study_csv_name, sep=',')
test_data = pd.read_csv(test_csv_name, sep=',')

# make variables to load neural data
study_labels = list(study_data.imgType)
test_labels = list(test_data.imgType)
trials = np.array(range(1,97))
runs = np.repeat(range(1,7),16, axis= 0)

# load neural data 
print 'loading neural data...' 
study_beta_name = subj + '.' + study_beta_prefix + '.nii'
mask_name = subj + '.' + mask_prefix + '.nii'
mask_name =  'PARC_sub_2848_anatMask.nii'
test_beta_name = subj + '.' + test_beta_prefix + '.nii'

ds_study = fmri_dataset(samples = study_beta_name, mask = mask_name, chunks= runs, targets=study_labels)
ds_test = fmri_dataset(samples = test_beta_name, mask = mask_name, chunks= runs, targets=test_labels)
zscore(ds_study)
zscore(ds_test)


loading neural data...

In [17]:
clf = LinearCSVMC(C=-1)
cv = CrossValidation(clf, NFoldPartitioner())
sl = sphere_searchlight(cv, radius=12, postproc=mean_sample())

In [21]:
res = sl(ds_study)


---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-21-a5a2b6e1c711> in <module>()
----> 1 res = sl(ds_study)

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/learner.pyc in __call__(self, ds)
    257                                    "used and auto training is disabled."
    258                                    % str(self))
--> 259         return super(Learner, self).__call__(ds)
    260 
    261 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/node.pyc in __call__(self, ds)
    109 
    110         self._precall(ds)
--> 111         result = self._call(ds)
    112         result = self._postcall(ds, result)
    113 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/measures/searchlight.pyc in _call(self, dataset)
    141 
    142         # pass to subclass
--> 143         results = self._sl_call(dataset, roi_ids, nproc)
    144 
    145         if 'mapper' in dataset.a:

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/measures/searchlight.pyc in _sl_call(self, dataset, roi_ids, nproc)
    360             # otherwise collect the results in an 1-item list
    361             p_results = [
--> 362                     self._proc_block(roi_ids, dataset, self.__datameasure)]
    363 
    364         # Finally collect and possibly process results

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/measures/searchlight.pyc in _proc_block(self, block, ds, measure, seed, iblock)
    456 
    457             # compute the datameasure and store in results
--> 458             res = measure(roi)
    459 
    460             if assure_dataset and not is_datasetlike(res):

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/learner.pyc in __call__(self, ds)
    257                                    "used and auto training is disabled."
    258                                    % str(self))
--> 259         return super(Learner, self).__call__(ds)
    260 
    261 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/node.pyc in __call__(self, ds)
    109 
    110         self._precall(ds)
--> 111         result = self._call(ds)
    112         result = self._postcall(ds, result)
    113 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/measures/base.pyc in _call(self, ds)
    495         # always untrain to wipe out previous stats
    496         self.untrain()
--> 497         return super(CrossValidation, self)._call(ds)
    498 
    499 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/measures/base.pyc in _call(self, ds)
    324                 ca.datasets.append(sds)
    325             # run the beast
--> 326             result = node(sds)
    327             # callback
    328             if not self._callback is None:

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/learner.pyc in __call__(self, ds)
    257                                    "used and auto training is disabled."
    258                                    % str(self))
--> 259         return super(Learner, self).__call__(ds)
    260 
    261 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/node.pyc in __call__(self, ds)
    109 
    110         self._precall(ds)
--> 111         result = self._call(ds)
    112         result = self._postcall(ds, result)
    113 

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/measures/base.pyc in _call(self, ds)
    598                     for i in dstrain.get_attr(splitter.get_space())[0].unique])
    599         # ask splitter for first part
--> 600         measure.train(dstrain)
    601         # cleanup to free memory
    602         del dstrain

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/base/learner.pyc in train(self, ds)
    130             # things might have happened during pretraining
    131             if ds.nfeatures > 0:
--> 132                 result = self._train(ds)
    133             else:
    134                 warning("Trying to train on dataset with no features present")

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/clfs/libsvmc/svm.pyc in _train(self, dataset)
    182 
    183         try:
--> 184             self.__model = _svm.SVMModel(svmprob, libsvm_param)
    185         except Exception, e:
    186             raise FailedToTrainError(str(e))

/Users/Jim/anaconda/lib/python2.7/site-packages/mvpa2/clfs/libsvmc/_svm.pyc in __init__(self, arg1, arg2)
    275             if msg:
    276                 raise ValueError, msg
--> 277             self.model = svmc.svm_train(prob.prob, param.param)
    278 
    279         #setup some classwide variables

KeyboardInterrupt: 

In [22]:
sphere_errors = res.samples[0]
res_mean = np.mean(res)
res_std = np.std(res)

chance_level = 1.0 - (1.0 / len(ds_study.uniquetargets))
frac_lower = np.round(np.mean(sphere_errors < chance_level - 2 * res_std), 3)

In [26]:
chance_level


Out[26]:
0.5

In [23]:
hist(sphere_errors, bins=np.linspace(0, 1, 18))


Out[23]:
[<matplotlib.axes.AxesSubplot at 0x1284cc090>]

In [24]:
map2nifti(ds_study, 1.0 - sphere_errors).to_filename('PARC_sub_2848_WholeBrain_r12_Searchlight.nii.gz')

In [25]:
pwd


Out[25]:
u'/Volumes/group/iang/biac3/gotlib7/data/PARC/testingGround/PARC_mvpa'

In [ ]: