Skip to content
Snippets Groups Projects
Commit c6beb86d authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

BF: Couple of small tweaks

parent f8f758ae
No related branches found
No related tags found
No related merge requests found
...@@ -118,6 +118,8 @@ def parseArgs(args): ...@@ -118,6 +118,8 @@ def parseArgs(args):
# Convert confound files to absolute # Convert confound files to absolute
# paths, error if any do not exist. # paths, error if any do not exist.
if args.conffile is None:
args.conffile = []
for i, cf in enumerate(args.conffile): for i, cf in enumerate(args.conffile):
if not op.exists(cf): if not op.exists(cf):
print('Confound file does not exist: {}'.format(cf)) print('Confound file does not exist: {}'.format(cf))
...@@ -153,8 +155,8 @@ def genComponentIndexList(comps, ncomps): ...@@ -153,8 +155,8 @@ def genComponentIndexList(comps, ncomps):
allcomps.extend([c - 1 for c in ccomps]) allcomps.extend([c - 1 for c in ccomps])
if any([cc < 0 or cc >= ncomps for cc in ccomps]): if any([c < 0 or c >= ncomps for c in allcomps]):
raise ValueError('Invalid component indices: {}'.format(ccomps)) raise ValueError('Invalid component indices: {}'.format(allcomps))
return list(sorted(set(allcomps))) return list(sorted(set(allcomps)))
...@@ -214,12 +216,13 @@ def main(argv=None): ...@@ -214,12 +216,13 @@ def main(argv=None):
args = parseArgs(argv) args = parseArgs(argv)
try: try:
comps = genComponentIndexList(args.components) ts = melanalysis.getComponentTimeSeries(args.icadir)
ts = melanalysis.getComponentTimeSeries(args.icadir) npts, ncomps = ts.shape
ts = ts[:, comps] confs = loadConfoundFiles(args.conffile, npts)
confs = loadConfoundFiles(args.conffiles, ts.shape[0]) comps = genComponentIndexList(args.components, ncomps)
ts = ts[:, comps]
except ValueError as e: except Exception as e:
print(e) print(e)
sys.exit(1) sys.exit(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment