| Reference | Downloads | Github

Variable field position in RDK

I’d like to be able to pass the Field Position of a RDK as a parameter inside a loop.
Is this possible? I tried various syntaxes but always get a syntax error.
Thanks in advance for the help.

What did you try? What was the error?

Thanks for the answer Jon. More precisely, what I’d like to do is to change the field position of a RDK across trials, using the standard cvs file method. To this aim, I tried:

with the two scalar parameters field7 and field8 defined in the trialTypes.cvs file, and got the error:

I also tried

with the parameter field defined as (-0.3,0.0) in the trialTypes.cvs file, in which case I got the error

Note that in the same experiment I am able to pass dot directions and speeds as parameters via the cvs file without problems.


Hi @Alessio, try using the variables without the $ prefix:

dor_7.setFieldPos((field_7, field_8))

Alternatively use the Field position parameter in the dots component, but you will need to use square brackets to define your positions in your conditions file. Using round brackets gets interpreted as a string. You can also remove the $.

Thanks a lot!
It now works by using
with the two scalar parameters defined in the cvs file. But I still get a string to float conversion error if I try to pass a single parameter
defined as [-0.3,0.0] in the cvs file. Am I doing something wrong?

Hmm not sure, I cannot recreate that error. Which version of PsychoPy are you using?

What did you exactly put in the Field position field of the builder and in the associated column of the cvs file?

I used field in the Field position parameter, and my conditions file is attached below:

cond.csv (33 Bytes)

ahh thanks!
I was missing the " in the cond file.