Issue with all data saving even though experiment runs properly

If this template helps then use it. If not then just delete and start from scratch.

OS: Apple Sonoma 14.4.1
PsychoPy version: 2022.2.4

I’ve created the following experiment in PsychoPy Builder that is designed to collect continuous and discrete ratings as participants listen to audio clips. It has been synced to Pavlovia and is run through Pavlovia. The experiment seems to run properly and collects data well, but when I look at some of the data files, not all the continuous ratings save for each trial and I’m really not sure why because it works when I pilot it. So while for some of the 20 trials we have a full dataset of continuous ratings, some do not. I should note that the experiment is run on a variety of computers. I’m not sure if it’s an issue with the experiment design, so am asking here. If anything is confusing, please let me know and I appreciate your assistance.
EDMUrgeToMove.psyexp (749.6 KB)

I would not recommend trying to save a rating using thisExp.addData every frame. Are you also using thisExp.nextEntry()? For continuous ratings I would check every frame whether the rating has changed since the last frame and save the time and rating only if it’s different.

Thank you so much for your reply - I appreciate it. I’m not using thisExp.nextEntry(). Why is it not recommended to use thisExp.addData, and how would it need to be modified to instead save the time and rating only if it’s different?

I’ve just looked at your code and you aren’t using thisExp.addData every frame, but you do have:

rating.append(sliderThroughTheLandNoBeatDrop.getMarkerPos())
print(sliderThroughTheLandNoBeatDrop.getMarkerPos())

timestamp.append(t)

The print statement every frame is definitely an issue. However, I would recommend putting oldRating = -1 in Begin Routine and then using:

newRating = sliderThroughTheLandNoBeatDrop.getMarkerPos()
if newRating != oldRating:
     rating.append(newRating)
     print(newRating) # Remove this when you have finished debugging
     timestamp.append(t)
     oldRating = newRating

Thank you so much for sharing that. I will make the change to the code and see how it runs.

Thank you again for your suggestion on changing my code each frame. Do I need to modify anything in the end routine code to account for the change in each frame? I’m thinking not, but just wanted to confirm.