File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1573,14 +1573,24 @@ def set_slice_times(self, slice_times):
1573
1573
so_recoder = self ._field_recoders ['slice_code' ]
1574
1574
labels = so_recoder .value_set ('label' )
1575
1575
labels .remove ('unknown' )
1576
- for label in labels :
1576
+
1577
+ matching_labels = []
1578
+ # reversing the order so that "alternative" go last
1579
+ for label in sorted (labels , reverse = True ):
1577
1580
if np .all (st_order == self ._slice_time_order (
1578
1581
label ,
1579
1582
n_timed )):
1580
- break
1581
- else :
1583
+ matching_labels .append (label )
1584
+
1585
+ if not matching_labels :
1582
1586
raise HeaderDataError ('slice ordering of %s fits '
1583
1587
'with no known scheme' % st_order )
1588
+ if len (matching_labels ) > 1 :
1589
+ warnings .warn (
1590
+ 'Multiple slice orders satisfy: %s. Choosing the first one'
1591
+ % ', ' .join (matching_labels )
1592
+ )
1593
+ label = matching_labels [0 ]
1584
1594
# Set values into header
1585
1595
hdr ['slice_start' ] = slice_start
1586
1596
hdr ['slice_end' ] = slice_end
You can’t perform that action at this time.
0 commit comments