Randomizing variable image size/position with t and functions

OS (e.g. Win10): Win11
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2024.2.4
Standard Standalone Installation? (y/n) y
Do you want it to also run online? (y/n) n

What are you trying to achieve?:
I’m trying to show participants three different types of training trials, where the image goes from left to right, right to left, or zooms in and out. I can use t and related functions when typing directly into the image component’s size/position fields but not when I try to put them into a spreadsheet for randomization.

What did you try to make it work?:
In my image component and conditions spreadsheet:
image
image

When I try to run it, it says “ValueError: could not convert string to float: ‘t*0.125-.5’”

Link to the most relevant existing thread you have found:

What specifically went wrong when you tried that?:
I have edited the variables to not contain the entire brackets but just one variable at a time, but there seems to be no way to randomize/counterbalance variable image size and position.

test.zip (30.9 KB)

Hello @vinibini

Apparently trimg_pos is read a string but you need a float there. In parameters which are preceded by a $ you do not need to add a $ in the parameter field.
e.g.

(trimg_pos, 0)

instead of

$(trimg_pos, 0)

You might also need to convert trimg_pos to a float.

(float(trimg_pos), 0)

Best wishes, Jens

You can’t put a formula in your Excel spreadsheet. Instead you could have a column for trimg_c and another for trimg_m and set thew position as (t * trimg_m + trimg_c, 0)