Eprime triggers to EEG out of sync

閲覧: 2,511 回
最初の未読メッセージにスキップ

aldelfino

未読、
2012/08/14 9:37:582012/08/14
To: e-p...@googlegroups.com
Hello everyone,

I'm running an experiment using triggers from Eprime to a BrainVision equipment. I need Eprime to send a trigger according to the position of target-words along the sentence e.g. at 0, 5, or 11 seconds after the beginning of the sentence. I tried used the following script:

WritePort &H378, c.GetAttrib("trigger") 'identifies the item’
              sleep  c.GetAttrib ("delay") 'identifies the position of the target-word after the beginning of the sentence’
              c.SetAttrib  "CheckResponseTime", Clock.Read

I defined two attributes: (i) trigger, as a code to identify the trigger according to each sentence, and (ii) delay, as the time after the beginning of the sentence the trigger should be sent to BrainAmp. After listening each sentence, the subject has to answer a yes-no question to check understanding. The problem is that the BrainVision cannot register the trigger synchronized with the delay attribute, but only with the time the subject hits the answer button.

Does anyone have a solution or an alternative script for my experiment?

Thanks in advance
メッセージは削除されました

Paul Groot

未読、
2012/08/28 16:29:512012/08/28
To: e-p...@googlegroups.com
Hi Matt,
 
I'm not sure if I understand your description completely, but I think that the problem you described is related to the settings of the input mask and terminate action. You probably have a sound or slide object for playing the sentence. I suspect that you added an input mask to this object to record the subject response. When the trigger-script is placed after this object, you will have a problem because the script will be exucuted after the button response in this case. Is this indeed what is happening?
 
If this is the case, you could try to fix it by having a separate response object (such as a Text object) that is placed after the inline script. Instead of using the sleep function, you could set the duration of the sound-object to [delay]. The Sound 'Stop After' property should be set to No. However, the problem with this construction is that it is more difficult to make sure that the response object is displayed after the end of the audio track. (unless all sentences have the same duration). Perhaps the new Task Event mechanism of EPrime 2 will help out here: http://www.pstnet.com/support/kb.asp?TopicID=4803 I haven't used this yet, but I think it should be possible to generate a delayed parallel port write operation.
 
Cheers,
Paul
 
 

 
2012/8/28 Matt Ku <lch...@gmail.com>

aldelfino於 2012年8月14日星期二UTC+8下午9時37分58秒寫道:

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/GCDJ-V3aqTIJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

aldelfino

未読、
2012/09/18 11:08:462012/09/18
To: e-p...@googlegroups.com
Hi Paul,

maybe I haven't stated my problem clearly enough. For now, I decided to change the script. I eliminated the response object and used a Sound object instead of a Slide object. My biggest issue is on how to play a certain audio file and make an associated trigger to be sent to EEG a few milisseconds after the onset of the same audio file. So far, I'm able to send the triggers, but the 'sleep' function delays both audio execution and trigger signal. Is it possible to set up the sleep function only for the trigger? Please find below an updated version of the inline script:

Dim StimTrigger as Integer
Dim StimDelay as Integer
StimTrigger = c. GetAttrib ("Trigger")  'condition-associated trigger
StimDelay = c. GetAttrib ("Delay")  'delay in milisseconds a trigger must be sent to after the onset of the audio file
SoundOut1.OnsetSignalEnabled = True
SoundOut1.OnsetSignalPort = &H378
SoundOut1.OnsetSignalData = StimTrigger
sleep StimDelay (?)


Thanks,

Alexandre.

Paul Groot

未読、
2012/09/18 11:37:442012/09/18
To: e-p...@googlegroups.com
Hi Alexandre

I would advise to use the new EP2-Pro Task Events mechanism here:
http://www.pstnet.com/support/kb.asp?TopicID=4803

No need to do such inline programming anymore with Task Events...

Paul


