Millisecond Forums

calling a sequence of orientation/rotation

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

By yjung541 - 11/25/2020

Hi Dave,
I'm trying to have a pre-generated sequence of orientations for the images, so that each trial, there's varying rotation value.
I know how the pre-generated sequence works for images, but I can't figure out how to work this out for the orientation. Here is my toy script that I tried with list attributes so that orientation for each trial becomes 30, 45, and 90.

<item images>
/1 = "stimuli/yellow_line.png"
/2 = "stimuli/red_line.png"
/3 = "stimuli/blue_line.png"
</item>

<picture inst_base>
/ items = items.images
/ size = (15%, 30%)
/ position = (50%, 50%)
/ rotation = values.ang
</picture>
    
<text InstTitle>
/ items = ("ORIENTATION JUDGEMENT TASK")
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 1)
/ position = (50%, 10%)
</text>

<text Inst1>
/ items = ("In this study, you will see a line (BASE IMAGE) and a picture with striples (TARGET IMAGE).")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 20%)
</text>

<list angles>
/ items = (30 45 90)
/ selectionmode = sequence
</list>

<trial tr_instr1>
/ stimulusframes = [1 = Inst1, InstTitle, inst_base]
/ validresponse = (57)
/ beginresponsetime = 500
/ ontrialbegin = [
    values.ang = list.angles.nextvalue
]
</trial>

My question is - if I want to pre-generate the sequence of orientations (for hundreds of trials) and especially multiple pre-generated sequences that will be randomly assigned to each participant, what would be the best way to implement it?
Should my text file include the list? Something like -

<list angles>
/ items = (30 45 90 30 40 20 50 180 ... 300)
/ selectionmode = sequence
</list>

and, randomly call a file for each participant? (I saw a forum post about this, and I think I can work on it on my own).
Or, is there a way to make it an item attribute and use it? 

I'm sorry if something similar has been asked before - I couldn't find this exact solution.

Thank you so much for your help in advance!
Yaelan
By Dave - 11/25/2020

yjung541 - 11/25/2020
Hi Dave,
I'm trying to have a pre-generated sequence of orientations for the images, so that each trial, there's varying rotation value.
I know how the pre-generated sequence works for images, but I can't figure out how to work this out for the orientation. Here is my toy script that I tried with list attributes so that orientation for each trial becomes 30, 45, and 90.

<item images>
/1 = "stimuli/yellow_line.png"
/2 = "stimuli/red_line.png"
/3 = "stimuli/blue_line.png"
</item>

<picture inst_base>
/ items = items.images
/ size = (15%, 30%)
/ position = (50%, 50%)
/ rotation = values.ang
</picture>
    
<text InstTitle>
/ items = ("ORIENTATION JUDGEMENT TASK")
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 1)
/ position = (50%, 10%)
</text>

<text Inst1>
/ items = ("In this study, you will see a line (BASE IMAGE) and a picture with striples (TARGET IMAGE).")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 20%)
</text>

<list angles>
/ items = (30 45 90)
/ selectionmode = sequence
</list>

<trial tr_instr1>
/ stimulusframes = [1 = Inst1, InstTitle, inst_base]
/ validresponse = (57)
/ beginresponsetime = 500
/ ontrialbegin = [
    values.ang = list.angles.nextvalue
]
</trial>

My question is - if I want to pre-generate the sequence of orientations (for hundreds of trials) and especially multiple pre-generated sequences that will be randomly assigned to each participant, what would be the best way to implement it?
Should my text file include the list? Something like -

<list angles>
/ items = (30 45 90 30 40 20 50 180 ... 300)
/ selectionmode = sequence
</list>

and, randomly call a file for each participant? (I saw a forum post about this, and I think I can work on it on my own).
Or, is there a way to make it an item attribute and use it? 

I'm sorry if something similar has been asked before - I couldn't find this exact solution.

Thank you so much for your help in advance!
Yaelan

The trick would be to perform list-nesting. Let's expand your toy example to three lists of pregerenated rotations, and let's select one of those lists at random at the start of the experiment. It goes like this:

<item images>
/1 = "stimuli/yellow_line.png"
/2 = "stimuli/red_line.png"
/3 = "stimuli/blue_line.png"
</item>

<picture inst_base>
/ items = item.images
/ size = (15%, 30%)
/ position = (50%, 50%)
/ rotation = values.ang
</picture>
 
<text InstTitle>
/ items = ("ORIENTATION JUDGEMENT TASK")
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 1)
/ position = (50%, 10%)
</text>

<text Inst1>
/ items = ("In this study, you will see a line (BASE IMAGE) and a picture with striples (TARGET IMAGE).")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 20%)
</text>

// list angles with the individual sequence lists as its items
<list angles>
/ items = (list.angle_sequence_1.nextvalue, list.angle_sequence_2.nextvalue, list.angle_sequence_3.nextvalue)
/ selectionmode = values.selectedlist
</list>

// sequence 1
<list angle_sequence_1>
/ items = (30, 45, 90)
/ selectionmode = sequence
</list>

