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] Recording multiple responses in one trial

sebastiaansebastiaan Posts: 2,737
edited August 2011 in OpenSesame
On GitHub, Trombonechamp points out that multiple responses in one trial will overwrite each other. This makes it problematic to record, for example, the duration that has elapsed between two key presses.

Proposed solution
Add a prefix or suffix to all response variables, so that responses from multiple items won't overwrite each other. For example, a keyboard_response item named "resp", would record responses as [response_resp]. This is in addition to the old [response] variable, which is kept for backward compatibility.

Current workaround
To solve this issue for now, an inline_script item is required that renames the variables after they have been collected. For example:
self.experiment.set("response_a", self.get("response"))
self.experiment.set("response_time_a", self.get("response_time"))
self.experiment.set("correct_a", self.get("correct"))

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

Thanked by 1Kantartur

Comments

  • sebastiaansebastiaan Posts: 2,737
    edited 5:30PM

    Added as a feature request on GitHub #28.

    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

  • EvertoxEvertox Posts: 23
    edited 5:30PM

    Hi Sebastiaan,
    How do you collect multiple responses using the Parallel Plugin? The above code does not seem to work using this method.
    Thanks
    Anthony McGuffie

  • sebastiaansebastiaan Posts: 2,737
    edited 5:30PM

    Hi Anthony,

    The problem described in this post is that there used to be only a single response variable, which made it impossible to distinguish responses collected in multiple response items. For example when you had two keyboard_response items in a trial sequence. But the solution proposed above has been implemented already way back. (The post is from 2011.) See also:

    But this is unrelated to the parallel plug-in. Could you describe in more detail what you're trying to do, and what problems you run into?

    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

  • EvertoxEvertox Posts: 23
    edited 5:30PM

    Hi Sebastiaan,

    I am trying to create an Implicit Memory task that I have previously used in E-Prime.

    It is a dual task where participants are shown a word for 0-2000ms and at the same time (0-1000ms) there is a 3 digit number (num1) displayed above. At 1000ms-2000ms a second 3 digit number is displayed (num2) and (num1) disappears.

    The user responds with an 'x' if the word is living and also an 'm' if num1 and/or num2 is an odd number.

    This means there is a possible number of 3 individual responses within the 2000ms stimulus presentation. I have created 2 sketchpads (stim1) and (stim2) each duration being 1000ms and used the Parallel Plugin to record the responses.

    The problem I have is when using the Parallel Plugin, where to insert the inline code following the keyboard_response to collect all 3 responses. Has this method been tried in the past?

    I have supplied a link for you to get an idea of what i am trying to achieve.

    https://www.dropbox.com/s/it4yafta9huun9a/ImplicitMemory.opensesame?dl=0

    Thanks

    Anthony McGuffie

  • sebastiaansebastiaan Posts: 2,737
    edited November 2014

    Hi Anthony,

    Right, I see. So if I understand correctly, you want to show three sketchpads (num1, num2, and blank) and collect three responses at the same time. Is that correct?

    You can do this by adding two sequences to your parallel item. The first sequence contains three keyboard_response item, thus collecting three responses. The second sequence contains three sketchpads for the stimulus presentation. Like so:

    image

    So I don't think you will need any scripting at all for this. For a simple example, see this gist:

    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

  • ShradhaShradha Posts: 1

    Hi Sebastiaan,
    I have been working on open sesame for making a time series experiment for Necker cube perceptual switches. So how can I collect more than 250 key press responses on every perceptual switch which showing the same Necker cube target for around 5-6 minutes as a free viewing task. considering the fact that target should remain consistently in the screen without creating any visible changes.

    Thanx
    Shradha

  • eduardeduard Posts: 875

    Hi Shradha,

    There are two ways:

    1) A little crude, but you can make a simple loop with a sketchpad (for the cube with a duration of 0), a keyboard_response (duration keypress) and a logger. The trick is to set the number of repetitions of the loop to a very high value, so that it basically runs forever (sort of). Additionally, you check in the loop how much time has passed since you entered it, and break it as soon as 5-6 minutes have passed.

    2) Move everything into an inline_script. Something like that:

    cv = canvas()
    kb = keyboard()
    path = exp.pool[u'image_in_pool.png']
    cv.image(path)
    block_dur = 300000 # 5 minutes
    
    t0 = cv.show()
    while clock.time-t0<block_dur:
        var.response,var.response_time = kb_get_key()
        log.write_vars()
    

    Quite simple, you see?

    Good lcuk,

    Eduard

Sign In or Register to comment.