Skip to content

Commit 1c97fda

Browse files
committed
refactor
1 parent 6389908 commit 1c97fda

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/bidspm.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def base_cmd(bids_dir: Path, output_dir: Path) -> str:
2323
return cmd
2424

2525

26+
def append_main_cmd(cmd: str, analysis_level: str, action: str) -> str:
27+
cmd += f"{new_line}'{analysis_level}'{new_line}'action', '{action}'"
28+
return cmd
29+
30+
2631
def end_cmd(cmd: str) -> str:
2732
cmd += "); exit;"
2833
return cmd
@@ -95,7 +100,7 @@ def default_model(
95100
return 1
96101

97102
cmd = base_cmd(bids_dir=bids_dir, output_dir=output_dir)
98-
cmd += f"{new_line}'dataset'{new_line}'action', 'default_model'"
103+
cmd = append_main_cmd(cmd=cmd, analysis_level=analysis_level, action="default_model")
99104
cmd = append_base_arguments(
100105
cmd=cmd, verbosity=verbosity, space=space, task=task, ignore=ignore
101106
)
@@ -129,7 +134,7 @@ def preprocess(
129134
return 1
130135

131136
cmd = base_cmd(bids_dir=bids_dir, output_dir=output_dir)
132-
cmd += f"{new_line}'subject'{new_line}'action', 'preprocess'"
137+
cmd = append_main_cmd(cmd=cmd, analysis_level="subject", action="preprocess")
133138
cmd = append_base_arguments(
134139
cmd=cmd, verbosity=verbosity, space=space, task=task, ignore=ignore
135140
)
@@ -180,7 +185,7 @@ def stats(
180185
return 1
181186

182187
cmd = base_cmd(bids_dir=bids_dir, output_dir=output_dir)
183-
cmd += f"{new_line}'subject'{new_line}'action', '{action}'"
188+
cmd = append_main_cmd(cmd=cmd, analysis_level="subject", action=action)
184189
cmd = append_base_arguments(
185190
cmd=cmd, verbosity=verbosity, space=space, task=task, ignore=ignore
186191
)

src/matlab.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ def matlab() -> str:
1010
1111
The 'matlab' executable is usually in the 'bin' subdirectory.
1212
"""
13-
return "/usr/local/MATLAB/R2018a/bin/matlab"
13+
return "/usr/local/MATLAB/R2018a/ bin/matlab"

0 commit comments

Comments
 (0)