Stimuli that involve complex movements


Author
Message
mji24
mji24
New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)
Group: Forum Members
Posts: 9, Visits: 42
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Dave
Dave
Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



mji24
mji24
New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)
Group: Forum Members
Posts: 9, Visits: 42
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!
Dave
Dave
Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx
mji24
mji24
New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)
Group: Forum Members
Posts: 9, Visits: 42
Dave - 2/16/2021
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx

Hi Dave,

I encountered two additional problems and hope you can help me with them.

(1) The dot positions were originally generated as pixels with (0,0) being the center of the screen. It looks like Inquisit treats top left corner as (0,0) by default. I have tried adding half of the screen size to the positions (e.g., values.dot1x = xPos + display.width/2). However, it is still not centered in the middle of the screen. Is there a way to make Inquisit to treat center of the screen as (0,0)?

(2) I used the trial structure you provided above and the dots are indeed moving. However, they are moving in a very sluggish fashion. Sometimes the dots would even freeze without updating their positions for a few hundred milliseconds. Is it because I am updating too many dots in a too short period of time? I have attached one of the trials below. 

// all the dot shapes are similarly written as this one
<shape dot1>
/ shape = circle
/ color = white
/ size = (5px, 5px)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape> 

<trial T1>
/ontrialbegin = [
values.framecount +=1;
values.sheepX = list.T1sheepxlist.nextvalue;
values.sheepY = list.T1sheepylist.nextvalue;
values.wolfX = list.T1wolfxlist.nextvalue;
values.wolfY = list.T1wolfylist.nextvalue;
values.d1x = list.T1dot1xlist.nextvalue;
values.d1y = list.T1dot1ylist.nextvalue;
values.d2x = list.T1dot2xlist.nextvalue;
values.d2y = list.T1dot2ylist.nextvalue;
values.d3x = list.T1dot3xlist.nextvalue;
values.d3y = list.T1dot3ylist.nextvalue;
values.d4x = list.T1dot4xlist.nextvalue;
values.d4y = list.T1dot4ylist.nextvalue;
values.d5x = list.T1dot5xlist.nextvalue;
values.d5y = list.T1dot5ylist.nextvalue;
values.d6x = list.T1dot6xlist.nextvalue;
values.d6y = list.T1dot6ylist.nextvalue;
values.d7x = list.T1dot7xlist.nextvalue;
values.d7y = list.T1dot7ylist.nextvalue;
values.d8x = list.T1dot8xlist.nextvalue;
values.d8y = list.T1dot8ylist.nextvalue;
values.d9x = list.T1dot9xlist.nextvalue;
values.d9y = list.T1dot9ylist.nextvalue;
values.d10x = list.T1dot10xlist.nextvalue;
values.d10y = list.T1dot10ylist.nextvalue;
values.d11x = list.T1dot11xlist.nextvalue;
values.d11y = list.T1dot11ylist.nextvalue;
values.d12x = list.T1dot12xlist.nextvalue;
values.d12y = list.T1dot12ylist.nextvalue;
values.d13x = list.T1dot13xlist.nextvalue;
values.d13y = list.T1dot13ylist.nextvalue;
values.d14x = list.T1dot14xlist.nextvalue;
values.d14y = list.T1dot14ylist.nextvalue;
values.d15x = list.T1dot15xlist.nextvalue;
values.d15y = list.T1dot15ylist.nextvalue;
values.d16x = list.T1dot16xlist.nextvalue;
values.d16y = list.T1dot16ylist.nextvalue;
values.d17x = list.T1dot17xlist.nextvalue;
values.d17y = list.T1dot17ylist.nextvalue;
values.d18x = list.T1dot18xlist.nextvalue;
values.d18y = list.T1dot18ylist.nextvalue;
values.d19x = list.T1dot19xlist.nextvalue;
values.d19y = list.T1dot19ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, background, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, sheep, wolf]
/ inputdevice=keyboard
/ trialduration = 15
/ validresponse = ("j")
/ correectresponse = ("j")
/ recorddata = false
/ responsetrial = ("j",responseTrial)
/ branch = [if (values.framecount < list.T1sheepxlist.itemcount) trial.T1]
/ branch = [if (values.framecount >= list.T1sheepxlist.itemcount) trial.responseTrial]
</trial>

