Millisecond Forums

conditional and randomisation logic

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

By paughl - 2/20/2015

Dear forum,

I am struggling to build the following, and would greatly appreciate any help.

I want to deliver a "prime" (audio vignette), followed by a question on the strength of the "prime" (visual analogue scale/slider), followed by a "target" (an image, presented as continuous flash suppression). This question is not about the continuous flash suppression trials, so just consider the "target" to be an image presented within a trial. 

There are 3 types of primes (positive, negative, none) and three types of targets (positive, negative, gabor). 
There are 6 primes for each prime type (eg, 6 positive primes). Each prime will be used 3 times with different target types.
There are 36 targets (12 positive, 12 negative and 12 gabor).
This table might make it more clear:
 
Prime
Target 1
Target 2
Target 3
Positive Vignette #1
Positive
Negative
Gabor
Positive Vignette #2
Positive
Gabor
Negative
Positive Vignette #3
Negative
Positive
Gabor
Positive Vignette #4
Negative
Gabor
Positive
Positive Vignette #5
Gabor
Positive
Negative
Positive Vignette #6
Gabor
Negative
Positive
Negative Vignette #1
Positive
Negative
Gabor
Negative Vignette #2
Positive
Gabor
Negative
Negative Vignette #3
Negative
Positive
Gabor
Negative Vignette #4
Negative
Gabor
Positive
Negative Vignette #5
Gabor
Positive
Negative
Negative Vignette #6
Gabor
Negative
Positive
No Vignette
Positive
Negative
Gabor
No Vignette
Positive
Gabor
Negative
No Vignette
Negative
Positive
Gabor
No Vignette
Negative
Gabor
Positive
No Vignette
Gabor
Positive
Negative
No Vignette
Gabor
Negative
Positive

All primes to be presented in random order, with a given prime never presented closer than 4 trials apart.
All targets to be presented in random order, though constrained to deliver the above 18 sequence types per prime type.
(One such sequence would be that if a given positive prime is paired with a positive target, then the next time it appears it should be paired with either a negative or a gabor target. If it is paired with a negative target on its second appearance, it should be paired with a gabor at its third. etc. Each prime type (eg positive) should cover all 18 possible sequence types, as the table shows).

I am not very familiar with conditionality code.

Apologies if this is confusing, and many thanks in advance!

paul
By Dave - 2/20/2015

> All primes to be presented in random order, with a given prime never presented closer than 4 trials apart.
> All targets to be presented in random order, though constrained to deliver the above 18 sequence types per prime type.

The above is the tricky part and I don't see an easy / obvious way to do it. You either (1) need to come up with an algorithm that reliably and deterministically produces trial sequences satisfying that constraint (and then implement it) or (2) manually construct a bunch of such sequences, hardcode them into the script and then simply select one of those.

(For the record: I am not entirely sure what exactly you mean by "All targets to be presented in random order, though constrained to deliver the above 18 sequence types per prime type.")

For general background, see https://www.millisecond.com/forums/Topic6419.aspx. For a specific example, study the sequence generation code in https://www.millisecond.com/download/library/AAT/ (the forum topic https://www.millisecond.com/forums/Topic12826.aspx contains some discussion of that code and its limitations.)

Apart from the constraints, the rest would look somewhat like the code below (which might give you a starting point).

<block myblock>
/ trials = [1-54=list.triallist]
</block>
  
<list triallist>
/ items = (trial.posprime1, trial.posprime2, trial.posprime3, trial.posprime4, trial.posprime5, trial.posprime6,
    trial.negprime1, trial.negprime2, trial.negprime3, trial.negprime4, trial.negprime5, trial.negprime6,
    trial.noprime1, trial.noprime2, trial.noprime3, trial.noprime4, trial.noprime5, trial.noprime6)
/ poolsize = 54
/ maxrunsize = 0
</list>

*** Positive Prime Trials ***
<trial posprime1>
/ stimulusframes = [1=posprime1]
/ validresponse = (57)
/ branch = [list.posprime1targets.nextvalue]
</trial>

<trial posprime2>
/ stimulusframes = [1=posprime2]
/ validresponse = (57)
/ branch = [list.posprime2targets.nextvalue]
</trial>

<trial posprime3>
/ stimulusframes = [1=posprime3]
/ validresponse = (57)
/ branch = [list.posprime3targets.nextvalue]
</trial>

<trial posprime4>
/ stimulusframes = [1=posprime4]
/ validresponse = (57)
/ branch = [list.posprime4targets.nextvalue]
</trial>

<trial posprime5>
/ stimulusframes = [1=posprime5]
/ validresponse = (57)
/ branch = [list.posprime5targets.nextvalue]
</trial>

<trial posprime6>
/ stimulusframes = [1=posprime6]
/ validresponse = (57)
/ branch = [list.posprime6targets.nextvalue]
</trial>

*** Negative Prime Trials ***
<trial negprime1>
/ stimulusframes = [1=negprime1]
/ validresponse = (57)
/ branch = [list.negprime1targets.nextvalue]
</trial>

<trial negprime2>
/ stimulusframes = [1=negprime2]
/ validresponse = (57)
/ branch = [list.negprime2targets.nextvalue]
</trial>

<trial negprime3>
/ stimulusframes = [1=negprime3]
/ validresponse = (57)
/ branch = [list.negprime3targets.nextvalue]
</trial>

<trial negprime4>
/ stimulusframes = [1=negprime4]
/ validresponse = (57)
/ branch = [list.negprime4targets.nextvalue]
</trial>

