niquery.data.utils module

niquery.data.utils.bids_dataset_name_pattern() Pattern[str][source]

Return the compiled regex pattern to identify BIDS dataset filenames.

Compiles a specific regex pattern designed to match filenames associated with BIDS datasets. The pattern is structured to match strings that have ‘dsd{6}.tsv’ pattern (e.g. ‘ds000006.tsv’, ‘ds000021.tsv’, etc.): i.e. the ‘ds’ prefix is followed by exactly six digits and ends with the ‘.tsv’ extension.

Returns:

A compiled regex pattern matching BIDS dataset filenames.

Return type:

Pattern[str]

niquery.data.utils.filter_non_conforming_ds(dirname: Path) dict[source]

Filter non-conforming datasets based on their name.

Consider only files that have the ‘dsd{6}.tsv’ pattern (e.g. ‘ds000006.tsv’, ‘ds000021.tsv’, etc.)

Parameters:

dirname (Path) – Directory where dataset files are located.

Returns:

Pairs of dataset names and absolute paths.

Return type:

dict