2012/9/18 aldelfino <alde...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/zS47jDaq0AIJ.

Ryan Blything

未読、
2014/08/30 17:05:532014/08/30
To: e-p...@googlegroups.com
Hi everyone,

I came across this post because I am going to be trying a similar thing in my experiment such that we will be using e-prime v.1 to present audio stimuli and we are interested in setting markers so that they are not just at the onset of stimuli - but also at a number of specific points in each sentence (e.g. onset of the verb, noun, preposition). This would require having several markers for each trial and Im wondering about the best way to go about this? One way is through code but no one seems to have managed to do this successfully that Im aware of. How did it go for any of you? Im quite new to e-prime and SPM (which we will use to analyse data) so I would appreciate any advice before I continue.

An alternative option Ive heard about is post-hoc labelling, which would be done in SPM, post-hoc working from the onset triggers provided by e-prime (and psuedo-marking points later in the sentence). Im not very familiar with SPM but am I right in thinking that as long as the onset of the sentence is marked accurately, then we can - post hoc - set markers anywhere we want in the data thereafter? This may be the most ideal solution because I have 200 sentences, each of which must be labelled separately (so that I can recognise each one). Apparently e-prime is limited to sending out 250 labels so perhaps post-hoc multiple labelling is the answer. I would appreciate any thoughts any of you may have.

Many Thanks,
Ryan

armina

未読、
2014/08/31 7:28:402014/08/31
To: e-p...@googlegroups.com
Hi Ryan,

A few years ago we did it, it's quite simple. Now I am far from my working place and from the needed computer so I cannot tell you the exact InLine and the rest but the idea is the following. We've sent TTL signals from the lamps (you have 5 lamps on the SRB, just flash/sleep them). Each lamp signal was going to a separate channel. So, you have 5 channels to code/mark whatever you want. You may vary duration of the signal, number of the signals, duration between the TTL signals, and the channel. it gives you practically unlimited number of different markers :) you can have several markers for each trial and you never get lost in them. each channel can be set for something particular, say, one channel for sentence onset, another for specific components within the sentence (with each component having its specific marker), etc. This system was easy to structure and to use. Hope it helps.

good luck,

armina

Michiel Sovijärvi-Spapé

未読、
2014/08/31 14:04:052014/08/31
To: e-p...@googlegroups.com

Hi Ryan, et al.,

 

What is “this post”? AFAIK, most people have successfully sent triggers using E-Prime (that’s probably why there are few messages suggesting anything else!), accurately timed, and indeed, the number of publications with EEG and E-Prime must be in the hundreds by now. I have never had a problem with out of sync triggers myself. In general, you always set triggers, and the software used for recoding is insignificant – of course you can change them with MATLAB (using whatever toolbox, e.g. SPM, EEGLAB), but that doesn’t change timing. In general, any EEG amp worth its salt will come with dedicated E-Prime packaged – find them on their website. In other words: post-hoc labelling isn’t an alternative: it’s just a way that you change “124” – the byte sent over parallel port, for instance, to “Stimulus Onset, VERB”.

In general, I use two types of triggers:

*Timing critical: particularly onset of the stimulus. You can use the “.onsetsignalenabled” (not sure about the exact phrase, being out of office at the moment) and so on for that (search here or elsewhere). Only needs to be a bit – the stimulus is ON NOW. This you need to code before the stimulus X happens (e.g. X.onsetsignalenabled). E-Prime then ensures the trigger is sent at the time the monitor refreshes, rather than at some other odd moment that isn’t related to the stimulus.

*Timing non-critical: data, in other words. I send loads of data nowadays with the following:

Writeport outport, 254

Sleep 1 ‘sleep is necessary because triggers can overwrite one another.

 ‘…Then start writing all sorts of more bytes

For i = 2 to 100,

                Writeport outport, i

                Sleep 1

                Writeport outport, 0 ‘to avoid problems with repetitions.

                Sleep 1

Next i

