Trigger (stimulus) codes sent on response to EEG recording

David McFarlane mcfarla9 at msu.edu
Tue Apr 3 21:42:55 UTC 2012


Ooh, I did not think about Task Events having a 
limited range of output options, thanks for 
acting the pioneer and reporting back.  I cannot 
think of any way around that, so your best bet is 
PST Web Support.  We also use ActiView/Biosemi, 
so I can confirm that for input it takes only 
8-bit values, i.e., integers in the range 0-255 (aka &h00 to &hFF).

The bit of generated code that you supply does 
not give us much hope either, it seems to confirm 
that Task Events allows only a limited range of 
fixed "Action" items.  BTW, the "ebUCase_W" etc. 
that you mention may be part of PST's effort to 
reduce the use of quoted strings so as to avoid 
"Script too big" problems, if you look in the KB 
you can find some articles about this.

So offhand I agree that your best bet is your 
plan to output a simple signal at the time of 
response and then follow that with a later signal 
for the coded response value.  Just one hint, if 
the signal on the output line is usually 0, then 
the external equipment will not see another 0 
output because there is no change on the output, 
you have to output something different (I explain 
this in my fMRI & EEG lesson).

BTW, I cannot resist a little programming style 
note.  The conventional way to indent your If-ElseIf-End If would be

If TaskImage.RESP = "l" Then
     resp = 55
ElseIf TaskImage.RESP = "s" Then
     resp = 56
ElseIf TaskImage.RESP = "o" Then
     resp = 57
ElseIf TaskImage.RESP = "w" Then
     resp = 58
ElseIf TaskImage.RESP = "" Then
     resp = 59
Else
     resp = 60
End If

At least you use ElseIf -- you wouldn't believe 
how many people I see do this with an ugly and 
inefficient sequence of plain If-Then-End If statements.

Regards,
-- David McFarlane


