Millisecond Forums

Randomized stimuli that are presented dependent on each other

https://forums.millisecond.com/Topic30342.aspx

By Christin41 - 12/2/2020

For a discrimination task I am trying to program 12 trials in which each trial, the participant first gets a countdown, then the text INHALE together with the label "REFERENCE" on top of the page gets displayed on the screen and an odor (via a port code) is presented at the same time. This is done again twice but once with the label ODOR 1 and once with the label ODOR 2. After these three "rounds" the participant has to respond with the A key for Odor 1 or the L key for Odor 2 which of the odors (a question displayed in the center of the screen) is identical to the reference odor. So the point of the task is for the participant to decide which one of the test odors (Odor 1 and Odor 2) is identical to the reference odor. The reference odor, as well as the test odor order needs to be randomized. 

The idea of the 12 trials is to have all the pairs e.g. 1 reference - 1,2 test. 1 reference - 1,3 test. 1 reference - 1,4 test. Up to odor 4. 

My question is now how do I program this dependency? Is it somehow possible to program that one port is randomly selected at the time of the REFERENCE label presentation and to then have the same port selected at the Odor 1 label presentation and any but the already selected port selected at the Odor 2 label presentation (but then at the same time have it randomized whether the "correct" port, so the port that is the same as the original is Odor 1 or Odor 2)? 

Any other suggestions on how this could be programmed are also very welcome!!

This what I have so far:

<text 3>
/ items = ("3")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text 2>
/ items = ("2")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text 1>
/ items = ("1")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text inhale>
/ items = ("INHALE")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text reference_label>
/ items = ("REFERENCE")
/ fontstyle = ("Arial", 25pt)
/ position = (50, 10)
</text>

<text odor1_label>
/ items = ("ODOR 1")
/ fontstyle = ("Arial", 25pt)
/ position = (50, 10)
</text>

<text odor2_label>
/ items = ("ODOR 2")
/ fontstyle = ("Arial", 25pt)
/ position = (50, 10)
</text>

<text odor1_response>
/ items = ("ODOR 1")
/ fontstyle = ("Arial", 25pt)
/ position = (20, 50)
</text>

<text odor2_response>
/ items = ("ODOR 2")
/ fontstyle = ("Arial", 25pt)
/ position = (80, 50)
</text>

<text discrim_quest>
/ items = ("Which Odor?")
/ fontstyle = ("Arial", 30pt)
/ position = (50, 50)
</text>

<shape empty>
/ shape = rectangle
/ size = (100, 100)
/ position = (50, 50)
/ color = black
/ erase = true(black)
</shape>


