random sequency of trials

411 views
Skip to first unread message

Madeleine Preiß

unread,
Nov 7, 2013, 5:27:49 PM11/7/13
to psychop...@googlegroups.com

Hello,

 

I’m new to PsychoPy, and I’m trying to implement a perceptual experiment where some specific frequences of pictures, which are organized in trials, are shown to the subject. Each trial (frequency) should be presented one time to the subject but the trials should appear randomized to each subject, so that every subject edits the trials in a diffrent sequence (but the same sequence of the picture-saccades in a trial) to prevent effects of sequences.
I have read postings about randomizing blocks on the forum, and I understand that you can have a loop on Pictures in each block, and another loop on the blocks. But I don’t want that the sequences of the picture-frequency in a trial is changed.
I’d be deeply greatful for any help!

 

Madeleine

Madeleine Preiß

unread,
Nov 11, 2013, 9:54:16 AM11/11/13
to psychop...@googlegroups.com
/Push

Jonathan Peirce

unread,
Nov 11, 2013, 11:12:58 AM11/11/13
to psychop...@googlegroups.com
You can have random presentations or sequential presentations set up by a loop. I'm afraid I don't understand what you want beyond that. Maybe give it a try yourself and see what happens. If that doesn't work then come back and explain the way in which it failed.

Jon


On 11/11/2013 14:54, Madeleine Prei� wrote:
/Push

Am Donnerstag, 7. November 2013 23:27:49 UTC+1 schrieb Madeleine Prei�:

Hello,

�

I�m new to PsychoPy, and I�m trying to implement a perceptual experiment where some specific frequences of pictures, which are organized in trials, are shown to the subject. Each trial (frequency) should be presented one time to the subject but the trials should appear randomized to each subject, so that every subject edits the trials in a diffrent sequence (but the same sequence of the picture-saccades in a trial) to prevent effects of sequences.
I have read postings about randomizing blocks on the forum, and I understand that you can have a loop on Pictures in each block, and another loop on the blocks. But I don�t want that the sequences of the picture-frequency in a trial is changed.
I�d be deeply greatful for any help!

�

Madeleine

--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/c6bbddca-71e2-4ab0-abc5-e9ed2c38d1ae%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

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.


Madeleine Preiß

unread,
Nov 13, 2013, 9:14:49 AM11/13/13
to psychop...@googlegroups.com
I tried to do a fullRandom loop without any repetition.But every time I add the loop I'm getting this:

2.0701 ERROR avbin.dll failed to loas. Try importing psychopy.visual as the first
   library (before anything that uses scipy) and make sure that avnin is installed.

I've already read a post concerning this problem, but there was no solution :(


Jonathan Peirce

unread,
Nov 13, 2013, 9:17:58 AM11/13/13
to psychop...@googlegroups.com
It won't be having any effect though, unless you're actually trying to present a movie stimulus
Jon
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

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

Madeleine Preiß

unread,
Nov 13, 2013, 11:07:49 AM11/13/13
to psychop...@googlegroups.com
I'm sorry, I don't want to annoy you but it still doesn't work. I've got 12 different trials (including a presentation of pictures) and every time I start the experiment the trials should appear in a diffrent order. When I add a loop (type fullRandom or random) the trials appear always in the same sequence. Is the number of trials to high? What am I doing wrong?
I do really appreciate your help!


Random_Sequency.PNG

Jeremy Gray

unread,
Nov 13, 2013, 11:27:56 AM11/13/13
to psychop...@googlegroups.com
The only thing I can think of is to make sure that you don't accidentally have a random seed set. (I don't see one in the screenshot.) I'm not sure if a space character will be used as a seed (and be present but not visible in the random seed $ box).

--Jeremy


On Wed, Nov 13, 2013 at 11:07 AM, Madeleine Preiß <made....@gmail.com> wrote:
I'm sorry, I don't want to annoy you but it still doesn't work. I've got 12 different trials (including a presentation of pictures) and every time I start the experiment the trials should appear in a diffrent order. When I add a loop (type fullRandom or random) the trials appear always in the same sequence. Is the number of trials to high? What am I doing wrong?
I do really appreciate your help!


--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.

Michael MacAskill

unread,
Nov 13, 2013, 3:49:11 PM11/13/13
to psychop...@googlegroups.com
Dear Madeleine,

I think you've misunderstood how loops are used in PsychoPy. All the routines within a loop are always presented in a fixed order (in this case, trials 1 through to 12), regardless of whether a loop is random or fixed. This is because routines within a loop are designed to do different things (such as present instructions, followed by presenting a stimulus, etc), which have to happen in a certain order.

What the loop does is allow you to set the *attributes* of those trials, such as the stimuli, in either a fixed or random order. e.g. if you want to display 12 images in a random order, you would have a loop encompassing just a *single* trial, and the loop would run 12 times. In that trial, you specify variables in the .csv or .xlsx file that the loop refers to, which allows you to set, say, the image file, its position, and so on.

See this page for an explanation: <http://www.psychopy.org/builder/flow.html>

Regards,

Michael

Madeleine Preiß

unread,
Nov 15, 2013, 2:47:31 AM11/15/13
to psychop...@googlegroups.com
Dear Michael,

thank you very much for your helpful answer! I knew that one uses a routine for repetitions but I hoped that I could use it in a diffrent way.
The problem is, that I'm using each trial to present a number of the same image (every single picture is changed somehow; you can't see it in the screenshot, that was only a test) which has to be shown a a certain order; it's kind of a "movie".
So there is no way I can let appear the whole trials in diffrent sequences?

Regards,
Madeleine

Michael MacAskill

unread,
Nov 15, 2013, 4:37:34 AM11/15/13
to psychop...@googlegroups.com
Dear Madeleine,

OK, I think I get it now. Each of your routines is genuinely different somehow, but you don't want to display them in the order they appear in the flow panel.

In Builder at least, this isn't the way it is designed to do things but there are usually workarounds. Matt Wall recently wrote a blog post illustrating a way of doing something related to this here:
<http://computingforpsychologists.wordpress.com/2013/11/12/how-to-hack-conditional-branching-in-the-psychopy-builder/>

In essence, you put a loop around all of your routines, which will run 12 times. But you also put a loop around each of your individual routines. On each run through the outer loop, all the inner loops except one will be set to have zero iterations. i.e. on each outer loop iteration, just one one of the routines will execute.

Matt's code is simple for just using two routines, but in your case with 12, it would get a bit unwieldy. You could amend his code as below:
if selectBlock==1:
nRepsblock1=1
nRepsblock2=0
elif selectBlock==2:
nRepsblock1=0
nRepsblock2=1

to read something like this (NB untested):

# first set all 12 trials to not run:
for i in range(1,13):
exec("nrepsblock" + str(i) + " = 0") # set the number of reps to zero

# then set the desired trial so that it will run once:
exec("nrepsblock" + selectBlock + " = 1")


But otherwise do what he describes. I THINK that will do what you want.

Michael

Madeleine Preiß

unread,
Nov 15, 2013, 11:53:22 AM11/15/13
to psychop...@googlegroups.com
Dear Michael,

that's brilliant!!! It works perfectly.
I do really appreciate the time and effort you spent. Thank you so much!
-Made my day :)

Regards,
Madeleine

Reply all
Reply to author
Forward
0 new messages