Skip to content

Commit

Permalink
[FIX] Fix type mismatch in clinica.iotools.bids_utils (#1376)
Browse files Browse the repository at this point in the history
* look for 'flutemeta' in file name

* fix
  • Loading branch information
NicolasGensollen authored Nov 22, 2024
1 parent 1886a29 commit 9032855
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions clinica/iotools/bids_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,9 @@ def create_scans_dict(
# Some flutemeta lines contain a non-coded string value at the second-to-last position. This value
# contains a comma which adds an extra column and shifts the remaining values to the right. In this
# case, we just remove the erroneous content and replace it with -4 which AIBL uses as n/a value.
on_bad_lines = ( # noqa: E731
lambda bad_line: bad_line[:-3] + [-4, bad_line[-1]]
if "flutemeta" in file_path and study_name == StudyName.AIBL
else "error"
)

on_bad_lines = lambda x: "error" # noqa
if "flutemeta" in file_path.name and study_name == StudyName.AIBL:
on_bad_lines = lambda bad_line: bad_line[:-3] + [-4, bad_line[-1]] # noqa
file_to_read = pd.read_csv(
file_path,
sep=",",
Expand Down

0 comments on commit 9032855

Please sign in to comment.