Clock Task - Moving dot around clockwise in Inquisit


Author
Message
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 101K
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

One more thing, in case it isn't obvious:

The current trial's latency is available /ontrialend, so you can absolutely perform calculations based on that latency /ontrialend in <trial experiment> -- no need to have a separate <trial> for that. To display those results on-screen, however, you would require a separate trial, it can't be done via /responsemessage or the like in the running instance of <trial experiment>.


Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.
Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 101K
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 101K
AndrewPapale - 9/21/2022
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Generally speaking, the higher the refresh rate, the smoother animations can be. Beyond that, I'm not sure what precisely you consider to indicate "lack of smoothness" and which criteria you used to evaluate it.

Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
Dave - 9/21/2022
AndrewPapale - 9/21/2022
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Generally speaking, the higher the refresh rate, the smoother animations can be. Beyond that, I'm not sure what precisely you consider to indicate "lack of smoothness" and which criteria you used to evaluate it.

Eh it's hard to describe without sharing a video, sorry for being imprecise.  The dot's movement around the circle can be a bit blurry / jittery.
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 101K
AndrewPapale - 9/21/2022
Dave - 9/21/2022
AndrewPapale - 9/21/2022
Dave - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/14/2022
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Is there a way to get the current position of the animation in pixels or degrees?  I suppose I could compute it from the starting position and time elapsed.

Relatedly, is the tan function input default in radians or degrees? tku

> Is there a way to get the current position of the animation in pixels or degrees

You can get that position in either percentages or pixels /ontrialend or in /isvalidresponse, whatever you prefer.

Percentages:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>%, <%values.circle_y%>%) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpct;
        values.circle_y = shape.mycircle.ypct;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


Pixels:

<values>
/ circle_x = 0%
/ circle_y = 0%
/ n_revolutions = 0
</values>

<shape mycircle>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ animation=circle(5000, -1, 75%, 50%, 50%, 35%)
/ erase = false
</shape>

<shape mycircle_static>
/ color = darkblue
/ shape = circle
/ size = (5%, 0.05px*display.canvaswidth)
/ hposition = shape.mycircle.hposition
/ vposition = shape.mycircle.vposition
/ erase = false
</shape>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<text pos>
/ items = ("Circle stopped at position (<%values.circle_x%>px, <%values.circle_y%>px) after <%values.n_revolutions%> revolution(s).")
/ erase = false
/ position = (50%, 5%)
</text>

<trial mytrial>
/ ontrialbegin = [
    values.n_revolutions = 0;
]
/ stimulustimes = [0=clearscreen, fixation, mycircle]
/ validresponse = (57)
/ isvalidresponse = [
    if (trial.mytrial.response == 57) {
        values.circle_x = shape.mycircle.xpx;
        values.circle_y = shape.mycircle.ypx;
        values.n_revolutions = ipart((script.elapsedtime-shape.mycircle.timestamp)/5000);
        return true;
    };
]
/ branch = [
    trial.feedbacktrial;
]
</trial>

<trial feedbacktrial>
/ stimulusframes = [1=clearscreen, fixation, mycircle_static, pos]
/ validresponse = (57)
/ recorddata = false
</trial>

<block myblock>
/ trials = [1-10 = trial.mytrial]
</block>


> Relatedly, is the tan function input default in radians or degrees?

The expected input is radians.


I'm worried that the PI's won't like the lack of smoothness to the animation.  It was a lot smoother in our Psychtoolbox version of the task.  I saw this thread from a few years ago but there was no real solution reached on how to achieve smoother animations (https://forums.millisecond.com/PrintTopic30203.aspx).  My refresh rate is 60Hz.  For EEG experiments, we would be running this on gaming laptops with a 144Hz refresh rate.  Haven't tried it on there yet, but it might be better?

Generally speaking, the higher the refresh rate, the smoother animations can be. Beyond that, I'm not sure what precisely you consider to indicate "lack of smoothness" and which criteria you used to evaluate it.

Eh it's hard to describe without sharing a video, sorry for being imprecise.  The dot's movement around the circle can be a bit blurry / jittery.

I would suggest you try on the 144Hz display. In theory, that should reduce blurriness compared to running on a 60Hz display.
Andrew Papale
Andrew Papale
Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)Partner Member (815 reputation)
Group: Forum Members
Posts: 62, Visits: 230
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Would it be possible to animate a custom image instead of a simple dot?  Currently using the following:

<shape animatedCircle>
/ shape = circle
/ color = darkblue
/ size = (5%, 0.05px*display.canvaswidth)
/ animation = circle(values.time_per_revolution,-1,values.startPos,50%,50%,expressions.radius_px)
/ erase = false
</shape>


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 101K
AndrewPapale - 1/12/2023
AndrewPapale - 9/8/2022
Dave - 9/8/2022
Dave - 9/8/2022
AndrewPapale - 9/8/2022
Excellent, I've got the animation working.  I now need a variable handle to the latency on each trial from the time the circle starts rotating to the time the subject presses the spacebar to compute the number of points that I play to display via a response message.  I thought this would be "trial.experiment.latency".  But on the first trial this is always displaying "0" and subsequent trials are seemingly not displaying the correct response time either. 

Any help would be appreciated.  The 'latency' variable is saving correctly in the iqdat spreadsheet (as far as I can tell based on my internal clock) and differs from the 'trial.experiment.latency' that is being displayed here. 

Relevant code (Inquisit 6.6.1 on MacOS Monterey):

<shape animatedCircle>
/ shape = circle
/ color = blue
/ size = (100,100)
/ animation = circle(5000,1,75%,50%,50%,33%)
/ erase = true(white)
</shape>

<text dispLatency>
/ items= ("latency = <% trial.experiment.latency %>")
</text>

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
/ responsemessage = (" ",dispLatency,1000)
/ recorddata = true
/ ontrialend = [
        
]

> / responsemessage = (" ",dispLatency,1000)

You can't display the current trial's latency per a stimulus in /responsemessage. That stimulus is prepared at the start of the trial, hence it does not know about the latency of the current trial (which has not yet been collected).

This is what you need to do instead:

<trial experiment>
/ ontrialbegin = [
]
/ stimulustimes = [0 = fixationCross; 1000 = animatedCircle;
]

/ inputdevice = keyboard
/ beginresponsetime = 1000
/ validresponse = (" ")
/ responseinterrupt = immediate
// responsemessage = (" ",dispLatency,1000) // can't work to display the current trial's latency
/ recorddata = true
/ branch = [
    return trial.dispLat;
]
</trial>

<trial dispLat>
/ stimulusframes = [1=text.dispLatency]
/ trialduration = 1000
/ recorddata = false
</trial>

wonderful, thank you

Would it be possible to animate a custom image instead of a simple dot?  Currently using the following:

<shape animatedCircle>
/ shape = circle
/ color = darkblue
/ size = (5%, 0.05px*display.canvaswidth)
/ animation = circle(values.time_per_revolution,-1,values.startPos,50%,50%,expressions.radius_px)
/ erase = false
</shape>


Sure. The /animation attribute is available for <picture> elements and works the same way as for <shape> elements.

https://www.millisecond.com/support/docs/current/html/language/attributes/animation.htm
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search