Extract Values on multiple files in Process 1 without averaging

Hello BSTers,
I've successfully run TF decomposition (Morlet) on a bunch of data. I did the decomposition on the full trial length (-1000, 1200ms) full spectrum (1 to 90HZ) and would now like to extract only some Time (e.g., 0 to 800ms) and some frequency ranges individually (alpha; beta.. these should end up being on separate files) to conduct further testing.

Yet, when I add all the files (the data) in Process 1 and
--> Run
--> Extract Values
--> Time Window: 0 800ms
--> Frequency range: 7 to 12 Hz (for alpha)
signal names = empty
no average selected for time / signals / frequency bands.
no match signals
concatenate over time

The result is ONE file, i.e., an average of all the files there were on Process 1. What I was looking for is to have each file with that extraction applied (file1 [0ms, 800ms 7-12Hz]; file2 [0ms, 800ms 7-12Hz]; fileN [0ms, 800ms 7-12Hz];

Any idea?


p.s. doing the same process using the "Extract Time" function works as expected and outputs, for each file in Process 1, one file with the time extraction performed (unless overwrite input is selected, of course).

Hi @SpagnaPhd,

Indeed, the result is one file, but not the average. It contains the results you expected but they are concatenated in time. The resulting TF map has a duration of N×800ms with N being the number of files.

A solution, to have the results you are looking for, is to run a FOR loop for all the files.
See this tutorial Scripting for Brainstorm

The script will look something like this: Brainstorm: Extract values for multiple Time-Freq files · GitHub

1 Like

Cool cool,
thanks for the prompt reply and for the sample script, Raimundo;


Indeed, the process "Extract values" is aimed to collect into one single table data from multiple files.

If your goal is to obtain the average over different frequency bands, you can run the process "Frequency > Group in time or frequency band".
I don't recommend using the "time bands" options here because many processes do not support this option. Instead, use the processes "Extract time" and "Average time".