From 336f2737ad47f21640d1b942b608782cd07a4f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Cl=C3=A9net?= Date: Wed, 22 Nov 2023 10:32:04 +0100 Subject: [PATCH] Removing sub- from participants ids in the get_group function --- narps_open/data/participants.py | 8 ++++---- tests/data/test_participants.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/narps_open/data/participants.py b/narps_open/data/participants.py index 835e834f..b0d6213e 100644 --- a/narps_open/data/participants.py +++ b/narps_open/data/participants.py @@ -51,9 +51,9 @@ def get_participants_subset(nb_participants: int = 108) -> list: return get_all_participants()[0:nb_participants] def get_group(group_name: str) -> list: - """ Return a list containing all the participants inside the group_name group + """ Return a list containing all the participants inside the group_name group """ - Warning : the subject ids are return as written in the participants file (i.e.: 'sub-*') - """ participants = get_participants_information() - return participants.loc[participants['group'] == group_name]['participant_id'].values.tolist() + group = participants.loc[participants['group'] == group_name]['participant_id'].values.tolist() + + return [p.replace('sub-', '') for p in group] diff --git a/tests/data/test_participants.py b/tests/data/test_participants.py index f36f0a05..eaf313fb 100644 --- a/tests/data/test_participants.py +++ b/tests/data/test_participants.py @@ -112,5 +112,5 @@ def test_get_group(mock_participants_data): """ Test the get_group function """ assert part.get_group('') == [] - assert part.get_group('equalRange') == ['sub-002', 'sub-004'] - assert part.get_group('equalIndifference') == ['sub-001', 'sub-003'] + assert part.get_group('equalRange') == ['002', '004'] + assert part.get_group('equalIndifference') == ['001', '003']