# Variable field position in RDK

**URL:** <https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352>\
**Category:** Builder\
**Created:** [July 3, 2019, 11:57pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352 "2019-07-03T23:57:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alessio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/alessio/32/5268_2.png) [@Alessio](https://discourse.psychopy.org/u/Alessio)\
**Post date:** [July 3, 2019, 11:57pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/1 "2019-07-03T23:57:08Z")

</div>

Hello,  
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.  
Alessio

---

<div class="post-metadata">

**Author:** ![jon](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/jon/32/22_2.png) [@jon](https://discourse.psychopy.org/u/jon)\
**Post date:** [July 8, 2019, 10:43am UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/2 "2019-07-08T10:43:07Z")

</div>

What did you try? What was the error?

---

<div class="post-metadata">

**Author:** ![Alessio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/alessio/32/5268_2.png) [@Alessio](https://discourse.psychopy.org/u/Alessio)\
**Post date:** [July 8, 2019, 1:06pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/3 "2019-07-08T13:06:19Z")

</div>

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:

 ![follow_up1](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/6/1/61a1e8a7a272eeb33ad8ee253f07490df9318481.png)  
with the two scalar parameters field7 and field8 defined in the trialTypes.cvs file, and got the error:  
 ![followup2](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/c/f/cf6178cd551415244cb50d20c27f8df1f212d1db.png)

---

<div class="post-metadata">

**Author:** ![Alessio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/alessio/32/5268_2.png) [@Alessio](https://discourse.psychopy.org/u/Alessio)\
**Post date:** [July 8, 2019, 1:06pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/4 "2019-07-08T13:06:56Z")

</div>

I also tried

 ![followup3](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/0/c/0c6f0256636340f9c15664be3caa849dce604033.png)  
with the parameter field defined as (-0.3,0.0) in the trialTypes.cvs file, in which case I got the error  
 ![followup4](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/6/0/6059d5f6a616c8a31ba22dc89562f28316ef5c71.png)

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

Thanks.

---

<div class="post-metadata">

**Author:** ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)\
**Post date:** [July 8, 2019, 1:27pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/5 "2019-07-08T13:27:53Z")

</div>

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

```auto
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 `$`.

---

<div class="post-metadata">

**Author:** ![Alessio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/alessio/32/5268_2.png) [@Alessio](https://discourse.psychopy.org/u/Alessio)\
**Post date:** [July 8, 2019, 2:02pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/6 "2019-07-08T14:02:46Z")

</div>

Thanks a lot!  
It now works by using  
(field\_1,field\_2)  
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  
field  
defined as [-0.3,0.0] in the cvs file. Am I doing something wrong?

---

<div class="post-metadata">

**Author:** ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)\
**Post date:** [July 8, 2019, 2:09pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/7 "2019-07-08T14:09:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Alessio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/alessio/32/5268_2.png) [@Alessio](https://discourse.psychopy.org/u/Alessio)\
**Post date:** [July 8, 2019, 2:53pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/8 "2019-07-08T14:53:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dvbridges](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/dvbridges/32/1918_2.png) [@dvbridges](https://discourse.psychopy.org/u/dvbridges)\
**Post date:** [July 8, 2019, 3:04pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/9 "2019-07-08T15:04:46Z")

</div>

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

[cond.csv](https://discourse.psychopy.org/uploads/short-url/kpEn8LL4JWtVjRTXheePlH949EN.csv) (33 Bytes)

---

<div class="post-metadata">

**Author:** ![Alessio](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/alessio/32/5268_2.png) [@Alessio](https://discourse.psychopy.org/u/Alessio)\
**Post date:** [July 8, 2019, 3:09pm UTC](https://discourse.psychopy.org/t/variable-field-position-in-rdk/8352/10 "2019-07-08T15:09:11Z")

</div>

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