// Example list of how x and y positions are stored, all the dot motion vector lists look similar to this one
<list dot1xlist>
/items = (-2px,-1px,0px,1px,2px,3px,4px,5px,6px,7px,8px,9px,10px)
</list>

If the above code is too little to identify the issue, I can also attach the entire script.
Dave
Dave
Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
mji24 - 2/20/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx

Hi Dave,

I encountered two additional problems and hope you can help me with them.

(1) The dot positions were originally generated as pixels with (0,0) being the center of the screen. It looks like Inquisit treats top left corner as (0,0) by default. I have tried adding half of the screen size to the positions (e.g., values.dot1x = xPos + display.width/2). However, it is still not centered in the middle of the screen. Is there a way to make Inquisit to treat center of the screen as (0,0)?

(2) I used the trial structure you provided above and the dots are indeed moving. However, they are moving in a very sluggish fashion. Sometimes the dots would even freeze without updating their positions for a few hundred milliseconds. Is it because I am updating too many dots in a too short period of time? I have attached one of the trials below. 

// all the dot shapes are similarly written as this one
<shape dot1>
/ shape = circle
/ color = white
/ size = (5px, 5px)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape> 

<trial T1>
/ontrialbegin = [
values.framecount +=1;
values.sheepX = list.T1sheepxlist.nextvalue;
values.sheepY = list.T1sheepylist.nextvalue;
values.wolfX = list.T1wolfxlist.nextvalue;
values.wolfY = list.T1wolfylist.nextvalue;
values.d1x = list.T1dot1xlist.nextvalue;
values.d1y = list.T1dot1ylist.nextvalue;
values.d2x = list.T1dot2xlist.nextvalue;
values.d2y = list.T1dot2ylist.nextvalue;
values.d3x = list.T1dot3xlist.nextvalue;
values.d3y = list.T1dot3ylist.nextvalue;
values.d4x = list.T1dot4xlist.nextvalue;
values.d4y = list.T1dot4ylist.nextvalue;
values.d5x = list.T1dot5xlist.nextvalue;
values.d5y = list.T1dot5ylist.nextvalue;
values.d6x = list.T1dot6xlist.nextvalue;
values.d6y = list.T1dot6ylist.nextvalue;
values.d7x = list.T1dot7xlist.nextvalue;
values.d7y = list.T1dot7ylist.nextvalue;
values.d8x = list.T1dot8xlist.nextvalue;
values.d8y = list.T1dot8ylist.nextvalue;
values.d9x = list.T1dot9xlist.nextvalue;
values.d9y = list.T1dot9ylist.nextvalue;
values.d10x = list.T1dot10xlist.nextvalue;
values.d10y = list.T1dot10ylist.nextvalue;
values.d11x = list.T1dot11xlist.nextvalue;
values.d11y = list.T1dot11ylist.nextvalue;
values.d12x = list.T1dot12xlist.nextvalue;
values.d12y = list.T1dot12ylist.nextvalue;
values.d13x = list.T1dot13xlist.nextvalue;
values.d13y = list.T1dot13ylist.nextvalue;
values.d14x = list.T1dot14xlist.nextvalue;
values.d14y = list.T1dot14ylist.nextvalue;
values.d15x = list.T1dot15xlist.nextvalue;
values.d15y = list.T1dot15ylist.nextvalue;
values.d16x = list.T1dot16xlist.nextvalue;
values.d16y = list.T1dot16ylist.nextvalue;
values.d17x = list.T1dot17xlist.nextvalue;
values.d17y = list.T1dot17ylist.nextvalue;
values.d18x = list.T1dot18xlist.nextvalue;
values.d18y = list.T1dot18ylist.nextvalue;
values.d19x = list.T1dot19xlist.nextvalue;
values.d19y = list.T1dot19ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, background, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, sheep, wolf]
/ inputdevice=keyboard
/ trialduration = 15
/ validresponse = ("j")
/ correectresponse = ("j")
/ recorddata = false
/ responsetrial = ("j",responseTrial)
/ branch = [if (values.framecount < list.T1sheepxlist.itemcount) trial.T1]
/ branch = [if (values.framecount >= list.T1sheepxlist.itemcount) trial.responseTrial]
</trial>

