redefinetrial_offset option

Michael Wibral michael.wibral at WEB.DE
Fri Apr 16 13:27:46 CEST 2010


Hi Natalie,

may be I am missing something but the shift by 51 samples implied by

(-)6009 +(-51)

is always to the "left" as you call it - irrespective of the sign of "6009":

6009 +(-51) = 5958 < 6009 (left shift)

-6009 +(-51) = -6060 < -6009 (left shift)


Michael

-----Ursprüngliche Nachricht-----
Von: Natalia Grion <grion at SISSA.IT>
Gesendet: Apr 16, 2010 1:09:28 PM
An: FIELDTRIP at NIC.SURFNET.NL
Betreff: [FIELDTRIP] redefinetrial_offset option

>Hi all,
>         When inspecting in detail "redefinetrial" function I found a
>striking point, I think there is an error on the code that could
>be easily solved but maybe i'm missing something:
> My trials are of fixed length: they go from -3sec to +3sec with 1 trigger
>event as t=0. I want to realign the trials to a new (sub)event, so I
>defined offset as: Nxsamples relative to t=0. For each trial, offset has
>different signs as the event happened either before trigger event
>(-#samples) or after it (+#samples).
>In the code: when having for example -51 (samples relative to trigger)
>data.time is shifted to the left, and this would be correct. But when
>correcting "trial definition" this offset is summed to trl(:,3); the point
>is: my trl(:,3) is negative since is indicating  that the trial begins
>before the trigger, (-)6009 +(-51) results in shifting the offset of
>trigger to the right which is not the case: (possible solution:
>abs(trl(:,3))+(-51).). Then: trl(:,1),trl(:,2) correction is omitted, why?
>as "event" changed, shouldn't beg and ensample follow this change?
>sticking to +/-3sec defined as star/end of trial? In fact, data.time was
>shift. In the rest of the code i don't see any line related to this
>change.
> Any help will be welcome!
>Natalia
>
>.............................
>elseif ~isempty(cfg.offset)
>  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>% shift the time axis from each trial
>  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>offset = cfg.offset(:);
>  if length(cfg.offset)==1
>    offset = repmat(offset, Ntrial, 1);
>  end
>  for i=1:Ntrial
>    data.time{i} = data.time{i} + offset(i)/data.fsample;
>  end
>
>  % also correct the trial definition
>  if ~isempty(trl)
>    trl(:,3) = trl(:,3) + offset;
>  end
>........................................
>
>----------------------------------------------------------------
>  SISSA Webmail https://webmail.sissa.it/
>  Powered by SquirrelMail http://www.squirrelmail.org/
>
>
>
>
>
>----------------------------------------------------------------
>  SISSA Webmail https://webmail.sissa.it/
>  Powered by SquirrelMail http://www.squirrelmail.org/
>
>----------------------------------
>The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.

----------------------------------
The aim of this list is to facilitate the discussion between users of the FieldTrip  toolbox, to share experiences and to discuss new ideas for MEG and EEG analysis. See also http://listserv.surfnet.nl/archives/fieldtrip.html and http://www.ru.nl/neuroimaging/fieldtrip.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Michael Wibral.vcf
Type: text/x-vcard
Size: 628 bytes
Desc: not available
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20100416/5d585754/attachment-0001.vcf>


More information about the fieldtrip mailing list