Millisecond Forums

Picture not returning to 100% size and centre despite size=100% and hposition=50%

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

By pops - 10/28/2021

I thought I would start a new thread for this topic. I have a large image which is presented using the picture element at full size and centrally (hposition = 50%) for the first half of the block. It is then reduced to 35% of its size and shown along with another picture side by side (at hposition = 25% or hposition = 75%) for the last half of the block. This all works great. However, at the start of the next block, despite the size being returned to 100% and the hposition = 50%, the images are shown off centre and not full sized (they are nearly full sized but not quite). I'm tearing my hair out.

<item Fractals>
/ 1 = "fractal1.jpg"
/ 2 = "fractal2.jpg"
/..
</item>

<picture fractalPicLoseCake>
/items = Fractals
/ select = values.fractalbalance
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<picture fractalPicWinCake>
/items = Fractals
/ select = expressions.fractal2
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<trial Pavlovian>
/ ontrialbegin = [
    trial.Pavlovian.insertstimulustime(shape.eraser, parameters.fixationduration);
    values.trialType = list.pavTrialType.nextvalue;
    if (list.pavTrialType.nextvalue==1){
    trial.Pavlovian.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    values.pavPicName = picture.fractalPicWinCake.currentitem}
    else if (list.pavTrialType.nextvalue==2){
    trial.Pavlovian.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);     
    values.pavPicName = picture.fractalPicLoseCake.currentitem;}]
..
</trial>

<trial pavChoiceTrial>
/ inputdevice=keyboard
/ ontrialbegin = [
    values.fractalsize=35%;
  values.trialType = list.pavChoiceTrialSelector.nextvalue;
    values.fractalpositions = list.fractal_positions.nextvalue;
    if (values.fractalpositions == 1) {
        values.fractal1_x=25%;
        values.fractal2_x=75%;
    } else if (values.fractalpositions == 2) {
        values.fractal1_x=75%;
        values.fractal2_x=25%;
    };
    trial.pavChoiceTrial.insertstimulustime(shape.eraser, parameters.fixationduration);
    if (values.trialType==1){
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    picture.fractalPicWinCake.hposition=values.fractal1_x;
    values.PavChoice1 = picture.fractalPicWinCake.currentitem;
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);
    picture.fractalPicLoseCake.hposition=values.fractal2_x;
    values.PavChoice2 = picture.fractalPicLoseCake.currentitem;
]
    ...
</trial>

<block pavlovianTrials>
/ onblockbegin = [ values.fractalsize=100%; values.fractal1_x=50%; values.fractal2_x=50%;]
/ trials = [1-8 = Pavlovian; 9-15 = pavChoiceTrial]
..
</block>

Is it something to do with what it thinks the size of the canvas is? Currently the only default setting is / canvasaspectratio = (4,3). I'll be testing this over the internet so don't want to constrain the window too much as people's monitors will change so much?

Please help, thank you!
By pops - 10/28/2021

pops - 10/29/2021
I thought I would start a new thread for this topic. I have a large image which is presented using the picture element at full size and centrally (hposition = 50%) for the first half of the block. It is then reduced to 35% of its size and shown along with another picture side by side (at hposition = 25% or hposition = 75%) for the last half of the block. This all works great. However, at the start of the next block, despite the size being returned to 100% and the hposition = 50%, the images are shown off centre and not full sized (they are nearly full sized but not quite). I'm tearing my hair out.

<item Fractals>
/ 1 = "fractal1.jpg"
/ 2 = "fractal2.jpg"
/..
</item>

<picture fractalPicLoseCake>
/items = Fractals
/ select = values.fractalbalance
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<picture fractalPicWinCake>
/items = Fractals
/ select = expressions.fractal2
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<trial Pavlovian>
/ ontrialbegin = [
    trial.Pavlovian.insertstimulustime(shape.eraser, parameters.fixationduration);
    values.trialType = list.pavTrialType.nextvalue;
    if (list.pavTrialType.nextvalue==1){
    trial.Pavlovian.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    values.pavPicName = picture.fractalPicWinCake.currentitem}
    else if (list.pavTrialType.nextvalue==2){
    trial.Pavlovian.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);     
    values.pavPicName = picture.fractalPicLoseCake.currentitem;}]
