# save zstat map res_dir = sp.path('rsa', f'{res_name}_{name}') if not os.path.exists(res_dir): os.makedirs(res_dir) filepath = os.path.join(res_dir, 'zstat.nii.gz') nifti = map2nifti(ds, sl_map[i]) nifti.to_filename(filepath) # save mask of included voxels include_file = os.path.join(res_dir, 'included.nii.gz') nifti_include.to_filename(include_file) if __name__ == '__main__': parser = su.SubjParser(include_log=False) parser.add_argument('mask', help="name of mask for searchlight centers") parser.add_argument('feature_mask', help="name of mask for included voxels") parser.add_argument('models', help="models to include (e.g., hmax-wiki_w2v)") parser.add_argument('category', help="category to include (face,scene)") parser.add_argument('res_name', help="name of results directory") parser.add_argument('--suffix', '-b', default='_stim2', help="suffix for beta images (_stim2)") parser.add_argument('--radius', '-r', type=int, default=3,
stat = prsa.perm_partial(data_vec, perm['model_mats'][i], perm['model_resid'][i]) rho[i] = stat[0] zstat[i] = prsa.perm_z(stat) # save results res_dir = os.path.join(study_dir, 'batch', 'prsa', res_name, roi) if not os.path.exists(res_dir): os.makedirs(res_dir, exist_ok=True) df = pd.DataFrame({'rho': rho, 'zstat': zstat}, index=model_names) res_file = os.path.join(res_dir, f'zstat_{subject}.csv') df.to_csv(res_file) if __name__ == '__main__': parser = subjutil.SubjParser(include_log=False) parser.add_argument('beh_dir', help='path to behavioral data directory') parser.add_argument('rsa_name', help='name for rsa results') parser.add_argument('roi', help='name of roi to analyze') parser.add_argument('res_name', help='name for results') parser.add_argument('--block', '-b', help='block to include (walk, random)') parser.add_argument('--n-perm', '-p', type=int, default=1000, help="number of permutations to run (1000)") args = parser.parse_args() main(args.subject, args.study_dir,