Accessing data from another loop

I’m trying to get reaction times from a baseline loop, for comparison with reaction times in the current test loop. I modelled this after the instructions here.

“…In this case, to get all the keys pressed in a numpy array:
trials.data[‘key_resp.keys’] #numpy array with size=[ntrials,ntypes]”

URL of experiment: https://run.pavlovia.org/uqlleow/july/html

Description of the problem: TypeError: Cannot read property ‘BaselineResponse.keys’ of undefined
at Scheduler.trainingfeedbackRoutineBegin [as _currentTask] (jul.js:664)

Here’s the JS snippets in line 664
[baseline.data[“BaselineResponse.keys”]];
pracmeanRt = [baseline.data[“BaselineResponse.rt”].mean()];

I assume that I should be accessing the loop baseline (hence baseline.data), before asking it to give me the rt to obtain the mean…

Please let me know how I can fix this! Its likely something obvious, but I am afraid I’m unfamiliar with both python and JS! Thank you so much for your help!

I’ve managed to fix my problem. The code is here if anyone is interested. I think I just didn’t know how to obtain mean in JS. Here’s how I did it.

Py :
pracmeanRt = baselinetrials.data[‘BaselineResponse.rt’].mean()

JS :
var nums = [BaselineResponse.rt];
var totalSum = 0;
for(var i in nums) {
totalSum += nums[i];
}
var numsCnt = nums.length;
var pracmeanRt = totalSum / numsCnt;