// Example list of how x and y positions are stored, all the dot motion vector lists look similar to this one
<list dot1xlist>
/items = (-2px,-1px,0px,1px,2px,3px,4px,5px,6px,7px,8px,9px,10px)
</list>

If the above code is too little to identify the issue, I can also attach the entire script.

Re. 1.) No, there isn't any command to make (0,0) the center of the screen. You can do math to transform the coordinates; why what you did with display.width/2 isn't working, I can't say. I'd have to see the actual math.

Re. 2.) If you don't give me something I can actually run and look at, I cannot identify the issue.





mji24
mji24
New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)
Group: Forum Members
Posts: 9, Visits: 42
Dave - 2/20/2021
mji24 - 2/20/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx

Hi Dave,

I encountered two additional problems and hope you can help me with them.

(1) The dot positions were originally generated as pixels with (0,0) being the center of the screen. It looks like Inquisit treats top left corner as (0,0) by default. I have tried adding half of the screen size to the positions (e.g., values.dot1x = xPos + display.width/2). However, it is still not centered in the middle of the screen. Is there a way to make Inquisit to treat center of the screen as (0,0)?

(2) I used the trial structure you provided above and the dots are indeed moving. However, they are moving in a very sluggish fashion. Sometimes the dots would even freeze without updating their positions for a few hundred milliseconds. Is it because I am updating too many dots in a too short period of time? I have attached one of the trials below. 

// all the dot shapes are similarly written as this one
<shape dot1>
/ shape = circle
/ color = white
/ size = (5px, 5px)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape> 

<trial T1>
/ontrialbegin = [
values.framecount +=1;
values.sheepX = list.T1sheepxlist.nextvalue;
values.sheepY = list.T1sheepylist.nextvalue;
values.wolfX = list.T1wolfxlist.nextvalue;
values.wolfY = list.T1wolfylist.nextvalue;
values.d1x = list.T1dot1xlist.nextvalue;
values.d1y = list.T1dot1ylist.nextvalue;
values.d2x = list.T1dot2xlist.nextvalue;
values.d2y = list.T1dot2ylist.nextvalue;
values.d3x = list.T1dot3xlist.nextvalue;
values.d3y = list.T1dot3ylist.nextvalue;
values.d4x = list.T1dot4xlist.nextvalue;
values.d4y = list.T1dot4ylist.nextvalue;
values.d5x = list.T1dot5xlist.nextvalue;
values.d5y = list.T1dot5ylist.nextvalue;
values.d6x = list.T1dot6xlist.nextvalue;
values.d6y = list.T1dot6ylist.nextvalue;
values.d7x = list.T1dot7xlist.nextvalue;
values.d7y = list.T1dot7ylist.nextvalue;
values.d8x = list.T1dot8xlist.nextvalue;
values.d8y = list.T1dot8ylist.nextvalue;
values.d9x = list.T1dot9xlist.nextvalue;
values.d9y = list.T1dot9ylist.nextvalue;
values.d10x = list.T1dot10xlist.nextvalue;
values.d10y = list.T1dot10ylist.nextvalue;
values.d11x = list.T1dot11xlist.nextvalue;
values.d11y = list.T1dot11ylist.nextvalue;
values.d12x = list.T1dot12xlist.nextvalue;
values.d12y = list.T1dot12ylist.nextvalue;
values.d13x = list.T1dot13xlist.nextvalue;
values.d13y = list.T1dot13ylist.nextvalue;
values.d14x = list.T1dot14xlist.nextvalue;
values.d14y = list.T1dot14ylist.nextvalue;
values.d15x = list.T1dot15xlist.nextvalue;
values.d15y = list.T1dot15ylist.nextvalue;
values.d16x = list.T1dot16xlist.nextvalue;
values.d16y = list.T1dot16ylist.nextvalue;
values.d17x = list.T1dot17xlist.nextvalue;
values.d17y = list.T1dot17ylist.nextvalue;
values.d18x = list.T1dot18xlist.nextvalue;
values.d18y = list.T1dot18ylist.nextvalue;
values.d19x = list.T1dot19xlist.nextvalue;
values.d19y = list.T1dot19ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, background, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, sheep, wolf]
/ inputdevice=keyboard
/ trialduration = 15
/ validresponse = ("j")
/ correectresponse = ("j")
/ recorddata = false
/ responsetrial = ("j",responseTrial)
/ branch = [if (values.framecount < list.T1sheepxlist.itemcount) trial.T1]
/ branch = [if (values.framecount >= list.T1sheepxlist.itemcount) trial.responseTrial]
</trial>

