<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style>
</head>
<body lang="en-DE" link="#0563C1" vlink="#954F72" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Hi Fieldtrip community, <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">I’m reaching out with a question about a warning I encountered when redefining trial length from resting-state MEG data using ft_definetrial and ft_redefine trial.
<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Namely, I redefined the length of input data from a resting-state MEG file from two-second trials to longer trials of 10-second length. I successfully used the ft_definetrial and ft_redefinetrial functions to do so, using the ‘trl’ field from the
struct where I define the trial to input as a configuration for the ft_redefinetrial function.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">With the two-second length I have 144 trials from the data, while with the ten-second length there are 28 trials.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The pipeline and structs look like the following: <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">%% define trials with 10-second length <o:p></o:p></p>
<p class="MsoNormal">clear ten_seconds;<o:p></o:p></p>
<p class="MsoNormal">cfg = [];<o:p></o:p></p>
<p class="MsoNormal">cfg.dataset = restfile; % refers to resting-state file of a single subject<o:p></o:p></p>
<p class="MsoNormal">cfg.trialdef.beginning = 0; % start at the beginning of the recording<o:p></o:p></p>
<p class="MsoNormal">cfg.trialdef.length = 10; % 10-second trial length<o:p></o:p></p>
<p class="MsoNormal">cfg.trialdef.overlap = 0; % no overlap between trials<o:p></o:p></p>
<p class="MsoNormal">ten_seconds = ft_definetrial(cfg);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">%% redefine trials to 10 seconds<o:p></o:p></p>
<p class="MsoNormal">clear redef_data;<o:p></o:p></p>
<p class="MsoNormal">cfg = [];<o:p></o:p></p>
<p class="MsoNormal">cfg.trl = ten_seconds.trl; % use trl from defined trial<o:p></o:p></p>
<p class="MsoNormal">redef_data = ft_redefinetrial(cfg,data);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">%% preprocess redefined 10-second trials<o:p></o:p></p>
<p class="MsoNormal">clear ten_sec_trls;<o:p></o:p></p>
<p class="MsoNormal">cfg = [];<o:p></o:p></p>
<p class="MsoNormal">cfg.demean = 'yes';<o:p></o:p></p>
<p class="MsoNormal">cfg.baselinewindow = 'all';<o:p></o:p></p>
<p class="MsoNormal">% cfg.baselinewindow = [0 1018];<o:p></o:p></p>
<p class="MsoNormal">ten_sec_trls = ft_preprocessing(cfg,redef_data);<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">These are the associated structs with their fields:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">redef_data = <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">fsample: 508.6275<o:p></o:p></p>
<p class="MsoNormal">grad: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal">label: {244×1 cell}<o:p></o:p></p>
<p class="MsoNormal">cfg: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal">hdr: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal">trial: {1×28 cell}<o:p></o:p></p>
<p class="MsoNormal">time: {1×28 cell}<o:p></o:p></p>
<p class="MsoNormal">trialinfo: [28×2 double]<o:p></o:p></p>
<p class="MsoNormal">sampleinfo: [28×2 double]<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">ten_sec_trls = <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">fsample: 508.6275<o:p></o:p></p>
<p class="MsoNormal">grad: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal">hdr: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal">trialinfo: [28×2 double]<o:p></o:p></p>
<p class="MsoNormal">trial: {1×28 cell}<o:p></o:p></p>
<p class="MsoNormal">time: {1×28 cell}<o:p></o:p></p>
<p class="MsoNormal">label: {244×1 cell}<o:p></o:p></p>
<p class="MsoNormal">cfg: [1×1 struct]<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">When I plug the redefined data (i.e., with redefined length, ten_sec_trls) into ft_timelockanalysis, I receive the
<span lang="EN-US">following </span>warning:<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Warning: data contains NaN values <o:p></o:p></p>
<p class="MsoNormal"> In ft_preproc_polyremoval at line 75<o:p></o:p></p>
<p class="MsoNormal"> In ft_preproc_baselinecorrect at line 52<o:p></o:p></p>
<p class="MsoNormal"> In ft_timelockanalysis at line 174<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">the call to "ft_selectdata" took 0 seconds and required the additional allocation of an estimated 22 MB<o:p></o:p></p>
<p class="MsoNormal">Warning: inconsistent sampleinfo <o:p></o:p></p>
<p class="MsoNormal"> In makessense at line 115<o:p></o:p></p>
<p class="MsoNormal"> In ft_datatype_timelock at line 72<o:p></o:p></p>
<p class="MsoNormal"> In ft_checkdata at line 479<o:p></o:p></p>
<p class="MsoNormal"> In ft_timelockanalysis at line 207<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’ve run a loop over the trial field in the output of the ft_timelockanalysis as well as ft_preprocessing to check for NaNs in my 10-second data structs, but I didn’t find any when running this loop.<span lang="EN-US"> I’ve checked the
relevant lines from the Fieldtrip functions but couldn’t find a way to solve the warning from there.
</span>I’ve also checked the sampleinfo, but I sense the warning may be due to the sampleinfo in the configuration being inconsistent with the actual data due to the removal of non-MEG channels from the sampleinfo in the resting file.<span lang="EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The warning message might influence later analyses, so I’m wondering if anyone has faced the same and/or has an explanation. <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks a lot in advance!<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">All the best,<br>
Marta<o:p></o:p></p>
</div>
</body>
</html>