Experiment stopping for no reason or warning(sometimes)

I’m running an experiment based on movies and sometimes, with no warning at all, the experiment just crashes.

The funny thing is, when I exit psychopy and restart the experiment, it works just fine.

It keeps happening every time a new participant is starting the experiment.

It is not run online, and the same experiment file(with no questionnaires) runs smoothly everytime.

Hi There,

So that we can help, we are going to need a bit more information. For example, what version of psychopy are you running? does it crash at a specific point when a specific thing is happening?

Thanks,
Becca

ah yes!

Im using the 2020.2.4 version. And it seems to crash everytime right when the video stimuli should start.

The only warning that keeps popping up is that my stimuli is bigger than the screen? but this is odd as the video is 800x600 size displayed at 48x27 deg on psychopy, which should be within the screen size.

Also, this only happens on my experiment 2 file which is basically the same experiment with the first one only with several slider questions. So the video stimuli seems to work fine on other experiment.

Hi,

OK so it is still a bit tricky to figure out but here are some pointers on where to start debugging.

  1. under experiment settings, set the logging level of your log file to debug - this might tell you exactly when your experiment is crashing.
  2. to figure out which components are causing the issue try disabling the component (each component has a ‘testing’ tab - this helps because, for example, if you suspect it is the video file you can disable it and see if the experiment runs fine without it - but if you still get your crash we can see it might be the slider components).

Give those a go first to see if it helps pin down the issue a bit more :slight_smile:
Becca

Thank you Becca for your prompt reply.

When I disabled the video component, it ran smoothly. But I’m not sure whether it is due to chance as it runs smoothly with the video like 60% of the time.

Maybe it is because I’m running the experiment on 240hz monitor with eyetracker?

ps) after disabling the video stimuli, I ran the experiment several times to replicate the problem. The experiment crashed even with the video disabled, and I don’t think the scale might be the problem as it halts to a stop before it reaches the questions.

pps) I think I narrowed it down to the problem point. To make the cue not visible for half of the trials I’m using this line of code in the begin experiment section

**Begin Experiment** 
#condition
block = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
random.shuffle(block)
left_loc = [loc1, loc2, loc3, loc4, loc5, loc6, loc7, loc8]
right_loc = [loc9, loc10, loc11, loc12, loc13, loc14, loc15, loc16]

and this line in Begin Routine section.

thisExp.addData('movie_time', time.time())
thisExp.addData('movie_tick', cv2.getTickCount())
random.shuffle(left_loc)
random.shuffle(right_loc)


opacity = 0.1
cue = 0.016

starttime = 0
num = trials.thisN
side = [0, 1]
side2 = random.choices(side, weights = (50, 50), k = 1)
side_rec = ''
if block[num] == 0:
    opacity = 0
    cue = 0
    side_rec = 'none'
    thisExp.addData('side', side_rec)

elif block[num] == 1:
    if side2[0] == 0: #left 80%, right 20% 
        pos1 = left_loc[0]
        pos2 = left_loc[1]
        pos3 = left_loc[2]
        pos4 = left_loc[3]
        pos5 = left_loc[4]
        pos6 = left_loc[5]
        pos7 = left_loc[6]
        pos8 = left_loc[7]
        pos9 = right_loc[0]
        pos10 = right_loc[1]
        #record side
        side_rec = 'left'
        thisExp.addData('side', side_rec)
        
        
    elif side2[0] == 1:  #left 20%, right 80% 
        pos1 = right_loc[0]
        pos2 = right_loc[1]
        pos3 = right_loc[2]
        pos4 = right_loc[3]
        pos5 = right_loc[4]
        pos6 = right_loc[5]
        pos7 = right_loc[6]
        pos8 = right_loc[7]
        pos9 = left_loc[0]
        pos10 = left_loc[1]
        
        #record side
        side_rec = 'right'
        thisExp.addData('side', side_rec)

and everytime the ‘side_rec’ prints out ‘none’ the experiment crashes.

AH! I fixed it. The problem was in the data logging process as in condition block[num] == 0 pos values were not set.