psychopy.org | Reference | Downloads | Github

Screen blank for too long between fixation and stimuli screens

OS (e.g. Win10): OSX 10.12.2
PsychoPy version (e.g. 1.84.x): 1.84.2

I have programmed an experiment that is working in every way I want, except sometimes between presenting images the screen is blank (just black) for too long whereas sometimes the next presentation is instantaneous. I am preloading stimuli but not my screen during ITIs is a constant fixation ‘+’

I mostly used the builder, but then used the coder to implement some specific things I wanted.

Can you rephrase this for clarity?

We probably need to know details of that to say anything useful. And by “the coder” do you mean that you edit the .py file directly (often not necessary/recommended), or that you used code components in Builder (generally preferred)?

So the screen is either supposed to show a stimulus (one of several shapes) or a fixation cross which looks like: +

Sometimes when changing from one to the other the screen is blank for too long - other times it changes instantly from the shape to + or + to a shape. I’m wondering if there is anything I can do to prevent that.

By “preloading” stimuli I mean that each image is set during a previous constant period - usually a period that contains + since everything during that time is constant.

I used code components as well as editing the .py file directly. The only edits to the .py file directly were to add in lines to record onset and offset times of stimuli. I couldn’t figure out how to use the code component to do that and was able to do that in the .py file much more easily. This issue of the screen being blank for too long occurs when I run the .psyexp file, not just the .py file.

Let me know if you need any other clarification! Apologies for the short/confusing post earlier.

Thank you,
Sarah

You’ll need to work out the minimal example that demonstrates the problem. If this happens from the builder (not the customized code) then start with that. Then strip bits our until you’re left with the bare minimum. Send us that. If it contains lots of routines and stimuli that aren’t related then your post will probably be ignored in the name of this-would-take-too-long so really try to keep it minimal.

1 Like

Okay, thanks. I will try to post a minimal version as soon as I can!

I am attaching a minimal version of the experiment and the image files that need to be in a folder called habitstimuli so the program can find them.

I have removed all instruction screens as well as other routines that are not necessary to have to see the problem. This is a Go/No-go experiment where there are go shapes (press a button) and no-go shapes (do not press a button). Normally I have three trial types: two-go (two go shapes followed by a no go shape), three-go (three go shapes followed by a no go shape) and four go (four go shapes followed by a no go shape). I removed all of the the three-go and four-go routines and reduced the number of trials.

Let me know if this is not minimal enough to not be “this-would-take-too-long” status. Thank you!

GNG_minimal.psyexp (216.8 KB)
<img src="/uploads/psychopy/original/1X/a8dd4dc525a770f34501e8bd5a9f40c770300ab0.png" width=“512” height=“380”>

That is indeed way too complicated for me to disentangle.

One thing that leaps out is that your static period is set to be 1.2 frames long. There are two problems with that:

  • asking something to be done for a fraction of a frame doesn’t make sense. Either request a period of time in seconds or an integer number of frames.
  • 20ms might also be too short to load your images from disk, depending on how much loading you’re doing

Your title says there is “too long” but not how much too long and if you’re talking about the gap being another 50ms then it might just be that your disk access to load the images is taking 70ms and you’re only giving it 20ms to achieve this.

But you’d need to simplify the experiment further for us really to debug it properly

Okay, thanks I will play with the timing and also continue simplifying the experiment…to what extent is it too complicated. Is is the block select aspect? Thank you!

I also need to figure out how long the “too long” is…it seems variable and I haven’t measure it, but I will. It also isn’t systematic based on what I have tried before.

Perhaps I have gone about “preloading” stimuli in the wrong way. In general do you have any tips on the “best” way to do the preloading so that the program runs most efficiently. Thank you very much!

I simplified more and set each image to “set every repeat” and now the problem seems to have gone away in the simple version…not sure what this means? Is the actual experiment just too bulky? When I use “set every repeat” in the actual experiment the problem seems better (i.e. the screen is not blank for as long), but not completely gone. Any thoughts? I’m uploading the even more simplified version.

GNG_minimal21317.psyexp (205.0 KB)

You’ve set them to “set every repeat” and what were they before?

In terms of “what is too complicated” for the forum the answer is that anything in your experiment that can be removed should be removed. If removing something doesn’t fix the problem then it wasn’t relevant so we don’t need to see it. If removing it does fix the problem then this is a clue and you can try removing other irrelevant things to see if it’s just this that’s the problem. You’re aiming for the smallest possible version that’s broken

Before I had them set to update during an ITI right before they were supposed to appear. The ITIs range from 500ms-4500ms.

Okay, I will keep playing with it. The smallest version I uploaded yesterday doesn’t have the problem, so I suppose now I need to see if that at all isolates what is wrong in the biggest version. If I can make a small version that has the problem I will upload it. Thanks!

Hi Jon,

I have discovered that when I remove the keyboard recording components my problem goes away. Any thoughts on why this would be happening? I need to record reaction times and responses, so I need to use this function, but I also need my experiment to run without the screen being blank for random amounts of time (especially since it is an fMRI experiment).

Thank you,
Sarah

I’m wondering if perhaps there is an issue with the keyboard component since it also records correct answers as ‘0’ in the data log. (Given the nature of my task, knowing at least what key they hit makes it possible for me to know if it was correct or not so this isn’t as crucial as the other issue.) I look forward to hearing from you…

Apologies for so many posts, just want to update you so that you are not working on something when I have moved forward with it.

I have discovered that the problem was caused by recording for an amount of time that covers from the start of the stimuli to the end of fixation…when I don’t do that the issue goes away. Is there a problem with recording across routines?