// sequence 2
<list angle_sequence_2>
/ items = (60, 90, 180)
/ selectionmode = sequence
</list>

// sequence 3
<list angle_sequence_3>
/ items = (90, 135, 270)
/ selectionmode = sequence
</list>

<trial tr_instr1>
/ stimulusframes = [1 = Inst1, InstTitle, inst_base]
/ validresponse = (57)
/ beginresponsetime = 500
/ ontrialbegin = [
  values.ang = list.angles.nextvalue
]
</trial>

<block exampleblock>
/ trials = [1-3 = tr_instr1]
</block>

<values>
/ selectedlist = 0
/ ang = 0
</values>

// 3 sequence lists to select from in this example
<list sequences>
/ poolsize = 3
</list>

<expt>
/ onexptbegin = [
    // select one of our angle sequences
    values.selectedlist = list.sequences.nextindex;
]
/ blocks = [1=exampleblock]
</expt>


By yjung541 - 11/25/2020

Dave - 11/25/2020
yjung541 - 11/25/2020
Hi Dave,
I'm trying to have a pre-generated sequence of orientations for the images, so that each trial, there's varying rotation value.
I know how the pre-generated sequence works for images, but I can't figure out how to work this out for the orientation. Here is my toy script that I tried with list attributes so that orientation for each trial becomes 30, 45, and 90.

<item images>
/1 = "stimuli/yellow_line.png"
/2 = "stimuli/red_line.png"
/3 = "stimuli/blue_line.png"
</item>

<picture inst_base>
/ items = items.images
/ size = (15%, 30%)
/ position = (50%, 50%)
/ rotation = values.ang
</picture>
    
<text InstTitle>
/ items = ("ORIENTATION JUDGEMENT TASK")
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 1)
/ position = (50%, 10%)
</text>

<text Inst1>
/ items = ("In this study, you will see a line (BASE IMAGE) and a picture with striples (TARGET IMAGE).")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 20%)
</text>

<list angles>
/ items = (30 45 90)
/ selectionmode = sequence
</list>

<trial tr_instr1>
/ stimulusframes = [1 = Inst1, InstTitle, inst_base]
/ validresponse = (57)
/ beginresponsetime = 500
/ ontrialbegin = [
    values.ang = list.angles.nextvalue
]
</trial>

My question is - if I want to pre-generate the sequence of orientations (for hundreds of trials) and especially multiple pre-generated sequences that will be randomly assigned to each participant, what would be the best way to implement it?
Should my text file include the list? Something like -

<list angles>
/ items = (30 45 90 30 40 20 50 180 ... 300)
/ selectionmode = sequence
</list>

and, randomly call a file for each participant? (I saw a forum post about this, and I think I can work on it on my own).
Or, is there a way to make it an item attribute and use it? 

I'm sorry if something similar has been asked before - I couldn't find this exact solution.

Thank you so much for your help in advance!
Yaelan

The trick would be to perform list-nesting. Let's expand your toy example to three lists of pregerenated rotations, and let's select one of those lists at random at the start of the experiment. It goes like this:

<item images>
/1 = "stimuli/yellow_line.png"
/2 = "stimuli/red_line.png"
/3 = "stimuli/blue_line.png"
</item>

<picture inst_base>
/ items = item.images
/ size = (15%, 30%)
/ position = (50%, 50%)
/ rotation = values.ang
</picture>
 
<text InstTitle>
/ items = ("ORIENTATION JUDGEMENT TASK")
/ fontstyle = ("Arial", 3.5%, true, false, false, false, 5, 1)
/ position = (50%, 10%)
</text>

<text Inst1>
/ items = ("In this study, you will see a line (BASE IMAGE) and a picture with striples (TARGET IMAGE).")
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ position = (50%, 20%)
</text>

// list angles with the individual sequence lists as its items
<list angles>
/ items = (list.angle_sequence_1.nextvalue, list.angle_sequence_2.nextvalue, list.angle_sequence_3.nextvalue)
/ selectionmode = values.selectedlist
</list>

// sequence 1
<list angle_sequence_1>
/ items = (30, 45, 90)
/ selectionmode = sequence
</list>

// sequence 2
<list angle_sequence_2>
/ items = (60, 90, 180)
/ selectionmode = sequence
</list>

// sequence 3
<list angle_sequence_3>
/ items = (90, 135, 270)
/ selectionmode = sequence
</list>

<trial tr_instr1>
/ stimulusframes = [1 = Inst1, InstTitle, inst_base]
/ validresponse = (57)
/ beginresponsetime = 500
/ ontrialbegin = [
  values.ang = list.angles.nextvalue
]
</trial>

<block exampleblock>
/ trials = [1-3 = tr_instr1]
</block>

<values>
/ selectedlist = 0
/ ang = 0
</values>

// 3 sequence lists to select from in this example
<list sequences>
/ poolsize = 3
</list>

<expt>
/ onexptbegin = [
    // select one of our angle sequences
    values.selectedlist = list.sequences.nextindex;
]
/ blocks = [1=exampleblock]
</expt>



This is super helpful! Thank you so much, Dave!