..
</trial>

<trial pavChoiceTrial>
/ inputdevice=keyboard
/ ontrialbegin = [
    values.fractalsize=35%;
  values.trialType = list.pavChoiceTrialSelector.nextvalue;
    values.fractalpositions = list.fractal_positions.nextvalue;
    if (values.fractalpositions == 1) {
        values.fractal1_x=25%;
        values.fractal2_x=75%;
    } else if (values.fractalpositions == 2) {
        values.fractal1_x=75%;
        values.fractal2_x=25%;
    };
    trial.pavChoiceTrial.insertstimulustime(shape.eraser, parameters.fixationduration);
    if (values.trialType==1){
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    picture.fractalPicWinCake.hposition=values.fractal1_x;
    values.PavChoice1 = picture.fractalPicWinCake.currentitem;
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);
    picture.fractalPicLoseCake.hposition=values.fractal2_x;
    values.PavChoice2 = picture.fractalPicLoseCake.currentitem;
]
    ...
</trial>

<block pavlovianTrials>
/ onblockbegin = [ values.fractalsize=100%; values.fractal1_x=50%; values.fractal2_x=50%;]
/ trials = [1-8 = Pavlovian; 9-15 = pavChoiceTrial]
..
</block>

Is it something to do with what it thinks the size of the canvas is? Currently the only default setting is / canvasaspectratio = (4,3). I'll be testing this over the internet so don't want to constrain the window too much as people's monitors will change so much?

Please help, thank you!

But if it were a canvas issue it would be weird that the values of size=100% and hposition = 50% displays the picture perfectly in the first block.
By Dave - 10/28/2021

pops - 10/29/2021
pops - 10/29/2021
I thought I would start a new thread for this topic. I have a large image which is presented using the picture element at full size and centrally (hposition = 50%) for the first half of the block. It is then reduced to 35% of its size and shown along with another picture side by side (at hposition = 25% or hposition = 75%) for the last half of the block. This all works great. However, at the start of the next block, despite the size being returned to 100% and the hposition = 50%, the images are shown off centre and not full sized (they are nearly full sized but not quite). I'm tearing my hair out.

<item Fractals>
/ 1 = "fractal1.jpg"
/ 2 = "fractal2.jpg"
/..
</item>

<picture fractalPicLoseCake>
/items = Fractals
/ select = values.fractalbalance
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<picture fractalPicWinCake>
/items = Fractals
/ select = expressions.fractal2
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<trial Pavlovian>
/ ontrialbegin = [
    trial.Pavlovian.insertstimulustime(shape.eraser, parameters.fixationduration);
    values.trialType = list.pavTrialType.nextvalue;
    if (list.pavTrialType.nextvalue==1){
    trial.Pavlovian.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    values.pavPicName = picture.fractalPicWinCake.currentitem}
    else if (list.pavTrialType.nextvalue==2){
    trial.Pavlovian.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);     
    values.pavPicName = picture.fractalPicLoseCake.currentitem;}]
..
</trial>

<trial pavChoiceTrial>
/ inputdevice=keyboard
/ ontrialbegin = [
    values.fractalsize=35%;
  values.trialType = list.pavChoiceTrialSelector.nextvalue;
    values.fractalpositions = list.fractal_positions.nextvalue;
    if (values.fractalpositions == 1) {
        values.fractal1_x=25%;
        values.fractal2_x=75%;
    } else if (values.fractalpositions == 2) {
        values.fractal1_x=75%;
        values.fractal2_x=25%;
    };
    trial.pavChoiceTrial.insertstimulustime(shape.eraser, parameters.fixationduration);
    if (values.trialType==1){
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    picture.fractalPicWinCake.hposition=values.fractal1_x;
    values.PavChoice1 = picture.fractalPicWinCake.currentitem;
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);
    picture.fractalPicLoseCake.hposition=values.fractal2_x;
    values.PavChoice2 = picture.fractalPicLoseCake.currentitem;
]
    ...
