randomizing slide states for affect modulated acoustic startle paradigm

176 views
Skip to first unread message

Elle Waite

unread,
Feb 25, 2020, 9:15:15 AM2/25/20
to E-Prime

Hi there,

I’m pretty new to e-prime and I’d love some help!


I’m working on building a task where participants will see 16 negative and 16 neutral images (presented for 6 sec), with a jitter fixation period before and an emotion rating afterward. These images are split into 2 blocks (each with 8 neg and 8 neu), and each image is presented twice within its block. So this will be 2 blocks of 32 trials each. I’ve used nested lists to organize the images.


In each block, a random set of 24 trials will be accompanied by a startle eliciting probe – half of these probes will start 4 sec after the image begins displaying, and the other half will be 5sec. I’ve built the image + sound as a slide in my trialproc, with 3 slidestates: one without the sound, one with the 4sec delay sound file, and one with the 5sec delay sound file. I tried to use a InLine to fill in a randomly generated “SlideState” attribute that I can enter into the Active State box on the Slide Properties file, but I keep getting an error that the “SlideState” attribute does not exist or that the Active State is invalid.


Once I get this working, I'll also need to add the startle probe to a random set of the inter stimuli intervals, so I plan on using a similar process...


I’d love it if someone could tell me where I went wrong and help me correct it!


I’ve included the InLine language below and my task is linked here: https://drive.google.com/file/d/1wHkWFITgyJZ85aVEKQJxssCKElfy64QE/view?usp=sharing


--

Dim SlideState As String

 

'Select a random number roughley equavelent to a percentage

Dim z As Integer

z = Random (1,100)

 

Const LongLead = "LongLead"

Const ShortLead = "ShortLead"

Const noSound = "noSound"

 

 

'Assign the value of he duration to an attribute

If z <= 25 Then

      c.SetAttrib "SlideState", noSound

ElseIf z <= 62.5 Then

      c.SetAttrib "SlideState", ShortLead

ElseIf z <=100 Then

      c. SetAttrib "SlideState", LongLead

Else

      Debug.Assert False

End If

 

Debug.Print "SlideState"

 

 

Thanks so much

Elle

 

David McFarlane

unread,
Feb 25, 2020, 3:19:39 PM2/25/20
to e-p...@googlegroups.com
Elle,

Your code does look like it properly sets the SlideState attribute, but
I bet that you have run into the "gotchas" discussed at
groups.google.com/d/topic/e-prime/hkEndArSIEA .

Now that I have given a direct answer to the immediate question, I will
take this opportunity to address a few other issues ...


You say that you use a single Slide object with different SlideStates to
present a sound with different delays. For that to work, I imagine that
you have different sound files that start with different periods of
silence. That is a pretty clever solution, and for all I know gives
more precise timing than how I would do it. It does however seem a bit
clumsy to me, although my method may look just as clumsy. I would use a
single startle sound file, with no beginning silence. I would
dynamically set the Duration of my Slide stimulus to the delay value for
the onset of the startle sound, and then just follow that with a
SoundOut object for my startle sound. In order to have some trials with
no startle sound, I might make one Procedure with the startle sound and
another Procedure with no startle sound (as opposed to one Procedure
with some sort of If-Then to skip the sound, or using some sort of
SlideState choice). I suppose others could come up with other
strategies. But if you already have something that works for you, then
you might just want to stick with that.


Your If-ElseIf code presents an example of good programming practice --
any time you use ElseIf, you should always end with a final Else to
catch anything that might escape all the ElseIf clauses, if only as a
sanity check. That said, in this case you could just get rid of the
"ElseIf z<=100" and make that clause the final Else.

That said, your code may fail to do exactly what you want, because the
Random function always selects *with* replacement rather than without
replacement, i.e., it acts like a die roll rather than a shuffled card
deck. In this case, there is nothing to prevent this coming up at
random with no sound for all 32 trials, etc.! You could of course
overcome this by generating a global array and shuffling that. But why
do that when E-Prime will do that for you with a nested List?

So, make a List with three rows, one each for noSound, ShortLead, and
LongLead, or however you want to name these (depending on whether you
stick to your SlideState solution or try my other ideas above). Give
each row a Weight corresponding to how many trials of that you want --
i.e., 8 for noSound, 12 for ShortLead, and 12 for LongLead. Set this
List to Random order, and use it as a nested List for your main trial or
stimulus List so that it will be shuffled separately from that.
(Remember, think of each List as a separate deck of playing cards.)

For more on nested Lists, see Appendix C of the E-Prime Users Guide, or
see "The E-Primer", or take my online E-Prime 2 course -- you can do a
lot with E-Prime Lists if you know how! And once you understand nested
Lists, you might see how to use that for randomizing your ISIs.


