[FieldTrip] missing sample after using ft_componentanalysis with method bsscca

Schoffelen, J.M. (Jan Mathijs) jan.schoffelen at donders.ru.nl
Wed May 6 11:18:01 CEST 2020


Hi Linda

Is the data internally consistent after ft_componentanalysis? In other words, does the number of time points per trial (in data.time) match the number of columns in data.trial?

Please note that the bsscca is a poorly maintained corner (and hardly ever used) of the code, so it might need improvement.

Feel free to send us a Pull Request through github for code improvements.

Best,
Jan-Mathijs

PS: bsscca returns ’shorter’ data than the input because of the way the algorithm works, as described in the reference paper.



On 6 May 2020, at 10:23, Drijvers, L. (Linda) <l.drijvers at donders.ru.nl<mailto:l.drijvers at donders.ru.nl>> wrote:

P.S., sorry, mixed things up: data in comp_output.trial have 499 samples, while smps has 500 elements (presumably based on sampleinfo). So key question is: why do the output trials after bsscca have 1 fewer sample than the input trials?

Best,
Linda

dr. Linda Drijvers | postdoctoral researcher | https://cosilab.org<https://cosilab.org/>
Donders Institute for Brain, Cognition and Behaviour, Radboud University, NL
www.ru.nl/english/people/drijvers-l/<http://www.ru.nl/english/people/drijvers-l/> | https://www.mpi.nl/people/drijvers-linda

From: fieldtrip <fieldtrip-bounces at science.ru.nl<mailto:fieldtrip-bounces at science.ru.nl>> On Behalf Of Drijvers, L. (Linda)
Sent: woensdag 6 mei 2020 09:59
To: fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>
Subject: [FieldTrip] missing sample after using ft_componentanalysis with method bsscca

Dear all,

I’m analysing an EEG dataset using MATLAB 2016a + FieldTrip version 20200409.

I am trying to use ft_componentanalysis with cfg.method = ‘bsscca’ (see code):

cfg             = [];
cfg.channel     = 1:length(data_Aclean.label)-2;
cfg.method      = 'bsscca';
cfg.cellmode    = 'yes';
comp_output      = ft_componentanalysis(cfg, data_Aclean);

When I then try to use ft_databrowser with the following code:
    cfg = [];
    cfg.channel = [1:10];
    cfg.viewmode = 'component';
    cfg.layout = 'customlayout.mat';
    ft_databrowser(cfg, comp_output);

I get the following error:

Index exceeds matrix dimensions.

Error in ft_fetch_data (line 199)
    dat(:,ok) = data.trial{utrl}(chanindx,smps);

Error in ft_databrowser>redraw_cb (line 1630)
  dat = ft_fetch_data(opt.orgdata, 'header', opt.hdr, 'begsample', begsample, 'endsample', endsample, 'chanindx', chanindx,
  'allowoverlap', istrue(cfg.allowoverlap));

Error in ft_databrowser (line 729)
redraw_cb(h);

A closer look at the data shows that while fsample for my data is 500, smps is 499 after running ft_componentanalysis with method bsscca. However, I can solve the error above by running ft_databrowser with comp_output = rmfield(comp_output, 'sampleinfo').

My question is: what causes this discrepancy in smps (why does this one sample go missing)? Any help would be appreciated.

Best wishes,
Linda Drijvers

dr. Linda Drijvers | postdoctoral researcher | https://cosilab.org
Donders Institute for Brain, Cognition and Behaviour, Radboud University, NL
www.ru.nl/english/people/drijvers-l/<http://www.ru.nl/english/people/drijvers-l/> | https://www.mpi.nl/people/drijvers-linda

_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20200506/6ef6b748/attachment.htm>


More information about the fieldtrip mailing list