Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] to program an experience related to the subject’s response

edited April 2015 in OpenSesame

Hi everyone,
I am a novice in using OpenSesame and python. I would like to be able to program an experience related to the subject’s response.

Task: the participant must choose 30 objects in a set 60.

First, we show an object to the subject, if the participant chooses this object, he presses the « q » key, but if he doesn’t want it, he presses the « m » key. When the participant presses one of these keys, the object disappears. After a certain delay (400ms, 600ms or 800ms), a basket full of items (basket_full) or an empty one (basket_empty) appears on the screen.

50% of the time, baskets are congruent with the subject’s response (for example: if the subject want the object he presses the « q » key and I show him a basket_full , if he doesn’t want the object he presses the « m » key and I show him a basket_empty).
The other half , the basket doesn’t match the subject’s response (for example: if the subject want the object he presses the « q » key and I show him a basket_empty, if he doesn’t want the object he presses the « m » key and I show him a basket_full).

However I would like to have 60 randomized trials:
10 trials with a delay = 400ms and congruent with the subject’s response
10 trials with a delay = 400ms and incongruent with the subject’s response
10 trials with a delay = 600ms and congruent with the subject’s response
10 trials with a delay = 600ms and incongruent with the subject’s response
10 trials with a delay = 800ms and congruent with the subject’s response
10 trials with a delay = 800ms and incongruent with the subject’s response

Could you, please, help me?
Thank you very much!
Agnès

