275ch CTF stimulus channel

Robert Oostenveld r.oostenveld at FCDONDERS.RU.NL
Fri May 6 09:21:48 CEST 2005


Hi Sanja,

<--let's move our email exchange over towards the discussion list-->

On 5 May 2005, at 22:50, Sanja Kovacevic wrote:

> Thank you for helping me with this. I changed the filetype and
> read_ctf_res.m files as you suggested, and I was able to read in the
> data, however now I got problem with definetrial.m. Actually, I think
> the problem is with read_ctf_trigger as the 275 CTF dataset does not
> have a channel named 'STIM' but 'UPPT001' (line 63 in
> read_ctf_trigger). That was easy to fix by replacing STIM with
> UPPT001.
>
> However, I don't understand why you use (line 70 and 71 in
> read_ctf_trigger.m)
>
> bpstim = fix(stim / 2^16);
> fpstim = double(bitand(uint32(stim), 2^16-1));

WHen I started at the donders and implemented this, I was told that our
151 ch system has a "frontpanel" and a "backpanel". I never looked very
acurately at the electronics cabinet and all the cables that go into
it, but I guess that they refer to the way in which the cabinet is
placed in our lab. Somehow, the CTF system's own triggers are put on
the frontpanel, and the triggers that are generated on the stimulus PC
are put on the backpanel. Since people write their stimulus programs on
the presentations pc, and define/write trigger values in the 16
bit-range on that computer. They appear in the higher 16 bits of the 32
bit STIM channel, which is confusing since then the values don't match
the ones on the presentation computer. Therefore the 16 lowest and 16
highest bits are separated and treated separately. On line 70, the
highest 16 bits are shifted downward by 16 bits (i.e. divide by 2^16).
On line 71, the highest 16 bits are masked away, keeping only the
lowest 16 bits.

> The trigger values on our CTF system use lower 8 bits, i.e. possible
> values of the triggers are from 0 to 255. I am now quite confused with
> what happens to my trigger values. The bottom line is that I have all
> zeroes for backpanel and frontpanel.

I think that you should look at the so called "frontpanel" triggers
(whose bits are not shifted).

> BTW, could you give me or point to an example of a user specified
> trialfun that would include trials where trigger with value of 10 ir
> trigger with value of 138 occurs?

You mean either a 10 or a 138? Just from my head:

function [trl] = trigger138(cfg)
hdr      = read_fcdc_header(cfg.dataset);
event    = read_fcdc_event(cfg.dataset);
trl      = [];
prestim  = 0.1;
poststim = 0.5;
for i=1:length(event)
   if strcmp(event(i).type, 'frontpannel trigger')
     if (event(i).value==10) | (event(i).value==138)
        % found trigger of interest
        trl(end+1,1) = event(i).sample - prestim*hds.Fs;
        trl(end  ,2) = event(i).sample + poststim*hds.Fs;
        trl(end  ,3) =                 - prestim*hds.Fs;
     end
   end
end

You could put prestim and poststim (time in seconds) in the cfg
structure, to keep the function more flexible. From this example, you
caneasily  to make a conditional function, i.e. find the sample at
which a trigger 138 occurred and which was preceded by a trigger 10.

Alternatively, you can also use the standard code, i.e. without a
custom trialfunction, to achieve the same. Try this:

cfg = [];
cfg.dataset = 'something.ds';
cfg.trialdef.eventtype  = 'frontpannel trigger';
cfg.trialdef.eventvalue = [10 138];
cfg.trialdef.prestim    = 0.1;
cfg.trialdef.poststim   = 0.5;
cfg = definetrial(cfg);

best regards,
Robert



More information about the fieldtrip mailing list