// Example list of how x and y positions are stored, all the dot motion vector lists look similar to this one
<list dot1xlist>
/items = (-2px,-1px,0px,1px,2px,3px,4px,5px,6px,7px,8px,9px,10px)
</list>

If the above code is too little to identify the issue, I can also attach the entire script.

Re. 1.) No, there isn't any command to make (0,0) the center of the screen. You can do math to transform the coordinates; why what you did with display.width/2 isn't working, I can't say. I'd have to see the actual math.

Re. 2.) If you don't give me something I can actually run and look at, I cannot identify the issue.





Hi Dave,

Thanks for the quick reply! I have attached the script.
Attachments
chasingExp.zip (30 views, 81.00 KB)
Dave
Dave
Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
mji24 - 2/20/2021
Dave - 2/20/2021
mji24 - 2/20/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx

Hi Dave,

I encountered two additional problems and hope you can help me with them.

(1) The dot positions were originally generated as pixels with (0,0) being the center of the screen. It looks like Inquisit treats top left corner as (0,0) by default. I have tried adding half of the screen size to the positions (e.g., values.dot1x = xPos + display.width/2). However, it is still not centered in the middle of the screen. Is there a way to make Inquisit to treat center of the screen as (0,0)?

(2) I used the trial structure you provided above and the dots are indeed moving. However, they are moving in a very sluggish fashion. Sometimes the dots would even freeze without updating their positions for a few hundred milliseconds. Is it because I am updating too many dots in a too short period of time? I have attached one of the trials below. 

// all the dot shapes are similarly written as this one
<shape dot1>
/ shape = circle
/ color = white
/ size = (5px, 5px)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape> 

<trial T1>
/ontrialbegin = [
values.framecount +=1;
values.sheepX = list.T1sheepxlist.nextvalue;
values.sheepY = list.T1sheepylist.nextvalue;
values.wolfX = list.T1wolfxlist.nextvalue;
values.wolfY = list.T1wolfylist.nextvalue;
values.d1x = list.T1dot1xlist.nextvalue;
values.d1y = list.T1dot1ylist.nextvalue;
values.d2x = list.T1dot2xlist.nextvalue;
values.d2y = list.T1dot2ylist.nextvalue;
values.d3x = list.T1dot3xlist.nextvalue;
values.d3y = list.T1dot3ylist.nextvalue;
values.d4x = list.T1dot4xlist.nextvalue;
values.d4y = list.T1dot4ylist.nextvalue;
values.d5x = list.T1dot5xlist.nextvalue;
values.d5y = list.T1dot5ylist.nextvalue;
values.d6x = list.T1dot6xlist.nextvalue;
values.d6y = list.T1dot6ylist.nextvalue;
values.d7x = list.T1dot7xlist.nextvalue;
values.d7y = list.T1dot7ylist.nextvalue;
values.d8x = list.T1dot8xlist.nextvalue;
values.d8y = list.T1dot8ylist.nextvalue;
values.d9x = list.T1dot9xlist.nextvalue;
values.d9y = list.T1dot9ylist.nextvalue;
values.d10x = list.T1dot10xlist.nextvalue;
values.d10y = list.T1dot10ylist.nextvalue;
values.d11x = list.T1dot11xlist.nextvalue;
values.d11y = list.T1dot11ylist.nextvalue;
values.d12x = list.T1dot12xlist.nextvalue;
values.d12y = list.T1dot12ylist.nextvalue;
values.d13x = list.T1dot13xlist.nextvalue;
values.d13y = list.T1dot13ylist.nextvalue;
values.d14x = list.T1dot14xlist.nextvalue;
values.d14y = list.T1dot14ylist.nextvalue;
values.d15x = list.T1dot15xlist.nextvalue;
values.d15y = list.T1dot15ylist.nextvalue;
values.d16x = list.T1dot16xlist.nextvalue;
values.d16y = list.T1dot16ylist.nextvalue;
values.d17x = list.T1dot17xlist.nextvalue;
values.d17y = list.T1dot17ylist.nextvalue;
values.d18x = list.T1dot18xlist.nextvalue;
values.d18y = list.T1dot18ylist.nextvalue;
values.d19x = list.T1dot19xlist.nextvalue;
values.d19y = list.T1dot19ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, background, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, sheep, wolf]
/ inputdevice=keyboard
/ trialduration = 15
/ validresponse = ("j")
/ correectresponse = ("j")
/ recorddata = false
/ responsetrial = ("j",responseTrial)
/ branch = [if (values.framecount < list.T1sheepxlist.itemcount) trial.T1]
/ branch = [if (values.framecount >= list.T1sheepxlist.itemcount) trial.responseTrial]
</trial>