<trial discr_Odor1_correct>
/ stimulustimes = [0=3; 1000=2; 2000=1; 3000=inhale; 3000=reference_label; 5000=empty;
                7000=3; 8000=2; 9000=1; 10000=inhale; 10000=odor1_label; 12000=empty;
                14000=3; 15000=2; 16000=1; 17000=inhale; 17000=odor2_label; 19000=empty;
                21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ correctresponse = ("a")
/ validresponse = ("a", "l")
/ beginresponsetime = 21000
/ pretrialpause = 1000
</trial>

<trial discr_Odor2_correct>
/ stimulustimes = [0=3; 1000=2; 2000=1; 3000=inhale; 3000=reference_label; 5000=empty;
                7000=3; 8000=2; 9000=1; 10000=inhale; 10000=odor1_label; 12000=empty;
                14000=3; 15000=2; 16000=1; 17000=inhale; 17000=odor2_label; 19000=empty;
                21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ correctresponse = ("l")
/ validresponse = ("a", "l")
/ beginresponsetime = 21000
/ pretrialpause = 1000
</trial>


<block discrimination>
/ trials = [1=discr_Odor1_correct; 2=discr_Odor2_correct]
/ preinstructions = (discr_instr)
</block>
By Dave - 12/2/2020

Christin41 - 12/2/2020
For a discrimination task I am trying to program 12 trials in which each trial, the participant first gets a countdown, then the text INHALE together with the label "REFERENCE" on top of the page gets displayed on the screen and an odor (via a port code) is presented at the same time. This is done again twice but once with the label ODOR 1 and once with the label ODOR 2. After these three "rounds" the participant has to respond with the A key for Odor 1 or the L key for Odor 2 which of the odors (a question displayed in the center of the screen) is identical to the reference odor. So the point of the task is for the participant to decide which one of the test odors (Odor 1 and Odor 2) is identical to the reference odor. The reference odor, as well as the test odor order needs to be randomized. 

The idea of the 12 trials is to have all the pairs e.g. 1 reference - 1,2 test. 1 reference - 1,3 test. 1 reference - 1,4 test. Up to odor 4. 

My question is now how do I program this dependency? Is it somehow possible to program that one port is randomly selected at the time of the REFERENCE label presentation and to then have the same port selected at the Odor 1 label presentation and any but the already selected port selected at the Odor 2 label presentation (but then at the same time have it randomized whether the "correct" port, so the port that is the same as the original is Odor 1 or Odor 2)? 

Any other suggestions on how this could be programmed are also very welcome!!

This what I have so far:

<text 3>
/ items = ("3")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text 2>
/ items = ("2")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text 1>
/ items = ("1")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text inhale>
/ items = ("INHALE")
/ fontstyle = ("Arial", 9%)
/ position = (50, 50)
</text>

<text reference_label>
/ items = ("REFERENCE")
/ fontstyle = ("Arial", 25pt)
/ position = (50, 10)
</text>

<text odor1_label>
/ items = ("ODOR 1")
/ fontstyle = ("Arial", 25pt)
/ position = (50, 10)
</text>

<text odor2_label>
/ items = ("ODOR 2")
/ fontstyle = ("Arial", 25pt)
/ position = (50, 10)
</text>

<text odor1_response>
/ items = ("ODOR 1")
/ fontstyle = ("Arial", 25pt)
/ position = (20, 50)
</text>

<text odor2_response>
/ items = ("ODOR 2")
/ fontstyle = ("Arial", 25pt)
/ position = (80, 50)
</text>

<text discrim_quest>
/ items = ("Which Odor?")
/ fontstyle = ("Arial", 30pt)
/ position = (50, 50)
</text>

<shape empty>
/ shape = rectangle
/ size = (100, 100)
/ position = (50, 50)
/ color = black
/ erase = true(black)
</shape>


<trial discr_Odor1_correct>
/ stimulustimes = [0=3; 1000=2; 2000=1; 3000=inhale; 3000=reference_label; 5000=empty;
                7000=3; 8000=2; 9000=1; 10000=inhale; 10000=odor1_label; 12000=empty;
                14000=3; 15000=2; 16000=1; 17000=inhale; 17000=odor2_label; 19000=empty;
                21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ correctresponse = ("a")
/ validresponse = ("a", "l")
/ beginresponsetime = 21000
/ pretrialpause = 1000
</trial>

<trial discr_Odor2_correct>
/ stimulustimes = [0=3; 1000=2; 2000=1; 3000=inhale; 3000=reference_label; 5000=empty;
                7000=3; 8000=2; 9000=1; 10000=inhale; 10000=odor1_label; 12000=empty;
                14000=3; 15000=2; 16000=1; 17000=inhale; 17000=odor2_label; 19000=empty;
                21000=odor1_response; 21000=odor2_response; 21000=discrim_quest]
/ correctresponse = ("l")
/ validresponse = ("a", "l")
/ beginresponsetime = 21000
/ pretrialpause = 1000
</trial>


<block discrimination>
/ trials = [1=discr_Odor1_correct; 2=discr_Odor2_correct]
/ preinstructions = (discr_instr)
</block>

> The idea of the 12 trials is to have all the pairs e.g. 1 reference - 1,2 test. 1 reference - 1,3 test. 1 reference - 1,4 test. Up to odor 4.

Pairing stimui, i.e. their respective items, is detailed here:
https://www.millisecond.com/support/docs/v5/html/howto/howtopairs.htm

It doesn't matter whether you pair two (or more) text elements, two or more picture elements, or any mix of stimulus types (i.e. you can pair a <port>'s items to a <text>'s items or vice versa). You can pair lists for item selection in the same way.

The rest, then, essentially goes like this:


// 12 pairs of reference and comparison odors
<list reference_odors>
/ items = (
    1,1,1,
    2,2,2
    3,3,3,
    4,4,4)
/ selectionmode = random
/ replace = false
/ maxrunsize = 2
</list>

<list comparison_odors>
/ items = (
    2,3,4,
    1,3,4,
    1,2,4,
    1,2,3)
/ selectionmode = list.reference_odors.currentindex
</list>

// randomly determine whether odor_1 or odor_2 is identical to the reference odor
<list is_reference_list>
/ items = ("odor_1", "odor_2")
/ poolsize = 12
</list>

<values>
/ reference_odor_item = 0
/ comparison_odor_item = 0
/ odor_1_item = 0
/ odor_2_item = 0
/ is_reference = ""
/ correctkey = 0
</values>

<block myblock>
/ trials = [1-12 = mytrial]
</block>

// pick reference and paired comparison odor item number
// determine whether odor_1 or odor_2 will be identical to reference
// set correct key accordingly
<trial mytrial>
/ ontrialbegin = [
    values.reference_odor_item = list.reference_odors.nextvalue;
    values.comparison_odor_item = list.comparison_odors.nextvalue;
    values.is_reference = list.is_reference_list.nextvalue;
]
/ ontrialbegin = [
    if (values.is_reference == "odor_1") {
        values.odor_1_item = values.reference_odor_item;
        values.odor_2_item = values.comparison_odor_item;
        values.correctkey = 30;
    } else if (values.is_reference == "odor_2") {
        values.odor_1_item = values.comparison_odor_item;
        values.odor_2_item = values.reference_odor_item;
        values.correctkey = 38;
    };
]
/ stimulustimes = [0=reference_odor; 1000=odor_1; 2000=odor_2]
/ validresponse = (30, 38)
/ iscorrectresponse = [
    trial.mytrial.response == values.correctkey
]
</trial>

<text reference_odor>
/ items = odor_items
/ select = values.reference_odor_item
/ position = (50%, 25%)
</text>

<text odor_1>
/ items = odor_items
/ select = values.odor_1_item
/ position = (40%, 50%)
</text>

<text odor_2>
/ items = odor_items
/ select = values.odor_2_item
/ position = (60%, 50%)
</text>

<item odor_items>
/ 1 = "ODOR A"
/ 2 = "ODOR B"
/ 3 = "ODOR C"
/ 4 = "ODOR D"
</item>

<data>
/ columns = (date time subject group blocknum blockcode trialnum trialcode values.reference_odor_item values.comparison_odor_item values.is_reference response correct latency)
/ separatefiles = true
</data>