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

[solved] Randomization + item-specific duration

jakubchjakubch Posts: 29
edited March 2012 in OpenSesame

Hi Sebastiaan,

Thanks for this great program!

I have a question regarding randomization. I have a set of items, names and surnmes. Each item contains also additional information (images, more text) but that's irrelevant now (I have created slides and export them as .png files to use in OpenSesame). Here is what I want to do:

  1. I have a list of "name slides" and "surname slides". Each "name slide" has assigned one "surname slide".
  2. Create a random presentation of "name slides" where each "name slide" is followed by it's assigned "surname slide". (In other words, I would randomized just the "name slides").

Example:
[name slide] [surname slide]
[Sherlock] [Holmes]
[Doctor] [Watson]
[James] [Moriarty]
[Mrs.] [Hudson]

I want to randomize it like this:
[James] [Moriarty]
[Sherlock] [Holmes]
[Mrs.] [Hudson]
[Doctor] [Watson]

But not like this:
[Doctor] [Moriarty]
[Hudson] [Watson]
[Holmes] [Sherlock]
[James] [Mrs.]

I hope it hasn't been answered yet. If I'm wrong, please post a link to the answer. Thanks in advance!

Best regards,
Jakub

Comments

  • sebastiaansebastiaan Posts: 2,812
    edited 10:00AM

    Hi Jakub,

    Welcome to the forum!

    If I understand your question correctly, this would be fairly easy to implement. Basically, you want to present two slides (which would be sketchpads in OpenSesame) in a fixed order, right? But which pair of slides should be shown on a given trial, should be randomized.

    First, you would set up a table in the block-loop with something like the following (if this does not sound familiar, please check out the tutorial):

    name     surname
    Sherlock Holmes
    Mrs.     Hudson
    ...
    James    Moriarty

    Next, you would add two sketchpads to a sequences, the first containing the text [name], the second containing the text [surname]. So the structure in the overview would look something like this (there would probably be more items in the actual experiment):

    loop
    - sequence
    - - sketchpad_name
    - - sketchpad_surname

    Hope this gets you started!

    Regards,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • jakubchjakubch Posts: 29
    edited March 2012

    Thanks for your quick reply, Sebastiaan!

    Well, seems pretty straightforward and I did just what you wrote here to do. I set up a block loop with NAME and SURNAME variables. Then I used names of my .png files (n1-n6 as values for the NAME variable and a1-a6 as values for the SURNAME variable). I did basically something like they did in "Cat face experiment" tutorial, inserting images into file pool, then into sketchpad and modifying the script accordingly. The problem is, when I run the experiment either in window or full screen, I get just the first Display_text item, and then the experiment terminates with following error message:

    An unexpected error occurred, which was not caught by OpenSesame. This should not happen! Message:
    Only 24-bit or 32-bit surfaces can be smoothly scaled

    I get this on both Windows and Ubuntu 11.10, running Darwin. I assume it has to do with pictures I imported into the experiment. Is there a way to solve it?

    Thanks in advance.

    EDIT: Ok, I changed the back-end to PsychoPy and the problem seems to be solved. As for randomization, it works just like I wanted. Thanks again!

  • jakubchjakubch Posts: 29
    edited 10:00AM

    PS.: I figured a debug window could help:

    http://dl.dropbox.com/u/5689384/debug.txt

  • sebastiaansebastiaan Posts: 2,812
    edited 10:00AM

    Hi Jakub,

    Thank you for anticipating my question! The debug output clears things up. It indeed seems that some images cannot be scaled with the legacy (pygame) back-end. I can reproduce this using a grayscale .bmp file. I will see what I can do to fix this: https://github.com/smathot/OpenSesame/issues/76

    One way to solve it, as you discovered, is to use the psycho back-end. Alternatively, you could convert your images into .png format with a tool such as GIMP or (more advanced) ImageMagick, both available in Ubuntu.

    Good luck!

    Regards,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • jakubchjakubch Posts: 29
    edited March 2012

    Hey there again!

    This is not so urgent but anyway:

    While on Win 7 the program works fine using PsychoPy backend, on Oneiric I get these while using PsychoPy and OpenGL:

    http://dl.dropbox.com/u/5689384/debug_psychopy_oneiric

    http://dl.dropbox.com/u/5689384/debug_opnGL_oneiric

    Seems like I'm missing some GL libraries. I did some research and installed various packages but it didn't do the trick. I don't actually know which libraries are necessary and where to get them. A hint would be appreciated! ;-)

    Jakub

  • sebastiaansebastiaan Posts: 2,812
    edited 10:00AM

    Hi Jacob,

    You need the following packages: python-opengl and/ or psychopy.

    sudo apt-get install python-opengl psychopy

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • jakubchjakubch Posts: 29
    edited 10:00AM

    Sorry, I forgot to mention the most important thing: both python-opengl and psychopy are already installed on my system but I get those errors anyway.

  • sebastiaansebastiaan Posts: 2,812
    edited 10:00AM

    Really? Hmm, maybe there's something wrong with (the Python bindings of) OpenGL. If you open a Python interpreter (by typing python in a terminal) and try to import OpenGL, do you receive an error?

    import OpenGL.GL

    And can you run other OpenGL based things? For example, do the desktop effects work (e.g., are there shadows under the Windows)?

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • jakubchjakubch Posts: 29
    edited 10:00AM

    As for the desktop effects: Yes, there are shadows under windows (altho I didn't explore other kinds of effects since I don't like to use them. However, I will try if it's necessary).

    And here is the output from terminal:

    Traceback (most recent call last):
      File "", line 1, in 
      File "/usr/lib/pymodules/python2.7/OpenGL/GL/__init__.py", line 2, in 
        from OpenGL.raw.GL import *
      File "/usr/lib/pymodules/python2.7/OpenGL/raw/GL/__init__.py", line 6, in 
        from OpenGL.raw.GL.constants import *
      File "/usr/lib/pymodules/python2.7/OpenGL/raw/GL/constants.py", line 7, in 
        from OpenGL import platform, arrays
      File "/usr/lib/pymodules/python2.7/OpenGL/platform/__init__.py", line 36, in 
        _load()
      File "/usr/lib/pymodules/python2.7/OpenGL/platform/__init__.py", line 27, in _load
        plugin_class = plugin.load()
      File "/usr/lib/pymodules/python2.7/OpenGL/plugins.py", line 14, in load
        return importByName( self.import_path )
      File "/usr/lib/pymodules/python2.7/OpenGL/plugins.py", line 28, in importByName
        module = __import__( ".".join(moduleName), {}, {}, moduleName)
      File "/usr/lib/pymodules/python2.7/OpenGL/platform/glx.py", line 8, in 
        class GLXPlatform( baseplatform.BasePlatform ):
      File "/usr/lib/pymodules/python2.7/OpenGL/platform/glx.py", line 20, in GLXPlatform
        raise ImportError("Unable to load OpenGL library", *err.args)
    ImportError: ('Unable to load OpenGL library', 'GL: cannot open shared object file: No such file or directory', 'GL', None)
    
  • sebastiaansebastiaan Posts: 2,812
    edited 10:00AM

    Hi Jacub,

    Hmm, right. It appears that (py)OpenGL doesn't work on your system. If you haven't done anything out of the ordinary, such as adding third party repositories with different versions of OpenGL-related stuff, my bet is that there's a problem with your graphics card. Perhaps you could try some Google searches on the error that you get + your version of Ubuntu + your graphics card?

    I'm afraid I cannot really help you much in this department. It can be a bit tricky to get the proper graphics drivers running on Ubuntu, unfortunately (I've had my share of trouble as well).

    Good luck!

    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • jakubchjakubch Posts: 29
    edited 10:00AM

    Thanks, Sebastiaan! At least I know what's going on and I can use the Windows version while trying to solve this problem.

    Good luck to you too!

    Jakub

  • jakubchjakubch Posts: 29
    edited 10:00AM

    Hi Sebastiaan!

    I have more questions about randomization.

    These are my variables:

    NAME  SURNAME
    a1    n1
    ...   ...
    a12   n12
    

    As I said earlier, each variable represents a serie of slides to be presented to the subject via displaying the sketchpad. Each sketchpad element's duration is set to a specific time period. Now, here comes the tricky part:

    I need all the odd numbers (a1, a3... a5 and n1, ...n5) to have the duration set to, let's say 12 seconds while all the even numbers (the rest) to have the duration set to 6 seconds. In other words, I need the duration of the sketchpad element to be determined by what value of the variable is being used.

    Is this possible?

    Jakub

  • sebastiaansebastiaan Posts: 2,812
    edited March 2012

    Hi Jakub,

    Yes, sure. The easiest way is probably to add an extra column, let's call it MYDURATION, so the table looks like this:

    NAME  SURNAME MYDURATION
    a1    n1   12
    ...   ...   6
    a12   n12   6

    And then you enter [MYDURATION] into the duration field of the sketchpad.

    Hope this helps!

    Cheers,
    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

  • jakubchjakubch Posts: 29
    edited 10:00AM

    That's pretty intuitive, actually (so intuitive that I haven't thought of it). I'm starting to see the elegance of this program.

    Thanks a lot!

Sign In or Register to comment.