</trial>

<block pavlovianTrials>
/ onblockbegin = [ values.fractalsize=100%; values.fractal1_x=50%; values.fractal2_x=50%;]
/ trials = [1-8 = Pavlovian; 9-15 = pavChoiceTrial]
..
</block>

Is it something to do with what it thinks the size of the canvas is? Currently the only default setting is / canvasaspectratio = (4,3). I'll be testing this over the internet so don't want to constrain the window too much as people's monitors will change so much?

Please help, thank you!

But if it were a canvas issue it would be weird that the values of size=100% and hposition = 50% displays the picture perfectly in the first block.

Would you please provide code that is sufficiently complete to actually run as well as the respective images the code requires to run? I have no idea how to make sense of this and potentially figure out what's going on whithout this.

Thanks.
By pops - 10/28/2021

Dave - 10/29/2021
pops - 10/29/2021
pops - 10/29/2021
I thought I would start a new thread for this topic. I have a large image which is presented using the picture element at full size and centrally (hposition = 50%) for the first half of the block. It is then reduced to 35% of its size and shown along with another picture side by side (at hposition = 25% or hposition = 75%) for the last half of the block. This all works great. However, at the start of the next block, despite the size being returned to 100% and the hposition = 50%, the images are shown off centre and not full sized (they are nearly full sized but not quite). I'm tearing my hair out.

<item Fractals>
/ 1 = "fractal1.jpg"
/ 2 = "fractal2.jpg"
/..
</item>

<picture fractalPicLoseCake>
/items = Fractals
/ select = values.fractalbalance
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<picture fractalPicWinCake>
/items = Fractals
/ select = expressions.fractal2
/size = (values.fractalsize,values.fractalsize)
/h_position = values.fractal1_x
</picture>

<trial Pavlovian>
/ ontrialbegin = [
    trial.Pavlovian.insertstimulustime(shape.eraser, parameters.fixationduration);
    values.trialType = list.pavTrialType.nextvalue;
    if (list.pavTrialType.nextvalue==1){
    trial.Pavlovian.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    values.pavPicName = picture.fractalPicWinCake.currentitem}
    else if (list.pavTrialType.nextvalue==2){
    trial.Pavlovian.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);     
    values.pavPicName = picture.fractalPicLoseCake.currentitem;}]
..
</trial>

<trial pavChoiceTrial>
/ inputdevice=keyboard
/ ontrialbegin = [
    values.fractalsize=35%;
  values.trialType = list.pavChoiceTrialSelector.nextvalue;
    values.fractalpositions = list.fractal_positions.nextvalue;
    if (values.fractalpositions == 1) {
        values.fractal1_x=25%;
        values.fractal2_x=75%;
    } else if (values.fractalpositions == 2) {
        values.fractal1_x=75%;
        values.fractal2_x=25%;
    };
    trial.pavChoiceTrial.insertstimulustime(shape.eraser, parameters.fixationduration);
    if (values.trialType==1){
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicWinCake, parameters.fixationduration);
    picture.fractalPicWinCake.hposition=values.fractal1_x;
    values.PavChoice1 = picture.fractalPicWinCake.currentitem;
    trial.pavChoiceTrial.insertstimulustime(picture.fractalPicLoseCake, parameters.fixationduration);
    picture.fractalPicLoseCake.hposition=values.fractal2_x;
    values.PavChoice2 = picture.fractalPicLoseCake.currentitem;
]
    ...
</trial>

<block pavlovianTrials>
/ onblockbegin = [ values.fractalsize=100%; values.fractal1_x=50%; values.fractal2_x=50%;]
/ trials = [1-8 = Pavlovian; 9-15 = pavChoiceTrial]
..
</block>

