Changing experiment from online to offline

Hi everyone,

I need to change my experiment from online to offline. Some of the components were written only in Javascript, I have managed to changed most of it so it works offline. However, the timing isn’t quite right. This is a sequence learning task so participants learn 4 element sequences using the computer keyboard and the faster the participants complete the sequence the more points they get. Currently, when I perform the sequence very fast and correctly it gives me 0 points and when I do it slightly slower I get more points.

This is the URL for the online version of the experiment for context: behaviouralCQ [PsychoPy]

I think the problem is this section of code. This section of the code tracks the stim times for the instructed trials. This is the original code in javascript:

Begin routine tab:
routine_times.append(util.MonotonicClock.getReferenceTime())
stimLogged = False

each frame:

store the stim onset times

if t >= 0.0 and imageB.status == PsychoJS.Status.NOT_STARTED:
# grab the time relative to the global monotonic clock which is the same clock used for the time
# stamps of key presses
imageB.globalMonotonicStart = util.MonotonicClock.getReferenceTime();

end routine:

store the tim onset times in a list

stim_times_global_monotonic.append(imageB.globalMonotonicStart)

I have changed this code to this:

Begin routine:
Clock = core.Clock()

routine_times.append(Clock.getTime())
stimLogged = False

Each frame:
if t >= 0.0 and imageB.status == NOT_STARTED:
# stamps of key presses
imageB.globalMonotonicStart = Clock.getTime();

End routine:

store the time onset times in a list

stim_times_global_monotonic.append(imageB.globalMonotonicStart)

I don’t really code in python so is there anything in this part of the code that I have changed that would explain the problems I am having with the timing?

Thank you, if anymore details are needed let me know.

Try calling your clock myClock instead of just Clock. There might be a conflict there.

Thanks I changed it to myClock but I still have the same problem. I noticed as well that when I run it I found this in the psychopy Runner:
Marker positions will be [0, -0.3801096666696443, -0.5, -0.5]
responses made were: [‘i’, ‘u’, ‘l’, ‘y’]
correct answers were: [‘i’, ‘u’, ‘l’, ‘y’, None]
type B trial, adding speed points
speed points 1

For some reason when I perform the sequence very fast it thinks I have done it incorrectly because it adds None at the end. It does not do this when I perform is correctly but at a slower speed so I think it may be to do with the timing still. Any suggestions would be great thank you!