Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The function define_participants return value is not deterministic #1317

Closed
NicolasGensollen opened this issue Oct 9, 2024 · 1 comment · Fixed by #1318
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@NicolasGensollen
Copy link
Member

The following function:

def define_participants(
data_directory: Path,
subjs_list_path: Optional[Path] = None,
) -> List[str]:
"""
Defines the actual list of participants based on the (provided) subjects list filtered
using existing data.
Parameters
----------
data_directory : Path to the raw data directory.
subjs_list_path : [Optional] Path to a text file containing a list of specific subjects to extract.
Returns
-------
The list of ids that were either present in the data directory or asked for with a specific text file, provided
associated images actually exists.
"""
list_from_data = _get_subjects_list_from_data(data_directory)
if subjs_list_path is None:
return list_from_data
cprint("Loading a subjects list provided by the user...")
list_from_file = _get_subjects_list_from_file(subjs_list_path)
list_filtered = [subject for subject in list_from_file if subject in list_from_data]
invalid_subjects = list(set(list_from_file) - set(list_filtered))
if invalid_subjects:
cprint(
f"The subjects : {' , '.join(invalid_subjects)} do not have any associated data inside the directory {data_directory}"
f" and can not be converted."
)
return list_filtered

is not fully deterministic and the order of the returned subject labels may vary as can be seen here:

https://github.com/aramis-lab/clinica/actions/runs/11251994838/job/31284194042?pr=1316

We need to make sure the order is deterministic, for example by sorting prior to returning.

@AliceJoubert WDYT ?

@NicolasGensollen
Copy link
Member Author

Solved by #1318

@NicolasGensollen NicolasGensollen added this to the v0.9.2 milestone Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants