Skip to content

Commit

Permalink
fix: adaption helpers with lists of length 1
Browse files Browse the repository at this point in the history
  • Loading branch information
oesteban authored Nov 17, 2023
1 parent ceda0d7 commit 9383268
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 8 additions & 2 deletions mriqc/workflows/functional/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,10 @@ def epi_mni_align(name="SpatialNormalization"):

def _parse_tqual(in_file):
if isinstance(in_file, (list, tuple)):
return [_parse_tqual(f) for f in in_file]
return (
[_parse_tqual(f) for f in in_file] if len(in_file) > 1
else _parse_tqual(in_file[0])
)

import numpy as np

Expand All @@ -730,7 +733,10 @@ def _parse_tqual(in_file):

def _parse_tout(in_file):
if isinstance(in_file, (list, tuple)):
return [_parse_tout(f) for f in in_file]
return (
[_parse_tout(f) for f in in_file] if len(in_file) > 1
else _parse_tout(in_file[0])
)

import numpy as np

Expand Down
8 changes: 5 additions & 3 deletions mriqc/workflows/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@

def _tofloat(inlist):
if isinstance(inlist, (list, tuple)):
return [_tofloat(el) for el in inlist]
else:
return float(inlist)
return (
[_tofloat(el) for el in inlist] if len(inlist) > 1
else _tofloat(inlist[0])
)
return float(inlist)


def fwhm_dict(fwhm):
Expand Down

0 comments on commit 9383268

Please sign in to comment.