Millisecond Forums

Question about possible ways to sort trials (script included)

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

By BigBadUnicorn - 10/28/2018

Hi Guys! 

I have a question about possible ways to sort trials. In a sense I'm looking for something like: "if trial have certain properties (ie. stimulus position), return it to the selection pool and redraw another at random ".  Skip was my candidate but this function exclude the trial from selection pool which i would like to avoid. 

I have 8 possible trial combinations but in the script I defined only 4. I  set values at the beginning of experiment and use  them with expression to change hposition of stimulus. 

#I have 4 text elements and i want them to be matched with positive or negative picture element.: this is my idea to create grups of stimulus across experiment. I have 4 list one for each text element. Below only  example for the first one: 

<list cs_1_selector>
/ items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
/ selectionmode = random
/ selectionrate = always
/ replace = false
/ not = [
if (values.Cacht == 1) (1);
if (values.Cacht == 1) (2);
if (values.Cacht == 1) (3);
if (values.Cacht == 1) (4);
if (values.Cacht == 1) (5);
if (values.Cacht == 1) (6);
if (values.Cacht == 0) (7);
if (values.Cacht == 0) (8);
if (values.Cacht == 0) (9);
if (values.Cacht == 0) (10);
if (values.Cacht == 0) (11);
if (values.Cacht == 0) (12);
]
</list>

# visual parameters of my stimulus
<text cs1>
/ items = ("Cacht")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Cacht_odleglosc
</text>

<text cs2>
/ items = ("Ailbe")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Ailbe_odleglosc
</text>

<text cs3>
/ items = ("Morag")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Morag_odleglosc
</text>

<text cs4>
/ items = ("Straun")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Straun_odleglosc
</text>

<picture us_cs1>
/ items = us
/ select = list.cs_1_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Cacht_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs2>
/ items = us
/ select = list.cs_2_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Ailbe_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs3>
/ items = us
/ select = list.cs_3_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Morag_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs4>
/ items = us
/ select = list.cs_4_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Straun_odleglosc == 44) {56} else {84}
</picture>

## 4 trials (8 conditions). 
<trial 1_cs1_us>
/ stimulustimes = [0 = cs1, us_cs1]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 2_cs2_us>
/ stimulustimes = [0 = cs2, us_cs2]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 3_cs3_us>
/ stimulustimes = [0 = cs3, us_cs3]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 4_cs4_us>
/ stimulustimes = [0 = cs4, us_cs4]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

## I would like to present cs-us groups  in pseudorandom fashion. Where the distance is systematically changed from close to far.  
<block blok_1_x24>
/ trials = [1,3,5,7,9,11,13,15,17,19,21,23 = noreplace (1_cs1_us_blisko, 2_cs2_us_blisko, 3_cs3_us_blisko, 4_cs4_us_us_blisko);
2,4,6,8,10,12,14,16,18,20,22,24 = noreplace(5_cs1_us_daleko, 6_cs2_us_daleko, 7_cs3_us_daleko, 8_cs4_us_us_daleko)]
</block>
By Dave - 10/28/2018

BigBadUnicorn - Monday, October 29, 2018
Hi Guys! 

I have a question about possible ways to sort trials. In a sense I'm looking for something like: "if trial have certain properties (ie. stimulus position), return it to the selection pool and redraw another at random ".  Skip was my candidate but this function exclude the trial from selection pool which i would like to avoid. 

I have 8 possible trial combinations but in the script I defined only 4. I  set values at the beginning of experiment and use  them with expression to change hposition of stimulus. 

#I have 4 text elements and i want them to be matched with positive or negative picture element.: this is my idea to create grups of stimulus across experiment. I have 4 list one for each text element. Below only  example for the first one: 

<list cs_1_selector>
/ items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
/ selectionmode = random
/ selectionrate = always
/ replace = false
/ not = [
if (values.Cacht == 1) (1);
if (values.Cacht == 1) (2);
if (values.Cacht == 1) (3);
if (values.Cacht == 1) (4);
if (values.Cacht == 1) (5);
if (values.Cacht == 1) (6);
if (values.Cacht == 0) (7);
if (values.Cacht == 0) (8);
if (values.Cacht == 0) (9);
if (values.Cacht == 0) (10);
if (values.Cacht == 0) (11);
if (values.Cacht == 0) (12);
]
</list>

# visual parameters of my stimulus
<text cs1>
/ items = ("Cacht")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Cacht_odleglosc
</text>

<text cs2>
/ items = ("Ailbe")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Ailbe_odleglosc
</text>

<text cs3>
/ items = ("Morag")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Morag_odleglosc
</text>

<text cs4>
/ items = ("Straun")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Straun_odleglosc
</text>

<picture us_cs1>
/ items = us
/ select = list.cs_1_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Cacht_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs2>
/ items = us
/ select = list.cs_2_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Ailbe_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs3>
/ items = us
/ select = list.cs_3_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Morag_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs4>
/ items = us
/ select = list.cs_4_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Straun_odleglosc == 44) {56} else {84}
</picture>

