File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -119,14 +119,17 @@ def populate_aggregated_jsons(path):
119
119
suf = '_bold.json'
120
120
assert fpath .endswith (suf )
121
121
# specify the name of the '_events.tsv' file:
122
- if ( '_echo-' in fpath ) :
122
+ if '_echo-' in fpath :
123
123
# multi-echo sequence: bids (1.1.0) specifies just one '_events.tsv'
124
124
# file, common for all echoes. The name will not include _echo-.
125
+ # TODO: RF to use re.match for better readability/robustness
125
126
# So, find out the echo number:
126
- fpath_split = fpath .split ('_echo-' ) # split fpath using '_echo-'
127
- fpath_split_2 = fpath_split [1 ].split ('_' ) # split the second part of fpath_split using '_'
128
- echoNo = fpath_split_2 [0 ] # get echo number
129
- if ( echoNo == '1' ):
127
+ fpath_split = fpath .split ('_echo-' , 1 ) # split fpath using '_echo-'
128
+ fpath_split_2 = fpath_split [1 ].split ('_' , 1 ) # split the second part of fpath_split using '_'
129
+ echoNo = fpath_split_2 [0 ] # get echo number
130
+ if echoNo == '1' :
131
+ if len (fpath_split_2 ) != 2 :
132
+ raise ValueError ("Found no trailer after _echo-" )
130
133
# we modify fpath to exclude '_echo-' + echoNo:
131
134
fpath = fpath_split [0 ] + '_' + fpath_split_2 [1 ]
132
135
else :
You can’t perform that action at this time.
0 commit comments