All RTs in one column

Hello all,

I have 6 image components to be clicked in the retrieval phase. I have different image retrieval routines and all Reaction times for those routines are saved to separate columns and rows on Excel.

I want to create a column and save all RTs for different routines to one single column called ‘visualRT’.

For the RTs in this routine,
I added a custom code at the end of the components, end routine:

if len(mouse_retI.time) == 1:
    if mouse_retI.time[0] == mouse_ret1I.mouseClock.getTime():
        visualRT = mouse_ret1I.time
    elif mouse_retI.time[0] == mouse_ret2I.mouseClock.getTime():   
        visualRT =mouse_ret2I.time
    elif mouse_retI.time[0] == mouse_ret3I.mouseClock.getTime():   
        visualRT = mouse_ret3I.time
    elif mouse_retI.time[0] == mouse_ret4I.mouseClock.getTime():   
        visualRT = mouse_ret4I.time
    elif mouse_retI.time[0] == mouse_ret5I.mouseClock.getTime():   
        visualRT = mouse_ret5I.time
    elif mouse_retI.time[0] == mouse_ret6I.mouseClock.getTime():   
        visualRT = mouse_ret6I.time    
WMI_testLoop.addData('visualRT', visualRT)

the error is:

Here is how the variables are defined in python script:

Thank you!

The error is stated explicitly: you are trying to refer to an object called mouse_ret1I but no object of that name exists when this code runs.

e.g. the script extract you provide only refers to a mouse called mouse_retI: there is no mention of any numbered variants of that.

It isn’t clear why you might want to have several mouse objects with different names all available simultaneously - usually there is only one mouse connected to the computer. We can’t help much further without being told more details.

This kind of duplication is usually an indication that you’re fighting against PsychoPy’s natural design. e.g. rather than having 6 slightly different routines, try to have a single routine surrounded by a loop that runs six times, and change what needs to be changed on each successive repetition (either in a code component or in a condition file linked to your loop). Then magically all the reaction times will end up in the same column, as you only have a single routine name in use.

Sorry, I think I could not explain it clearly. I do not know how to add 6 images located different in 1 single image component. I have 6 images separately presented within 1 routine. I have only 1 mouse click. What I meant by the different routines is that:
I have different retrieval routines (image and word retrieval) so I wanted to randomize the order of their presentation. The loop ‘is trials’ did not work online and created separate 5 rows for each trial which is hard to take care of it. So I copied the routines for image and word retrievals. This time I have each trial in one column but the data is saved in different columns.

I wrote a code component if the nRepsImlist2 == 0 , continue routine = 0 kind of arrangement. So I ended up with different columns if the Nreps is 1 and Nreps is 0. I want to merge these two columns.

The details above not important though. I want to refer to the mouse click time to that specific component. just need help with the right way to write the code. I succeed it doing for the accuracy (.name function) but .time not working. or .getTime or .getPressed