Events sorted into wrong group after epoching

Brainstorm version: 19-Sep-2020
OS: MacOS Catalina 10.15.6
Matlab version: R2020a

When I epoch my data using bst_process('CallProcess', 'process_import_data_event', ...), the events often fall under the wrong group header. For example, event 1 here is sorted correctly, but the event 3 grouping contains epochs from event 9. (They aren't shown in the screenshot, but event 11 is in the event 9 grouping, and 3 is in 11.)

Note that within the grouping, the labels are correct: 9 (#1) does correspond to the first instance of event 9 in the continuous file.

image

At first I thought the issue was that I was running two different epoching processes, in order to split the epochs into 2 different folders representing trial types that, for the purpose of my current analysis, are equivalent. The events in the first folder are fine, but the second folder is shown above. However, the same problem occurs if I do all of the epochs at the same time, except that it causes event types that were originally correct to go in the wrong group.

Thing's I've tried to fix this:

  • import all events individually as separate calls, including separate calls to start & save bst_report
  • importing all events at the same time
  • importing events using the "Run" interface in the GUI (Import > Import recordings > Import MEG/EEG: Events) instead of scripting
  • importing events by right clicking on the link to the raw file > Import in database
  • toggling CTF compensation (though this is EEG data, so it shouldn't apply anyway)

It's also not an issue with the filenames in the database. Before the most recent update, the filenames had matched the assigned grouping rather than the actual event type, but that appears to have changed after I updated today. Now, the filenames are correct, but the grouping is still wrong.

The one way I've found to get around this is to toggle createcond ("Create a separate folder for each event type" in the GUI) in order to make a new folder for each event type. This turns out to work mostly fine for my purposes, though it makes working with the data somewhat more tedious. However, since creating folders for each event may not work for everyone, such as described in the epoching tutorial, I thought I would report the bug.

Thank you for reporting this bug.

It would help us a lot if you could package an example, in order to reproduce the error:

  1. Create a new protocol
  2. Create a new subject using the default anatomy
  3. Link your continuous file to the database
  4. Import a few epochs (just enough to illustrate the problem)
  5. File > Export protocol > Export as zip file (this won't include your original file, only the imported epochs)
  6. Upload the .zip file somewhere and post the download link here.

Thanks!

Thank you for the example dataset, and for reporting this issue.

There was indeed a bug in the sorting of the files in different trial groups, when the order of the files (alphabetical) was not same as the sorting in the database explorer (natural order of the numbers).

I posted a fix: https://github.com/brainstorm-tools/brainstorm3/commit/d197dd8b415ab6a1ce3c350bb4d5a881a3384585

Please update Brainstorm and try again.

Hey there, sorry it took a while to get back to you -- classes started a few weeks ago so I haven't been able to spend as much time on research.

I updated Brainstorm, and it seems to work as desired now. Thanks for fixing the issue!