## 4 trials (8 conditions). 
<trial 1_cs1_us>
/ stimulustimes = [0 = cs1, us_cs1]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 2_cs2_us>
/ stimulustimes = [0 = cs2, us_cs2]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 3_cs3_us>
/ stimulustimes = [0 = cs3, us_cs3]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 4_cs4_us>
/ stimulustimes = [0 = cs4, us_cs4]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

## I would like to present cs-us groups  in pseudorandom fashion. Where the distance is systematically changed from close to far.  
<block blok_1_x24>
/ trials = [1,3,5,7,9,11,13,15,17,19,21,23 = noreplace (1_cs1_us_blisko, 2_cs2_us_blisko, 3_cs3_us_blisko, 4_cs4_us_us_blisko);
2,4,6,8,10,12,14,16,18,20,22,24 = noreplace(5_cs1_us_daleko, 6_cs2_us_daleko, 7_cs3_us_daleko, 8_cs4_us_us_daleko)]
</block>

Sorry, I don't understand where "return[ing a trial] to the selection pool and redraw[ing] another at random" comes into play here. Could you please provide a more concise, annotated, and self-contained (i.e. runnable) example, instead of isolated code snippets?

For example, it's entirely unclear from your code when / where the values determining short vs long distance actually get set:

<picture us_cs1>
/ items = us
/ select = list.cs_1_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Cacht_odleglosc == 44) {56} else {84}
</picture>
By BigBadUnicorn - 10/29/2018

Dave - Monday, October 29, 2018
BigBadUnicorn - Monday, October 29, 2018
Hi Guys! 

I have a question about possible ways to sort trials. In a sense I'm looking for something like: "if trial have certain properties (ie. stimulus position), return it to the selection pool and redraw another at random ".  Skip was my candidate but this function exclude the trial from selection pool which i would like to avoid. 

I have 8 possible trial combinations but in the script I defined only 4. I  set values at the beginning of experiment and use  them with expression to change hposition of stimulus. 

#I have 4 text elements and i want them to be matched with positive or negative picture element.: this is my idea to create grups of stimulus across experiment. I have 4 list one for each text element. Below only  example for the first one: 

<list cs_1_selector>
/ items = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)
/ selectionmode = random
/ selectionrate = always
/ replace = false
/ not = [
if (values.Cacht == 1) (1);
if (values.Cacht == 1) (2);
if (values.Cacht == 1) (3);
if (values.Cacht == 1) (4);
if (values.Cacht == 1) (5);
if (values.Cacht == 1) (6);
if (values.Cacht == 0) (7);
if (values.Cacht == 0) (8);
if (values.Cacht == 0) (9);
if (values.Cacht == 0) (10);
if (values.Cacht == 0) (11);
if (values.Cacht == 0) (12);
]
</list>

# visual parameters of my stimulus
<text cs1>
/ items = ("Cacht")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Cacht_odleglosc
</text>

<text cs2>
/ items = ("Ailbe")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Ailbe_odleglosc
</text>

<text cs3>
/ items = ("Morag")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Morag_odleglosc
</text>

<text cs4>
/ items = ("Straun")
/ select = noreplace
/ vposition = 50.0
/ hposition = values.Straun_odleglosc
</text>

<picture us_cs1>
/ items = us
/ select = list.cs_1_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Cacht_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs2>
/ items = us
/ select = list.cs_2_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Ailbe_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs3>
/ items = us
/ select = list.cs_3_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Morag_odleglosc == 44) {56} else {84}
</picture>

<picture us_cs4>
/ items = us
/ select = list.cs_4_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Straun_odleglosc == 44) {56} else {84}
</picture>

## 4 trials (8 conditions). 
<trial 1_cs1_us>
/ stimulustimes = [0 = cs1, us_cs1]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 2_cs2_us>
/ stimulustimes = [0 = cs2, us_cs2]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 3_cs3_us>
/ stimulustimes = [0 = cs3, us_cs3]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

<trial 4_cs4_us>
/ stimulustimes = [0 = cs4, us_cs4]
/ pretrialpause = 750
/ posttrialpause = 750
/ trialduration = 5500
</trial>

## I would like to present cs-us groups  in pseudorandom fashion. Where the distance is systematically changed from close to far.  
<block blok_1_x24>
/ trials = [1,3,5,7,9,11,13,15,17,19,21,23 = noreplace (1_cs1_us_blisko, 2_cs2_us_blisko, 3_cs3_us_blisko, 4_cs4_us_us_blisko);
2,4,6,8,10,12,14,16,18,20,22,24 = noreplace(5_cs1_us_daleko, 6_cs2_us_daleko, 7_cs3_us_daleko, 8_cs4_us_us_daleko)]
</block>

Sorry, I don't understand where "return[ing a trial] to the selection pool and redraw[ing] another at random" comes into play here. Could you please provide a more concise, annotated, and self-contained (i.e. runnable) example, instead of isolated code snippets?

For example, it's entirely unclear from your code when / where the values determining short vs long distance actually get set:

<picture us_cs1>
/ items = us
/ select = list.cs_1_selector.nextvalue
/ size = (16%, 16%)
/ vposition = 50.0
/ hposition = if (values.Cacht_odleglosc == 44) {56} else {84}
</picture>

Thank you for quick answer. I already figured out using different approach. Sorry if my question was unclear.