psychopy.org | Reference | Downloads | Github

Psychopy can’t quit

Hi, I’m very new to Psychopy. I am trying to color images by using them as masks. However, Psychopy can’t quit at the end of the experiment. It will stuck on the final scene. Below is the Psychopy output File. Any one knows how to fix this? Thanks!!

These are just warnings, and although they should be addressed, they aren’t the reason for the experiment not ending.

You need to show us a screenshot of your final routine layout, and how it is supposed to end.

Hi @Michael, Thanks for your reply! My study includes a study phase and a test phase. During the test phase, participants need to do an old-new recognition test. If they recognize an image as old, they should further do another three related tests; if they regard an image as new, no further tests will be presented. Below is the layout. It supposed to end after 16 trials, but it always stuck on the final image.



I defined num_test at the very beginning of the experiment (in the first routine):

import random, xlrd
random.seed()
infile = 'image_stim.xlsx'
num_study = 8
num_test = 16
num_items = 16

Besides, code in the routine ‘textcode’ is:

Begine Experiment:

test_order = list(range(num_test))

random.shuffle(test_order)

test_trial = 0

Begine Routine:

#assigning the test item
imageitem = image_item[test_order[test_trial]]
imagecolor = image_color[test_order[test_trial]]
point = point_value[test_order[test_trial]]
oldnew = old_new[test_order[test_trial]]

#add some data for this trial
thisExp.addData('Test_ImageItem', imageitem)
thisExp.addData('Test_oldnew', oldnew)
thisExp.addData('Test_ImageColor', imagecolor)
thisExp.addData('Test_point', point)
thisExp.addData('Test_Trial', test_trial)
thisExp.addData('Test_Order', test_order[test_trial])

#increment the current test item counter
test_trial = test_trial + 1

That is useful detail. But:

  • How do you control the ending of the final routine (i.e. the one containing the final image)?
  • I guess you also have some code to make decisions based on what the subject types in the YNTest routine?

Also:

Hi @Michael,

  • How do you control the ending of the final routine (i.e. the one containing the final image)?

    By keyboard (force end of routine). There are two possible endings. One is a “no” response at the YNTest routine for the final image, the other is a “1”, “2” or “3” response at the pointest routine for the final image.

  • I guess you also have some code to make decisions based on what the subject types in the YNTest routine?

    I don’t have code in the YNTest routine but I have codes in the latter three routines (i.e. RKG, colortest and pointest).

if response.keys != '1':

     continueRoutine = False

It is worth noting that I have another .psyexp using words as materials. It has the same layout and codes as this one. The verbal one runs perfectly, but this one got stuck on the final image.

Hi @Michael,
During the test phase, I used the images as masks and colored them in white (below).
mask
Then I tried another way (below) and the Psychopy ended successfully!


But now the question is that the background of the images is black which is not wanted.

Could you help me solve this problem? Many thanks!

Sorry, this problem is a bit beyond me. I think the only way to solve it would be to post your .psyexp file here to inspect, and please clarify from the post above exactly what change you make that allows the experiment to finish (i.e. you show the advanced tab only for the problematic condition: we need to see how you specify that tab hen it does work (e.g. do you just remove the entry from the mask field?)

Hi @Michael, I am so grateful for your help! The only change I’ve made is putting $imageitem from mask field (advanced tab) to image field (basic tab), see below. Please find attached the .psyexp file. Thanks!

Pri_pic_demo.psyexp (46.0 KB)