Group event codes by name

Hi Francois,

Sorry, one more request from a different project. Whenever we display more than 255 types of stimuli, we cannot use a simple code. In such case we send two consecutive codes (within a few milliseconds apart) to indicate separate events. For example, we send 1 followed by 1, 1 followed by 2, etc.

The process 'process_evt_groupname' then allows us to combine these codes by name. The problem is that it fails when the codes are the same, so '1 2' works, but '1 1' is not detected. Currently there is no way to handle this case in Brainstorm. Could you extend this function to also work when the pairs of events are equal with each other?

[The process combine stim/response also cannot handle two events with same code, maybe this could also be extended similarly? This has more flexibility because it allows to determine the position of the created code]

Thank you!
Dimitrios

Hi Dimitrios,

I modified the process "Group by name":

  • it is now possible to group an event with itself (B = A, A)
  • there is a new option first/last, so that you can decide which one you want to keep.

Commit: https://github.com/brainstorm-tools/brainstorm3/commit/cb0f793187e36a4cce0c2b30d062addac089476b

The process "combine stim/response" works in a different way, incompatible with the matching of an event with itself.

Let me know if the solution I propose works for you.
Francois

Hi Francois,

This is great and works! Exactly what we needed!

Thank you,
Dimitrios

1 Like

Hi Francois,

I think the process has a bug and it does not work when the option delete is set to 1. Can you please have a look?

Thank you,
Dimitrios

Does this commit fix the bug?

Hi Francois,

Yes, this fixed the problem! But it is not in the latest version of Brainstorm yet, (which I just downloaded), does it take some time?

Best,
Dimitrios

I ran the update script manually, it should be in there now.

Hi Francois,

There seems to be a different bug in process_evt_groupname. It now cannot rename any events (the E=A option). I appreciate if you can have a look.

We have a long list of events we need to rename (to remove 1-back trials) and the complementary process rename process_evt_rename is prohibitively slow and not practical.

Thank you!
Dimitrios

It now cannot rename any events (the E=A option)

I'm sorry, when coding the grouping of an event with itself, I forgot that the process could also be used for renaming... I added and additional test for handling the renaming separately:

process_evt_rename is prohibitively slow and not practical

I also modified this process so that it can take multiple events at once:

I hope it will work this time...

Thank you Francois, everything appears to work well now!

Cheers,
Dimitrios