psychopy.org | Reference | Downloads | Github

Randomization of columns in condition file

randomization

#1

If this template helps then use it. If not then just delete and start from scratch.

**Win 7
PsychoPy version (e.g. 1.84.x):
**Standard Standalone? Y

Hi

I want to randomize the 3 columns of my condition file to be present in 3 specific position. This is my condition file:

conditions

And this is my routine screenshot:

I have specified 3 position for 3 columns of my condition files (columns A,B, and C). However, I want to these columns were randomly assigned to these 3 positions in each trials.

I would appreciate it if somebody could help me. Thank you in advance.


#2

Dear @Michael, I would appreciate if you could help me find how to deal with this problem. Thanks.


#3

Dear Omid,

You should read through your post again carefully and ask yourself this question: “Could someone who isn’t already familiar with my task and my requirements understand what I am asking?”

Unless a question is clear and precise, it simply can’t attract any answers.


#4

Thank you Michael for your answer. You are right. My effort to simply explain my task can hinder understanding my task and my goals. So, let me clear this a bit more.

I have 2 questions (say, products) that each of them has two attributes. For example, a computer with the size of hard drive (attribute 1) and speed (attribute 2). Participants need to choose between 3 options of computers:

computers

Having this in mind, I constructed my conditions as follow, with 2 products, each with 2 attributes and 3 options.
conditions

Then, this is an screenshot of my routine with 5 text input, one for products, one for attributes, and the other 3 for each options (a,b,c):

So far everything is OK, and this is a screenshot of my experiment:

Now, my question is how can I randomize three options (a,b,c, which is circled in the pic above) to appear in 3 different positions? For now, I define the position of each options to be [0,0], [-.3,0], and [-.6,0]. However, I need these options randomly appear in this three positions.

I hope this explanations clear my question up.

Thank you in advance.


#5

Insert a code component. In its “Begin routine” tab, put something like:

positions = [[0, 0], [-0.3, 0], [-0.6, 0]]
shuffle(positions) # randomise the order on each trial

Then in each of your text stimuli, put this in the location field:

positions.pop()

This pulls out the next remaining position from the list.


#6

Thank you for your answer. I did everything that you said, however I encountered with the following error:

No matter changing the positions to be constant or set every repeat, I faced the same error.


#7

You need to set that field to update “every repeat”. Currently you likely have it set as “constant”, so PsychoPy will be trying to set it at the beginning of the experiment, when the list of positions hasn’t yet been defined.