// Example list of how x and y positions are stored, all the dot motion vector lists look similar to this one
<list dot1xlist>
/items = (-2px,-1px,0px,1px,2px,3px,4px,5px,6px,7px,8px,9px,10px)
</list>

If the above code is too little to identify the issue, I can also attach the entire script.

Re. 1.) No, there isn't any command to make (0,0) the center of the screen. You can do math to transform the coordinates; why what you did with display.width/2 isn't working, I can't say. I'd have to see the actual math.

Re. 2.) If you don't give me something I can actually run and look at, I cannot identify the issue.





Hi Dave,

Thanks for the quick reply! I have attached the script.

Okay, re. 1.), you've defined a canvas, i.e. you're not using the full display, so display.canvaswidth is the relevant property, not display.width. (Same for display.canvasheight vs display.height.)

Re. 2), I'm not sure. I'm seeing some choppiness, but I'm not seeing stalling on the order of hundreds of milliseconds (that is, unless the given dot is instructed to remain stationary for X amount of time). The choppiness, however, does seem to increase the more dots are being displayed and moved around, so there's probably some kind of too much happening at once in too short a timespan performance issue involved. I'll need to give this some thought for a couple of days. Maybe there is a way to optimize some of the overhead away.

mji24
mji24
New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)New Member (43 reputation)
Group: Forum Members
Posts: 9, Visits: 42
Dave - 2/20/2021
mji24 - 2/20/2021
Dave - 2/20/2021
mji24 - 2/20/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx

Hi Dave,

I encountered two additional problems and hope you can help me with them.

(1) The dot positions were originally generated as pixels with (0,0) being the center of the screen. It looks like Inquisit treats top left corner as (0,0) by default. I have tried adding half of the screen size to the positions (e.g., values.dot1x = xPos + display.width/2). However, it is still not centered in the middle of the screen. Is there a way to make Inquisit to treat center of the screen as (0,0)?

(2) I used the trial structure you provided above and the dots are indeed moving. However, they are moving in a very sluggish fashion. Sometimes the dots would even freeze without updating their positions for a few hundred milliseconds. Is it because I am updating too many dots in a too short period of time? I have attached one of the trials below. 

// all the dot shapes are similarly written as this one
<shape dot1>
/ shape = circle
/ color = white
/ size = (5px, 5px)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape> 

