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.
- daysback
int
| ‘auto’ Number of days by which to move back the recording date in time. If
'auto'
, tries to randomly pick a suitable number.- subject_mapping
dict
|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. IfNone
, subject IDs are not changed.- datatypes
list
ofstr
|str
|None
Which data type to anonymize. If can be
meg
,eeg
,ieeg
, oranat
. Multiple data types may be passed as a collection of strings. IfNone
, try to anonymize the entire input dataset.- random_state
None
|int
| instance ofRandomState
A seed for the NumPy random number generator (RNG). If
None
(default), the seed will be obtained from the operating system (seeRandomState
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 derivedaysback
andsubject_mapping
if they are'auto'
.- verbose
bool
|str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.