-
Notifications
You must be signed in to change notification settings - Fork 1
/
05_job_submit_server.py
64 lines (50 loc) · 3.06 KB
/
05_job_submit_server.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
59
60
61
62
63
"""
Run the analysis pipeline in the server with parallel processing of the subjects
@author: giuliano giari, [email protected]
"""
import sys
import glob
from joblib import Parallel, delayed
from gft2_config import opt
from gft2_preprocessing import meg_preprocess, make_epochs, make_segments_epochs
from gft2_frequency import compute_coh_epochs, compute_fft_epochs
from gft2_stc import compute_fft_stc, compute_coh_stc
from gft2_src import make_src
from gft2_eye import eye_correlation, eye_preprocess, realign_to_dots, \
compute_heatmaps, correlate_heatmaps, compare_angle_distributions
ses_id = sys.argv[1]
exp_id = 'exp_2' if ses_id == 'meg' else 'exp_1'
n_jobs = -1
for exp_id in [exp_id]:
subj_list = [sub_id for sub_id in opt[exp_id]['subj_list'] if not sub_id in opt[exp_id]['to_exclude']]
for ses_id in [ses_id]:
if ses_id == 'anat':
# create source space
Parallel(n_jobs=n_jobs)(delayed(make_src)(sub_id, opt) for sub_id in subj_list)
else:
# preprocessing
Parallel(n_jobs=n_jobs)(delayed(meg_preprocess)(sub_id, ses_id, opt.copy()) for sub_id in subj_list)
# epoching
Parallel(n_jobs=n_jobs)(delayed(make_epochs)(sub_id, ses_id, opt.copy()) for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(make_segments_epochs)(sub_id, ses_id, 'task', 15, opt.copy(),
save=True) for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(make_segments_epochs)(sub_id, ses_id, 'task', 30, opt.copy(),
save=True) for sub_id in subj_list)
# eye tracker
Parallel(n_jobs=n_jobs)(delayed(eye_preprocess)(sub_id, ses_id, opt.copy())
for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(realign_to_dots)(sub_id, ses_id, opt.copy())
for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(compute_heatmaps)(sub_id, ses_id, opt.copy())
for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(correlate_heatmaps)(sub_id, ses_id, opt.copy())
for sub_id in subj_list)
if ses_id == 'dots':
Parallel(n_jobs=n_jobs)(delayed(eye_correlation)(sub_id, ses_id, 'dist', opt.copy())
for sub_id in subj_list)
# frequency analysis
Parallel(n_jobs=n_jobs)(delayed(compute_fft_epochs)(sub_id, ses_id, opt_local.copy()) for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(compute_coh_epochs)(sub_id, ses_id, opt_local.copy()) for sub_id in subj_list)
# source analysis
Parallel(n_jobs=n_jobs)(delayed(compute_fft_stc)(sub_id, ses_id, opt_local.copy()) for sub_id in subj_list)
Parallel(n_jobs=n_jobs)(delayed(compute_coh_stc)(sub_id, ses_id, opt_local.copy()) for sub_id in subj_list)