Millisecond Forums

Cycling through images within a trial via key press

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

By lachie.kay1 - 5/26/2020

Hi all,

I'm currently trying to create an experiment where, in a given trial, one image with a specific brightness level is presented on one side of the screen, and the same image is presented on the other side of the screen at a different brightness level. The task is to adjust the brightness level of the second image to match that of the first. 

My initial idea for doing this was to write code which allowed participants to directly adjust the brightness of one image using something like the slider element, but I don't think this is possible in Iquisit (although I'm relatively new to Inquisit so I could well be wrong).

My second idea was to load a large set of images (all the same image but with different preset brightness values) and allow participants to scroll through these images in a trial until they find one that matches.

Can either of these methods be achieved in Inquisit? Any guidance at all would be greatly appreciated as I'm quite lost.

Thanks in advance!
Lachlan
By Dave - 5/26/2020

lachie.kay1 - 5/26/2020
Hi all,

I'm currently trying to create an experiment where, in a given trial, one image with a specific brightness level is presented on one side of the screen, and the same image is presented on the other side of the screen at a different brightness level. The task is to adjust the brightness level of the second image to match that of the first. 

My initial idea for doing this was to write code which allowed participants to directly adjust the brightness of one image using something like the slider element, but I don't think this is possible in Iquisit (although I'm relatively new to Inquisit so I could well be wrong).

My second idea was to load a large set of images (all the same image but with different preset brightness values) and allow participants to scroll through these images in a trial until they find one that matches.

Can either of these methods be achieved in Inquisit? Any guidance at all would be greatly appreciated as I'm quite lost.

Thanks in advance!
Lachlan

The latter option is definitely possible. All you have to do is manipulate the item number up or down per a value in the <picture> element's /select depending on the key press (increase vs decrease brightness).
By lachie.kay1 - 5/31/2020

Thanks Dave!

Does this seem like I'm at all on the right track?  Where I'm trying to adjust "rightPic" to match "leftPic"

(excuse the poorly written code, I'm still very much a novice):


<values>
/ Brightness = 3
</values>

<item leftPicList>
/ 1 = "leftPic.PNG"
</item>

<picture leftPic>
/ items = leftPicList
/ position = (25, 50)
</picture>

<item rightPicList>
/ 1 = "rightPic_brightness1.PNG"
/ 2 = "rightPic_brightness2.PNG"
/ 3 = "rightPic_brightness3.PNG"
/ 4 = "rightPic_brightness4.PNG"
/ 5 = "rightPic_brightness5.PNG"
</item>

<picture rightPic>
/ items = rightPicList
/ position = (75, 50)
/ select = values.Brightness
</picture>

<trial myTrial>
/ stimulustimes = [1 = leftPic, rightPic ]
/ inputdevice = keyboard
/ validresponse = (28, 203, 205)
/ response = free
/ responseinterrupt = trial
/ isvalidresponse = [if (trial.myTrial.response == 205) values.Brightness += 1; picture.rightPic.item]
/ isvalidresponse = [if (trial.myTrial.response == 203) values.Brightness -= 1; picture.rightPic.item]
/ isvalidresponse = [if (trial.myTrial.response == 28) trial.myTrial.next]
</trial>

<block myBlock>
/ trials = [1-4 = myTrial]
</block>
By Dave - 6/1/2020

lachie.kay1 - 6/1/2020
Thanks Dave!

Does this seem like I'm at all on the right track?  Where I'm trying to adjust "rightPic" to match "leftPic"

(excuse the poorly written code, I'm still very much a novice):


<values>
/ Brightness = 3
</values>

<item leftPicList>
/ 1 = "leftPic.PNG"
</item>

<picture leftPic>
/ items = leftPicList
/ position = (25, 50)
</picture>

<item rightPicList>
/ 1 = "rightPic_brightness1.PNG"
/ 2 = "rightPic_brightness2.PNG"
/ 3 = "rightPic_brightness3.PNG"
/ 4 = "rightPic_brightness4.PNG"
/ 5 = "rightPic_brightness5.PNG"
</item>

<picture rightPic>
/ items = rightPicList
/ position = (75, 50)
/ select = values.Brightness
</picture>

<trial myTrial>
/ stimulustimes = [1 = leftPic, rightPic ]
/ inputdevice = keyboard
/ validresponse = (28, 203, 205)
/ response = free
/ responseinterrupt = trial
/ isvalidresponse = [if (trial.myTrial.response == 205) values.Brightness += 1; picture.rightPic.item]
/ isvalidresponse = [if (trial.myTrial.response == 203) values.Brightness -= 1; picture.rightPic.item]
/ isvalidresponse = [if (trial.myTrial.response == 28) trial.myTrial.next]
</trial>

<block myBlock>
/ trials = [1-4 = myTrial]
</block>

Yes, that looks to be on the right track. You, should be using /branch, however, to loop <trial mytrial> unless the subject indicates s/he is done (response 28).

Here https://www.millisecond.com/forums/FindPost25178.aspx is an example where a given stimulus's size is increased or decreased depending on key press instead of increasing or decreasing the item number selected for a given stimulus. The overall approach , though, is very similar to what you need.