[FieldTrip] error with databrowser after rejecting components in ICA

Lei, A. (Anqi) anqi.lei at ru.nl
Sat Mar 26 11:22:05 CET 2022


Hi Tzvetan,

Thank you for your quick reply! However, before I rejected ICA components I did not get the 'ft_fetch_data' error when I visualized the data, so this implies that the segmentation is alright, but something went wrong in the ICA rejection step, right?

Best,
Anqi


From: fieldtrip <fieldtrip-bounces at science.ru.nl> on behalf of Tzvetan Popov via fieldtrip <fieldtrip at science.ru.nl>
Reply-To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Date: Saturday, March 26, 2022 at 11:17 AM
To: FieldTrip discussion list <fieldtrip at science.ru.nl>
Cc: Tzvetan Popov <tzvetan.popov at uni-konstanz.de>
Subject: Re: [FieldTrip] error with databrowser after rejecting components in ICA

Dear Anqi,

The cause for this error is that somewhere during the segmentation a sample at the end of trial N is also at the begin of trial N+1. Hence, you might re-consider your segmentation/trial length.
As for the plotting, you could remove comp = rmfield(comp,’sampleinfo’) and you will be able to plot.
Note, however, the first issue needs a fix.

Good luck
Tzvetan



On 26 Mar 2022, at 10:10, Lei, A. (Anqi) via fieldtrip <fieldtrip at science.ru.nl<mailto:fieldtrip at science.ru.nl>> wrote:

Hello,

I was performing ICA on my EEG data and the script was running smoothly until I rejected bad components using 'ft_rejectcomponent' – after that I couldn't visualize my data using databrowser and got this error:

"Error using ft_fetch_data (line 168)
some of the requested samples occur twice in the data and have conflicting values"

This is the script I used for ICA, could you let me know what might be wrong? Thank you so much!

%% ICA
%Decomposition of EEG data
    cfg            = [];
    cfg.resamplefs = 150;
    cfg.detrend    = 'no';
    data           = ft_resampledata(cfg, data_all);

    cfg        = [];
    cfg.method = 'runica'; % this is the default and uses the implementation from EEGLAB
    comp = ft_componentanalysis(cfg, data);

    %Identify components reflecting eye artifacts
    % plot the components for visual inspection
    figure
    cfg = [];
    cfg.component = 1:20;       % specify the component(s) that should be plotted
    cfg.layout    = 'acticap-64ch-standard2_XZ.mat'; % specify the layout file that should be used for plotting
    cfg.comment   = 'no';
    ft_topoplotIC(cfg, comp)

    %Removing bad artifacts and backprojecting data
    cfg = [];
    cfg.component = [1 2]; % e.g. to be removed component(s)
data_all = ft_rejectcomponent(cfg, comp, data_all);

    %Display data (this is where the error message occurs)
    cfg = [];
    cfg.layout = 'acticap-64ch-standard2_XZ.mat'; % specify the layout file that should be used for plotting
    cfg.viewmode = 'vertical';
    ft_databrowser(cfg, data_all);



Best,
Anqi
_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202<https://urldefense.com/v3/__https:/doi.org/10.1371/journal.pcbi.1002202__;!!HJOPV4FYYWzcc1jazlU!9tln1tvYAQXPiR98H6m9to3tVWIqZQy05x_y2b6wMAJp84HSW6ENGENFxkKOAN-Qz2YJs81chXw_B-VroFuMGA$>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20220326/4239a111/attachment.htm>


More information about the fieldtrip mailing list