key press/release & RT

981 views
Skip to first unread message

Courtney Griffin

unread,
Oct 30, 2012, 2:26:31 PM10/30/12
to e-p...@googlegroups.com
Hello all,

I am programming my first experiment with E-Prime and have run into some issues I was hoping that someone might be able to help with. For my experiment I will be having subjects simultaneously hold down two keys (u and o), a stimulus is presented and they are to respond to it by releasing one of the two keys and making a movement to another to respond ({TAB} or {END}). Additionally, I would also like to record movement time (time from release of key to response) and reaction time (time of release of one of the initial keys). So far I have already gone in and allowed both Key Presses and Releases. My issue is actually how to get the program to recognize the release of the key and start recording the time, so I decided to use the Clock.Read function, but I'm not sure exactly how to implement it.
Any assistance with this would be TRULY appreciated. Here is a bit of the code I have come up with, but I know that I am probably nowhere near where I need to be:

Dim kbState As Integer

Do

If Keyboard.GetKeyState("u") = ebStatePress And _
Keyboard.GetKeyState("o") = ebStatePress Then

If kbState = Keyboard.GetKeyState ("{END}")= 0 Then
Clock.Read

ElseIf kbState = Keyboard.GetKeyState ("{TAB}") = 1 Then
Clock.Read - Stimulus.OnsetTime

Courtney Griffin

unread,
Oct 30, 2012, 4:08:41 PM10/30/12
to e-p...@googlegroups.com
basically I want it to go something like this:

at stimulus display, read the clock and get the time (will name this variable T1)
after key release, read the clock and get that time (will name this variable T2)
at key press (final response), read the clock and get that time (will name variable T3)

RT (reaction time) = T2-T1
MT (movement time) = T3-T1

David McFarlane

unread,
Oct 30, 2012, 4:17:19 PM10/30/12
to e-p...@googlegroups.com
Don't know about specifics in this case, just a couple hints for
now. Take a look at the "{key} nomenclature" topic in the E-Basic
Help facility for hints on how to get RTs using key releases with
ordinary stimulus objects. That might get you most of the way, and
if needed you could supplement this with some simple computations in
inline code.

-----
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) PST's trained staff
take any and all questions at
http://support.pstnet.com/e%2Dprime/support/login.asp , and they
strive to respond to all requests in 24-48 hours -- this is pretty
much their substitute for proper documentation, so make full use of
it. 3) In addition, PST takes questions at their Facebook page
(http://www.facebook.com/pages/Psychology-Software-Tools-Inc/241802160683
), and offers several instructional videos there and on their YouTube
channel (http://www.youtube.com/user/PSTNET ) (no Twitter feed yet,
though). 4) If you do get an answer from PST staff, please extend
the courtesy of posting their reply back here for the sake of others.
\----

Courtney Griffin

unread,
Nov 2, 2012, 1:24:06 PM11/2/12
to e-p...@googlegroups.com
David, thank you so much for your help. I was able to read through the Help section and get an idea of how to accomplish what I wanted.