One final note, in case you are doing this for fMRI -- in that case you
will also have to pay special attention to stimulus timing across the
whole session (hint: use Cumulative instead of Event timing mode, and
use End Action of "(none)" -- I go over this in my online course).


Now that I have gone over a few general principles, perhaps you can
recombine these to accomplish your mission. Good luck.

-- David McFarlane


On 2020-02-25 Tue 9:15 AM, Elle Waite wrote:
> Hi there,
>
> I’m pretty new to e-prime and I’d love some help!
>
> I’m working on building a task where participants will see 16 negative and
> 16 neutral images (presented for 6 sec), with a jitter fixation period
> before and an emotion rating afterward. These images are split into 2
> blocks (each with 8 neg and 8 neu), and each image is presented twice
> within its block. So this will be 2 blocks of 32 trials each. I’ve used
> nested lists to organize the images.
>
> In each block, a random set of 24 trials will be accompanied by a startle
> eliciting probe – half of these probes will start 4 sec after the image
> begins displaying, and the other half will be 5sec. I’ve built the image +
> sound as a slide in my trialproc, with 3 slidestates: one without the
> sound, one with the 4sec delay sound file, and one with the 5sec delay
> sound file. I tried to use a InLine to fill in a randomly generated
> “SlideState” attribute that I can enter into the Active State box on the
> Slide Properties file, but I keep getting an error that the “SlideState”
> attribute does not exist or that the Active State is invalid.
>
> Once I get this working, I'll also need to add the startle probe to a
> random set of the inter stimuli intervals, so I plan on using a similar
> process...
>
> I’d love it if someone could tell me where I went wrong and help me correct
> it!
>
> I’ve included the InLine language below and my task is linked here:
> https://urldefense.com/v3/__https://drive.google.com/file/d/1wHkWFITgyJZ85aVEKQJxssCKElfy64QE/view?usp=sharing__;!!HXCxUKc!jDNJPRMsqKFvi90cur9DEwFK6nuwfE7RlmeNLZfhmdtUsL1NlZcAzPkJYwKcpUqn$

Elle Waite

unread,
Feb 26, 2020, 12:17:05 AM2/26/20
to E-Prime
Hi David,
 
Thanks so much for your help!  Your suggestion of using nested lists was definitely helpful. I opted for this as it seemed to offer more control than the random with replacement issue that you noted with the inline. However, I'm still having another problem with this method, though the task ran without errors (which is a big win for me at this point!)

So this is the list flow that I currently have.
Trial List
     - no sound (weight: 8)
           - negative (weight: 16)
                - list of 8 negative images, each with a weight of 2
           - neutral (weight: 16)
                - list of 8 neutral images, each with a weight of 2
     - ShortLead (weight: 12; same as above)
     - LongLead (weight: 12; same as above)
 
This worked mostly great: I had the correct number of trials (32), 8 of them were not accompanied by a sound, 12 had the 4sec delay, and 12 had the 5sec delay. The only problem is that 18 negative images and 14 neutral images were displayed (rather than 16 and 16). So some of the negative images were displayed more than twice, while some of the neutral images were displayed only once.
 
Looking at the structure, I can see how this happened, as it prioritized displaying a set number of the sound aspect. And, since I had multiple lists of the negative + neutral image lists, each time with a weight of 2, my images were essentially weighted 6 times (in other words, there were 6 possible ways that image could be displayed in a single session.
 
So, I guess now I'm wondering, how can I make the script strictly follow all the different parameters of the task? These parameters being:
Display a random order of 8 negative and 8 neutral images, with each image presented twice, creating 32 trials total. 8 of those trials will not have a sound (4 will be negative and 4 will be positive), 12 will have a sound w/ a 4 second delay (6 with negative images and 6 with neutral images), and the remaining 12 will have a 5 second delay (again, 6 of these with negative images and 6 with neutral images).
Thanks again!
Elle 

David McFarlane

unread,
Aug 2, 2022, 4:59:38 PM8/2/22
to e-p...@googlegroups.com
Elle,

Apologies for never getting back to you at the time. If I had answered,
I would have pointed you to other threads that discussed randomization
issues, and might have recommended coming up with one suitable
"randomized" order outside of E-Prime and then just running that
sequentially. I hope you managed to sort this out in any case.

-- David McFarlane
> <https://urldefense.com/v3/__http://groups.google.com/d/topic/e-prime/hkEndArSIEA__;!!HXCxUKc!kBezIPLNfIsT7DGT4vKXrCzlq04tC5ouJr5vTLbHCAfiolfKG5kqnAmM4R1QmBr8$>
Reply all
Reply to author
Forward
0 new messages