<trial negprime5>
/ stimulusframes = [1=negprime5]
/ validresponse = (57)
/ branch = [list.negprime5targets.nextvalue]
</trial>

<trial negprime6>
/ stimulusframes = [1=negprime6]
/ validresponse = (57)
/ branch = [list.negprime6targets.nextvalue]
</trial>

*** No Prime Trials ***
<trial noprime1>
/ stimulusframes = [1=noprime1]
/ validresponse = (57)
/ branch = [list.noprime1targets.nextvalue]
</trial>

<trial noprime2>
/ stimulusframes = [1=noprime2]
/ validresponse = (57)
/ branch = [list.noprime2targets.nextvalue]
</trial>

<trial noprime3>
/ stimulusframes = [1=noprime3]
/ validresponse = (57)
/ branch = [list.noprime3targets.nextvalue]
</trial>

<trial noprime4>
/ stimulusframes = [1=noprime4]
/ validresponse = (57)
/ branch = [list.noprime4targets.nextvalue]
</trial>

<trial noprime5>
/ stimulusframes = [1=noprime5]
/ validresponse = (57)
/ branch = [list.noprime5targets.nextvalue]
</trial>

<trial noprime6>
/ stimulusframes = [1=noprime6]
/ validresponse = (57)
/ branch = [list.noprime6targets.nextvalue]
</trial>

*** Three Target Options Per Prime ***
*** Positive ***
<list posprime1targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list posprime2targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list posprime3targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list posprime4targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list posprime5targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list posprime6targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

*** Negative ***
<list negprime1targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list negprime2targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list negprime3targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list negprime4targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list negprime5targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list negprime6targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

*** None ***
<list noprime1targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list noprime2targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list noprime3targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list noprime4targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list noprime5targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

<list noprime6targets>
/ items = (trial.postarget, trial.negtarget, trial.gabortarget)
</list>

*** Target Trials ***
*** Positive ***
<trial postarget>
/ stimulusframes = [1=postarget]
/ validresponse = (57)
</trial>

*** Negative ***
<trial negtarget>
/ stimulusframes = [1=negtarget]
/ validresponse = (57)
</trial>

*** Gabor ***
<trial gabortarget>
/ stimulusframes = [1=gabortarget]
/ validresponse = (57)
</trial>

*** Stimuli ***
*** Primes ***
*** Positive ***
<text posprime1>
/ items = ("Positive Prime 1")
</text>

<text posprime2>
/ items = ("Positive Prime 2")
</text>

<text posprime3>
/ items = ("Positive Prime 3")
</text>

<text posprime4>
/ items = ("Positive Prime 4")
</text>

<text posprime5>
/ items = ("Positive Prime 5")
</text>

<text posprime6>
/ items = ("Positive Prime 6")
</text>

*** Negative ***
<text negprime1>
/ items = ("Negative Prime 1")
</text>

<text negprime2>
/ items = ("Negative Prime 2")
</text>

<text negprime3>
/ items = ("Negative Prime 3")
</text>

<text negprime4>
/ items = ("Negative Prime 4")
</text>

<text negprime5>
/ items = ("Negative Prime 5")
</text>

<text negprime6>
/ items = ("Negative Prime 6")
</text>

*** None ***
<text noprime1>
/ items = ("No Prime 1")
</text>

<text noprime2>
/ items = ("No Prime 2")
</text>

<text noprime3>
/ items = ("No Prime 3")
</text>

<text noprime4>
/ items = ("No Prime 4")
</text>

<text noprime5>
/ items = ("No Prime 5")
</text>

<text noprime6>
/ items = ("No Prime 6")
</text>

*** Targets  ***
*** Positive ***
<text postarget>
/ items = postargetitems
</text>

<item postargetitems>
/ 1 = "Positive Target 1"
/ 2 = "Positive Target 2"
/ 3 = "Positive Target 3"
/ 4 = "Positive Target 4"
/ 5 = "Positive Target 5"
/ 6 = "Positive Target 6"
/ 7 = "Positive Target 7"
/ 8 = "Positive Target 8"
/ 9 = "Positive Target 9"
/ 10 = "Positive Target 10"
/ 11 = "Positive Target 11"
/ 12 = "Positive Target 12"
</item>

*** Negative ***
<text negtarget>
/ items = negtargetitems
</text>

<item negtargetitems>
/ 1 = "Negative Target 1"
/ 2 = "Negative Target 2"
/ 3 = "Negative Target 3"
/ 4 = "Negative Target 4"
/ 5 = "Negative Target 5"
/ 6 = "Negative Target 6"
/ 7 = "Negative Target 7"
/ 8 = "Negative Target 8"
/ 9 = "Negative Target 9"
/ 10 = "Negative Target 10"
/ 11 = "Negative Target 11"
/ 12 = "Negative Target 12"
</item>

*** Gabor ***
<text gabortarget>
/ items = gabortargetitems
</text>

<item gabortargetitems>
/ 1 = "Gabor Target 1"
/ 2 = "Gabor Target 2"
/ 3 = "Gabor Target 3"
/ 4 = "Gabor Target 4"
/ 5 = "Gabor Target 5"
/ 6 = "Gabor Target 6"
/ 7 = "Gabor Target 7"
/ 8 = "Gabor Target 8"
/ 9 = "Gabor Target 9"
/ 10 = "Gabor Target 10"
/ 11 = "Gabor Target 11"
/ 12 = "Gabor Target 12"
</item>
By paughl - 3/2/2015

Many thanks Dave! Very kind of you.