Would you happen to know how to use the Clock.Read function to start as soon as the stimulus is presented (I'm using basic text as my stimulus)?

David McFarlane

unread,
Nov 2, 2012, 4:56:53 PM11/2/12
to e-p...@googlegroups.com
Please do not use Clock.Read to get the starting time of your
stimulus, this will almost never be exact, and is in any case
superfluous. Suppose your text stimulus is named StimText. Then
StimText.OnsetTime already tells you the onset time of the stimulus,
you should use that (see
http://groups.google.com/group/e-prime/browse_thread/thread/39e899d3457d4917 ).

If you think further, you might not even need to do that. If you
have StimText start after the key is pressed down, and have StimText
launch its own "release" input mask, then StimText.RT will already be
the appropriate RT for the release response relative to the onset of StimText.

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




At 11/2/2012 01:24 PM Friday, Courtney Griffin wrote:
>David, thank you so much for your help. I was able to read through
>the Help section and get an idea of how to accomplish what I wanted.
>
>Would you happen to know how to use the Clock.Read function to start
>as soon as the stimulus is presented (I'm using basic text as my stimulus)?
>
>On Tuesday, October 30, 2012 4:19:40 PM UTC-4, McFarlane, David wrote:
>Don't know about specifics in this case, just a couple hints for
>now. Take a look at the "{key} nomenclature" topic in the E-Basic
>Help facility for hints on how to get RTs using key releases with
>ordinary stimulus objects. That might get you most of the way, and
>if needed you could supplement this with some simple computations in
>inline code.
>
>-----
>David McFarlane
>E-Prime training
>online:
><http://psychology.msu.edu/Workshops_Courses/eprime.aspx>http://psychology.msu.edu/Workshops_Courses/eprime.aspx
>
>Twitter: @EPrimeMaster
>(<https://twitter.com/EPrimeMaster>https://twitter.com/EPrimeMaster)
>
>/----
>Stock reminder: 1) I do not work for PST. 2) PST's trained staff
>take any and all questions at
><http://support.pstnet.com/e%2Dprime/support/login.asp>http://support.pstnet.com/e%2Dprime/support/login.asp
>, and they
>strive to respond to all requests in 24-48 hours -- this is pretty
>much their substitute for proper documentation, so make full use of
>it. 3) In addition, PST takes questions at their Facebook page
>(<http://www.facebook.com/pages/Psychology-Software-Tools-Inc/241802160683>http://www.facebook.com/pages/Psychology-Software-Tools-Inc/241802160683
>
>), and offers several instructional videos there and on their YouTube
>channel
>(<http://www.youtube.com/user/PSTNET>http://www.youtube.com/user/PSTNET
>--
>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/-/qqFBuuTyZowJ>https://groups.google.com/d/msg/e-prime/-/qqFBuuTyZowJ.
>For more options, visit
><https://groups.google.com/groups/opt_out>https://groups.google.com/groups/opt_out.
>
>

Michiel Sovijarvi-Spape

unread,
Nov 6, 2012, 5:52:19 AM11/6/12
to e-p...@googlegroups.com
For more options, visit https://groups.google.com/groups/opt_out.


Michiel Sovijarvi-Spape

unread,
Nov 6, 2012, 6:18:40 AM11/6/12
to e-p...@googlegroups.com
Hi,
Just to add, that depends on whatever she means with "basic text" - I'd
agree with you that normally, you'd think this is a textdisplay, but what if
she meant "some text displayed using e-basic"? In other words, canvas,
right?
Generally, the point is that the vertical sync is messed up if you'd just
say
10 c.setattrib textonsettime, clock.read
20 write text to canvas
Because it can take long and short to write things actually to the screen
(also depending on how much you put there). Now, there's two tricks:
1) Display.waitforverticalblank makes sure you have the synchronisation
working (i.e. things aren't appearing halfway)
2) use a second canvas first to write everything to, then copy this canvas
to the active display. The first bit (writing stuff) takes much longer than
just copying the already made pictures.

Does that help? All in all, once upon a time, I loved doing everything in
canvas things, but nowadays (perhaps with less time on my hands), I have as
a rule of thumb: if it CAN be done without code, then do that instead; if it
CAN'T be done without LOTS OF code, there might be better software around
for the purposes. I think this is also a pretty good rule for those with
questions regarding dragging and dropping and whatnot.
Best,

Michiel

-----Original Message-----
From: e-p...@googlegroups.com [mailto:e-p...@googlegroups.com] On Behalf
Of David McFarlane
Sent: 02 November 2012 22:57
To: e-p...@googlegroups.com; e-p...@googlegroups.com
Subject: Re: key press/release & RT

For more options, visit https://groups.google.com/groups/opt_out.


Courtney Griffin

unread,
Nov 6, 2012, 1:03:02 PM11/6/12
to e-p...@googlegroups.com
David, as always, thank you for your helpful suggestions. I will look more into this.

Courtney Griffin

unread,
Nov 6, 2012, 1:05:22 PM11/6/12
to e-p...@googlegroups.com
Michiel, thanks for your input. I had not considered the time it would take to write things. I will look into this.

Courtney Griffin

unread,
Nov 13, 2012, 12:36:39 PM11/13/12
to e-p...@googlegroups.com
Still working on getting this experiment running. I have run into a bit of an issue. I now have two separate programs: 1) my actual stimulus/experiment etc, for the experiment and 2) the simultaneous button pressing portion (see experiment). when i try to merge the two, i.e. after the instructions are presented, I want the the subject to hold down the two buttons simultaneously and then move on to the actual experiment portion for each trial. (so simultaneous button -> stimulus response, simultaneous button -> stimulus response, etc) However, I cannot figure out how order them correctly so that it will do one process first and then the other. Either I keep getting these weird recursive loops or when I try to run the program I think will work, E-Prime force closes. Any assistance would be TRULY appreciated.

Please see links to attachments (get an error when trying to attach to this post directly).




On Tuesday, October 30, 2012 2:26:31 PM UTC-4, Courtney Griffin wrote:
Reply all
Reply to author
Forward
0 new messages