[FieldTrip] Artifact rejection problem due to samples occurring twice in the data

Hartog, M.M.J. den (Maria) maria.denhartog at ru.nl
Thu Oct 26 11:31:21 CEST 2023


Dear community,

My name is Maria den Hartog and I am a PhD candidate at the Centre for Language Studies (CLS) at Radboud University in Nijmegen. I am currently preprocessing data from an ERP reading experiment about the processing of pronouns of address (e.g. he, she, they) within a text.

I want to use automatic artifact rejection to remove full trials with signal exceeding +-100 µV as part of my preprocessing pipeline, but I get an error message indicating that 'some of the requested samples occur twice in the data and have conflicting values'. This is true, and it is a consequence of the naturalistic reading paradigm I used. My trials run from -200 ms prestimulus to 1000 ms poststimulus. The t = 0 of each trial is the onset of a pronoun within a text, and the pronouns can occur less than 1000 ms after each other (e.g., the stimuli are he and his in 'He looked at his cat.'). I have baselined my trials to the 200 ms window up to the stimulus, meaning the same sample can have different values in different trials.

The code I use for artifact rejection is:
    cfg = [];
    cfg.continuous = 'no';
    cfg.artfctdef.threshold.min = -100;
    cfg.artfctdef.threshold.max = 100;
    art = ft_artifact_threshold(cfg,data);

    cfg = [];
    cfg.artfctdef.xxx.artifact = art.artfctdef.threshold.artifact;
    data_forERP = ft_rejectartifact(cfg,data);
The error I get:

Error using ft_fetch_data
some of the requested samples occur twice in the data and have conflicting values

Error in ft_artifact_threshold (line 186)
    dat = ft_fetch_data(data,        'header', hdr, 'begsample', trl(trlop,1), 'endsample', trl(trlop,2), 'chanindx', chanindx, 'checkboundary', strcmp(cfg.continuous, 'no'));

Is there a way to adjust the cfg for ft_rejectartifact so that the function will accept that samples do indeed occur twice in the data and that the same sample can have different values in different trials (and data from the correct trial will be fetched)?

Here are a few solutions that I have tried based on other discussion list questions, that I have found to be unsatisfactory or ineffective:

  *   For ft_databrowser, it is possible to use cfg.allowoverlap = 'yes' to avoid errors due to conflicting sample values, but this setting is not available for ft_rejectartifact.
  *   I do not want to remove or adjust the sampleinfo from the data, because I want to be able to relate trials to the original samples if necessary.
  *   I have found that downsampling my signal will lead ft_rejectartifact to reconstruct the sampleinfo assuming that the trials are consecutive segments of a continuous recording, but I do not want to 'hack' my way around the problem in this way.

Hope you can help me out!

Best,
Maria


------------------------------------------------------------------------
Maria den Hartog, MSc | PhD Candidate | Radboud University
Centre for Language Studies | Grammar and Cognition
Working days: Tuesday - Friday | Erasmus Building, Room 8.01


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20231026/877fd5c0/attachment.htm>


More information about the fieldtrip mailing list