redefinetrial_offset option

Natalia Grion grion at SISSA.IT
Fri Apr 16 14:42:01 CEST 2010


Hi Michael,
When I wrote possible solution i meant: -(abs(trl(:,3))+(-51)) = -5958,
which is conceptually different from -6060.
In "definetrial" function when declaring trl(:,3)= - 6009 means that
1)trial start before trigger event (negative sign) and 2)the offset of
trigger is 6009 samples away with respect to the "begining" of the trial:
in sum: that the trial starts 6009 steps before trigger. If the sub-event
to which i want to realign happens 51 steps before trigger, then number of
steps with respect to t=0 are "-" 51, and this is applied when defining
data.time in the code of redefinetrial. But when redefining trl(:,3),
trigger  should get "closer" to beginning of trial, as beginning of trial
is still the old one. If what i' saying is correct, then also trl(:,1) and
(:,2) has to be modified relative to the new "sub-event".
Any reply will be great.
Natalia


> 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.


----------------------------------------------------------------
  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.



More information about the fieldtrip mailing list