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):
15731573 so_recoder = self ._field_recoders ['slice_code' ]
15741574 labels = so_recoder .value_set ('label' )
15751575 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 ):
15771580 if np .all (st_order == self ._slice_time_order (
15781581 label ,
15791582 n_timed )):
1580- break
1581- else :
1583+ matching_labels .append (label )
1584+
1585+ if not matching_labels :
15821586 raise HeaderDataError ('slice ordering of %s fits '
15831587 '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 ]
15841594 # Set values into header
15851595 hdr ['slice_start' ] = slice_start
15861596 hdr ['slice_end' ] = slice_end
You can’t perform that action at this time.
0 commit comments