From c56a96401b60cb41b4e3b2ec335865b11e79c2f1 Mon Sep 17 00:00:00 2001 From: NicolasGensollen Date: Thu, 14 Nov 2024 14:26:45 +0100 Subject: [PATCH 1/2] look for 'flutemeta' in file name --- clinica/iotools/bids_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clinica/iotools/bids_utils.py b/clinica/iotools/bids_utils.py index e4eb8cedf..2cf1d9438 100644 --- a/clinica/iotools/bids_utils.py +++ b/clinica/iotools/bids_utils.py @@ -578,7 +578,7 @@ def create_scans_dict( # 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 + if "flutemeta" in file_path.name and study_name == StudyName.AIBL else "error" ) From 449f68056f1e7aba6fff17e9efc842430ce4b6f7 Mon Sep 17 00:00:00 2001 From: NicolasGensollen Date: Thu, 21 Nov 2024 11:08:24 +0100 Subject: [PATCH 2/2] fix --- clinica/iotools/bids_utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/clinica/iotools/bids_utils.py b/clinica/iotools/bids_utils.py index 2cf1d9438..962d4ef1e 100644 --- a/clinica/iotools/bids_utils.py +++ b/clinica/iotools/bids_utils.py @@ -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.name 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=",",