Randomizing image position in a slide object

1,749 views
Skip to first unread message

gilis

unread,
Feb 22, 2010, 9:44:09 AM2/22/10
to E-Prime
Hi to all again,

Appologize for bothring the forum again, but it's not a too hard one I
hope:
I want the computer to randomly present the stimuli in the center,
left or right side
of the display.

I know that it can be done easily by adding attribute ("side") in the
trial list with values of left right or center and then to define the
X axis of the image in the slide object as [side] and that's all.

However, this method means that I have to insert manualy all different
combinations -and it's not an elegant solution.

I tried to define side as a new attribute in an inline object this way

c.SetAttrib "side", RandomizeArray(1,3,4)

of course-it didn't work and I tried many different configurations and
randomization commands. With which command can I randomize left,
center and right?


Thanks,
Gilis

Tobias

unread,
Feb 22, 2010, 10:59:16 AM2/22/10
to E-Prime
Hi Gilis,

I think this should work: Have an attribute in the list, let's say
"posX". Refer to the x values of the bitmaps with [posX]. If I
understood you correctly, the y value is not to be changed. If yes,
this can also be done without problems.

Well, have an inline like this before the display appears:

dim x as integer
x = random(1,3)
if x = 1 then c.setattrib "posX", 200
if x = 2 then c.setattrib "posX", 400
if x = 3 then c.setattrib "posX", 600

This will set posX randomly to 200, 400 or 600 and of course you can
change these values.
However, if you really want to make sure that each subject had each
condition equally often, you should go for setting this in the list.
This is imho the more elegant way ;)

Best,
Tobias

Michiel Spape

unread,
Feb 22, 2010, 11:13:09 AM2/22/10
to e-p...@googlegroups.com
Hi Gilis,
What may be unelegant programming-wise, I often find much better psychologically, for some reason! That is, yes, it seems like an awful lot to tell a programme to use "red", "green", "blue" for a Stroop task and then having to bother with setting all 9 combinations, rather than, for example, setting one attribute (congruence) and using a little script to randomly set colours and words. Still, I would advise you to use the list anyway; it provides much more clarity for yourself and others, its randomising tends to give better results than randomizing with replacement, and, well, you don't need to learn so much E-Basic programming.

Anyway, we have discussed randomising location fully and thoroughly in the seminal E-Primer (www.cognitology.eu, under references) and the easiest would be just to use percentage. I don't see where 'side' comes in... Just use two attributes [XLoc], [YLoc] if you will, use % values in your list and voila.

"c.SetAttrib "side", RandomizeArray(1,3,4)"
...makes very little sense. If you are using "Side" to set your location, why do you want to fill it (I guess) with 1, 3 or 4? Are those pixels? 3 is about 2 pixels to the right of 1... Are you trying to randomize a list? If you have many combinations, I suggest looking up nested lists in the user guide / getting started guide.
Cheers,
Mich


Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology

Hi to all again,

c.SetAttrib "side", RandomizeArray(1,3,4)


Thanks,
Gilis

--
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.
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.

David McFarlane

unread,
Feb 22, 2010, 11:35:02 AM2/22/10
to e-p...@googlegroups.com
Gilis,

As Michiel says, setting out the full set of combinations into a List is
pretty much the "E-Prime way". However, if you mean to combinatorically
mix one set of attributes (e.g., stimulus location) with other
attributes, then you might look into nested Lists. In that case, first
work through the Nested List tutorial in Appendix C of the User's Guide
that came with E-Prime, and see if that gives you any ideas. And of
course, do also look through Michiel's E-Primer.

-- David McFarlane, Professional Faultfinder


Michiel Spape wrote:
> Hi Gilis,
> What may be unelegant programming-wise, I often find much better psychologically, for some reason! That is, yes, it seems like an awful lot to tell a programme to use "red", "green", "blue" for a Stroop task and then having to bother with setting all 9 combinations, rather than, for example, setting one attribute (congruence) and using a little script to randomly set colours and words. Still, I would advise you to use the list anyway; it provides much more clarity for yourself and others, its randomising tends to give better results than randomizing with replacement, and, well, you don't need to learn so much E-Basic programming.
>
> Anyway, we have discussed randomising location fully and thoroughly in the seminal E-Primer (www.cognitology.eu, under references) and the easiest would be just to use percentage. I don't see where 'side' comes in... Just use two attributes [XLoc], [YLoc] if you will, use % values in your list and voila.
>
> "c.SetAttrib "side", RandomizeArray(1,3,4)"
> ...makes very little sense. If you are using "Side" to set your location, why do you want to fill it (I guess) with 1, 3 or 4? Are those pixels? 3 is about 2 pixels to the right of 1... Are you trying to randomize a list? If you have many combinations, I suggest looking up nested lists in the user guide / getting started guide.
> Cheers,
> Mich
>
>
>
>
>
>
>
>

> Michiel Spap�

gilis

unread,
Feb 22, 2010, 11:50:13 AM2/22/10
to E-Prime
Hi Mich,

Sure it make a little sense, it was just an hypothetical example ;) -
meaning that I was trying to find a way to randomize three dichotomic
values (e.g., a , c and d without the sequence between them).
Somehow "RandomizeArray" was associatively connected in my mind
with similar suffix functions from Matlab -I was sure it can be done
in Eprime as well...For the present experiment I will use the list,
but anyway wanted to know the alternatives. Thank you very much for
the link, I hope to use it intensively.
Cheers
Gilis

