mne_bids.anonymize_dataset#

mne_bids.anonymize_dataset(bids_root_in, bids_root_out, daysback='auto', subject_mapping='auto', datatypes=None, random_state=None, verbose=None)[source]#

Anonymize a BIDS dataset.

This function creates a copy of a BIDS dataset, and tries to remove all personally identifiable information from the copy.

Parameters:
bids_root_inpath-like

The root directory of the input BIDS dataset.

bids_root_outpath-like

The directory to place the anonymized dataset into.

daysbackint | ‘auto’

Number of days by which to move back the recording date in time. If 'auto', tries to randomly pick a suitable number.

subject_mappingdict | callable() | ‘auto’ | None

How to anonymize subject IDs. If a dictionary, maps the original IDs (keys) to the anonymized IDs (values). If a function, must be one that accepts the original IDs as a list of strings and returns a dictionary with original IDs as keys and anonymized IDs as values. If 'auto', automatically produces a mapping (zero-padded numerical IDs) and prints it on the screen. If None, subject IDs are not changed.

datatypeslist of str | str | None

Which data type to anonymize. If can be meg, eeg, ieeg, or anat. Multiple data types may be passed as a collection of strings. If None, try to anonymize the entire input dataset.

random_stateNone | int | instance of RandomState

A seed for the NumPy random number generator (RNG). If None (default), the seed will be obtained from the operating system (see RandomState for details), meaning it will most likely produce different output every time this function or method is run. To achieve reproducible results, pass a value here to explicitly initialize the RNG with a defined state. The RNG will be used to derive daysback and subject_mapping if they are 'auto'.

verbosebool | str | int | None

Control verbosity of the logging output. If None, use the default verbosity level. See the logging documentation and mne.verbose() for details. Should only be passed as a keyword argument.

Examples using mne_bids.anonymize_dataset#

13. Anonymizing a BIDS dataset

13. Anonymizing a BIDS dataset