Custom_process noise per epoch modification

Hi Brainstorm community,

I attach here a custom process that I made that calculates the "noise per epoch" of an auditory evoked potential (AEP) recording. This is used in cortical auditory evoked potentials (CAEPs) and auditory brainstem responses (ABRs).
process_noise_per_epoch.m (4.5 KB)

If you input 6000 epochs, it calculates the "noise" value (which is the standard deviation of the epoch) of each epoch and presents how the noise value changes from the 1st to the 6000th epoch.
The output is shown below where the x-axis = the number of epochs and the y-axis = the noise value in microvolts.

I would like to modify this process so the user can specify a numerical noise value to the process GUI so that the process deletes any epoch that equals or exceeds the specified noise value.
In other words, if you input 10 microvolts into the process GUI, it would now delete all the epochs that go above the red line in the figure down below.
image

I would like your thoughts on how best to do this.
I imagine that I would need to have something in the sProcess.options with value as the option type.
Any thoughts and comments would be appreciated.

Many thanks! :slight_smile:

That is right, it would require a option of type value
Here you can find more details on how to add options:
https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess#Definition_of_the_options

:warning: There are already hundreds of processes in Brainstorm, so you can take inspiration of them.
https://neuroimage.usc.edu/brainstorm/Tutorials/TutUserProcess#Create_your_own_process

To know what is the script associated with a process in the GUI, over its title

Finally, for deleting the files, you can make use of another process that is already there:
bst_process('CallProcess', 'process_delete', FileNames)