On 22 פברואר, 18:13, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>
wrote:

> For more options, visit this group athttp://groups.google.com/group/e-prime?hl=en.

gilis

unread,
Feb 22, 2010, 11:51:28 AM2/22/10
to E-Prime
Thanks David,
BTW, just tried to open the link and it seem to be a dead one-can you
post it again please?
Best Wishes
Gilis

gilis

unread,
Feb 22, 2010, 11:53:26 AM2/22/10
to E-Prime
So simple, so true...How couldn't I see that ;)
Thanks a lot!
Gilis

Michiel Spape

unread,
Feb 22, 2010, 12:01:08 PM2/22/10
to e-p...@googlegroups.com
Hi,
Seems fine here: http://www.cognitology.eu/about_me.htm below everything else. PDF takes some time to load, so I'd suggest right-clicking and using "save link as".

One of these days, I should really try to update things (both book and website). I guess PST has infected me!
Cheers,
Mich


Michiel Spapé

Michiel Spape

unread,
Feb 22, 2010, 12:19:27 PM2/22/10
to e-p...@googlegroups.com
Hi Gilis,
Yes, I noticed it sounded very matlabby :) Matlab is awesome in terms of arrays, but I'm happy enough that E-Prime at least has this randomiseArray, er randomizeArray, function. Here's how you can do about the same:
Dim locs() as integer
Dim I as integer

For i = 1 to 640
Locs(i) = i
Next i

RandomizeArray Locs 'this would be Locs = RandomizeArray(Locs) in Matlab style

...or something of that sort to obtain 640 values which you can later insert in your trial (e.g. if a slide has an image with x value referencing [myX] and you have a trial-counter called trialnum, then something like c.SetAttrib "myX", Locs(trialnum)

Personally, I get heavily frustrated by the usage of (E-)Basic ()s which seems rather arbitrary, their lack of []s to reference arrays as in C, and can't quite wrap my mind around how all that is yet different in Matlab (including the added {}s)!

David McFarlane

unread,
Feb 22, 2010, 1:29:46 PM2/22/10
to e-p...@googlegroups.com

> > Well, have an inline like this before the display appears:
> >
> > dim x as integer
> > x = random(1,3)
> > if x = 1 then c.setattrib "posX", 200
> > if x = 2 then c.setattrib "posX", 400
> > if x = 3 then c.setattrib "posX", 600

Just can't let this sit (even though Mich & I disagree on this point
of programming style :) ), so here is the same code in two more
different styles:

dim x as integer
x = random(1,3)
if x = 1 then
c.setattrib "posX", 200

elseif x = 2 then
c.setattrib "posX", 400
elseif x = 3 then
c.setattrib "posX", 600
end if

or

dim x as integer
select case random(1,3)
case 1
c.setattrib "posX", 200
case 2
c.setattrib "posX", 400
case 3
c.setattrib "posX", 600
end select

gilis

unread,
Feb 22, 2010, 2:19:23 PM2/22/10
to E-Prime
Hi David,
Select Case is my favorite condition, for some kinky reason :)
Great forum you build here!
Gilis

gilis

unread,
Feb 22, 2010, 2:28:09 PM2/22/10
to E-Prime
Well, there is at the very least two things can be done in PST but not
in E-prime
1. Gabor patch 2. Controling the luminance level for each stimuli
within the program itself.
That's at least what I learn in person when I worked on my thesis
(transient attention)..Great list of publications you have-I liked!
Best
Gilis

On 22 פברואר, 19:01, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>
wrote:
> Hi,
> Seems fine here:http://www.cognitology.eu/about_me.htmbelow everything else. PDF takes some time to load, so I'd suggest right-clicking and using "save link as".

> For more options, visit this group athttp://groups.google.com/group/e-prime?hl=en.

gilis

unread,
Feb 22, 2010, 2:43:33 PM2/22/10
to E-Prime
I meant PTB and not PST...as I told, very "green" in here..;)

On 22 פברואר, 19:19, Michiel Spape <Michiel.Sp...@nottingham.ac.uk>

Michiel Spape

unread,
Feb 23, 2010, 5:34:03 AM2/23/10
to e-p...@googlegroups.com
I think you meant Tobias, who wrote

dim x as integer
x = random(1,3)
if x = 1 then c.setattrib "posX", 200
if x = 2 then c.setattrib "posX", 400
if x = 3 then c.setattrib "posX", 600

...rather than my...

Dim Locs() as integer
Dim i as integer


For i = 1 to 640
Locs(i) = i
Next i
RandomizeArray Locs

As I tried to explain usage of RandomizeArray... Still, my choice for your example, without randomized arrays would be:

dim x as integer
c.SetAttrib "posX", 200 * random(1,3)

Hatsekidee!
Cheers,
Mich

Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology


-----Original Message-----
From: e-p...@googlegroups.com [mailto:e-p...@googlegroups.com] On Behalf Of David McFarlane
Sent: 22 February 2010 18:30
To: e-p...@googlegroups.com
Subject: Re: Randomizing image position in a slide object

or

--

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.

For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.

Reply all
Reply to author
Forward
0 new messages