psychopy.org | Reference | Downloads | Github

Using two conditions files

Win10
3.06
Standard Standalone

I’m creating a dot probe task and trying to alternate the positions of my two images as well as the position of the dot. I’ve done this in two conditions files as I wanted their positions to be independent of each other. However, whilst both work separately (i.e. images are positionally randomized when its corresponding condition file is the only one used and the dot is randomly positioned when its corresponding conditions file is the only one used) when I try and use both conditions files together via a second loop one just doesn’t work.

Does anyone have any idea why? Thanks

“one just doesn’t work” does not give us anything to go on here. As a guide to asking an effective question on a forum like this, ask yourself "could someone on the other side of the world understand my situation knowing nothing other than what I wrote down for them? "

  • tell us exactly what you want to happen.
  • show us what you did.
  • show us what exactly went wrong.

Hi, thanks for responding.

By ‘one just doesn’t work’, I mean the intended effect of the conditions file, which is to move a dot in my task to alternative positions (as specified by the conditions file) does not work/happen when placed in a loop with a second conditions file. Or alternatively, the effect of the second aforementioned conditions file, which is to swap the positions of the images in my study will not happen/work, depending on which conditions file was put in first. I would like both of these conditions files to work within the same routine.

To implement both conditions files, I put in 2 loops around the same routine, one specifying where the dot should move, and one specifying to swap the positions of the images. I have entered $eval(“the corresponding heading”) in the positions column in order for the variables to get the positions from the conditions files.Both of these conditions files work when they are in the only loop around the target routine.

I hope this properly clarifies my issue, thanks.

OK, hierarchical (i.e. nested) loops won’t work here. The inner loop will cycle through all of its conditions, and only then will the next iteration of the outer loop run, meaning that effectively its conditions are static until the inner loop restarts.

What you should do is have a single conditions file that incorporates all possible crossed conditions of those variables, and connect that to a single loop. The independence comes from specifying all possible combinations, and presenting them in random order if required.

Thanks very much for the helpful advice.

Did you finish the whole program of dot probe task? i create a dot probe via builder and a little bit python, but i don’t know how to let the positions of the dot and the pictures be random(same as your problem). i am a student of clinical psychology from taiwan, i am preparing a study about the decision making and attentional bias of MDD patients, but i have difficults in creating this dot probe task. If your dot probe task is working, would you mind to share you file or the code to me, and then i’ll do some modification. thanks a lot , looking forward to your reply.

I have a dot probe program that works on mobile devices as well as computers
https://run.pavlovia.org/Wake/abm-dot-probe/html

Is this doing something close to what you want?

yes!! it is very close !! but is that a task attentional bias modication?

Correct. The different conditions are (if I remember correctly), dots behind random face, dots behind happy face and dots behind happy participant’s face.

would it be possible for you to share your psychopy file or code to me? then i can get a reference and try to create my version

Here’s a psyexp file that should help.

Best wishes,

Wakefield
abm.psyexp (69.1 KB)

thanks!!
how should i call you?
because i want to write your name into my thanks list in my study
if i finished my study in the future

another request, would you mind to share the xslx files you used in this experiment?

My name is Wakefield Morys-Carter

It doesn’t use external spreadsheets but you will need to add some images.

Currently the image code is:

code_faces

happyFaces=['03F_HA_C.jpg','07F_HA_C.jpg','13F_HA_C.jpg','19F_HA_C.jpg','37M_HA_C.jpg','24M_HA_C.jpg','38M_HA_C.jpg','45M_HA_C.jpg']
sadFaces=['03F_SA_C.jpg','07F_SA_C.jpg','13F_SA_C.jpg','19F_SA_C.jpg','37M_SA_C.jpg','24M_SA_C.jpg','38M_SA_C.jpg','45M_SA_C.jpg']

thisFace=int(expInfo['face'])-1

code_JS

if ((expInfo["group"] === "1")) 
{
    psychoJS.downloadResources([
    { name: (expInfo["participant"] + "s.jpg"), path: ("../faces/" + expInfo["participant"] + "s.jpg") },
    { name: (expInfo["participant"] + ".jpg"), path: ("../faces/" + expInfo["participant"] + ".jpg") }
    ]);
}
else 
{
        psychoJS.downloadResources([
        { name: happyFaces[thisFace], path: "../Nim-Face-Stimuli/"+happyFaces[thisFace] },
        { name: sadFaces[thisFace], path: "../Nim-Face-Stimuli/"+sadFaces[thisFace] }
        ]);
}

code

if expInfo['group']=='1':
    smiling=expInfo['participant']+'s.jpg'
    sad=expInfo['participant']+'.jpg'
else:
    smiling=happyFaces[thisFace]
    sad=sadFaces[thisFace]

I don’t feel that it’s appropriate for me to send you the images but I’m also reluctant to simplify the code when I don’t know what you need.

Here are the conditions (in code)

#conditions[0] happypos 1 top -1 bottom
#conditions[1] dotpos 1 happy -1 neutral
#conditions[2] dotnum 1 or 2
if expInfo['group']=='3':
    conditions=[[1,1,1],[1,1,2],[1,-1,1],[1,-1,2],[-1,1,1],[-1,1,2],[-1,-1,1],[-1,-1,2]]
else:
    conditions=[[1,1,1],[1,1,2],[1,1,1],[1,1,2],[-1,1,1],[-1,1,2],[-1,1,1],[-1,1,2]]
shuffle(conditions)