‘ Ending with

Writeport outport, 255

 

(search for outport elsewhere).

The deal is that afterwards, you concatenate the data in between (the …then start writing bit, here resulting in trigger values 2 to 100 being send), so that basically, you can afterwards always recode the Timing critical event using the triggers that precede it.

 

Hope that helps.

Best,

Michiel

--

You received this message because you are subscribed to the Google Groups "E-Prime" group.

To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+u...@googlegroups.com.


To post to this group, send email to e-p...@googlegroups.com.

David McFarlane

未読、
2014/09/02 11:37:242014/09/02
To: e-p...@googlegroups.com
Ryan,

Just a few remarks ...

"Apparently e-prime is limited to sending out 250 labels ..." -- Not
clear if you think that E-Prime may only do signal output events 250
times during a session, or if you think that it may use only 250
different signal values, so to clarify: (1) E-Prime may do any
number of signal output events during a session. (2) Typically, you
output an 8-bit value. Unsigned 8-bit values may range from decimal
0 to 255. You would reserve 0 for an "off" or null value, thus,
ordinarily, E-Prime is "limited" to using 255 unique signal values
(unless you can coax E-Prime into outputting 16-bit signals, in which
case it will use 65,535 unique signal values). Not sure why you
would need a unique signal value for each event during a session
anyway, typically you reuse signal values on different trials just to
signify general categorical information (stimulus onset, etc.).

Post-hoc labelling -- If you can output one signal at a known time
relative to stimulus onset, and if all your later markers come at
known offsets from that, then it should be straightforward to send
the first marker at run time (which you already know how to do in
E-Prime), and add the remaining markers later during analysis. Sure,
it might be slick to have E-Prime do all this at run time, but I
don't think it is worth the trouble.

As far as getting E-Prime 1 to do this at run time anyway, these
threads may be of some interest (even though they refer to outputting
signals relative to the time of response instead):

https://groups.google.com/d/topic/e-prime/z8PQMH1cf70
https://groups.google.com/d/topic/e-prime/7w5ajYuHqgw

-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (https://twitter.com/EPrimeMaster)

/----
Stock reminder: 1) I do not work for PST. 2) You may reach PST's
trained staff (and other support facilities) at
https://support.pstnet.com . 3) If you do get an answer from PST
staff, please extend the courtesy of posting their reply back here
for the sake of others.
\----

Jenna Luque

未読、
2015/09/21 13:24:492015/09/21
To: E-Prime
Paul (and anybody else):

3 years later, I have found this post while trying to figure out my own experiment. Basically, I have 6 words being presented auditorily, and to reduce delay I have concatenated them all into one sound file (my delays were around 100ms before each sound, and now it is 100ms before the whole train of sounds). I want the trigger to play out at the onset of the final word, but using task events, it looks like I cannot specify what I want the trigger to say (I have 72 different triggers) or have a variable amount of delay (it seems like you choose one delay value and it applies that to all trials). Is there a way to have the task event reference my stimuli lists to decide what trigger to send and when to send it, on a per trial basis. 

On another note, if anybody knows why I am getting such big delays, feel free to weigh in on that. I can make them go away by prereleasing, but that also messes up when the trigger gets sent, so I can't use that solution. 

Thanks!

-Jen

David McFarlane

未読、
2015/09/21 17:09:032015/09/21
To: e-p...@googlegroups.com
Jen,

You may use attribute references (e.g.
[TrigValue], [TrigDelay]) for Delay and Custom in
Task Events, just like you can use attribute
refrences to control lots of things in
E-Prime. So then you just add your trigger
delays & values as ordinary attributes in your
stimulus or trial List, just like everything
else. But don't take my word for this, please try it and report back!

