Not getting .xlsx output

Hey everyone!

I am constructing a rating task (slider) with 288 trials. Everything works just fine except that I somehow cannot get a .xlsx output when I do not run the entire experiment (288 trials).

Does someone know how to change that? .xlsx files are the easiest to analyse with my statistical software (JASP), therefore this is an important issue for me.

I am very thankful for any help!
-Severin

Code:

If you want to quit the experiment early you could have a key press that ends the loop (with code like trials.finished = True) so it exits cleanly instead of pressing excape.

Hey wakecarter,

thank you for answering! That is a clever way of approaching the problem. Do you know at which section i would have to insert this code? Unfortunately (suprise), i am not familiar with coding yet.

Thanks again,
-Severin

If you have a keyboard response called key_resp then you could add ‘q’ as a valid key and then put

if key_resp.keys == 'q':
     trials.finished = True

This assumes your keyboard response is set to save a single key, not all keys. If all keys then you could use:

if 'q' in key_resp.keys:
     trials.finished = True

If the trial can end with no key pressed then you might need the following to avoid an error

if key_resp.keys:
     if 'q' in key_resp.keys:
          trials.finished = True

Hey wakecarter,

thank you! Do you know where in the code-string i would have to insert this command? As far as i am concerned it is not possible to command a loop to end inside the builder, because a loop does not have a “stop” condition like trials do (?). So i would need to insert this piece of code somewhere in the coder, right?

Thanks again,
-Severin

Put it in the trial routine in a code component in the End Routine tab (in Builder)

(I almost never use coder)

Dear wakecarter,

you are the man.

-Severin

1 Like

321_BA_Experiment_2023-11-09_18h09.33.804.csv (2.9 KB)

Dear wakecarter,

i guess it would have been too nice. If I run it offline, i am getting an xlsx file - perfect. If I run it online using credits i unfortunately do not get an xlsx file, just the usual csv file (which is very messy and therefore not attractive to further work with, you find one attached).

May I ask for your expertise once again? A way to get an ordered csv output would be a solution as well! Find also an ordered xlsx file attached.
665_BA_Experiment_2023-11-09_18h23.24.547.xlsx (14.8 KB)

Thank you once again
-Severin

Online the variables are created in the order of first use. Therefore you may be able to fool it into giving you the order you want by using thisExp.addData to add some empty data in your preferred columns in Begin Routine of the first routine.

Dear wakecarter,

I understand. So there is no way of getting different types of data into separated columns as an output from online experiments? If this is the only opportunity, i would again use a custom code, insert it in the very first routine and write a code in the “Begin Routine” section. I am afraid i dont know what kind of code you would insert here. I tried to understand it, with approaches like thisExp.addData.slider.rating, thisExp.add.slider.rating, thisExp.slider.rating .

None of this worked. Could you specify what kind of code you meant?

Thank you
-Severin

Try thisExp.addData('slider.rating','') etc.

Alternatively, if PsychoPy doesn’t like you saving that, then you could copy the data you want into custom columns that you’ve set to save first .

Column priority now works offline but won’t be online until next year

It didn’t like it. Sorry for asking such questions, but how would I automatically transfer data to other columns?

Rating = slider.rating()
thisExp.addData('Rating', Rating)
1 Like