Is it something to do with what it thinks the size of the canvas is? Currently the only default setting is / canvasaspectratio = (4,3). I'll be testing this over the internet so don't want to constrain the window too much as people's monitors will change so much?

Please help, thank you!

But if it were a canvas issue it would be weird that the values of size=100% and hposition = 50% displays the picture perfectly in the first block.

Would you please provide code that is sufficiently complete to actually run as well as the respective images the code requires to run? I have no idea how to make sense of this and potentially figure out what's going on whithout this.

Thanks.

Sure will cut it down a bit and upload asap. Thank
By pops - 10/28/2021

Please see attached a script and pics with just the problematic blocks in question.It looks great for block 1 and then not quite right from block 2 onwards. I'm recording the hposition value in the datafile and can confirm that it is set to 50% at the start of the new block.....

I've adjusted an old experiment in quite a cackhanded way, so don't judge the poor choices that have been made in hard-coding all the trial types into one single trial....thank you. :)

edit: the zip file is taking too long to upload to the Instant Forum...so I uploaded it to cloudStor instead and you can download it from: https://cloudstor.aarnet.edu.au/plus/s/t3GzGMg8Bo1IPDy Many thanks
By Dave - 10/28/2021

pops - 10/29/2021
Please see attached a script and pics with just the problematic blocks in question.It looks great for block 1 and then not quite right from block 2 onwards. I'm recording the hposition value in the datafile and can confirm that it is set to 50% at the start of the new block.....

I've adjusted an old experiment in quite a cackhanded way, so don't judge the poor choices that have been made in hard-coding all the trial types into one single trial....thank you. :)

edit: the zip file is taking too long to upload to the Instant Forum...so I uploaded it to cloudStor instead and you can download it from: https://cloudstor.aarnet.edu.au/plus/s/t3GzGMg8Bo1IPDy Many thanks

Try with

<block pavlovianTrials>
/ onblockbegin = [values.fractalsize=100%; values.fractal1_x=50%; values.fractal2_x=50%;
    picture.fractalPicLoseCake.hposition = values.fractal1_x;
    picture.fractalPicLoseIce.hposition = values.fractal1_x;
    picture.fractalPicNothing.hposition = values.fractal1_x;
    picture.fractalPicWinCake.hposition = values.fractal1_x;
    picture.fractalPicWinIce.hposition = values.fractal1_x;
    ]
/ trials = [1-2 = Pavlovian; 3-4 = pavChoiceTrial]
/ postinstructions = (pavBlockBreak)

</block>

By pops - 10/28/2021

Dave - 10/29/2021
pops - 10/29/2021
Please see attached a script and pics with just the problematic blocks in question.It looks great for block 1 and then not quite right from block 2 onwards. I'm recording the hposition value in the datafile and can confirm that it is set to 50% at the start of the new block.....

I've adjusted an old experiment in quite a cackhanded way, so don't judge the poor choices that have been made in hard-coding all the trial types into one single trial....thank you. :)

edit: the zip file is taking too long to upload to the Instant Forum...so I uploaded it to cloudStor instead and you can download it from: https://cloudstor.aarnet.edu.au/plus/s/t3GzGMg8Bo1IPDy Many thanks

Try with

<block pavlovianTrials>
/ onblockbegin = [values.fractalsize=100%; values.fractal1_x=50%; values.fractal2_x=50%;
    picture.fractalPicLoseCake.hposition = values.fractal1_x;
    picture.fractalPicLoseIce.hposition = values.fractal1_x;
    picture.fractalPicNothing.hposition = values.fractal1_x;
    picture.fractalPicWinCake.hposition = values.fractal1_x;
    picture.fractalPicWinIce.hposition = values.fractal1_x;
    ]
/ trials = [1-2 = Pavlovian; 3-4 = pavChoiceTrial]
/ postinstructions = (pavBlockBreak)
</block>
</block>


ah genuis. Of course- that makes sense now. The position was not automatically updated when the picture was called again. THANK  YOU!