def run_all(code, roi_class_name, trials_name): """ Run sub() for all subjects, writing each Ss results separately. Note: Must be run from the parent folder of all the fMRI datasets.""" subjects = [101, 102, 103, 104, 105, 106, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118] all_results = {} for sub in subjects: print(sub) results = run(sub, roi_class_name, trials_name) print('Writing...') write_hdf(results, str(sub) + '_' + str(code) + '_roi_result.hdf5') del(results)
"wartaskAB_Superior Frontal Gyrus_bold.txt", "wartaskAB_Right Amygdala_bold.txt", "wartaskAB_Left Amygdala_bold.txt", "wartaskAB_Insular Cortex_bold.txt", "wartaskAB_Occipital Pole_bold.txt", "wartaskAB_Frontal Orbital Cortex_bold.txt"] ## This time do not both with the functional ROI data #subjects = [101, ] # for debug subjects = [101, 102, 103, 104, 105, 106, 108, 109, 111, 112, 113, 114, 115, 116, 117, 118] # -- # Loop over subjects for sub in subjects: # main() does all the work, then write results print(sub) sub_results = main(sub, roi_names) print('Writing results.') ## into a hdf5 results_name = str(sub) + '_' + exp_name + '_roi_result.hdf5' write_hdf(sub_results, results_name) del(sub_results) # Now extract the scores from the results # hdf5 file into something that can be easily # read into R for analyis. print("Getting and saving scores.") write_all_scores_as_df(results_name, str(sub) + exp_name)