<trial T1>
/ontrialbegin = [
values.framecount +=1;
values.sheepX = list.T1sheepxlist.nextvalue;
values.sheepY = list.T1sheepylist.nextvalue;
values.wolfX = list.T1wolfxlist.nextvalue;
values.wolfY = list.T1wolfylist.nextvalue;
values.d1x = list.T1dot1xlist.nextvalue;
values.d1y = list.T1dot1ylist.nextvalue;
values.d2x = list.T1dot2xlist.nextvalue;
values.d2y = list.T1dot2ylist.nextvalue;
values.d3x = list.T1dot3xlist.nextvalue;
values.d3y = list.T1dot3ylist.nextvalue;
values.d4x = list.T1dot4xlist.nextvalue;
values.d4y = list.T1dot4ylist.nextvalue;
values.d5x = list.T1dot5xlist.nextvalue;
values.d5y = list.T1dot5ylist.nextvalue;
values.d6x = list.T1dot6xlist.nextvalue;
values.d6y = list.T1dot6ylist.nextvalue;
values.d7x = list.T1dot7xlist.nextvalue;
values.d7y = list.T1dot7ylist.nextvalue;
values.d8x = list.T1dot8xlist.nextvalue;
values.d8y = list.T1dot8ylist.nextvalue;
values.d9x = list.T1dot9xlist.nextvalue;
values.d9y = list.T1dot9ylist.nextvalue;
values.d10x = list.T1dot10xlist.nextvalue;
values.d10y = list.T1dot10ylist.nextvalue;
values.d11x = list.T1dot11xlist.nextvalue;
values.d11y = list.T1dot11ylist.nextvalue;
values.d12x = list.T1dot12xlist.nextvalue;
values.d12y = list.T1dot12ylist.nextvalue;
values.d13x = list.T1dot13xlist.nextvalue;
values.d13y = list.T1dot13ylist.nextvalue;
values.d14x = list.T1dot14xlist.nextvalue;
values.d14y = list.T1dot14ylist.nextvalue;
values.d15x = list.T1dot15xlist.nextvalue;
values.d15y = list.T1dot15ylist.nextvalue;
values.d16x = list.T1dot16xlist.nextvalue;
values.d16y = list.T1dot16ylist.nextvalue;
values.d17x = list.T1dot17xlist.nextvalue;
values.d17y = list.T1dot17ylist.nextvalue;
values.d18x = list.T1dot18xlist.nextvalue;
values.d18y = list.T1dot18ylist.nextvalue;
values.d19x = list.T1dot19xlist.nextvalue;
values.d19y = list.T1dot19ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, background, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, sheep, wolf]
/ inputdevice=keyboard
/ trialduration = 15
/ validresponse = ("j")
/ correectresponse = ("j")
/ recorddata = false
/ responsetrial = ("j",responseTrial)
/ branch = [if (values.framecount < list.T1sheepxlist.itemcount) trial.T1]
/ branch = [if (values.framecount >= list.T1sheepxlist.itemcount) trial.responseTrial]
</trial>

// Example list of how x and y positions are stored, all the dot motion vector lists look similar to this one
<list dot1xlist>
/items = (-2px,-1px,0px,1px,2px,3px,4px,5px,6px,7px,8px,9px,10px)
</list>

If the above code is too little to identify the issue, I can also attach the entire script.

Re. 1.) No, there isn't any command to make (0,0) the center of the screen. You can do math to transform the coordinates; why what you did with display.width/2 isn't working, I can't say. I'd have to see the actual math.

Re. 2.) If you don't give me something I can actually run and look at, I cannot identify the issue.





Hi Dave,

Thanks for the quick reply! I have attached the script.

Okay, re. 1.), you've defined a canvas, i.e. you're not using the full display, so display.canvaswidth is the relevant property, not display.width. (Same for display.canvasheight vs display.height.)

Re. 2), I'm not sure. I'm seeing some choppiness, but I'm not seeing stalling on the order of hundreds of milliseconds (that is, unless the given dot is instructed to remain stationary for X amount of time). The choppiness, however, does seem to increase the more dots are being displayed and moved around, so there's probably some kind of too much happening at once in too short a timespan performance issue involved. I'll need to give this some thought for a couple of days. Maybe there is a way to optimize some of the overhead away.

(1) Great, thanks! I will implement that.

(2) Maybe it's because I am using a not very powerful laptop connected to a very high resolution high refresh rate monitor... Anyway, I will wait to hear back from you then! Thanks a lot!
Dave
Dave
Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)Supreme Being (933K reputation)
Group: Administrators
Posts: 11K, Visits: 68K
mji24 - 2/20/2021
Dave - 2/20/2021
mji24 - 2/20/2021
Dave - 2/20/2021
mji24 - 2/20/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Dave - 2/16/2021
mji24 - 2/16/2021
Hi all,

I am trying to design an experiment which the stimuli (multiple dots) engage in complex movements generated from a previous study. The movement trajectories are basically a bunch of x and y positions for each dot. The frequency of these positions are 60Hz (i.e. positions are updated every 16.67ms). Each trial is around 15s and contains 21 dots, and there are around a few hundred trials in total (meaning that I will have somewhere around a few million data points to deal with). The trajectories are different for each dot in each trial. I am wondering about two things:

