pymovements.Participants.load#
- static Participants.load(path: Path | str, metadata: Path | str | dict[str, Any] | None = None, *, verify_bids: Literal['REQUIRED', 'RECOMMENDED'] | bool = False, separator: str = '\t', rename: dict[str, str] | None = None, read_csv_kwargs: dict[str, Any] | None = None, metadata_encoding: str = 'utf-8') Participants[source]#
Load participant data from participant files.
By default, values encoded as
'n/a'are read as null values per BIDS. A cell whose literal content is'n/a'therefore cannot be distinguished from a missing value. To keep such strings, pass a differentnull_valuesviaread_csv_kwargs(for exampleread_csv_kwargs={'null_values': []}).- Parameters:
path (Path | str) – If this points to a directory, assume file with name participants.tsv inside that directory.
metadata (Path | str | dict[str, Any] | None) – Additional metadata. Can be directly passed as a dictionary. If path or string: load metadata from json file. If a relative path given, path is assumed to be relative to parent of
path. If None: check forpathparent directory for existingparticipants.jsonand load metadata if available. (default: None)verify_bids (Literal['REQUIRED', 'RECOMMENDED'] | bool) – Verify BIDS conformity. If True, raise exception on non-conformity at REQUIRED level. If ‘REQUIRED’ or ‘RECOMMENDED’, emit warnings for non-conformity at that level, except for a missing
participant_idcolumn, which raises a ValueError. If False, do not verify. (default:False)separator (str) – Separator in the tabular data file. (default:
\t)rename (dict[str, str] | None) – Rename columns according to mapping in dictionary. (default:
None)read_csv_kwargs (dict[str, Any] | None) – Pass these additional keyword arguments to
polars.read_csv(). Takes precedence over theseparatorargument. (default:None)metadata_encoding (str) – Use this encoding for loading the metadata json file. (default:
utf-8)
- Returns:
Participants initialized with data from loaded files.
- Return type: