- MNE version: 0.24.1
- operating system: Windows 10
- MNE-BIDS version: 0.10
Hello,
I have recently started my journey with mne-bids and have already come quite far.
Unfortunately, I cant solve this problem on my own and I am asking for help.
I prepared a bids-dataset and wanted to anonymize it with the function anonymize_dataset
.
The anonymization failed due to an AssertionError when comparing the initial events.tsv and the anonymized version: assert events_tsv_in['trial_type'] == events_tsv_out['trial_type']
.
For the initial events.tsv, I passed events_data and event_id to write_raw_bids
:
events = mne.find_events(raw,stim_channel='STI101')
events = mne.pick_events(events, include=1)
event_id = {'click': 1}
write_raw_bids(raw,
bids_path,
events_data=events,
event_id=event_id,
overwrite=True)
The written events.tsv file includes all the defined events but no annotations added by the acquisition system to the FIFF files.
The event value correponds to the value of the sum channel STI101 recorded from the neuronag meg.
original events.tsv
onset | duration | trial_type | value | sample |
---|---|---|---|---|
131.465 | 116.0 | click | 1 | 131465 |
131.847 | 0.0 | click | 1 | 131847 |
132.207 | 0.0 | click | 1 | 132207 |
…
The anonymized events.tsv looks like this and includes the annotations recorded in the FIFF file.
Due to the presence of the annotations (BAD_ACQ_SKIP), the event value of click has also been increased from 1 to 2 which is unwanted. Therefore, the comparison obviously fails.
anonymized events.tsv
onset | duration | trial_type | value | sample |
---|---|---|---|---|
2.0 | 116.0 | BAD_ACQ_SKIP | 1 | 2000 |
2.0 | 116.0 | BAD_ACQ_SKIP | 1 | 2000 |
131.465 | 116.0 | click | 2 | 131465 |
131.847 | 0.0 | click | 2 | 131847 |
132.207 | 0.0 | click | 2 | 132207 |
Is there a way to bypass the AssertionError or anything I can do to prevent anonymize_dataset
from generating the above events.tsv?
Another idea would be to modify the events_data and events_id to incorporate the annotations too when passed to write_raw_bids
. But in that case, the event value 1 is already occupied by BAD_ACQ_SKIP and I cant use it anymore.
Thanks guys
Best regards