Re: Using OnsetSignal/OffsetSignal to send conditional signal at stimulus onset

83 views
Skip to first unread message
Message has been deleted

PHILLIP M Mahoney

unread,
Jan 10, 2017, 9:07:37 PM1/10/17
to e-p...@googlegroups.com
Hi,
Forgive me if you've already considered this, but I think you're looking for "Select Case", here, in place of all of those "ElseIf"s.
Phil

On Tue, Jan 10, 2017 at 8:18 PM, <amandamiche...@gmail.com> wrote:
Hi all,

A search of this group tells me that this is a very popular topic, but I haven't been able to find a solution to this particular issue.

I'm trying to send a TTL trigger at the exact onset of a stimulus in eprime (Standard 2.0). Currently I'm using Writeport, but (as expected) the trigger is sent slight before the stimulus appears on the screen because of the monitor's refresh rate. To remedy this, I've been attempting to use: 

X.OnsetSignalEnabled
X.OnsetSignalPort
X.OnsetSignalData 

X.OffsetSignalEnabled
X.OffsetSignalPort
X.OffsetSignalData

As described in this group and in the PST knowledge base (i.e., https://www.pstnet.com/support/kb.asp?TopicID=1318)

However, the port data/val that I need to send at the onset of the stimulus varies as a function of 1) the type of stimulus (there are 4 types) and 2) the experimental block (there are 5 blocks). In the examples I've seen, the port information is sent through x.OnsetSignalData/x.OffsetSignalData, but I can't figure out how to incorporate conditional logic into this call. Below is a very poor attempt to do so, which (not surprisingly) did not send ttl triggers as expected. This was placed in line directly before the stimulus slide.

ImagePres.OnsetSignalEnabled = True 
ImagePres.OnsetSignalPort = &HE010 
ImagePres.OnsetSignalData = c.GetAttrib("BlockNum") 

If c.GetAttrib("BlockNum") = "1" Then
If c.GetAttrib("ImageType") = "1" Then
Writeport &HE010, 11 
ElseIf c.GetAttrib("ImageType") = "2" Then
Writeport &HE010, 12
ElseIf c.GetAttrib("ImageType") = "3" Then
Writeport &HE010, 13 
ElseIf c.GetAttrib("ImageType") = "4" Then
Writeport &HE010, 14 
End If
ElseIf c.GetAttrib("BlockNum") = "2" Then
If c.GetAttrib("ImageType") = "1" Then
Writeport &HE010, 21
ElseIf c.GetAttrib("ImageType") = "2" Then
Writeport &HE010, 22
ElseIf c.GetAttrib("ImageType") = "3" Then
Writeport &HE010, 23 
ElseIf c.GetAttrib("ImageType") = "4" Then
Writeport &HE010, 24 
End If
ElseIf c.GetAttrib("BlockNum") = "3" Then
If c.GetAttrib("ImageType") = "1" Then
Writeport &HE010, 31 
ElseIf c.GetAttrib("ImageType") = "2" Then
Writeport &HE010, 32
ElseIf c.GetAttrib("ImageType") = "3" Then
Writeport &HE010, 33 
ElseIf c.GetAttrib("ImageType") = "4" Then
Writeport &HE010, 34 
End If
ElseIf c.GetAttrib("BlockNum") = "4" Then
If c.GetAttrib("ImageType") = "1" Then
Writeport &HE010, 41 
ElseIf c.GetAttrib("ImageType") = "2" Then
Writeport &HE010, 42
ElseIf c.GetAttrib("ImageType") = "3" Then
Writeport &HE010, 43 
ElseIf c.GetAttrib("ImageType") = "4" Then
Writeport &HE010, 44 
End If
ElseIf c.GetAttrib("BlockNum") = "5" Then
If c.GetAttrib("ImageType") = "1" Then
Writeport &HE010, 51 
ElseIf c.GetAttrib("ImageType") = "2" Then
Writeport &HE010, 52
ElseIf c.GetAttrib("ImageType") = "3" Then
Writeport &HE010, 53 
ElseIf c.GetAttrib("ImageType") = "4" Then
Writeport &HE010, 54 
End If
End If

ImagePres.OffsetSignalData = 0 
ImagePres.OffsetSignalPort = &HE010 
ImagePres.OffsetSignalEnabled = True 

Does anyone know how to incorporate condition logic into this method of matching stim onset with ttl triggers? (Or is some other method more appropriate?)

Thank you!

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to e-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/5ac9053f-d7d1-471f-97f7-33df61fa79d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Phillip Mahoney, Ph.D.
Professor of English
826 Anderson Hall, Temple University
Philadelphia, PA 19122

amandamiche...@gmail.com

unread,
Jan 11, 2017, 7:13:06 AM1/11/17
to E-Prime
Thanks for your response! I'll look into using select case here. To confirm - that would address the ugliness of the code, but not the issue with the onset stim/trigger timing?

Thanks again!
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/5ac9053f-d7d1-471f-97f7-33df61fa79d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ryan Whitfield

unread,
Jan 11, 2017, 8:23:11 AM1/11/17
to e-p...@googlegroups.com
Try using Task Events for this (as long as you are using EP2 Pro or EP3. It will allow you to do all of this in the property pages for each object rather than scripting and will ensure triggers are sent at stimulus onset. More info for task events is on the support site if you need to see how it is implemented.

Ryan Whitfield

amandamiche...@gmail.com

unread,
Jan 11, 2017, 9:15:37 AM1/11/17
to E-Prime
Unfortunately I'm using eprime 2.0 standard (not pro). From what I've read, Task Events is not available for this version of eprime. But thank you for the response!

amandamiche...@gmail.com

unread,
Jan 11, 2017, 1:07:22 PM1/11/17
to E-Prime
And somehow I've managed to delete the original post. Yikes.

Anyway, I found a solution for anyone who comes across this/a similar issue moving forward (since the original is now deleted, you can view its content in the "show quoted text" section).

I reformatted the inline placement based on this discussion: https://groups.google.com/d/msg/e-prime/XZgbU6-oO9I/8xCoN9qmZaQJ

1) Trigger stim onset inline:

ImagePres.OnsetSignalEnabled = True 
ImagePres.OnsetSignalPort = &HC010  
ImagePres.OnsetSignalData = c.GetAttrib("BlockNum") + c.GetAttrib("ImageType")
sleep 5

2) stim slide

3) reset trigger/offset inline: 
ImagePres.OffsetSignalData = c.GetAttrib("BlockNum") + c.GetAttrib("ImageType")
ImagePres.OffsetSignalPort = &HC010 
ImagePres.OffsetSignalEnabled = True
sleep 5

Thanks to all who checked in!

Cheers,
Amanda
Reply all
Reply to author
Forward
0 new messages