<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Dear Maria,
<div class=""><br class="">
</div>
<div class="">Thanks for your clear message and diagnostics so far. Just for the clear picture: the error is thrown by ft_artifact_threshold, isn’t it? If I read through the code of this function, I get the impression that you might get yourself back into the
 game, if you specify cfg.continuous = ‘yes’ for the cfg into ft_artifact_threshold. Although, this feels a bit at odds with the representation of the data that you give as an input to the function, because the time-axes of the individual trials clearly is
 not continuous. However, the sampelinfo field of the data object is still consistent with a continuous data representation (on disk). It’s the sampleinfo field that ft_fetch_data uses under the hood to determine the overlapping samples. I think that the error
 will convert into a warning with cfg.continuous = ‘yes’; (unless you have already tried this and can disconfirm my hunch). So, long story short, I’d recommend cfg.continuous = ‘yes’.</div>
<div class=""><br class="">
</div>
<div class="">Best wishes,</div>
<div class="">Jan-Mathijs</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 26 Oct 2023, at 11:31, Hartog, M.M.J. den (Maria) via fieldtrip <<a href="mailto:fieldtrip@science.ru.nl" class="">fieldtrip@science.ru.nl</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
Dear community,</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<br class="">
</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
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. </div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<br class="">
</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
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<span class="Apple-converted-space"> </span><b class="">he<span class="Apple-converted-space"> </span></b>and<span class="Apple-converted-space"> </span><b class="">his<span class="Apple-converted-space"> </span></b>in
 '<b class="">He</b><span class="Apple-converted-space"> </span>looked at<span class="Apple-converted-space"> </span><b class="">his<span class="Apple-converted-space"> </span></b>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.</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<br class="">
</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
The code I use for artifact rejection is:</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<div class="rtcContent" style="padding: 30px;"><span class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;"><span class=""><span class="ContentPasted2">    cfg = [];</span></span></span>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">    cfg.continuous =<span class="Apple-converted-space"> </span></span><span class="ContentPasted2" style="color: rgb(167, 9, 245);">'no'</span><span class="ContentPasted2">;</span></span></div>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">    cfg.artfctdef.threshold.min = -100;</span></span></div>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">    cfg.artfctdef.threshold.max = 100;</span></span></div>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">    art = ft_artifact_threshold(cfg,data);</span></span></div>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">   <span class="Apple-converted-space"> </span></span></span></div>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">    cfg = [];</span></span></div>
<div class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;">
<span class=""><span class="ContentPasted2">    cfg.artfctdef.xxx.artifact = art.artfctdef.threshold.artifact;</span></span></div>
<span class="lineNode" style="font-size: 10pt; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-weight: normal;"><span class=""><span class="ContentPasted2">    data_forERP = ft_rejectartifact(cfg,data);</span></span></span></div>
The error I get:</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<br class="">
</div>
<div class="elementToProof" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Error
 using ft_fetch_data</span>
<div class="ContentPasted1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
some of the requested samples occur twice in the data and have conflicting values</div>
<div style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="ContentPasted1">
</div>
<div class="ContentPasted1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
Error in ft_artifact_threshold (line 186)</div>
<div class="ContentPasted1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
    dat = ft_fetch_data(data,        'header', hdr, 'begsample', trl(trlop,1), 'endsample', trl(trlop,2), 'chanindx', chanindx, 'checkboundary', strcmp(cfg.continuous, 'no'));</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class=""> </span>
<div class="elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
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)?</div>
<div class="elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<br class="">
</div>
<div class="elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
Here are a few solutions that I have tried based on other discussion list questions, that I have found to be unsatisfactory or ineffective:</div>
<div class="elementToProof ContentPasted0" style="font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;">
<ul data-editing-info="{"orderedStyleType":1,"unorderedStyleType":1}" class="">
<li style="list-style-type: disc;" class="">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.</li><li style="list-style-type: disc;" class="">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.</li><li style="list-style-type: disc;" class="">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.</li></ul>
</div>
<div class="elementToProof" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;" class="">
Hope you can help me out!</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;" class="">
<br class="">
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;" class="">
Best,</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;" class="">
Maria</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;" class="">
<br class="">
</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt;" class="">
<br class="">
</div>
<div id="Signature" class="">
<div class="">
<div class="WordSection1">
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 10pt;" class="">------------------------------------------------------------------------</span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 10pt;" class="">Maria den Hartog, MSc | PhD Candidate | Radboud University </span></div>
<div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 10pt;" class="">Centre for Language Studies | Grammar and Cognition<br class="">
Working days: Tuesday - Friday | Erasmus Building, Room 8.01</span></div>
<p class="MsoAutoSig" style="margin-top: 0px; margin-bottom: 0px;"> </p>
</div>
</div>
</div>
</div>
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">fieldtrip
 mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmailman.science.ru.nl%2Fmailman%2Flistinfo%2Ffieldtrip&data=05%7C01%7Cfieldtrip%40science.ru.nl%7C8684386668d54017f87308dbd6c36083%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638339906841784195%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=FEVLnDZ8VZlNHWE%2BhsH9BxytcIDm1mL9jj%2FZMtLiCQw%3D&reserved=0" originalsrc="https://mailman.science.ru.nl/mailman/listinfo/fieldtrip" shash="XHYcVRdPDe4fDPxLwIcx+ULjbtlzmALsxsCGODhbQ9H9tgSzDauyyhe07+xpzgzQeRCj/BXfBgYPIA15oEIQlMHR8QhJJzvdG1MZSlXltCsw1r83wLnjW+okhmMDLaM1j+HXD4/c3YPSMsIIBxQuzrvjPHnG/M83fGEGwg15vJA=" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://mailman.science.ru.nl/mailman/listinfo/fieldtrip</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdoi.org%2F10.1371%2Fjournal.pcbi.1002202&data=05%7C01%7Cfieldtrip%40science.ru.nl%7C8684386668d54017f87308dbd6c36083%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638339906841784195%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=of6nOs6lqZHmvWpT4nBZxA0%2BDFJlx%2Ba1P1%2FQz0tTvs0%3D&reserved=0" originalsrc="https://doi.org/10.1371/journal.pcbi.1002202" shash="SBPDVcrqJbilxHxJM1+KWYUktzVHC4b2OnzuCdE20XkMKDwrG6TNVFh5BmBJMZ0CZtNXFc8kV+TcwMMndW/DdNkoYzV/CTEqznNZGNa/ayuct8lDFMCL4YxkKKd7HzT7J84HAWUVLZxFh1Njtd6QTOVrckz1EcbDsuIiEZ+UdOg=" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">https://doi.org/10.1371/journal.pcbi.1002202</a></div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>