1. Right now the trajectories are stored as data frames in R. I have seen posts saying that in order for Inquisit to include them is to convert them into plain txt files. Considering the sheer amount of data points I have here (a few million data points containing positional information), is the plain txt method still the best practice? Should I convert the trajectories of each dot for each trial into separate lists and then call the corresponding lists when I generate the stimuli?

2. How do I actually make them move? I found two ways to make this work. One is that using the "animation" property of "shape", but I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible? The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving. They did not provide any sample code and I am very, very new to Inquisit so I do not know how to program this. 

Any help is greatly appreciated!

Re. 1), whatever you import must be in a form that Inquisit can understand, i.e. Inquisit syntax (e.g. <list> elements). Whether that syntax is contained in external text files you <include> or contained directly inside the main script is immaterial.
Re. 2):
> I have not figured out a way to streamline a few thousands of x and y positions into animation. Is this even possible?
I don't know that anyone has ever tried 1000s of x/y coordinates in /animation.
> The other method was that I saw someone mentioned setting the h and v positions of the stimuli at each time point to simulate them moving.
That description is unclear. As far as I can see, the alternative to using /animation is something like this (10 frames in this example):

<shape dot1>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape>

<shape dot2>
/ shape = circle
/ color = white
/ size = (5mm, 5mm)
/ erase = false
/ hposition = values.d2x
/ vposition = values.d2y
</shape>

<trial frame>
/ ontrialbegin = [
    values.framecount +=1;
    values.d1x = list.dot1xlist.nextvalue;
    values.d1y = list.dot1ylist.nextvalue;
    values.d2x = list.dot2xlist.nextvalue;
    values.d2y = list.dot2ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, dot1, dot2]
/ trialduration = 15
/ validresponse = (0)
/ branch = [
    if (values.framecount < 10) trial.frame;
]
</trial>

<values>
/ framecount = 0
/ d1x = 0
/ d1y = 0
/ d2x = 0
/ d2y = 0
</values>

<block example>
/ screencolor = black
/ trials = [1=frame]
</block>

<list dot1xlist>
/ items = (21,22,22,23,23,23,24,25,25)
</list>
<list dot1ylist>
/ items = (45,44,45,46,47,48,48,48,49)
/ select = list.dot1xlist.currentindex
</list>

<list dot2xlist>
/ items = (51,51,52,52,51,50,50,50,50)
</list>
<list dot2ylist>
/ items = (75,74,73,73,73,74,74,75,75)
/ select = list.dot2xlist.currentindex
</list>



Hi Dave,

Thanks for the reply. I will need to try it out but I think the sample code you provided solves my problem. Thanks a lot!

If you get stuck on someting let me know; I'm fairly certain there's a way to make this work. Note that you can create lists of lists, which may become useful for switching the hardcoded motion vectors from trial to trial:

https://www.millisecond.com/forums/FindPost20679.aspx

Hi Dave,

I encountered two additional problems and hope you can help me with them.

(1) The dot positions were originally generated as pixels with (0,0) being the center of the screen. It looks like Inquisit treats top left corner as (0,0) by default. I have tried adding half of the screen size to the positions (e.g., values.dot1x = xPos + display.width/2). However, it is still not centered in the middle of the screen. Is there a way to make Inquisit to treat center of the screen as (0,0)?

(2) I used the trial structure you provided above and the dots are indeed moving. However, they are moving in a very sluggish fashion. Sometimes the dots would even freeze without updating their positions for a few hundred milliseconds. Is it because I am updating too many dots in a too short period of time? I have attached one of the trials below. 

// all the dot shapes are similarly written as this one
<shape dot1>
/ shape = circle
/ color = white
/ size = (5px, 5px)
/ erase = false
/ hposition = values.d1x
/ vposition = values.d1y
</shape> 

