How long should "Compute Sources" and "Extract Scout Time Series" take?

Hello Everybody,

I am wondering how long the "Compute Sources" and "Extract Scout Time Series" functions should take, as it currently performs it really fast which makes me a bit suspicious.

Some information so that some assumptions can be made:

Specs of my PC

  • CPU: intel i7-6700 (4 cores)
  • RAM: 8GB DDR4
  • OS: Windows 10
  • MATLAB version: 2017B

EEG data information

  • 57 channels
  • 512 Hz sample frequency
  • 5-10 minute recording (between 153600 - 307200 timepoints)

Reference calculation time

Calculation of the headmodel (FEM DUNEuro, surface headmodel): 21 hours

How I currently obtain my scout time series

Overview Functional Data Map

image

I take the EEG/Mat file and and place it in the "Process 1" tab.

Details Compute Sources [2018]

image

Details Extract Scout Time Series + Timeline Computations

MATLAB output when running this pipeline

Updated view of the functional tab

image

Data structure when I click on EEG/MAT | 130 scouts -> File -> Export to MATLAB

image

My real question/Why I am writing this long as post

The whole process of calculating the sources and extracting the scout time series took roughly 15 minutes, with most time being spent on the PCA calculation for each scout.

I am suspicious that this is too fast, and that I am doing something wrong here. Are my suspicions correct and if so, where to I make a mistake?

Thanks in advance!

15 minutes already sounds very long.
The computation of the MNE inverse solution is independent from the data and is expected to take only a few seconds.

Your signals look very long - is this resting state data?
In general, we recommend importing native file formats instead of manually semi-processed recordings from a .mat file, and then linking them to the database for preprocessing using the menu "Review raw file", as illustrated in the introduction tutorials. But maybe this is not applicable to your case.
https://neuroimage.usc.edu/brainstorm/Tutorials

Dear @Francois,

My computer is on the older side, this might explain it?

It is resting-state data indeed. I am importing completely preprocessed EEG files.

I was testing a few things and found out that if I use the "unconstrained" option when calculating the sources and afterwards extracting the scout time series, my computer crashes, but if I use the "constrained" option it works without a problem. Why does this happen? For resting-state EEG data and scout time series extraction, is the best option "constrained" or "unconstrained"?

EDIT: I just checked, before my computer crashes, it reaches 100% RAM usage and 100% ROM usage. I used "unconstrained" in the calculate sources 2018 (which does not result in a problem, the problem occurs during the extract scout time series step) and selected the "unconstrained sources: Norm of the three orientations (x,y,z)" option in the extract scout time series option.

Dear @Francois,

I discussed my problem with a colleague who told me that it is logical that my computer crashes since I want to extract all 130 timeseries in a single run (I would need too many GB of RAM to be able to do this).

I was now wondering if it is possible to run "Extract scout time series" multiple times after each other, each time extracting a few scouts. In the process editor I see that I can't place multiple "Extract scout time series" options after each other. So I think making a script would be best right? Or is there a logical reason why "Extract scout time series" can't be used multiple times?

Thanks in advance for the patience.

EDIT: So I tried a very basic script adjustment: I copied the first "extract scout time series" and adjusted the names of the two scouts that should be extracted.

But I get the following error:

Any idea why it is happening and how I can solve it?

EDIT 2:

I think it has to do with what data exactly is loaded at the time of calling the "extract scout time series" function. I adjusted the script slightly so that now it reruns the "compute sources 2018" function before the second time I call the "extract scout time series" function, and now I get this error:

I was now wondering if it is possible to run "Extract scout time series" multiple times after each other, each time extracting a few scouts. In the process editor I see that I can't place multiple "Extract scout time series" options after each other. So I think making a script would be best right? Or is there a logical reason why "Extract scout time series" can't be used multiple times?

There is no reason for not calling multiple times the process "Extract scouts time series", but this would be terribly inefficient: it would load all the data, the inverse kernel, multiply the two to reconstruct this gigantic source matrix (Nsources x Ntime) in memory, and then average a few sources to get the scout time series. If you call twice the process, all this is done twice...
To optimize the memory and CPU usage of your scripts: learn how to use the resource monitor of your operating system, and the Matlab Profiler.

Why do you need all the time points loaded at once?
The most logical, if you want to split the process in two for memory reasons, would be to split the data along the time dimension. You need continuous signals at the end, you can concatenate the scout signals easily with a process.

I copied the first "extract scout time series" and adjusted the names of the two scouts that should be extracted.
Any idea why it is happening and how I can solve it?

You are erasing the variable with the original input filenames....
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting#Simplify_the_calls

Dear @Francois,

A bit late, but I got everything working. Thanks for all the help along the way!