[FieldTrip] cfg.offset cutting randomly trial length

Zlatomira Ilchovska ZXI820 at student.bham.ac.uk
Tue Apr 18 14:32:18 CEST 2023


Good afternoon,

I'm using cfg.offset as an option in ft_redefinetrial, for the purpose of offsetting my t=0 to the response time for each trial. My problem is that after doing this successfully, some of my trials are cut at the ends "randomly" (e.g., instead of being -0.15sec. +1.55sec. around the new zero point, some are quite randomly cut to, for instance, -0.01sec. +1.0sec. around the new zero time). I am sure that my original trial length before offsetting is long enough to allow for a -0.15sec. +1.55sec. around the new "offset" zero point. So it's not a matter of that. I can't seem to figure out where the problem is though. Here is the code I use:

r500=[1.249;0.99;0.012;1.003;0.868;0.904;0.761;0.75;0.59;1.034;1.137;1.077;0.46;1.833;0.029;1.167;0.907;1.154;0.926;1.386;0.864;0.898;0.864;0.205;1.203;0.943;0.75;1.035;0.953;0.803;0.849;1.126;0.953;1.169;0.86;0.921;1.079;1.003;0.735;0.798;1.101;0.893;0.857;0.906;0.737;0.876;0.993;0.984;0.968;1.04;0.948;0.925;0.866;1.126;1.278;0.933;0.988;0.814;0.841;0.744;1.289;1.29;1.016;1.333;1.08;0.723;1.207;0.83;0.981;0.949;0.839;1.017;1.061;0.681;0.763;1.012;1.327;1.051;1.137;0.888;1.165;1.077;1.248;0.987;0.841;1.016;1.208;0.914;1.286;1.068;1.451;1.337;0.909;1.536;1.495;1.496;1.033;1.082;1.139;0.895;0.892;1.038;0.739;1.726;1.353;1.259;0.922;1.155;0.926;0.956;1.167;1.233;0.824;0.849;1.048;1.28;1.006;0.929;0.801;0.831;1.1;0.894;1.499;0.903;1.154;1.212;0.839;1.209;1.069;1.124;0.936;0.824;0.923;1.15;1.302;0.907;1.422;1.251;0.791;1.13;1.052;0.893;0.885;0.822;1.328;1.138;1.086;1.573;1.084;0.888;1.295;0.987;0.876;1.441;0.971;1.045;1.524;1.121;1.081;1.133;0.984;0.757;1.307;1.183;1.528;0.942;1.06;1.167;0.887;1.068;1.041;0.842;1.202;1.536;1.156;1.233;1.36;0.944;1.34;0.844;1.013;1.034;0.686;0.897;1.28;1.122;1.105;1.206;1.085;1.037;1.169;0.919;0.844;0.869;1.177;0.836;0.737;0.897;0.692;1.509;1.341;1.387;0.74;1.44;1.149;1.067;0.979;0.951;1.068;1.78;1.033;1.281;1.273;1.63;1.007;1.151;0.819;1.718;1.178;1.116;0.941;1.403;1.142;1.406;0.941;0.866;0.844;1.087;0.951;0.945;1.244;1.04;0.856;1.055;0.945;0.821;1.057] %the RTs for one example participant

p500=[1;0;1;1;0;1;1;1;1;1;1;0;1;1;1;1;0;0;1;1;1;1;1;1;0;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;0;1;1;1;1;1;0;1;1;0;1;1;1;1;1;1;1;1;1;1;0;0;1;0;0;1;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;0;1;1;0;1;1;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;0;1;1;1;1;0;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;0;1;1;1;1;1;1;1;1;1;0;1;0;1;1;1;1;1;1;0;0;1;1;1;0;1;1;1;1;0;1;1;1;1;1;1;1;0;1;1;1;0;1;1;1;1;1;1;1;0;0;1;1;1;1;1;1;0;0;1;0;1;1;0;1;1;1;1;1;1;1;1;1;0;0;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;1;0;1;0;1;1;1;1;0;1;1;1;1;0;1;1;1] %the correct trials for one example participant

cfg=[];
cfg.trials=p500
data_RT_corr = ft_redefinetrial(cfg, data_RT) %here I just select the trials that are correct and hence have a response time

rts_code = round(r500*500) %here I transform my RTs from seconds to samples (my sampling rate is 500 Hz)
cfg.offset = rts_code
data_RT_corr_offset = ft_redefinetrial(cfg, data_RT_corr); %here is where I offset to the new t=0 for each trial

% Now make the epochs until +1.55 sec after the new t=0:
cfg = [];
cfg.toilim = [-0.150 1.550]
data_RT_corr_offset = ft_redefinetrial(cfg, data_RT_corr_offset); %adjust the epoch length

Any suggestions would be very much appreciated. Thank you!

Best,

Zlati

PhD Researcher
School of Psychology
University of Birmingham

Please note that I am currently working more flexibly, which may result in sending and responding to emails out of hours, but there is no expectation on you to do the same.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20230418/aea75a3b/attachment.htm>


More information about the fieldtrip mailing list