Comments

  • edited April 2015

    Hi Agnès,

    The experiment you are describing sounds like a perfect case for the variable wizard. Check out step 3 of this tutorial to get a comprehensive explanation of how it works. Basically, what you need to do is clicking on variable wizardin a loop item and add all your variables with corresponding levels. As far as I understood this will be delay (400,600,800), and congruency (yes,no). The other variables (image and response), I would define later in the loop, e.g. picking 30 pictures randomly from a pool of 50 images within an inline_script. However, this is a personal preference, there are other ways of doing it. I recommend you try to set up your experiment by means of the variable wizard and see how far you get, later you will probably bump into other problems which you can post here again.

    Let me know if you need more help.

    Good luck,

    Eduard

    Buy Me A Coffee

  • edited 7:09AM

    Hi,

    First, thanks for your quick answer.

    Sorry, I have not been clear, here is my problem.

    I want 10 congruent trials and 10 incongruent trials when the delay is equal to 400 ms

    The trial is congruent:

    • If the subject presses the “q” key and if I show the picture “basket_full” (both conditions need to be applied)

    • If the subject presses the “m” key and if I show the picture “basket_empty” (both conditions need to be applied)

    The trial is incongruent:

    • If the subject presses the “m” key and if I show the picture “basket_full” (both conditions need to be applied)

    • If the subject presses the “q” key and if I show the picture “basket_empty” (both conditions need to be applied)

    I would like for opensesame to stock the subject’s responses and according to the subject’s responses opensesame should show a specific picture ( basket_empty or basket_full). Knowing, that I want 10 congruent trials and 10 incongruent trials.

    opensesame must stock 3 variables :

    • I= the input ( subject’s response “q” or “m”)
    • D= delay
    • O= output( basket_full or basket_empty)

    If opensesame counts 10 congruent trials, for example:

    Trial 1: [ “q”; 400, “basket_full]

    Trial 2: [ “q”; 400, “basket_full]

    Trial 3:[ “q”; 400, “basket_full]

    Trial 4: [“m”; 400, “basket_ empty]

    Trial 5: [“q”; 400, “basket_full]

    Trial 6: [“m”; 400, “basket_ empty]

    Trial 7: [ “m”; 400, “basket_ empty]

    Trial 8: [ “q”; 400, “basket_full]

    Trial 9: [ “m”; 400, “basket_ empty]

    Trial 10: [ “q”; 400, “basket_full]

    Then the eleventh trial must be incongruent:

    Trial 11: [ “q”; 400, “basket_ empty”] or [ “m”; 400, “basket_ full”]

    I have a coworker who knows more or less vba, we tried a “vba inspired” code (that I will later have to “translate” in python) to represent the logic behind this rigged randomization.

    Thank you very much

    Agnès

  • edited 7:09AM

    Hi Agnes,

    Just to be clear, is it essential that the ordering of trials is done in the way your vba suggests, that is, first are congruent trials sampled until there have been 10 and only after that incongruent trials are added, also up to 10. Or do you only want to make sure that there are equal numbers of congruent and incongruent trials (over the different delays), in which their order can be random?

    Sorry my confusion, but I don't know why you would opt for the first option.

    Thanks,

    Eduard

    Buy Me A Coffee

  • edited 7:09AM

    Hi Eduard,

    It is the second option, I want to make sure that there are equal numbers of congruent and incongruent trials (over the different delays), in which their order can be random.

    thank you

  • edited 7:09AM

    In this case, the strategy which I described (using the variable wizard) will make sure that every condition is presented equally often. So let's consider following:

    You specify a 2 variables. First is delay (400,600,800) and the second is congruency (congruent, incongruent). What the variable wizard does is combining these levels to create a matrix with all possible combinations (400c,400ic,600c,600ic,800c,800ic). Furthermore, you can specify the number of how often every conditions (called "cycles") is repeated. To do so, you just need to set the number of repeats to 10, and you will have 10 repetitions of every conditions, so 60 trials in total.
    So far this design won't include the choice of the participants (q vs m), but since this is completely in their hand, I don't think you want it to be specified, right?

    Am I still misunderstanding, or does this help?

    Eduard

    Buy Me A Coffee

  • edited 7:09AM

    Hi Eduard,

    This is the choice of the participants (“q” or “m”) + a specific picture (“basket_full” or “basket_empty”) wich determines if the trial is congruent or incongruent

    Example:

    Trial 1: Subject presses “m”

    I would like for opensesame to choose a picture (“basket_full” or “basket_empty”)only for the first 10 trials


    #sketchpad ( name:"basket") trials= 0 if trials<= 10: draw image 0 0 "basket_[basket_x].jpg" scale=1 center=1 z_index=0 show_if="always" trials=trials +1 if trials=> 10: break #opensesame must stock the pictures, the delay and the choice of the participants. #after the 10 first trials,onpesesame must count the number of congruent trials and incongruent trials congruent= 0 incongruent= 0 congruent2= 0 incongruent2= 0 congruent3= 0 incongruent3= 0 if delay=400: if response_keyboard =="m" and basket== "basket_empty.jpg": congruent= congruent + 1 if response_keyboard_ =="q" and basket== " basket_full.jpg ": congruent= congruent + 1 if response_keyboard =="m" and basket== "basket_full.jpg": incongruent = incongruent + 1 if response_keyboard_ =="q" and basket== " basket_empty.jpg ": incongruent =incongruent +1 if delay=400: if response_keyboard =="m" and basket== "basket_empty.jpg": congruent= congruent + 1 if response_keyboard_ =="q" and basket== " basket_full.jpg ": congruent= congruent + 1 if response_keyboard =="m" and basket== "basket_full.jpg": incongruent = incongruent + 1 if response_keyboard_ =="q" and basket== " basket_empty.jpg ": incongruent =incongruent +1 if delay=600: if response_keyboard =="m" and basket== "basket_empty.jpg": congruent2= congruent2 + 1 if response_keyboard_ =="q" and basket== " basket_full.jpg ": congruent2= congruent2 + 1 if response_keyboard =="m" and basket== "basket_full.jpg": incongruent2 = incongruent2 + 1 if response_keyboard_ =="q" and basket== " basket_empty.jpg ": incongruent2 =incongruent2 +1 if delay=800: if response_keyboard =="m" and basket== "basket_empty.jpg": congruent3= congruent3 + 1 if response_keyboard_ =="q" and basket== " basket_full.jpg ": congruent3= congruen3t + 1 if response_keyboard =="m" and basket== "basket_full.jpg": incongruent3 = incongruent3 + 1 if response_keyboard_ =="q" and basket== " basket_empty.jpg ": incongruent3 =incongruent3 +1 #if after the 10 first trials opensesame counts 10 congruent or incongruent trials for a specific delay #opensesame does the following: if delay= 400 and congruent => 10: if response_keyboard =="q": draw image 0 0 "basket_empty.jpg" scale=1 center=1 z_index=0 show_if="always" incongruent = incongruent + 1 if response_keyboard =="m": draw image 0 0 "basket_full.jpg" scale=1 center=1 z_index=0 show_if="always" incongruent = incongruent + 1 if delay= 400 and incongruent => 10: if response_keyboard =="q": draw image 0 0 "basket_empty.jpg" scale=1 center=1 z_index=0 show_if="always" congruent = congruent + 1 if response_keyboard =="m": draw image 0 0 "basket_full.jpg" scale=1 center=1 z_index=0 show_if="always" congruent = congruent + 1 if delay= 600 and congruent => 10: if response_keyboard =="q": draw image 0 0 "basket_empty.jpg" scale=1 center=1 z_index=0 show_if="always" incongruent2 = incongruent2 + 1 if response_keyboard =="m": draw image 0 0 "basket_full.jpg" scale=1 center=1 z_index=0 show_if="always" incongruent2 = incongruent2 + 1 if delay= 600 and incongruent => 10: if response_keyboard =="q": draw image 0 0 "basket_empty.jpg" scale=1 center=1 z_index=0 show_if="always" congruent2 = congruent2 + 1 if response_keyboard =="m": draw image 0 0 "basket_full.jpg" scale=1 center=1 z_index=0 show_if="always" congruent2 = congruent2 + 1 if delay= 800 and congruent => 10: if response_keyboard =="q": draw image 0 0 "basket_empty.jpg" scale=1 center=1 z_index=0 show_if="always" incongruent3 = incongruent3 + 1 if response_keyboard =="m": draw image 0 0 "basket_full.jpg" scale=1 center=1 z_index=0 show_if="always" incongruent3 = incongruent3 + 1 if delay= 800 and incongruent => 10: if response_keyboard =="q": draw image 0 0 "basket_empty.jpg" scale=1 center=1 z_index=0 show_if="always" congruent3 = congruent3 + 1 if response_keyboard =="m": draw image 0 0 "basket_full.jpg" scale=1 center=1 z_index=0 show_if="always" congruent3 = congruent3 + 1 #if after the 10 first trials opensesame does not count 10 congruent or incongruent trials for a specific delay #opensesame does the following: if congruent <= 10: if response_keyboard =="m": draw image 0 0 "basket_[basket_x].jpg" scale=1 center=1 z_index=0 show_if="always" congruent= congruent + 1 if response_keyboard_ =="q": draw image 0 0 "basket_[basket_x].jpg" scale=1 center=1 z_index=0 show_if="always" congruent= congruent + 1 if incongruent <= 10: if response_keyboard =="m": draw image 0 0 "basket_[basket_x].jpg" scale=1 center=1 z_index=0 show_if="always" incongruent = incongruent + 1 if response_keyboard_ =="q": draw image 0 0 "basket_[basket_x].jpg" scale=1 center=1 z_index=0 show_if="always" incongruent =incongruent +1 #then opensemame must give a feedback every 10 trials: print( "the number of objects in your basket is "[basket.count("basket_full.jpg"])

    Agnès

  • edited 7:09AM

    Hi Agnes,

    Sorry for not having responded earlier.

    I'm still not sure whether we're understanding each other (I tend to believe we're saying the some stuff just with different words). To be super clear, I wrote a basic version of this experiment to see, whether this is what you need. The logic is the same as I think you want to have, only stimulus set, and some other irrelevant (at least for now) parameters I set to my convenience.

    Have a look at this experiment and its log file. Is this what you're aiming at?

    Eduard

    Buy Me A Coffee

Sign In or Register to comment.