<trial T1>
/ontrialbegin = [
values.framecount +=1;
values.sheepX = list.T1sheepxlist.nextvalue;
values.sheepY = list.T1sheepylist.nextvalue;
values.wolfX = list.T1wolfxlist.nextvalue;
values.wolfY = list.T1wolfylist.nextvalue;
values.d1x = list.T1dot1xlist.nextvalue;
values.d1y = list.T1dot1ylist.nextvalue;
values.d2x = list.T1dot2xlist.nextvalue;
values.d2y = list.T1dot2ylist.nextvalue;
values.d3x = list.T1dot3xlist.nextvalue;
values.d3y = list.T1dot3ylist.nextvalue;
values.d4x = list.T1dot4xlist.nextvalue;
values.d4y = list.T1dot4ylist.nextvalue;
values.d5x = list.T1dot5xlist.nextvalue;
values.d5y = list.T1dot5ylist.nextvalue;
values.d6x = list.T1dot6xlist.nextvalue;
values.d6y = list.T1dot6ylist.nextvalue;
values.d7x = list.T1dot7xlist.nextvalue;
values.d7y = list.T1dot7ylist.nextvalue;
values.d8x = list.T1dot8xlist.nextvalue;
values.d8y = list.T1dot8ylist.nextvalue;
values.d9x = list.T1dot9xlist.nextvalue;
values.d9y = list.T1dot9ylist.nextvalue;
values.d10x = list.T1dot10xlist.nextvalue;
values.d10y = list.T1dot10ylist.nextvalue;
values.d11x = list.T1dot11xlist.nextvalue;
values.d11y = list.T1dot11ylist.nextvalue;
values.d12x = list.T1dot12xlist.nextvalue;
values.d12y = list.T1dot12ylist.nextvalue;
values.d13x = list.T1dot13xlist.nextvalue;
values.d13y = list.T1dot13ylist.nextvalue;
values.d14x = list.T1dot14xlist.nextvalue;
values.d14y = list.T1dot14ylist.nextvalue;
values.d15x = list.T1dot15xlist.nextvalue;
values.d15y = list.T1dot15ylist.nextvalue;
values.d16x = list.T1dot16xlist.nextvalue;
values.d16y = list.T1dot16ylist.nextvalue;
values.d17x = list.T1dot17xlist.nextvalue;
values.d17y = list.T1dot17ylist.nextvalue;
values.d18x = list.T1dot18xlist.nextvalue;
values.d18y = list.T1dot18ylist.nextvalue;
values.d19x = list.T1dot19xlist.nextvalue;
values.d19y = list.T1dot19ylist.nextvalue;
]
/ stimulusframes = [1=clearscreen, background, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15, d16, d17, d18, d19, sheep, wolf]
/ inputdevice=keyboard
/ trialduration = 15
/ validresponse = ("j")
/ correectresponse = ("j")
/ recorddata = false
/ responsetrial = ("j",responseTrial)
/ branch = [if (values.framecount < list.T1sheepxlist.itemcount) trial.T1]
/ branch = [if (values.framecount >= list.T1sheepxlist.itemcount) trial.responseTrial]
</trial>

// Example list of how x and y positions are stored, all the dot motion vector lists look similar to this one
<list dot1xlist>
/items = (-2px,-1px,0px,1px,2px,3px,4px,5px,6px,7px,8px,9px,10px)
</list>

If the above code is too little to identify the issue, I can also attach the entire script.

Re. 1.) No, there isn't any command to make (0,0) the center of the screen. You can do math to transform the coordinates; why what you did with display.width/2 isn't working, I can't say. I'd have to see the actual math.

Re. 2.) If you don't give me something I can actually run and look at, I cannot identify the issue.





Hi Dave,

Thanks for the quick reply! I have attached the script.

Okay, re. 1.), you've defined a canvas, i.e. you're not using the full display, so display.canvaswidth is the relevant property, not display.width. (Same for display.canvasheight vs display.height.)

Re. 2), I'm not sure. I'm seeing some choppiness, but I'm not seeing stalling on the order of hundreds of milliseconds (that is, unless the given dot is instructed to remain stationary for X amount of time). The choppiness, however, does seem to increase the more dots are being displayed and moved around, so there's probably some kind of too much happening at once in too short a timespan performance issue involved. I'll need to give this some thought for a couple of days. Maybe there is a way to optimize some of the overhead away.

(1) Great, thanks! I will implement that.

(2) Maybe it's because I am using a not very powerful laptop connected to a very high resolution high refresh rate monitor... Anyway, I will wait to hear back from you then! Thanks a lot!

Did some quick testng and refactoring. I think if we actually pipe the x/y vectors into /animation attributes, this should work much better. Revision based on the script you provided is attached, this should hopefully give you the general idea.
Attachments
expScript.iqx (28 views, 26.00 KB)
testFile.iqx (32 views, 336.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search