Scripting & "Cut stimulation artifact" process

Hello,

I am writing a script to perform my preprocessing automatically.
I stumbled upon an issue when trying to use the process "Cut stimulation artifact".

I use this process to cut the stimulation artifact between [-2ms, +5.0ms] around every trigger (550 triggers) of my EEG recording.

I used it with the GUI and it worked.
However, I can't get it to work with a script, even by simply trying to run the script I generated from the Pipeline editor ("Generate .m script") with all the input set exactly as they were when I used the GUI and clicked "Run".

Here is the error I get:

And here is the script:

Would you have any idea of what might cause this bug?

Please tell me if you need more details.

Thanks in advance for your help.

Best,

François

I found the source of the error.

In the script of the the cut stimulation process "process_cutstim.m", line 104, the variable containing the name of the interpolation method is expected to be a cell containing a string. Instead, in the script of the "Cut stimulation artifact" process generated by the option "Generate .m script", a string is associated with the option 'method', and not a cell containing a string (line 15 of the script in attached).

Hence the mismatch and error. Writing {'spline'} instead on 'spline' as the 'method' option of the bst_process function fixes the issue.

Hi François,

I'm glad you figured it out! Indeed, the script generation of this specific type of process options generated the value as a string rather than a cell. Adding the brackets to your existing scripts will do the trick, and the following commit should fix the issue for newly generated scripts: https://github.com/brainstorm-tools/brainstorm3/commit/a3274d0f6b5f6675f8659ef9d616bc854a1d0c5a

Thank you for reporting this issue!

Martin

1 Like