At 4/3/2012 04:43 PM Tuesday, JDB wrote:
>I'm glad to hear from someone else that the code 
>appears to work. I do wish it were more 
>efficient, but I don't have the budget to do the 
>online course, for the moment.
>
>I've followed David's suggestion and upgraded to 
>E-Prime 2.0.10 Professional (it was time), which 
>does indeed have Task Events that seem to fit my 
>needs. The problem is that the TaskImage.RESP is 
>not a number, which is (I believe) what my 
>external device needs—it's a letter. I don't 
>think I can use an IF,Then statement in the 
>parameters under Task Events. Am I missing something?
>
>One option I can think of is to send the 
>accuracy (a 1 or 0) when the participant 
>responds as a Task Event, and to send the 
>numeric code for response at the Offset via InLine code (as before).
>
>Better, though, would be to now code using the 
>code it generates from the Task Events. Is this 
>possible? When I Generate the experiment, the relevant lines are:
>If ParallelPort.GetState() = ebStateOpen Then
>
>TaskImage.Tasks.Add 
>ParallelPort.CreateTask("TaskImage.Keyboard(1).Press", 
>0, WriteByteACC, , Long, CLogical(Yes))
>
>End If
>
>
>(I've written out "WriteByteACC"—E-Studio writes 
>it as "ebUCase_W, ebLCase_r", etc. I'm copying 
>from another computer, but I'm also not sure 
>whether the eb?Case letter-names are necessary.)
>
>In any case, could I insert this as InLine code 
>instead (before the TaskImage), and include the 
>code I suggested above (*updated below)? Or 
>should I instead look into the other links 
>recommended (e.g., using the IsPending() function)? Any thoughts?
>
>Barring suggestions, I will of course contact 
>PST staff [and post their response here].
>
>Thanks!
>
>* Code to insert:
>
>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>' InLine - Code START
>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>If TaskImage.RESP = "l" Then
>         resp = 55
>     ElseIf TaskImage.RESP = "s" Then
>         resp = 56
>     ElseIf TaskImage.RESP = "o" Then
>         resp = 57
>     ElseIf TaskImage.RESP = "w" Then
>         resp = 58
>     ElseIf TaskImage.RESP = "" Then
>         resp = 59
>     Else resp = 60
>End If
>
>If ParallelPort.GetState() = ebStateOpen Then
>TaskImage.Tasks.Add 
>ParallelPort.CreateTask("TaskImage.Keyboard(1).Press", 
>0, WriteByte(custom), resp, Integer, CLogical(Yes))
>
>End If
>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>' InLine - Code END
>''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
>
>
>
>
>On Thursday, March 22, 2012 4:32:25 PM UTC-4, McFarlane, David wrote:
>If you use EP2.0.10.182 *Professional* or later then you are in luck
>-- see the new Task Events feature documented at
><http://www.pstnet.com/support/kb.asp?TopicID=4803>http://www.pstnet.com/support/kb.asp?TopicID=4803 
>.  (Remember, I
>have uniformly advised everyone to spend the extra money for
>Professional, no matter what PST advises.)
>
>If you do not have EP2.0.10.182 Pro, then you might look at
><http://groups.google.com/group/e-prime/browse_thread/thread/cfc3d0307d5c7fbd>http://groups.google.com/group/e-prime/browse_thread/thread/cfc3d0307d5c7fbd 
>
>and
><http://groups.google.com/group/e-prime/browse_thread/thread/ef0e5a8d8b87aa0c>http://groups.google.com/group/e-prime/browse_thread/thread/ef0e5a8d8b87aa0c 
>
>for hints.  Or, of course, take this up with PST Web Support at
><http://support.pstnet.com/e%2Dprime/support/login.asp>http://support.pstnet.com/e%2Dprime/support/login.asp 
>, where they
>strive to respond to all requests in 24-48 hours.  And if you do get
>an answer from PST staff, please extend the courtesy of posting their
>reply back here for the sake of others.
>
>BTW, although your particular inline code for the stimulus signal
>works well enough (which is a virtue), it suffers in efficiency.  I
>have an entire lesson about handling these sorts of things in my
>online course (although that lesson does not address your precise
>response signal question).
>
>-----
>David McFarlane
>E-Prime training
>online: 
><http://psychology.msu.edu/Workshops_Courses/eprime.aspx>http://psychology.msu.edu/Workshops_Courses/eprime.aspx
>Twitter:  @EPrimeMaster 
>(<http://twitter.com/EPrimeMaster>twitter.com/EPrimeMaster)
>
>
>At 3/22/2012 03:52 PM Thursday, you wrote:
> >I'm working on a project that involves interfacing an E-Prime
> >experiment with the ActiView/Biosemi interface for EEG recording.
> >
> >I have this in the UserScript:
> >Const Sport as Integer = &H378
> >
> >Every time an image appears, this code is sent immediately before:
> >
> >InLine:
> >Intermediary.OnsetSignalEnabled = True
> >Intermediary.OnsetSignalPort = Sport
> >Intermediary.OnsetSignalData = c.GetAttrib("IntermediaryCode")
> >
> >Intermediary.OffsetSignalData = 0
> >Intermediary.OffsetSignalPort = Sport
> >Intermediary.OffsetSignalEnabled = True
> >
> >This works fine. The task then presents the participant with images,
> >to one of which they respond; the image is on-screen for 500ms,
> >followed by a fixation cross for another 500ms. They can respond at
> >any point, but the image & cross are on-screen for a set amount of
> >time. What I'd like is for the stimcode to be sent as soon as possible
> >after the response. I've been successful in sending a response code
> >after fixation cross goes away, using the following code:
> >
> >InLine:
> >If TaskImage.RESP = "l" Then
> >         resp = 55
> >     ElseIf TaskImage.RESP = "s" Then
> >         resp = 56
> >     ElseIf TaskImage.RESP = "o" Then
> >         resp = 57
> >     ElseIf TaskImage.RESP = "w" Then
> >         resp = 58
> >     ElseIf TaskImage.RESP = "" Then
> >         resp = 59
> >     Else resp = 60
> >End If
> >
> >FixationCross2.OnsetSignalEnabled = True
> >FixationCross2.OnsetSignalPort = Sport
> >FixationCross2.OnsetSignalData = resp
> >
> >FixationCross2.OffsetSignalEnabled = True
> >FixationCross2.OffsetSignalPort = Sport
> >FixationCross2.OffsetSignalData = 0
> >
> >However, this only works by sending itself at the beginning of a new
> >fixation cross. Ideally, subject responses would be sent WHEN they
> >respond. But I can't figure out how to do that. Is there some function
> >equivalent to "OnResponse"? It seems like it should be possible, but
> >I'm not sure how to do it.
> >
> >Thanks for your help!

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list