psychopy.org | Reference | Downloads | Github

Presenting taks using latin square

OK, I misunderstood.

I may be wrong but I think what you are asking is called conditional branching and this link will probably help (?)

However, note that you will not have control as to how tasks’ presentation will be ordered between participants i.e. you may have 2-3 consecutive participants who have been given the same order of task presentation but I don’t think this is something that it is of great concern. This is beyond my level of knowledge on PsychoPy and Python and other experienced users may be able to help you on that.

Have a great day too.

Thank you :slight_smile:
I saw that one but the problem is my block-level loops have condition files associated with them so I can’t follow the exact instructions. Another problem is all my block-loops have more than one routine.

I am pretty sure it can be done in one way or another but unless you provide an example I am afraid I cannot be of more help myself.

This is my first time using psychopy. What should I send as examples and how? Sorry I really don’t know this stuff :confounded:

Use the icon in the circle when posting a reply to upload files

experiment1.psyexp (71.1 KB)
blocks.xlsx (27.7 KB)
FlankerConditionsText.xlsx (39.4 KB)
letterConditions.xlsx (33.0 KB)
innerConditions.xlsx (9.8 KB)
These are all the files I use.

Hi,

I cannot make out which task is which so I created 5 loops assuming that there are 5 tasks (I know I am wrong but adjust accordingly) and an outer loop that encloses everything and hopefully will randomise your tasks.

I haven’t tested it myself but perhaps you can give it a try to see if it works.

The ITIs and the breaks may be a bit tricky so you may need to consider including them inside some loops.

Attached.
experiment1.psyexp (77.1 KB)
myrandom.xlsx (8.1 KB)

1 Like

this is perfect! you are great, thank you so much :blush::ferris_wheel:

Hi,

If you need a latin square for three tasks, the following approach might be one option to do it. It uses the participant numbers (assuming these are 1, 2, 3, etc.) for a modulo division and then uses the remainder to select the task order accordingly. This will work for any number of participants, automatically repeating the order after 3 participants (of course, you could do full counterbalancing by increasing the number of input files and the number for the modulo division). Assuming just three different orders, at the very beginning of your experiment you could insert this code component:

subjCode = int(dlg.data[0])  # assuming participant is your first dialogue field
remainder = subjCode % 3

You could then use the remainder in the outermost loop like this:

In addition, you would need three input files specifying the different orders. For example, 1.xlsx might look like this:

(2.xlsx and 0.xlsx would contain the other two task orders)

I haven’t tried this out, but if I’m not mistaken it should work. (Just to be on the safe side: Using this approach, you would no longer need the “code_randomise” routine as task order will be determined by the input file.)

Jan

P.S. Sorry, I forgot that you need to convert the remainder to a string when using it for the file name: $str(remainder)+".xlsx"

Hi, thank you your help :)

I tried to do what you recommended but psychopy gave a invalid syntax error for remainder = subjCode % 3

It might be very easy problem to fix, but I just started to learn coding and I have no idea how :(

6 Ara 2016 Sal 16:30 tarihinde jderrfuss <psychopy@discoursemail.com> şunu yazdı:

jderrfuss

December 6

Hi,

If you need a latin square for three tasks, the following approach might be one option to do it. It uses the participant numbers (assuming these are 1, 2, 3, etc.) for a modulo division and then uses the remainder to select the task order accordingly. This will work for any number of participants, automatically repeating the order after 3 participants (of course, you could do full counterbalancing by increasing the number of input files and the number for the modulo division). Assuming just three different orders, at the very beginning of your experiment you could insert this code component:

subjCode = int(dlg.data[0])  # assuming participant is your first dialogue field
remainder = subjCode % 3

You could then use the remainder in the outermost loop like this:

In addition, you would need three input files specifying the different orders. For example, 1.xlsx might look like this:

(2.xlsx and 3.xlsx would contain the other two task orders)

I haven't tried this out, but if I'm not mistaken it should work. (Just to be on the safe side: Using this approach, you would no longer need the "code_randomise" routine as task order will be determined by the input file.)

Jan


Visit Topic or reply to this email to respond.


In Reply To

burcu

December 6this is perfect! you are great, thank you so much :blush::ferris_wheel:


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.

Could you perhaps upload your experiment? Also, as mentioned above, the code assumes two things:

  • that you enter an integer as participant code
  • that participant code is the first dialogue field

For example, this should work:

Thank you,
Jan

psychopy aborts the experiments before I see that message box. I will try to upload my experiment, but I have a very bad connection right now, so it might not be possible but I’ll try.

Thank you again :slight_smile:
hope you are having a great day.

experiment1l.psyexp (93.4 KB)
FlankerConditionsText.xlsx (39.4 KB)
innerConditions.xlsx (9.8 KB)
letterConditions.xlsx (35.4 KB)
1.xlsx (28.7 KB)2.xlsx (28.7 KB)3.xlsx (28.7 KB)

Please find an updated version attached. I made the following changes:

  • removed the code component from the outermost loop and added it to main instructions instead
  • added a closing bracket to the code component
  • added str() (see P.S. from my post above)

Please note that the third input file should be called 0.xlsx.

Hope this helps.

Jan

experiment1l.psyexp (93.4 KB)

2 Likes

I think you uploaded the wrong file. The only difference between this one and original one is that in this, key response in the main instruction starts with the text.
I made the changes you said you did. It is working now, but the only problem is for the first participant it starts with the first task, for the second with the third task instead of second and for the third participant again with the third task.

I don’t know whether it is a hard problem to fix, and if it is so please let me know. I took too much of your time already, I don’t want to cause anymore trouble. :slight_smile:

Thank you for your time

burcu

Oops, I think I simply forgot to save the changes before I uploaded the file. Sorry about this.

Could you perhaps upload your most recent version?

Thank you,
Jan

No problem. I solved the problem by the way. I was my mistake, not the files. It is working perfectly right now. You saved my day :slight_smile: thanks!

For info, @jderrfuss you don’t need to know the order of things in the dlg. The data from that dialog is always stored as a dictionary called expInfo and you can fetch specific entries by name like:

expInfo['participant']

and, of course, any other things you put there will work fine too. For instance you could add an entry to the dialog for “group” (0,1,2) and use that in your conditions filename like this:

$"conditions%i.xlsx" %(expInfo['group'])

But this is just icing. Glad you got the key problems sorted,
Jon

2 Likes

Ha, I suspected that this would be possible, but didn’t realise that expInfo has this information. Thanks, Jon! :slight_smile:

Jan

Glad it works! :slight_smile:

Jan