From 798f078ddd1bf3358cd1efb2c0c3db8024d0693f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Cl=C3=A9net?= <117362283+bclenet@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:49:50 +0100 Subject: [PATCH] Participants IDs (#130) * [BUG] inside unit_tests workflow * [ENH] add a remove_files method the new module * [TEST] add test for remove_files * [ENH] add voxel_dimensions [TEST] add test for voxel_dimensions * Adding sorting utils to narps_open.core.common[skip ci] * [TEST] for the core functions + adding get_group to narps_open.data.participants * [DOC] for the core module * [DOC] codespell * 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']