I'm working on an approach-avoidance task with some vertically and some horizontally oriented stimuli. Participants will be asked to respond to the color of the picture's frame. However, I've run into an issue I can't seem to fix while building this.
I'm trying to dynamically control the size of a rectangular shape element based on the size of the picture stimulus. My tactic is to adjust the picture stimulus' size on the fly based on the filename (which identifies whether the picture is horizontally or vertically oriented), then set the frame's size to slightly larger. But when I start the program, depending on the randomly selected sequence of pictures, the frame sometimes fits both and sometimes only fits the vertical orientation, apparently because the horizontal picture is presented smaller than it should be.
I've tried playing around with onprepare instead of ontrialbegin, but nothing seems to help. I'd appreciate a fresh set of eyes on the problem - maybe I'm just missing something in my code or about how Inquisit handles picture presentation and stimulus-bounding rectangles?
Here's an example:
<block show>
/ trials = [1-2 = showpic]
</block>
<trial showpic>
/ ontrialbegin = [
if (search(picture.pic.item(picture.pic.currentindex),"_h") > -1) {
values.hmultiplier = 3/4; values.vmultiplier = 1
}
else if (search(picture.pic.item(picture.pic.currentindex),"_h") == -1) {
values.hmultiplier = 4/3; values.vmultiplier = 1
}
]
/ stimulustimes = [0 = frame, pic, debug]
/ validresponse = ( " ")
</trial>
<text debug>
/ items = ("Item: <%picture.pic.item(picture.pic.currentindex)%>
Search: <%search(picture.pic.item(picture.pic.currentindex),~"_h~")%>")
/ position = (50%, 20%)
</text>
/ onprepare = [
if (search(picture.pic.item(picture.pic.currentindex),"_h") > -1) {
values.hmultiplier = 3/4; values.vmultiplier = 1
}
else if (search(picture.pic.item(picture.pic.currentindex),"_h") == -1) {
values.hmultiplier = 4/3; values.vmultiplier = 1
}
]
<picture pic>
/ items = ("Animals_177_h.jpg","Animals_166_v.jpg")
/ size = (values.hmultiplier*values.sizer, values.vmultiplier*values.sizer))
/ erase = true(white)
</picture>
/ onprepare = [
shape.frame.widthpx = 1px*(picture.pic.widthpx)+20px;
shape.frame.heightpx = 1px*(picture.pic.heightpx)+20px
]
<shape frame>
/ size = (1px*(picture.pic.widthpx)+20px, 1px*(picture.pic.heightpx)+20px)
/ shape = rectangle
/ color = cornflowerblue
/ position = (50%, 50%)
</shape>
<values>
/sizer = 0.3px*display.canvasheight
/hmultiplier = 0.1
/vmultiplier = 0.1
</values>
/ windowsize = (1980px, 1080px)
<defaults>
</defaults>
Note that several attributes are outside the relevant elements - these indicate some of the options I have tried out and that didn't produce the desired results. The required pictures are available under these links (I didn't upload them because they're part of a picture database, so I want to time-limit sharing them).
https://gigamove.rwth-aachen.de/de/download/d78e431156a12daeb263044e238ffb92https://gigamove.rwth-aachen.de/de/download/f84d4583ab4b84eda798de97de3ca932