That all works as long as the object knows what
values to use before the object runs, which
applies in your case. For cases where you do not
know what value to use until after the object
starts (e.g., outputting a trigger value that
depends on what response a subject gave), you
have to use a bit more trickery. You could
resort to WritePort in inline code, but recently
we got around this just by adding a Wait object
with Duration of 0 just after the response
period, and used Task Events on that to output
the value (maybe with a bit of inline code ahead
of it just to set an atttribute with the value to send).


Anyway, as for sound onset delays ... Do you
mean an OnsetDelay as reported by E-Prime, or a
real delay from the time that E-Prime tells the
sound to start until the sound actually starts
(measured, e.g., with an oscilloscope or a Black Box Toolkit)?

If the former, then yes, judicious use of
PreRelease, and perhaps Generate PreRun =
TopOfProcedure, should bring down the
OnsetDelay. I cannot think of why that would
mess up your trigger timing. Also, make sure
that your sounds have Onset Sync set to "(none)",
otherwise you get an additional onset delay as
your program needlessly waits for a screen refresh.

If the latter, then you need to work with your
sound subsystem. Under Windows XP, we could get
the sound onset latency only down to, say, 15 ms,
which was not good enough for our purposes (don't
quote me on that, I'm drawing this from memory,
the realy latency might have been even
longer). We got better results when we switched
to Windows 7 with EP2.0.10 and used the optimal
sound API (CoreAudio) for the Sound device. But
for the ultimate in sound latency performance,
spend some money and get the new Chronos device
from PST, which can output sound stimuli with
latencies under 1 ms -- http://www.pstnet.com/hardware.cfm?ID=240 .

-----
David McFarlane
E-Prime training
online: http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter: @EPrimeMaster (https://twitter.com/EPrimeMaster)


At 9/21/2015 01:24 PM Monday, Jenna Luque wrote:
>Paul (and anybody else):
>
>3 years later, I have found this post while
>trying to figure out my own experiment.
>Basically, I have 6 words being presented
>auditorily, and to reduce delay I have
>concatenated them all into one sound file (my
>delays were around 100ms before each sound, and
>now it is 100ms before the whole train of
>sounds). I want the trigger to play out at the
>onset of the final word, but using task events,
>it looks like I cannot specify what I want the
>trigger to say (I have 72 different triggers) or
>have a variable amount of delay (it seems like
>you choose one delay value and it applies that
>to all trials). Is there a way to have the task
>event reference my stimuli lists to decide what
>trigger to send and when to send it, on a per trial basis.Â
>
>On another note, if anybody knows why I am
>getting such big delays, feel free to weigh in
>on that. I can make them go away by
>prereleasing, but that also messes up when the
>trigger gets sent, so I can't use that solution.Â
>
>Thanks!
>
>-Jen
>
>On Tuesday, September 18, 2012 at 11:37:44 AM UTC-4, Paul Groot wrote:
>Hi Alexandre
>
>I would advise to use the new EP2-Pro Task Events mechanism here:
><http://www.pstnet.com/support/kb.asp?TopicID=4803>http://www.pstnet.com/support/kb.asp?TopicID=4803
>
>No need to do such inline programming anymore with Task Events...
>
>Paul
>
>
>2012/9/18 aldelfino <alde...@gmail.com>
>Hi Paul,
>
>maybe I haven't stated my problem clearly
>enough. For now, I decided to change the script.
>I eliminated the response object and used a
>Sound object instead of a Slide object. My
>biggest issue is on how to play a certain audio
>file and make an associated trigger to be sent
>to EEG a few milisseconds after the onset of the
>same audio file. So far, I'm able to send the
>triggers, but the 'sleep' function delays both
>audio execution and trigger signal. Is it
>possible to set up the sleep function only for
>the trigger? Please find below an updated version of the inline script:
>
>Dim StimTrigger as Integer
>Dim StimDelay as Integer
>StimTrigger = c. GetAttrib ("Trigger")Â 'condition-associated trigger
>StimDelay = c. GetAttrib ("Delay")Â 'delay in
全員に返信
投稿者に返信
転送
新着メール 0 件