-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_all_results.py
58 lines (46 loc) · 1.91 KB
/
generate_all_results.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from subprocess import Popen
import numpy as np
import os
import glob
import random
import argparse
import itertools
import nibabel as nib
from nilearn import plotting
from tqdm import tqdm
from sklearn.cross_decomposition import PLSRegression
from sklearn.linear_model import LinearRegression
from sklearn.linear_model import Ridge
from sklearn.preprocessing import StandardScaler
import torch
import time
import pickle
from tqdm import tqdm
from utils.helper import save_dict,load_dict
def main():
parser = argparse.ArgumentParser(description='Generates predictions for all subs all ROIs for a given track')
parser.add_argument('-t','--track', help='mini_track for all ROIs, full_track for whole brain (WB)', default = 'mini_track', type=str)
parser.add_argument('-fd','--fmri_dir',help='directory containing fMRI activity', default = './participants_data_v2021', type=str)
args = vars(parser.parse_args())
track = args['track']
fmri_dir = args['fmri_dir']
if track == 'full_track':
ROIs = ['WB']
else:
ROIs = ['LOC','FFA','STS','EBA','PPA','V1','V2','V3','V4']
num_subs = 10
subs=[]
for s in range(num_subs):
subs.append('sub'+str(s+1).zfill(2))
for roi in ROIs:
for sub in subs:
cmd_string = 'python perform_encoding.py' + ' --roi ' + roi + ' --sub ' + sub + ' -fd ' + fmri_dir + ' --mode test'
print("----------------------------------------------------------------------------")
print("----------------------------------------------------------------------------")
print ("Starting ROI: ", roi, "sub: ",sub)
os.system(cmd_string)
print ("Completed ROI: ", roi, "sub: ",sub)
print("----------------------------------------------------------------------------")
print("----------------------------------------------------------------------------")
if __name__ == "__main__":
main()