Welcome!

Sign in with your CogSci, Facebook, Google, or Twitter account.

Or register to create a new account.

We'll use your information only for signing in to this forum.

Supported by

python code

Hey guys, I have several loops in my code (e.g., handedness_loop). In each loop there are variables, (e.g., HQ_R, HQ_L, HQ_B) for which I will need to get the sums of the column variable and then the sum of the sum of the columns (i.e., Sum of HQ_R, HQ_L, and HQ_B separately and sum HQ_R+HQ_L+HQ_B).
I can't find examples of this in the documentation provided. Any help would be appreciated.

Comments

  • eduardeduard Posts: 1,115

    Do you mean for the data analysis? The easiest to accomplish this is using Pivot tables in Excel. There plenty tutorials how to do that on youtube.

    If you need it in the experiment itself. You have to define those columns in python code. So basically just make lists (var.aList = [1,2,3,4]) or dictionaries (var.aDict = dict(cond1 = [1,2,3,4], cond2 = [5,6,7,8]).

    That way you can manipulate all items of the list at any time. To run your trials you then would need to index the current item of one of the lists.

    Eduard

  • So, does that mean that OpenSesame has all the add-ins like numpy and scipy, etc for python already or do I use a pip command to call them first? These are the basics that seem to be missing from the Python instructions.

  • eduardeduard Posts: 1,115

    It comes with quite a few packages, but you can also pip install more if you need to. In any case, if you want to use them, you have to import it (in an inline_script)

    Eduard

  • Good to know. I wanted to check before I tried it. I took the CodeAcademy courses and I have the manual so I'll try it out and see how far I get. There is a Python forum too, isn't there? Specifically, Python coding in OpenSesame - not everything is always the same (it might be a different method).

Sign In or Register to comment.