Stimulus not visible in getMovieFrame screen capture although status is STARTED

OS (e.g. Win10): WIN10
PsychoPy version :2025.1.1
Standard Standalone Installation? (y) Notice the monitor runs at 120hz as tested by psychopy
Do you want it to also run online? (n)
What are you trying to achieve?: I want to know what is on the screen when a trigger is sent

What did you try to make it work?:

I have a stimulus (polygon) which is called “target“ which is the stimulus I want to synch my trigger with.

In order to do this I created a code component as you can see in the timeline, in the code component there is a flag which is set to false in the Begin Routine tab:

TriggerWasSent=False

and then in the Each Frame routine I put this

My understanding is that this should capture the screen (and eventually send the trigger if I put the DOET variable to True, but currently it is False) on the exact frame when the target polygon is presented.

In the end routine tab I have this command to save the captured frame as a TIF image:

win.saveMovieFrames(‘frame.tif’)

Link to the most relevant existing thread you have found:

What specifically went wrong when you tried that?:
When I look at the frame.tif image the target stimulus is not showing. It’s as if the stimulus was shown after the screen was captured. If this was the case it might also explain why when I compare the timing of the arrival time of the trigger on the Pupil Neon instrument I am trying to synch with the image of the screen captured by the scene camera, it appears that the stimulus is shown with some delay (a few tens of ms).

I guess my question is whether the “if target.status==STARTED” condition in the “every frame” tab is the right approach to execute a command exactly after the stimulus appears on the screen (or at least is in the visible buffer of the graphics card, I know monitors can add additional delays but I assume that shouldn’t affect the screen capture test).

Thank you in advance for any help you may provide!

Matteo

Dear Valsecchimat,

Make sure the screen grab happens after objects are drawn on the screen (otherwise it will be grabbing stuff that doesn’t exist yet).

Also some other fixes are: Exporting experiment to a .mov or mp4 file - #8 by Michael .

Also, with a trial that has fixed durations and object placements, you are better off just having a pre-recorded version of it, then overlaying your eye data post experiment for data analysis/presentation.

Issac

Dear Stanley,

I finally solved the problem by back-engineering the code produced by the parallelport trigger object (which I had used with a photodiode to confirm that the timing of my stimuli is OK, i.e. constant 5ms delay probably due to the monitor).

What I saw is that there the command to send the trigger is not executed directly after the if Target.status == STARTED check, but inside a win.callOnFlip command.

If I put the win.getMovieFrame inside a win.callOnFlip function now the grabbed image shows the target (and the trigger sent to the ET does not show the 60ms delay it used to).

I saw examples on the internet showing that the Target.status == STARTED means the stimulus is shown, as in it is in the visible buffer of the graphics card, but it is not, it just means that it scheduled for presentation. Why the delay was 60 ms without callOnFlip on a 120hz monitor is still a bit of a mystery to me, I would have expected less than 10 ms, but I’m happy the way it works now.

Thanks a lot,

Matteo