forked from ccarey/CBS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
genL1ArtBatches.py
32 lines (26 loc) · 1.32 KB
/
genL1ArtBatches.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
#!/usr/bin/env python
import argparse
import os
parser = argparse.ArgumentParser(description='Update the Level 1 Analysis batches after running ART.')
parser.add_argument('-p','--path', help='the path containing the subject directories (e.g. /users/me/data)', required=True, nargs=1)
parser.add_argument('-t','--template', help='The name of the batchfile, e.g., myLevel1Batch.m', required=True, nargs=1)
parser.add_argument('-s','--subjectid', help='the name of the subject(s)', required=False, nargs='*')
parser.add_argument('-f','--subjectfile', help='the name of the file containing subject(s)', required=False, nargs=1)
#parser.add_argument('-m','--usemovement', help='Include the movement regressors from ART', required=False, action='store_true')
args = vars(parser.parse_args())
if args["subjectfile"]:
substr = "\'"+args["subjectfile"][0]+"\'"
elif args["subjectid"]:
substr = "{\'"+"\',\'".join(args["subjectid"])+"\'}"
else:
raise Exception("Must specify either a subject file (-f) or subjectid (-s)")
runcmd = 'matlab -nodisplay -r "try; genL1PostArt('
runcmd += "\'"+args["path"][0]+"\'"
runcmd += ','+substr+','
runcmd += "{\'"+args["template"][0]+"\'}"
runcmd += ",true" # movement flag, a vestigial organ.
runcmd += ')'
runcmd += '; catch ME; disp(ME.message);'
runcmd += "end; exit()\""
print runcmd
os.system(runcmd)