Error in process_psd_features

I am getting an error when I try to compute the coefficient of variation using the Frequency > Compute PSD Features process.

I am following the tutorial: https://neuroimage.usc.edu/brainstorm/Tutorials/DeviationMaps?highlight=(deviation)|(maps)
but instead of checking 'Extract std' I have checked 'Extract cv' as shown in the input below.

When I run this, I am getting the error: 'Input file must contain Std matrix.' I had previously (~ 5 months ago) tested this process using the same data and was able to compute the coefficient of variation without issue, but now I am consistently getting this error. For reference I am using Brainstorm version 07-Jan-2025.

Any thoughts you have as to why this error might be occurring would be greatly appreciated. Thanks!

1 Like

Is it working when you check "std" as in the tutorial?
If so, can you check std with cv as well and see if this is working?

Yes, it does work when I check "std". It also works for "mean".
I tried checking both "std" and "cv" and I got the same error.

Looks to be a bug then.
Can you please post the error message that was displayed on the terminal?

This is the only output to the terminal:

Based on the source code, it seems to be hitting this error reporting (line 142) in process_psd_features.m but I'm not sure why there is no std matrix.

Could it be that the are Brainstorm functions that are shadowed?

After doing some more testing, it seems that the issue occurs when sProcess.options.win_std.Value is set to 'mean+std'. I'm not familiar enough with the Brainstorm architecture to trace back to the exact root of this issue, but I found a work around that has worked for me.

I modified process_psd_features.m to read in the mean and std files separately, removing the need to rely on the 'mean+std' structure (see attached). I think this works for now but it doesn't solve the root issue with the 'mean+std' option.

process_psd_features_cvFixed.m (8.0 KB)

The issue was how the frequency bands were handled at the moment CV, as the PSD file to compute it had mean and std, but std was cleared at grouping by bands.

Fixed in 6fcbb28